@realtimex/realtimex-alchemy 1.0.71 → 1.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function Ac(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $d={exports:{}},Po={},Ud={exports:{}},We={};var zy;function YS(){if(zy)return We;zy=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=g&&D[g]||D["@@iterator"],typeof D=="function"?D:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function k(D,G,P){this.props=D,this.context=G,this.refs=w,this.updater=P||v}k.prototype.isReactComponent={},k.prototype.setState=function(D,G){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,G,"setState")},k.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function S(){}S.prototype=k.prototype;function C(D,G,P){this.props=D,this.context=G,this.refs=w,this.updater=P||v}var j=C.prototype=new S;j.constructor=C,b(j,k.prototype),j.isPureReactComponent=!0;var O=Array.isArray,T=Object.prototype.hasOwnProperty,N={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function V(D,G,P){var _e,me={},ye=null,Ne=null;if(G!=null)for(_e in G.ref!==void 0&&(Ne=G.ref),G.key!==void 0&&(ye=""+G.key),G)T.call(G,_e)&&!M.hasOwnProperty(_e)&&(me[_e]=G[_e]);var pe=arguments.length-2;if(pe===1)me.children=P;else if(1<pe){for(var Be=Array(pe),st=0;st<pe;st++)Be[st]=arguments[st+2];me.children=Be}if(D&&D.defaultProps)for(_e in pe=D.defaultProps,pe)me[_e]===void 0&&(me[_e]=pe[_e]);return{$$typeof:e,type:D,key:ye,ref:Ne,props:me,_owner:N.current}}function B(D,G){return{$$typeof:e,type:D.type,key:G,ref:D.ref,props:D.props,_owner:D._owner}}function L(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function Q(D){var G={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(P){return G[P]})}var Y=/\/+/g;function he(D,G){return typeof D=="object"&&D!==null&&D.key!=null?Q(""+D.key):G.toString(36)}function K(D,G,P,_e,me){var ye=typeof D;(ye==="undefined"||ye==="boolean")&&(D=null);var Ne=!1;if(D===null)Ne=!0;else switch(ye){case"string":case"number":Ne=!0;break;case"object":switch(D.$$typeof){case e:case t:Ne=!0}}if(Ne)return Ne=D,me=me(Ne),D=_e===""?"."+he(Ne,0):_e,O(me)?(P="",D!=null&&(P=D.replace(Y,"$&/")+"/"),K(me,G,P,"",function(st){return st})):me!=null&&(L(me)&&(me=B(me,P+(!me.key||Ne&&Ne.key===me.key?"":(""+me.key).replace(Y,"$&/")+"/")+D)),G.push(me)),1;if(Ne=0,_e=_e===""?".":_e+":",O(D))for(var pe=0;pe<D.length;pe++){ye=D[pe];var Be=_e+he(ye,pe);Ne+=K(ye,G,P,Be,me)}else if(Be=y(D),typeof Be=="function")for(D=Be.call(D),pe=0;!(ye=D.next()).done;)ye=ye.value,Be=_e+he(ye,pe++),Ne+=K(ye,G,P,Be,me);else if(ye==="object")throw G=String(D),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return Ne}function W(D,G,P){if(D==null)return D;var _e=[],me=0;return K(D,_e,"","",function(ye){return G.call(P,ye,me++)}),_e}function ne(D){if(D._status===-1){var G=D._result;G=G(),G.then(function(P){(D._status===0||D._status===-1)&&(D._status=1,D._result=P)},function(P){(D._status===0||D._status===-1)&&(D._status=2,D._result=P)}),D._status===-1&&(D._status=0,D._result=G)}if(D._status===1)return D._result.default;throw D._result}var re={current:null},J={transition:null},ce={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:J,ReactCurrentOwner:N};function A(){throw Error("act(...) is not supported in production builds of React.")}return We.Children={map:W,forEach:function(D,G,P){W(D,function(){G.apply(this,arguments)},P)},count:function(D){var G=0;return W(D,function(){G++}),G},toArray:function(D){return W(D,function(G){return G})||[]},only:function(D){if(!L(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},We.Component=k,We.Fragment=n,We.Profiler=s,We.PureComponent=C,We.StrictMode=r,We.Suspense=u,We.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ce,We.act=A,We.cloneElement=function(D,G,P){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var _e=b({},D.props),me=D.key,ye=D.ref,Ne=D._owner;if(G!=null){if(G.ref!==void 0&&(ye=G.ref,Ne=N.current),G.key!==void 0&&(me=""+G.key),D.type&&D.type.defaultProps)var pe=D.type.defaultProps;for(Be in G)T.call(G,Be)&&!M.hasOwnProperty(Be)&&(_e[Be]=G[Be]===void 0&&pe!==void 0?pe[Be]:G[Be])}var Be=arguments.length-2;if(Be===1)_e.children=P;else if(1<Be){pe=Array(Be);for(var st=0;st<Be;st++)pe[st]=arguments[st+2];_e.children=pe}return{$$typeof:e,type:D.type,key:me,ref:ye,props:_e,_owner:Ne}},We.createContext=function(D){return D={$$typeof:a,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:o,_context:D},D.Consumer=D},We.createElement=V,We.createFactory=function(D){var G=V.bind(null,D);return G.type=D,G},We.createRef=function(){return{current:null}},We.forwardRef=function(D){return{$$typeof:c,render:D}},We.isValidElement=L,We.lazy=function(D){return{$$typeof:p,_payload:{_status:-1,_result:D},_init:ne}},We.memo=function(D,G){return{$$typeof:f,type:D,compare:G===void 0?null:G}},We.startTransition=function(D){var G=J.transition;J.transition={};try{D()}finally{J.transition=G}},We.unstable_act=A,We.useCallback=function(D,G){return re.current.useCallback(D,G)},We.useContext=function(D){return re.current.useContext(D)},We.useDebugValue=function(){},We.useDeferredValue=function(D){return re.current.useDeferredValue(D)},We.useEffect=function(D,G){return re.current.useEffect(D,G)},We.useId=function(){return re.current.useId()},We.useImperativeHandle=function(D,G,P){return re.current.useImperativeHandle(D,G,P)},We.useInsertionEffect=function(D,G){return re.current.useInsertionEffect(D,G)},We.useLayoutEffect=function(D,G){return re.current.useLayoutEffect(D,G)},We.useMemo=function(D,G){return re.current.useMemo(D,G)},We.useReducer=function(D,G,P){return re.current.useReducer(D,G,P)},We.useRef=function(D){return re.current.useRef(D)},We.useState=function(D){return re.current.useState(D)},We.useSyncExternalStore=function(D,G,P){return re.current.useSyncExternalStore(D,G,P)},We.useTransition=function(){return re.current.useTransition()},We.version="18.3.1",We}var Fy;function Rc(){return Fy||(Fy=1,Ud.exports=YS()),Ud.exports}var $y;function QS(){if($y)return Po;$y=1;var e=Rc(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(c,u,f){var p,g={},y=null,v=null;f!==void 0&&(y=""+f),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(v=u.ref);for(p in u)r.call(u,p)&&!o.hasOwnProperty(p)&&(g[p]=u[p]);if(c&&c.defaultProps)for(p in u=c.defaultProps,u)g[p]===void 0&&(g[p]=u[p]);return{$$typeof:t,type:c,key:y,ref:v,props:g,_owner:s.current}}return Po.Fragment=n,Po.jsx=a,Po.jsxs=a,Po}var Uy;function ZS(){return Uy||(Uy=1,$d.exports=QS()),$d.exports}var h=ZS(),R=Rc();const ra=Ac(R);var $l={},Bd={exports:{}},fn={},Vd={exports:{}},qd={};var By;function ej(){return By||(By=1,(function(e){function t(J,ce){var A=J.length;J.push(ce);e:for(;0<A;){var D=A-1>>>1,G=J[D];if(0<s(G,ce))J[D]=ce,J[A]=G,A=D;else break e}}function n(J){return J.length===0?null:J[0]}function r(J){if(J.length===0)return null;var ce=J[0],A=J.pop();if(A!==ce){J[0]=A;e:for(var D=0,G=J.length,P=G>>>1;D<P;){var _e=2*(D+1)-1,me=J[_e],ye=_e+1,Ne=J[ye];if(0>s(me,A))ye<G&&0>s(Ne,me)?(J[D]=Ne,J[ye]=A,D=ye):(J[D]=me,J[_e]=A,D=_e);else if(ye<G&&0>s(Ne,A))J[D]=Ne,J[ye]=A,D=ye;else break e}}return ce}function s(J,ce){var A=J.sortIndex-ce.sortIndex;return A!==0?A:J.id-ce.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,c=a.now();e.unstable_now=function(){return a.now()-c}}var u=[],f=[],p=1,g=null,y=3,v=!1,b=!1,w=!1,k=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,C=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(J){for(var ce=n(f);ce!==null;){if(ce.callback===null)r(f);else if(ce.startTime<=J)r(f),ce.sortIndex=ce.expirationTime,t(u,ce);else break;ce=n(f)}}function O(J){if(w=!1,j(J),!b)if(n(u)!==null)b=!0,ne(T);else{var ce=n(f);ce!==null&&re(O,ce.startTime-J)}}function T(J,ce){b=!1,w&&(w=!1,S(V),V=-1),v=!0;var A=y;try{for(j(ce),g=n(u);g!==null&&(!(g.expirationTime>ce)||J&&!Q());){var D=g.callback;if(typeof D=="function"){g.callback=null,y=g.priorityLevel;var G=D(g.expirationTime<=ce);ce=e.unstable_now(),typeof G=="function"?g.callback=G:g===n(u)&&r(u),j(ce)}else r(u);g=n(u)}if(g!==null)var P=!0;else{var _e=n(f);_e!==null&&re(O,_e.startTime-ce),P=!1}return P}finally{g=null,y=A,v=!1}}var N=!1,M=null,V=-1,B=5,L=-1;function Q(){return!(e.unstable_now()-L<B)}function Y(){if(M!==null){var J=e.unstable_now();L=J;var ce=!0;try{ce=M(!0,J)}finally{ce?he():(N=!1,M=null)}}else N=!1}var he;if(typeof C=="function")he=function(){C(Y)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,W=K.port2;K.port1.onmessage=Y,he=function(){W.postMessage(null)}}else he=function(){k(Y,0)};function ne(J){M=J,N||(N=!0,he())}function re(J,ce){V=k(function(){J(e.unstable_now())},ce)}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(J){J.callback=null},e.unstable_continueExecution=function(){b||v||(b=!0,ne(T))},e.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<J?Math.floor(1e3/J):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(J){switch(y){case 1:case 2:case 3:var ce=3;break;default:ce=y}var A=y;y=ce;try{return J()}finally{y=A}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(J,ce){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var A=y;y=J;try{return ce()}finally{y=A}},e.unstable_scheduleCallback=function(J,ce,A){var D=e.unstable_now();switch(typeof A=="object"&&A!==null?(A=A.delay,A=typeof A=="number"&&0<A?D+A:D):A=D,J){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=A+G,J={id:p++,callback:ce,priorityLevel:J,startTime:A,expirationTime:G,sortIndex:-1},A>D?(J.sortIndex=A,t(f,J),n(u)===null&&J===n(f)&&(w?(S(V),V=-1):w=!0,re(O,A-D))):(J.sortIndex=G,t(u,J),b||v||(b=!0,ne(T))),J},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(J){var ce=y;return function(){var A=y;y=ce;try{return J.apply(this,arguments)}finally{y=A}}}})(qd)),qd}var Vy;function tj(){return Vy||(Vy=1,Vd.exports=ej()),Vd.exports}var qy;function nj(){if(qy)return fn;qy=1;var e=Rc(),t=tj();function n(i){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+i+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function o(i,l){a(i,l),a(i+"Capture",l)}function a(i,l){for(s[i]=l,i=0;i<l.length;i++)r.add(l[i])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=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={},g={};function y(i){return u.call(g,i)?!0:u.call(p,i)?!1:f.test(i)?g[i]=!0:(p[i]=!0,!1)}function v(i,l,d,m){if(d!==null&&d.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return m?!1:d!==null?!d.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function b(i,l,d,m){if(l===null||typeof l>"u"||v(i,l,d,m))return!0;if(m)return!1;if(d!==null)switch(d.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function w(i,l,d,m,x,_,E){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=m,this.attributeNamespace=x,this.mustUseProperty=d,this.propertyName=i,this.type=l,this.sanitizeURL=_,this.removeEmptyString=E}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){k[i]=new w(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var l=i[0];k[l]=new w(l,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){k[i]=new w(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){k[i]=new w(i,2,!1,i,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(i){k[i]=new w(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){k[i]=new w(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){k[i]=new w(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){k[i]=new w(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){k[i]=new w(i,5,!1,i.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function C(i){return i[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(i){var l=i.replace(S,C);k[l]=new w(l,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var l=i.replace(S,C);k[l]=new w(l,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var l=i.replace(S,C);k[l]=new w(l,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){k[i]=new w(i,1,!1,i.toLowerCase(),null,!1,!1)}),k.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){k[i]=new w(i,1,!1,i.toLowerCase(),null,!0,!0)});function j(i,l,d,m){var x=k.hasOwnProperty(l)?k[l]:null;(x!==null?x.type!==0:m||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(b(l,d,x,m)&&(d=null),m||x===null?y(l)&&(d===null?i.removeAttribute(l):i.setAttribute(l,""+d)):x.mustUseProperty?i[x.propertyName]=d===null?x.type===3?!1:"":d:(l=x.attributeName,m=x.attributeNamespace,d===null?i.removeAttribute(l):(x=x.type,d=x===3||x===4&&d===!0?"":""+d,m?i.setAttributeNS(m,l,d):i.setAttribute(l,d))))}var O=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),N=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),L=Symbol.for("react.provider"),Q=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),he=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),ne=Symbol.for("react.lazy"),re=Symbol.for("react.offscreen"),J=Symbol.iterator;function ce(i){return i===null||typeof i!="object"?null:(i=J&&i[J]||i["@@iterator"],typeof i=="function"?i:null)}var A=Object.assign,D;function G(i){if(D===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);D=l&&l[1]||""}return`
2
- `+D+i}var P=!1;function _e(i,l){if(!i||P)return"";P=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(q){var m=q}Reflect.construct(i,[],l)}else{try{l.call()}catch(q){m=q}i.call(l.prototype)}else{try{throw Error()}catch(q){m=q}i()}}catch(q){if(q&&m&&typeof q.stack=="string"){for(var x=q.stack.split(`
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function Ac(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $d={exports:{}},Po={},Ud={exports:{}},We={};var zy;function YS(){if(zy)return We;zy=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=g&&D[g]||D["@@iterator"],typeof D=="function"?D:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function k(D,G,P){this.props=D,this.context=G,this.refs=w,this.updater=P||v}k.prototype.isReactComponent={},k.prototype.setState=function(D,G){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,G,"setState")},k.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function S(){}S.prototype=k.prototype;function C(D,G,P){this.props=D,this.context=G,this.refs=w,this.updater=P||v}var j=C.prototype=new S;j.constructor=C,b(j,k.prototype),j.isPureReactComponent=!0;var O=Array.isArray,T=Object.prototype.hasOwnProperty,N={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function V(D,G,P){var ve,Ne={},fe=null,Ae=null;if(G!=null)for(ve in G.ref!==void 0&&(Ae=G.ref),G.key!==void 0&&(fe=""+G.key),G)T.call(G,ve)&&!M.hasOwnProperty(ve)&&(Ne[ve]=G[ve]);var _e=arguments.length-2;if(_e===1)Ne.children=P;else if(1<_e){for(var me=Array(_e),tt=0;tt<_e;tt++)me[tt]=arguments[tt+2];Ne.children=me}if(D&&D.defaultProps)for(ve in _e=D.defaultProps,_e)Ne[ve]===void 0&&(Ne[ve]=_e[ve]);return{$$typeof:e,type:D,key:fe,ref:Ae,props:Ne,_owner:N.current}}function U(D,G){return{$$typeof:e,type:D.type,key:G,ref:D.ref,props:D.props,_owner:D._owner}}function L(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function Q(D){var G={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(P){return G[P]})}var Y=/\/+/g;function he(D,G){return typeof D=="object"&&D!==null&&D.key!=null?Q(""+D.key):G.toString(36)}function K(D,G,P,ve,Ne){var fe=typeof D;(fe==="undefined"||fe==="boolean")&&(D=null);var Ae=!1;if(D===null)Ae=!0;else switch(fe){case"string":case"number":Ae=!0;break;case"object":switch(D.$$typeof){case e:case t:Ae=!0}}if(Ae)return Ae=D,Ne=Ne(Ae),D=ve===""?"."+he(Ae,0):ve,O(Ne)?(P="",D!=null&&(P=D.replace(Y,"$&/")+"/"),K(Ne,G,P,"",function(tt){return tt})):Ne!=null&&(L(Ne)&&(Ne=U(Ne,P+(!Ne.key||Ae&&Ae.key===Ne.key?"":(""+Ne.key).replace(Y,"$&/")+"/")+D)),G.push(Ne)),1;if(Ae=0,ve=ve===""?".":ve+":",O(D))for(var _e=0;_e<D.length;_e++){fe=D[_e];var me=ve+he(fe,_e);Ae+=K(fe,G,P,me,Ne)}else if(me=y(D),typeof me=="function")for(D=me.call(D),_e=0;!(fe=D.next()).done;)fe=fe.value,me=ve+he(fe,_e++),Ae+=K(fe,G,P,me,Ne);else if(fe==="object")throw G=String(D),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return Ae}function W(D,G,P){if(D==null)return D;var ve=[],Ne=0;return K(D,ve,"","",function(fe){return G.call(P,fe,Ne++)}),ve}function ne(D){if(D._status===-1){var G=D._result;G=G(),G.then(function(P){(D._status===0||D._status===-1)&&(D._status=1,D._result=P)},function(P){(D._status===0||D._status===-1)&&(D._status=2,D._result=P)}),D._status===-1&&(D._status=0,D._result=G)}if(D._status===1)return D._result.default;throw D._result}var re={current:null},J={transition:null},ce={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:J,ReactCurrentOwner:N};function A(){throw Error("act(...) is not supported in production builds of React.")}return We.Children={map:W,forEach:function(D,G,P){W(D,function(){G.apply(this,arguments)},P)},count:function(D){var G=0;return W(D,function(){G++}),G},toArray:function(D){return W(D,function(G){return G})||[]},only:function(D){if(!L(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},We.Component=k,We.Fragment=n,We.Profiler=s,We.PureComponent=C,We.StrictMode=r,We.Suspense=u,We.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ce,We.act=A,We.cloneElement=function(D,G,P){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var ve=b({},D.props),Ne=D.key,fe=D.ref,Ae=D._owner;if(G!=null){if(G.ref!==void 0&&(fe=G.ref,Ae=N.current),G.key!==void 0&&(Ne=""+G.key),D.type&&D.type.defaultProps)var _e=D.type.defaultProps;for(me in G)T.call(G,me)&&!M.hasOwnProperty(me)&&(ve[me]=G[me]===void 0&&_e!==void 0?_e[me]:G[me])}var me=arguments.length-2;if(me===1)ve.children=P;else if(1<me){_e=Array(me);for(var tt=0;tt<me;tt++)_e[tt]=arguments[tt+2];ve.children=_e}return{$$typeof:e,type:D.type,key:Ne,ref:fe,props:ve,_owner:Ae}},We.createContext=function(D){return D={$$typeof:a,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:o,_context:D},D.Consumer=D},We.createElement=V,We.createFactory=function(D){var G=V.bind(null,D);return G.type=D,G},We.createRef=function(){return{current:null}},We.forwardRef=function(D){return{$$typeof:c,render:D}},We.isValidElement=L,We.lazy=function(D){return{$$typeof:p,_payload:{_status:-1,_result:D},_init:ne}},We.memo=function(D,G){return{$$typeof:f,type:D,compare:G===void 0?null:G}},We.startTransition=function(D){var G=J.transition;J.transition={};try{D()}finally{J.transition=G}},We.unstable_act=A,We.useCallback=function(D,G){return re.current.useCallback(D,G)},We.useContext=function(D){return re.current.useContext(D)},We.useDebugValue=function(){},We.useDeferredValue=function(D){return re.current.useDeferredValue(D)},We.useEffect=function(D,G){return re.current.useEffect(D,G)},We.useId=function(){return re.current.useId()},We.useImperativeHandle=function(D,G,P){return re.current.useImperativeHandle(D,G,P)},We.useInsertionEffect=function(D,G){return re.current.useInsertionEffect(D,G)},We.useLayoutEffect=function(D,G){return re.current.useLayoutEffect(D,G)},We.useMemo=function(D,G){return re.current.useMemo(D,G)},We.useReducer=function(D,G,P){return re.current.useReducer(D,G,P)},We.useRef=function(D){return re.current.useRef(D)},We.useState=function(D){return re.current.useState(D)},We.useSyncExternalStore=function(D,G,P){return re.current.useSyncExternalStore(D,G,P)},We.useTransition=function(){return re.current.useTransition()},We.version="18.3.1",We}var Fy;function Rc(){return Fy||(Fy=1,Ud.exports=YS()),Ud.exports}var $y;function QS(){if($y)return Po;$y=1;var e=Rc(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(c,u,f){var p,g={},y=null,v=null;f!==void 0&&(y=""+f),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(v=u.ref);for(p in u)r.call(u,p)&&!o.hasOwnProperty(p)&&(g[p]=u[p]);if(c&&c.defaultProps)for(p in u=c.defaultProps,u)g[p]===void 0&&(g[p]=u[p]);return{$$typeof:t,type:c,key:y,ref:v,props:g,_owner:s.current}}return Po.Fragment=n,Po.jsx=a,Po.jsxs=a,Po}var Uy;function ZS(){return Uy||(Uy=1,$d.exports=QS()),$d.exports}var h=ZS(),R=Rc();const ra=Ac(R);var $l={},Bd={exports:{}},pn={},Vd={exports:{}},qd={};var By;function ej(){return By||(By=1,(function(e){function t(J,ce){var A=J.length;J.push(ce);e:for(;0<A;){var D=A-1>>>1,G=J[D];if(0<s(G,ce))J[D]=ce,J[A]=G,A=D;else break e}}function n(J){return J.length===0?null:J[0]}function r(J){if(J.length===0)return null;var ce=J[0],A=J.pop();if(A!==ce){J[0]=A;e:for(var D=0,G=J.length,P=G>>>1;D<P;){var ve=2*(D+1)-1,Ne=J[ve],fe=ve+1,Ae=J[fe];if(0>s(Ne,A))fe<G&&0>s(Ae,Ne)?(J[D]=Ae,J[fe]=A,D=fe):(J[D]=Ne,J[ve]=A,D=ve);else if(fe<G&&0>s(Ae,A))J[D]=Ae,J[fe]=A,D=fe;else break e}}return ce}function s(J,ce){var A=J.sortIndex-ce.sortIndex;return A!==0?A:J.id-ce.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,c=a.now();e.unstable_now=function(){return a.now()-c}}var u=[],f=[],p=1,g=null,y=3,v=!1,b=!1,w=!1,k=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,C=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(J){for(var ce=n(f);ce!==null;){if(ce.callback===null)r(f);else if(ce.startTime<=J)r(f),ce.sortIndex=ce.expirationTime,t(u,ce);else break;ce=n(f)}}function O(J){if(w=!1,j(J),!b)if(n(u)!==null)b=!0,ne(T);else{var ce=n(f);ce!==null&&re(O,ce.startTime-J)}}function T(J,ce){b=!1,w&&(w=!1,S(V),V=-1),v=!0;var A=y;try{for(j(ce),g=n(u);g!==null&&(!(g.expirationTime>ce)||J&&!Q());){var D=g.callback;if(typeof D=="function"){g.callback=null,y=g.priorityLevel;var G=D(g.expirationTime<=ce);ce=e.unstable_now(),typeof G=="function"?g.callback=G:g===n(u)&&r(u),j(ce)}else r(u);g=n(u)}if(g!==null)var P=!0;else{var ve=n(f);ve!==null&&re(O,ve.startTime-ce),P=!1}return P}finally{g=null,y=A,v=!1}}var N=!1,M=null,V=-1,U=5,L=-1;function Q(){return!(e.unstable_now()-L<U)}function Y(){if(M!==null){var J=e.unstable_now();L=J;var ce=!0;try{ce=M(!0,J)}finally{ce?he():(N=!1,M=null)}}else N=!1}var he;if(typeof C=="function")he=function(){C(Y)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,W=K.port2;K.port1.onmessage=Y,he=function(){W.postMessage(null)}}else he=function(){k(Y,0)};function ne(J){M=J,N||(N=!0,he())}function re(J,ce){V=k(function(){J(e.unstable_now())},ce)}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(J){J.callback=null},e.unstable_continueExecution=function(){b||v||(b=!0,ne(T))},e.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<J?Math.floor(1e3/J):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(J){switch(y){case 1:case 2:case 3:var ce=3;break;default:ce=y}var A=y;y=ce;try{return J()}finally{y=A}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(J,ce){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var A=y;y=J;try{return ce()}finally{y=A}},e.unstable_scheduleCallback=function(J,ce,A){var D=e.unstable_now();switch(typeof A=="object"&&A!==null?(A=A.delay,A=typeof A=="number"&&0<A?D+A:D):A=D,J){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=A+G,J={id:p++,callback:ce,priorityLevel:J,startTime:A,expirationTime:G,sortIndex:-1},A>D?(J.sortIndex=A,t(f,J),n(u)===null&&J===n(f)&&(w?(S(V),V=-1):w=!0,re(O,A-D))):(J.sortIndex=G,t(u,J),b||v||(b=!0,ne(T))),J},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(J){var ce=y;return function(){var A=y;y=ce;try{return J.apply(this,arguments)}finally{y=A}}}})(qd)),qd}var Vy;function tj(){return Vy||(Vy=1,Vd.exports=ej()),Vd.exports}var qy;function nj(){if(qy)return pn;qy=1;var e=Rc(),t=tj();function n(i){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+i+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function o(i,l){a(i,l),a(i+"Capture",l)}function a(i,l){for(s[i]=l,i=0;i<l.length;i++)r.add(l[i])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=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={},g={};function y(i){return u.call(g,i)?!0:u.call(p,i)?!1:f.test(i)?g[i]=!0:(p[i]=!0,!1)}function v(i,l,d,m){if(d!==null&&d.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return m?!1:d!==null?!d.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function b(i,l,d,m){if(l===null||typeof l>"u"||v(i,l,d,m))return!0;if(m)return!1;if(d!==null)switch(d.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function w(i,l,d,m,x,_,E){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=m,this.attributeNamespace=x,this.mustUseProperty=d,this.propertyName=i,this.type=l,this.sanitizeURL=_,this.removeEmptyString=E}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){k[i]=new w(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var l=i[0];k[l]=new w(l,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){k[i]=new w(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){k[i]=new w(i,2,!1,i,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(i){k[i]=new w(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){k[i]=new w(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){k[i]=new w(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){k[i]=new w(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){k[i]=new w(i,5,!1,i.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function C(i){return i[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(i){var l=i.replace(S,C);k[l]=new w(l,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var l=i.replace(S,C);k[l]=new w(l,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var l=i.replace(S,C);k[l]=new w(l,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){k[i]=new w(i,1,!1,i.toLowerCase(),null,!1,!1)}),k.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){k[i]=new w(i,1,!1,i.toLowerCase(),null,!0,!0)});function j(i,l,d,m){var x=k.hasOwnProperty(l)?k[l]:null;(x!==null?x.type!==0:m||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(b(l,d,x,m)&&(d=null),m||x===null?y(l)&&(d===null?i.removeAttribute(l):i.setAttribute(l,""+d)):x.mustUseProperty?i[x.propertyName]=d===null?x.type===3?!1:"":d:(l=x.attributeName,m=x.attributeNamespace,d===null?i.removeAttribute(l):(x=x.type,d=x===3||x===4&&d===!0?"":""+d,m?i.setAttributeNS(m,l,d):i.setAttribute(l,d))))}var O=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),N=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),L=Symbol.for("react.provider"),Q=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),he=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),ne=Symbol.for("react.lazy"),re=Symbol.for("react.offscreen"),J=Symbol.iterator;function ce(i){return i===null||typeof i!="object"?null:(i=J&&i[J]||i["@@iterator"],typeof i=="function"?i:null)}var A=Object.assign,D;function G(i){if(D===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);D=l&&l[1]||""}return`
2
+ `+D+i}var P=!1;function ve(i,l){if(!i||P)return"";P=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(q){var m=q}Reflect.construct(i,[],l)}else{try{l.call()}catch(q){m=q}i.call(l.prototype)}else{try{throw Error()}catch(q){m=q}i()}}catch(q){if(q&&m&&typeof q.stack=="string"){for(var x=q.stack.split(`
3
3
  `),_=m.stack.split(`
4
4
  `),E=x.length-1,I=_.length-1;1<=E&&0<=I&&x[E]!==_[I];)I--;for(;1<=E&&0<=I;E--,I--)if(x[E]!==_[I]){if(E!==1||I!==1)do if(E--,I--,0>I||x[E]!==_[I]){var z=`
5
- `+x[E].replace(" at new "," at ");return i.displayName&&z.includes("<anonymous>")&&(z=z.replace("<anonymous>",i.displayName)),z}while(1<=E&&0<=I);break}}}finally{P=!1,Error.prepareStackTrace=d}return(i=i?i.displayName||i.name:"")?G(i):""}function me(i){switch(i.tag){case 5:return G(i.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return i=_e(i.type,!1),i;case 11:return i=_e(i.type.render,!1),i;case 1:return i=_e(i.type,!0),i;default:return""}}function ye(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case M:return"Fragment";case N:return"Portal";case B:return"Profiler";case V:return"StrictMode";case he:return"Suspense";case K:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case Q:return(i.displayName||"Context")+".Consumer";case L:return(i._context.displayName||"Context")+".Provider";case Y:var l=i.render;return i=i.displayName,i||(i=l.displayName||l.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case W:return l=i.displayName||null,l!==null?l:ye(i.type)||"Memo";case ne:l=i._payload,i=i._init;try{return ye(i(l))}catch{}}return null}function Ne(i){var l=i.type;switch(i.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=l.render,i=i.displayName||i.name||"",l.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ye(l);case 8:return l===V?"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 l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function pe(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Be(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function st(i){var l=Be(i)?"checked":"value",d=Object.getOwnPropertyDescriptor(i.constructor.prototype,l),m=""+i[l];if(!i.hasOwnProperty(l)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var x=d.get,_=d.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return x.call(this)},set:function(E){m=""+E,_.call(this,E)}}),Object.defineProperty(i,l,{enumerable:d.enumerable}),{getValue:function(){return m},setValue:function(E){m=""+E},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function bt(i){i._valueTracker||(i._valueTracker=st(i))}function Qn(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var d=l.getValue(),m="";return i&&(m=Be(i)?i.checked?"true":"false":i.value),i=m,i!==d?(l.setValue(i),!0):!1}function Zn(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function er(i,l){var d=l.checked;return A({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??i._wrapperState.initialChecked})}function ee(i,l){var d=l.defaultValue==null?"":l.defaultValue,m=l.checked!=null?l.checked:l.defaultChecked;d=pe(l.value!=null?l.value:d),i._wrapperState={initialChecked:m,initialValue:d,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function De(i,l){l=l.checked,l!=null&&j(i,"checked",l,!1)}function te(i,l){De(i,l);var d=pe(l.value),m=l.type;if(d!=null)m==="number"?(d===0&&i.value===""||i.value!=d)&&(i.value=""+d):i.value!==""+d&&(i.value=""+d);else if(m==="submit"||m==="reset"){i.removeAttribute("value");return}l.hasOwnProperty("value")?je(i,l.type,d):l.hasOwnProperty("defaultValue")&&je(i,l.type,pe(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(i.defaultChecked=!!l.defaultChecked)}function ge(i,l,d){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var m=l.type;if(!(m!=="submit"&&m!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+i._wrapperState.initialValue,d||l===i.value||(i.value=l),i.defaultValue=l}d=i.name,d!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,d!==""&&(i.name=d)}function je(i,l,d){(l!=="number"||Zn(i.ownerDocument)!==i)&&(d==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+d&&(i.defaultValue=""+d))}var be=Array.isArray;function Fe(i,l,d,m){if(i=i.options,l){l={};for(var x=0;x<d.length;x++)l["$"+d[x]]=!0;for(d=0;d<i.length;d++)x=l.hasOwnProperty("$"+i[d].value),i[d].selected!==x&&(i[d].selected=x),x&&m&&(i[d].defaultSelected=!0)}else{for(d=""+pe(d),l=null,x=0;x<i.length;x++){if(i[x].value===d){i[x].selected=!0,m&&(i[x].defaultSelected=!0);return}l!==null||i[x].disabled||(l=i[x])}l!==null&&(l.selected=!0)}}function Se(i,l){if(l.dangerouslySetInnerHTML!=null)throw Error(n(91));return A({},l,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function Qe(i,l){var d=l.value;if(d==null){if(d=l.children,l=l.defaultValue,d!=null){if(l!=null)throw Error(n(92));if(be(d)){if(1<d.length)throw Error(n(93));d=d[0]}l=d}l==null&&(l=""),d=l}i._wrapperState={initialValue:pe(d)}}function tt(i,l){var d=pe(l.value),m=pe(l.defaultValue);d!=null&&(d=""+d,d!==i.value&&(i.value=d),l.defaultValue==null&&i.defaultValue!==d&&(i.defaultValue=d)),m!=null&&(i.defaultValue=""+m)}function nt(i){var l=i.textContent;l===i._wrapperState.initialValue&&l!==""&&l!==null&&(i.value=l)}function Z(i){switch(i){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 le(i,l){return i==null||i==="http://www.w3.org/1999/xhtml"?Z(l):i==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var we,$e=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,d,m,x){MSApp.execUnsafeLocalFunction(function(){return i(l,d,m,x)})}:i})(function(i,l){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=l;else{for(we=we||document.createElement("div"),we.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=we.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;l.firstChild;)i.appendChild(l.firstChild)}});function qe(i,l){if(l){var d=i.firstChild;if(d&&d===i.lastChild&&d.nodeType===3){d.nodeValue=l;return}}i.textContent=l}var ot={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},Mt=["Webkit","ms","Moz","O"];Object.keys(ot).forEach(function(i){Mt.forEach(function(l){l=l+i.charAt(0).toUpperCase()+i.substring(1),ot[l]=ot[i]})});function jt(i,l,d){return l==null||typeof l=="boolean"||l===""?"":d||typeof l!="number"||l===0||ot.hasOwnProperty(i)&&ot[i]?(""+l).trim():l+"px"}function on(i,l){i=i.style;for(var d in l)if(l.hasOwnProperty(d)){var m=d.indexOf("--")===0,x=jt(d,l[d],m);d==="float"&&(d="cssFloat"),m?i.setProperty(d,x):i[d]=x}}var Zt=A({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 Ke(i,l){if(l){if(Zt[i]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(n(137,i));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(n(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(n(61))}if(l.style!=null&&typeof l.style!="object")throw Error(n(62))}}function an(i,l){if(i.indexOf("-")===-1)return typeof l.is=="string";switch(i){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 en=null;function tu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var nu=null,$s=null,Us=null;function tm(i){if(i=yo(i)){if(typeof nu!="function")throw Error(n(280));var l=i.stateNode;l&&(l=tl(l),nu(i.stateNode,i.type,l))}}function nm(i){$s?Us?Us.push(i):Us=[i]:$s=i}function rm(){if($s){var i=$s,l=Us;if(Us=$s=null,tm(i),l)for(i=0;i<l.length;i++)tm(l[i])}}function sm(i,l){return i(l)}function im(){}var ru=!1;function om(i,l,d){if(ru)return i(l,d);ru=!0;try{return sm(i,l,d)}finally{ru=!1,($s!==null||Us!==null)&&(im(),rm())}}function Ji(i,l){var d=i.stateNode;if(d===null)return null;var m=tl(d);if(m===null)return null;d=m[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(i=i.type,m=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!m;break e;default:i=!1}if(i)return null;if(d&&typeof d!="function")throw Error(n(231,l,typeof d));return d}var su=!1;if(c)try{var Xi={};Object.defineProperty(Xi,"passive",{get:function(){su=!0}}),window.addEventListener("test",Xi,Xi),window.removeEventListener("test",Xi,Xi)}catch{su=!1}function r1(i,l,d,m,x,_,E,I,z){var q=Array.prototype.slice.call(arguments,3);try{l.apply(d,q)}catch(ie){this.onError(ie)}}var Yi=!1,Oa=null,La=!1,iu=null,s1={onError:function(i){Yi=!0,Oa=i}};function i1(i,l,d,m,x,_,E,I,z){Yi=!1,Oa=null,r1.apply(s1,arguments)}function o1(i,l,d,m,x,_,E,I,z){if(i1.apply(this,arguments),Yi){if(Yi){var q=Oa;Yi=!1,Oa=null}else throw Error(n(198));La||(La=!0,iu=q)}}function rs(i){var l=i,d=i;if(i.alternate)for(;l.return;)l=l.return;else{i=l;do l=i,(l.flags&4098)!==0&&(d=l.return),i=l.return;while(i)}return l.tag===3?d:null}function am(i){if(i.tag===13){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function lm(i){if(rs(i)!==i)throw Error(n(188))}function a1(i){var l=i.alternate;if(!l){if(l=rs(i),l===null)throw Error(n(188));return l!==i?null:i}for(var d=i,m=l;;){var x=d.return;if(x===null)break;var _=x.alternate;if(_===null){if(m=x.return,m!==null){d=m;continue}break}if(x.child===_.child){for(_=x.child;_;){if(_===d)return lm(x),i;if(_===m)return lm(x),l;_=_.sibling}throw Error(n(188))}if(d.return!==m.return)d=x,m=_;else{for(var E=!1,I=x.child;I;){if(I===d){E=!0,d=x,m=_;break}if(I===m){E=!0,m=x,d=_;break}I=I.sibling}if(!E){for(I=_.child;I;){if(I===d){E=!0,d=_,m=x;break}if(I===m){E=!0,m=_,d=x;break}I=I.sibling}if(!E)throw Error(n(189))}}if(d.alternate!==m)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?i:l}function cm(i){return i=a1(i),i!==null?um(i):null}function um(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var l=um(i);if(l!==null)return l;i=i.sibling}return null}var dm=t.unstable_scheduleCallback,hm=t.unstable_cancelCallback,l1=t.unstable_shouldYield,c1=t.unstable_requestPaint,wt=t.unstable_now,u1=t.unstable_getCurrentPriorityLevel,ou=t.unstable_ImmediatePriority,fm=t.unstable_UserBlockingPriority,Ia=t.unstable_NormalPriority,d1=t.unstable_LowPriority,pm=t.unstable_IdlePriority,Da=null,tr=null;function h1(i){if(tr&&typeof tr.onCommitFiberRoot=="function")try{tr.onCommitFiberRoot(Da,i,void 0,(i.current.flags&128)===128)}catch{}}var Fn=Math.clz32?Math.clz32:m1,f1=Math.log,p1=Math.LN2;function m1(i){return i>>>=0,i===0?32:31-(f1(i)/p1|0)|0}var Ma=64,za=4194304;function Qi(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function Fa(i,l){var d=i.pendingLanes;if(d===0)return 0;var m=0,x=i.suspendedLanes,_=i.pingedLanes,E=d&268435455;if(E!==0){var I=E&~x;I!==0?m=Qi(I):(_&=E,_!==0&&(m=Qi(_)))}else E=d&~x,E!==0?m=Qi(E):_!==0&&(m=Qi(_));if(m===0)return 0;if(l!==0&&l!==m&&(l&x)===0&&(x=m&-m,_=l&-l,x>=_||x===16&&(_&4194240)!==0))return l;if((m&4)!==0&&(m|=d&16),l=i.entangledLanes,l!==0)for(i=i.entanglements,l&=m;0<l;)d=31-Fn(l),x=1<<d,m|=i[d],l&=~x;return m}function g1(i,l){switch(i){case 1:case 2:case 4:return l+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 l+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 y1(i,l){for(var d=i.suspendedLanes,m=i.pingedLanes,x=i.expirationTimes,_=i.pendingLanes;0<_;){var E=31-Fn(_),I=1<<E,z=x[E];z===-1?((I&d)===0||(I&m)!==0)&&(x[E]=g1(I,l)):z<=l&&(i.expiredLanes|=I),_&=~I}}function au(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function mm(){var i=Ma;return Ma<<=1,(Ma&4194240)===0&&(Ma=64),i}function lu(i){for(var l=[],d=0;31>d;d++)l.push(i);return l}function Zi(i,l,d){i.pendingLanes|=l,l!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,l=31-Fn(l),i[l]=d}function x1(i,l){var d=i.pendingLanes&~l;i.pendingLanes=l,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=l,i.mutableReadLanes&=l,i.entangledLanes&=l,l=i.entanglements;var m=i.eventTimes;for(i=i.expirationTimes;0<d;){var x=31-Fn(d),_=1<<x;l[x]=0,m[x]=-1,i[x]=-1,d&=~_}}function cu(i,l){var d=i.entangledLanes|=l;for(i=i.entanglements;d;){var m=31-Fn(d),x=1<<m;x&l|i[m]&l&&(i[m]|=l),d&=~x}}var rt=0;function gm(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var ym,uu,xm,vm,_m,du=!1,$a=[],Nr=null,Ar=null,Rr=null,eo=new Map,to=new Map,Pr=[],v1="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 bm(i,l){switch(i){case"focusin":case"focusout":Nr=null;break;case"dragenter":case"dragleave":Ar=null;break;case"mouseover":case"mouseout":Rr=null;break;case"pointerover":case"pointerout":eo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":to.delete(l.pointerId)}}function no(i,l,d,m,x,_){return i===null||i.nativeEvent!==_?(i={blockedOn:l,domEventName:d,eventSystemFlags:m,nativeEvent:_,targetContainers:[x]},l!==null&&(l=yo(l),l!==null&&uu(l)),i):(i.eventSystemFlags|=m,l=i.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),i)}function _1(i,l,d,m,x){switch(l){case"focusin":return Nr=no(Nr,i,l,d,m,x),!0;case"dragenter":return Ar=no(Ar,i,l,d,m,x),!0;case"mouseover":return Rr=no(Rr,i,l,d,m,x),!0;case"pointerover":var _=x.pointerId;return eo.set(_,no(eo.get(_)||null,i,l,d,m,x)),!0;case"gotpointercapture":return _=x.pointerId,to.set(_,no(to.get(_)||null,i,l,d,m,x)),!0}return!1}function wm(i){var l=ss(i.target);if(l!==null){var d=rs(l);if(d!==null){if(l=d.tag,l===13){if(l=am(d),l!==null){i.blockedOn=l,_m(i.priority,function(){xm(d)});return}}else if(l===3&&d.stateNode.current.memoizedState.isDehydrated){i.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Ua(i){if(i.blockedOn!==null)return!1;for(var l=i.targetContainers;0<l.length;){var d=fu(i.domEventName,i.eventSystemFlags,l[0],i.nativeEvent);if(d===null){d=i.nativeEvent;var m=new d.constructor(d.type,d);en=m,d.target.dispatchEvent(m),en=null}else return l=yo(d),l!==null&&uu(l),i.blockedOn=d,!1;l.shift()}return!0}function km(i,l,d){Ua(i)&&d.delete(l)}function b1(){du=!1,Nr!==null&&Ua(Nr)&&(Nr=null),Ar!==null&&Ua(Ar)&&(Ar=null),Rr!==null&&Ua(Rr)&&(Rr=null),eo.forEach(km),to.forEach(km)}function ro(i,l){i.blockedOn===l&&(i.blockedOn=null,du||(du=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,b1)))}function so(i){function l(x){return ro(x,i)}if(0<$a.length){ro($a[0],i);for(var d=1;d<$a.length;d++){var m=$a[d];m.blockedOn===i&&(m.blockedOn=null)}}for(Nr!==null&&ro(Nr,i),Ar!==null&&ro(Ar,i),Rr!==null&&ro(Rr,i),eo.forEach(l),to.forEach(l),d=0;d<Pr.length;d++)m=Pr[d],m.blockedOn===i&&(m.blockedOn=null);for(;0<Pr.length&&(d=Pr[0],d.blockedOn===null);)wm(d),d.blockedOn===null&&Pr.shift()}var Bs=O.ReactCurrentBatchConfig,Ba=!0;function w1(i,l,d,m){var x=rt,_=Bs.transition;Bs.transition=null;try{rt=1,hu(i,l,d,m)}finally{rt=x,Bs.transition=_}}function k1(i,l,d,m){var x=rt,_=Bs.transition;Bs.transition=null;try{rt=4,hu(i,l,d,m)}finally{rt=x,Bs.transition=_}}function hu(i,l,d,m){if(Ba){var x=fu(i,l,d,m);if(x===null)Au(i,l,m,Va,d),bm(i,m);else if(_1(x,i,l,d,m))m.stopPropagation();else if(bm(i,m),l&4&&-1<v1.indexOf(i)){for(;x!==null;){var _=yo(x);if(_!==null&&ym(_),_=fu(i,l,d,m),_===null&&Au(i,l,m,Va,d),_===x)break;x=_}x!==null&&m.stopPropagation()}else Au(i,l,m,null,d)}}var Va=null;function fu(i,l,d,m){if(Va=null,i=tu(m),i=ss(i),i!==null)if(l=rs(i),l===null)i=null;else if(d=l.tag,d===13){if(i=am(l),i!==null)return i;i=null}else if(d===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;i=null}else l!==i&&(i=null);return Va=i,null}function Sm(i){switch(i){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(u1()){case ou:return 1;case fm:return 4;case Ia:case d1:return 16;case pm:return 536870912;default:return 16}default:return 16}}var Or=null,pu=null,qa=null;function jm(){if(qa)return qa;var i,l=pu,d=l.length,m,x="value"in Or?Or.value:Or.textContent,_=x.length;for(i=0;i<d&&l[i]===x[i];i++);var E=d-i;for(m=1;m<=E&&l[d-m]===x[_-m];m++);return qa=x.slice(i,1<m?1-m:void 0)}function Ha(i){var l=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&l===13&&(i=13)):i=l,i===10&&(i=13),32<=i||i===13?i:0}function Ka(){return!0}function Em(){return!1}function xn(i){function l(d,m,x,_,E){this._reactName=d,this._targetInst=x,this.type=m,this.nativeEvent=_,this.target=E,this.currentTarget=null;for(var I in i)i.hasOwnProperty(I)&&(d=i[I],this[I]=d?d(_):_[I]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Ka:Em,this.isPropagationStopped=Em,this}return A(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Ka)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Ka)},persist:function(){},isPersistent:Ka}),l}var Vs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mu=xn(Vs),io=A({},Vs,{view:0,detail:0}),S1=xn(io),gu,yu,oo,Wa=A({},io,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vu,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==oo&&(oo&&i.type==="mousemove"?(gu=i.screenX-oo.screenX,yu=i.screenY-oo.screenY):yu=gu=0,oo=i),gu)},movementY:function(i){return"movementY"in i?i.movementY:yu}}),Cm=xn(Wa),j1=A({},Wa,{dataTransfer:0}),E1=xn(j1),C1=A({},io,{relatedTarget:0}),xu=xn(C1),T1=A({},Vs,{animationName:0,elapsedTime:0,pseudoElement:0}),N1=xn(T1),A1=A({},Vs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),R1=xn(A1),P1=A({},Vs,{data:0}),Tm=xn(P1),O1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},L1={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"},I1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function D1(i){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(i):(i=I1[i])?!!l[i]:!1}function vu(){return D1}var M1=A({},io,{key:function(i){if(i.key){var l=O1[i.key]||i.key;if(l!=="Unidentified")return l}return i.type==="keypress"?(i=Ha(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?L1[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vu,charCode:function(i){return i.type==="keypress"?Ha(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ha(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),z1=xn(M1),F1=A({},Wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nm=xn(F1),$1=A({},io,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vu}),U1=xn($1),B1=A({},Vs,{propertyName:0,elapsedTime:0,pseudoElement:0}),V1=xn(B1),q1=A({},Wa,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),H1=xn(q1),K1=[9,13,27,32],_u=c&&"CompositionEvent"in window,ao=null;c&&"documentMode"in document&&(ao=document.documentMode);var W1=c&&"TextEvent"in window&&!ao,Am=c&&(!_u||ao&&8<ao&&11>=ao),Rm=" ",Pm=!1;function Om(i,l){switch(i){case"keyup":return K1.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lm(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var qs=!1;function G1(i,l){switch(i){case"compositionend":return Lm(l);case"keypress":return l.which!==32?null:(Pm=!0,Rm);case"textInput":return i=l.data,i===Rm&&Pm?null:i;default:return null}}function J1(i,l){if(qs)return i==="compositionend"||!_u&&Om(i,l)?(i=jm(),qa=pu=Or=null,qs=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Am&&l.locale!=="ko"?null:l.data;default:return null}}var X1={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 Im(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l==="input"?!!X1[i.type]:l==="textarea"}function Dm(i,l,d,m){nm(m),l=Qa(l,"onChange"),0<l.length&&(d=new mu("onChange","change",null,d,m),i.push({event:d,listeners:l}))}var lo=null,co=null;function Y1(i){eg(i,0)}function Ga(i){var l=Js(i);if(Qn(l))return i}function Q1(i,l){if(i==="change")return l}var Mm=!1;if(c){var bu;if(c){var wu="oninput"in document;if(!wu){var zm=document.createElement("div");zm.setAttribute("oninput","return;"),wu=typeof zm.oninput=="function"}bu=wu}else bu=!1;Mm=bu&&(!document.documentMode||9<document.documentMode)}function Fm(){lo&&(lo.detachEvent("onpropertychange",$m),co=lo=null)}function $m(i){if(i.propertyName==="value"&&Ga(co)){var l=[];Dm(l,co,i,tu(i)),om(Y1,l)}}function Z1(i,l,d){i==="focusin"?(Fm(),lo=l,co=d,lo.attachEvent("onpropertychange",$m)):i==="focusout"&&Fm()}function eS(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Ga(co)}function tS(i,l){if(i==="click")return Ga(l)}function nS(i,l){if(i==="input"||i==="change")return Ga(l)}function rS(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var $n=typeof Object.is=="function"?Object.is:rS;function uo(i,l){if($n(i,l))return!0;if(typeof i!="object"||i===null||typeof l!="object"||l===null)return!1;var d=Object.keys(i),m=Object.keys(l);if(d.length!==m.length)return!1;for(m=0;m<d.length;m++){var x=d[m];if(!u.call(l,x)||!$n(i[x],l[x]))return!1}return!0}function Um(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Bm(i,l){var d=Um(i);i=0;for(var m;d;){if(d.nodeType===3){if(m=i+d.textContent.length,i<=l&&m>=l)return{node:d,offset:l-i};i=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Um(d)}}function Vm(i,l){return i&&l?i===l?!0:i&&i.nodeType===3?!1:l&&l.nodeType===3?Vm(i,l.parentNode):"contains"in i?i.contains(l):i.compareDocumentPosition?!!(i.compareDocumentPosition(l)&16):!1:!1}function qm(){for(var i=window,l=Zn();l instanceof i.HTMLIFrameElement;){try{var d=typeof l.contentWindow.location.href=="string"}catch{d=!1}if(d)i=l.contentWindow;else break;l=Zn(i.document)}return l}function ku(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l&&(l==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||l==="textarea"||i.contentEditable==="true")}function sS(i){var l=qm(),d=i.focusedElem,m=i.selectionRange;if(l!==d&&d&&d.ownerDocument&&Vm(d.ownerDocument.documentElement,d)){if(m!==null&&ku(d)){if(l=m.start,i=m.end,i===void 0&&(i=l),"selectionStart"in d)d.selectionStart=l,d.selectionEnd=Math.min(i,d.value.length);else if(i=(l=d.ownerDocument||document)&&l.defaultView||window,i.getSelection){i=i.getSelection();var x=d.textContent.length,_=Math.min(m.start,x);m=m.end===void 0?_:Math.min(m.end,x),!i.extend&&_>m&&(x=m,m=_,_=x),x=Bm(d,_);var E=Bm(d,m);x&&E&&(i.rangeCount!==1||i.anchorNode!==x.node||i.anchorOffset!==x.offset||i.focusNode!==E.node||i.focusOffset!==E.offset)&&(l=l.createRange(),l.setStart(x.node,x.offset),i.removeAllRanges(),_>m?(i.addRange(l),i.extend(E.node,E.offset)):(l.setEnd(E.node,E.offset),i.addRange(l)))}}for(l=[],i=d;i=i.parentNode;)i.nodeType===1&&l.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<l.length;d++)i=l[d],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var iS=c&&"documentMode"in document&&11>=document.documentMode,Hs=null,Su=null,ho=null,ju=!1;function Hm(i,l,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;ju||Hs==null||Hs!==Zn(m)||(m=Hs,"selectionStart"in m&&ku(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),ho&&uo(ho,m)||(ho=m,m=Qa(Su,"onSelect"),0<m.length&&(l=new mu("onSelect","select",null,l,d),i.push({event:l,listeners:m}),l.target=Hs)))}function Ja(i,l){var d={};return d[i.toLowerCase()]=l.toLowerCase(),d["Webkit"+i]="webkit"+l,d["Moz"+i]="moz"+l,d}var Ks={animationend:Ja("Animation","AnimationEnd"),animationiteration:Ja("Animation","AnimationIteration"),animationstart:Ja("Animation","AnimationStart"),transitionend:Ja("Transition","TransitionEnd")},Eu={},Km={};c&&(Km=document.createElement("div").style,"AnimationEvent"in window||(delete Ks.animationend.animation,delete Ks.animationiteration.animation,delete Ks.animationstart.animation),"TransitionEvent"in window||delete Ks.transitionend.transition);function Xa(i){if(Eu[i])return Eu[i];if(!Ks[i])return i;var l=Ks[i],d;for(d in l)if(l.hasOwnProperty(d)&&d in Km)return Eu[i]=l[d];return i}var Wm=Xa("animationend"),Gm=Xa("animationiteration"),Jm=Xa("animationstart"),Xm=Xa("transitionend"),Ym=new Map,Qm="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(i,l){Ym.set(i,l),o(l,[i])}for(var Cu=0;Cu<Qm.length;Cu++){var Tu=Qm[Cu],oS=Tu.toLowerCase(),aS=Tu[0].toUpperCase()+Tu.slice(1);Lr(oS,"on"+aS)}Lr(Wm,"onAnimationEnd"),Lr(Gm,"onAnimationIteration"),Lr(Jm,"onAnimationStart"),Lr("dblclick","onDoubleClick"),Lr("focusin","onFocus"),Lr("focusout","onBlur"),Lr(Xm,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fo="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(" "),lS=new Set("cancel close invalid load scroll toggle".split(" ").concat(fo));function Zm(i,l,d){var m=i.type||"unknown-event";i.currentTarget=d,o1(m,l,void 0,i),i.currentTarget=null}function eg(i,l){l=(l&4)!==0;for(var d=0;d<i.length;d++){var m=i[d],x=m.event;m=m.listeners;e:{var _=void 0;if(l)for(var E=m.length-1;0<=E;E--){var I=m[E],z=I.instance,q=I.currentTarget;if(I=I.listener,z!==_&&x.isPropagationStopped())break e;Zm(x,I,q),_=z}else for(E=0;E<m.length;E++){if(I=m[E],z=I.instance,q=I.currentTarget,I=I.listener,z!==_&&x.isPropagationStopped())break e;Zm(x,I,q),_=z}}}if(La)throw i=iu,La=!1,iu=null,i}function ut(i,l){var d=l[Du];d===void 0&&(d=l[Du]=new Set);var m=i+"__bubble";d.has(m)||(tg(l,i,2,!1),d.add(m))}function Nu(i,l,d){var m=0;l&&(m|=4),tg(d,i,m,l)}var Ya="_reactListening"+Math.random().toString(36).slice(2);function po(i){if(!i[Ya]){i[Ya]=!0,r.forEach(function(d){d!=="selectionchange"&&(lS.has(d)||Nu(d,!1,i),Nu(d,!0,i))});var l=i.nodeType===9?i:i.ownerDocument;l===null||l[Ya]||(l[Ya]=!0,Nu("selectionchange",!1,l))}}function tg(i,l,d,m){switch(Sm(l)){case 1:var x=w1;break;case 4:x=k1;break;default:x=hu}d=x.bind(null,l,d,i),x=void 0,!su||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),m?x!==void 0?i.addEventListener(l,d,{capture:!0,passive:x}):i.addEventListener(l,d,!0):x!==void 0?i.addEventListener(l,d,{passive:x}):i.addEventListener(l,d,!1)}function Au(i,l,d,m,x){var _=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var E=m.tag;if(E===3||E===4){var I=m.stateNode.containerInfo;if(I===x||I.nodeType===8&&I.parentNode===x)break;if(E===4)for(E=m.return;E!==null;){var z=E.tag;if((z===3||z===4)&&(z=E.stateNode.containerInfo,z===x||z.nodeType===8&&z.parentNode===x))return;E=E.return}for(;I!==null;){if(E=ss(I),E===null)return;if(z=E.tag,z===5||z===6){m=_=E;continue e}I=I.parentNode}}m=m.return}om(function(){var q=_,ie=tu(d),oe=[];e:{var se=Ym.get(i);if(se!==void 0){var xe=mu,ke=i;switch(i){case"keypress":if(Ha(d)===0)break e;case"keydown":case"keyup":xe=z1;break;case"focusin":ke="focus",xe=xu;break;case"focusout":ke="blur",xe=xu;break;case"beforeblur":case"afterblur":xe=xu;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=Cm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=E1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=U1;break;case Wm:case Gm:case Jm:xe=N1;break;case Xm:xe=V1;break;case"scroll":xe=S1;break;case"wheel":xe=H1;break;case"copy":case"cut":case"paste":xe=R1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=Nm}var Ee=(l&4)!==0,kt=!Ee&&i==="scroll",$=Ee?se!==null?se+"Capture":null:se;Ee=[];for(var F=q,U;F!==null;){U=F;var de=U.stateNode;if(U.tag===5&&de!==null&&(U=de,$!==null&&(de=Ji(F,$),de!=null&&Ee.push(mo(F,de,U)))),kt)break;F=F.return}0<Ee.length&&(se=new xe(se,ke,null,d,ie),oe.push({event:se,listeners:Ee}))}}if((l&7)===0){e:{if(se=i==="mouseover"||i==="pointerover",xe=i==="mouseout"||i==="pointerout",se&&d!==en&&(ke=d.relatedTarget||d.fromElement)&&(ss(ke)||ke[hr]))break e;if((xe||se)&&(se=ie.window===ie?ie:(se=ie.ownerDocument)?se.defaultView||se.parentWindow:window,xe?(ke=d.relatedTarget||d.toElement,xe=q,ke=ke?ss(ke):null,ke!==null&&(kt=rs(ke),ke!==kt||ke.tag!==5&&ke.tag!==6)&&(ke=null)):(xe=null,ke=q),xe!==ke)){if(Ee=Cm,de="onMouseLeave",$="onMouseEnter",F="mouse",(i==="pointerout"||i==="pointerover")&&(Ee=Nm,de="onPointerLeave",$="onPointerEnter",F="pointer"),kt=xe==null?se:Js(xe),U=ke==null?se:Js(ke),se=new Ee(de,F+"leave",xe,d,ie),se.target=kt,se.relatedTarget=U,de=null,ss(ie)===q&&(Ee=new Ee($,F+"enter",ke,d,ie),Ee.target=U,Ee.relatedTarget=kt,de=Ee),kt=de,xe&&ke)t:{for(Ee=xe,$=ke,F=0,U=Ee;U;U=Ws(U))F++;for(U=0,de=$;de;de=Ws(de))U++;for(;0<F-U;)Ee=Ws(Ee),F--;for(;0<U-F;)$=Ws($),U--;for(;F--;){if(Ee===$||$!==null&&Ee===$.alternate)break t;Ee=Ws(Ee),$=Ws($)}Ee=null}else Ee=null;xe!==null&&ng(oe,se,xe,Ee,!1),ke!==null&&kt!==null&&ng(oe,kt,ke,Ee,!0)}}e:{if(se=q?Js(q):window,xe=se.nodeName&&se.nodeName.toLowerCase(),xe==="select"||xe==="input"&&se.type==="file")var Ce=Q1;else if(Im(se))if(Mm)Ce=nS;else{Ce=eS;var Ae=Z1}else(xe=se.nodeName)&&xe.toLowerCase()==="input"&&(se.type==="checkbox"||se.type==="radio")&&(Ce=tS);if(Ce&&(Ce=Ce(i,q))){Dm(oe,Ce,d,ie);break e}Ae&&Ae(i,se,q),i==="focusout"&&(Ae=se._wrapperState)&&Ae.controlled&&se.type==="number"&&je(se,"number",se.value)}switch(Ae=q?Js(q):window,i){case"focusin":(Im(Ae)||Ae.contentEditable==="true")&&(Hs=Ae,Su=q,ho=null);break;case"focusout":ho=Su=Hs=null;break;case"mousedown":ju=!0;break;case"contextmenu":case"mouseup":case"dragend":ju=!1,Hm(oe,d,ie);break;case"selectionchange":if(iS)break;case"keydown":case"keyup":Hm(oe,d,ie)}var Re;if(_u)e:{switch(i){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else qs?Om(i,d)&&(Me="onCompositionEnd"):i==="keydown"&&d.keyCode===229&&(Me="onCompositionStart");Me&&(Am&&d.locale!=="ko"&&(qs||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&qs&&(Re=jm()):(Or=ie,pu="value"in Or?Or.value:Or.textContent,qs=!0)),Ae=Qa(q,Me),0<Ae.length&&(Me=new Tm(Me,i,null,d,ie),oe.push({event:Me,listeners:Ae}),Re?Me.data=Re:(Re=Lm(d),Re!==null&&(Me.data=Re)))),(Re=W1?G1(i,d):J1(i,d))&&(q=Qa(q,"onBeforeInput"),0<q.length&&(ie=new Tm("onBeforeInput","beforeinput",null,d,ie),oe.push({event:ie,listeners:q}),ie.data=Re))}eg(oe,l)})}function mo(i,l,d){return{instance:i,listener:l,currentTarget:d}}function Qa(i,l){for(var d=l+"Capture",m=[];i!==null;){var x=i,_=x.stateNode;x.tag===5&&_!==null&&(x=_,_=Ji(i,d),_!=null&&m.unshift(mo(i,_,x)),_=Ji(i,l),_!=null&&m.push(mo(i,_,x))),i=i.return}return m}function Ws(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function ng(i,l,d,m,x){for(var _=l._reactName,E=[];d!==null&&d!==m;){var I=d,z=I.alternate,q=I.stateNode;if(z!==null&&z===m)break;I.tag===5&&q!==null&&(I=q,x?(z=Ji(d,_),z!=null&&E.unshift(mo(d,z,I))):x||(z=Ji(d,_),z!=null&&E.push(mo(d,z,I)))),d=d.return}E.length!==0&&i.push({event:l,listeners:E})}var cS=/\r\n?/g,uS=/\u0000|\uFFFD/g;function rg(i){return(typeof i=="string"?i:""+i).replace(cS,`
6
- `).replace(uS,"")}function Za(i,l,d){if(l=rg(l),rg(i)!==l&&d)throw Error(n(425))}function el(){}var Ru=null,Pu=null;function Ou(i,l){return i==="textarea"||i==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Lu=typeof setTimeout=="function"?setTimeout:void 0,dS=typeof clearTimeout=="function"?clearTimeout:void 0,sg=typeof Promise=="function"?Promise:void 0,hS=typeof queueMicrotask=="function"?queueMicrotask:typeof sg<"u"?function(i){return sg.resolve(null).then(i).catch(fS)}:Lu;function fS(i){setTimeout(function(){throw i})}function Iu(i,l){var d=l,m=0;do{var x=d.nextSibling;if(i.removeChild(d),x&&x.nodeType===8)if(d=x.data,d==="/$"){if(m===0){i.removeChild(x),so(l);return}m--}else d!=="$"&&d!=="$?"&&d!=="$!"||m++;d=x}while(d);so(l)}function Ir(i){for(;i!=null;i=i.nextSibling){var l=i.nodeType;if(l===1||l===3)break;if(l===8){if(l=i.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return i}function ig(i){i=i.previousSibling;for(var l=0;i;){if(i.nodeType===8){var d=i.data;if(d==="$"||d==="$!"||d==="$?"){if(l===0)return i;l--}else d==="/$"&&l++}i=i.previousSibling}return null}var Gs=Math.random().toString(36).slice(2),nr="__reactFiber$"+Gs,go="__reactProps$"+Gs,hr="__reactContainer$"+Gs,Du="__reactEvents$"+Gs,pS="__reactListeners$"+Gs,mS="__reactHandles$"+Gs;function ss(i){var l=i[nr];if(l)return l;for(var d=i.parentNode;d;){if(l=d[hr]||d[nr]){if(d=l.alternate,l.child!==null||d!==null&&d.child!==null)for(i=ig(i);i!==null;){if(d=i[nr])return d;i=ig(i)}return l}i=d,d=i.parentNode}return null}function yo(i){return i=i[nr]||i[hr],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function Js(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(n(33))}function tl(i){return i[go]||null}var Mu=[],Xs=-1;function Dr(i){return{current:i}}function dt(i){0>Xs||(i.current=Mu[Xs],Mu[Xs]=null,Xs--)}function at(i,l){Xs++,Mu[Xs]=i.current,i.current=l}var Mr={},qt=Dr(Mr),ln=Dr(!1),is=Mr;function Ys(i,l){var d=i.type.contextTypes;if(!d)return Mr;var m=i.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===l)return m.__reactInternalMemoizedMaskedChildContext;var x={},_;for(_ in d)x[_]=l[_];return m&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=l,i.__reactInternalMemoizedMaskedChildContext=x),x}function cn(i){return i=i.childContextTypes,i!=null}function nl(){dt(ln),dt(qt)}function og(i,l,d){if(qt.current!==Mr)throw Error(n(168));at(qt,l),at(ln,d)}function ag(i,l,d){var m=i.stateNode;if(l=l.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var x in m)if(!(x in l))throw Error(n(108,Ne(i)||"Unknown",x));return A({},d,m)}function rl(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Mr,is=qt.current,at(qt,i),at(ln,ln.current),!0}function lg(i,l,d){var m=i.stateNode;if(!m)throw Error(n(169));d?(i=ag(i,l,is),m.__reactInternalMemoizedMergedChildContext=i,dt(ln),dt(qt),at(qt,i)):dt(ln),at(ln,d)}var fr=null,sl=!1,zu=!1;function cg(i){fr===null?fr=[i]:fr.push(i)}function gS(i){sl=!0,cg(i)}function zr(){if(!zu&&fr!==null){zu=!0;var i=0,l=rt;try{var d=fr;for(rt=1;i<d.length;i++){var m=d[i];do m=m(!0);while(m!==null)}fr=null,sl=!1}catch(x){throw fr!==null&&(fr=fr.slice(i+1)),dm(ou,zr),x}finally{rt=l,zu=!1}}return null}var Qs=[],Zs=0,il=null,ol=0,An=[],Rn=0,os=null,pr=1,mr="";function as(i,l){Qs[Zs++]=ol,Qs[Zs++]=il,il=i,ol=l}function ug(i,l,d){An[Rn++]=pr,An[Rn++]=mr,An[Rn++]=os,os=i;var m=pr;i=mr;var x=32-Fn(m)-1;m&=~(1<<x),d+=1;var _=32-Fn(l)+x;if(30<_){var E=x-x%5;_=(m&(1<<E)-1).toString(32),m>>=E,x-=E,pr=1<<32-Fn(l)+x|d<<x|m,mr=_+i}else pr=1<<_|d<<x|m,mr=i}function Fu(i){i.return!==null&&(as(i,1),ug(i,1,0))}function $u(i){for(;i===il;)il=Qs[--Zs],Qs[Zs]=null,ol=Qs[--Zs],Qs[Zs]=null;for(;i===os;)os=An[--Rn],An[Rn]=null,mr=An[--Rn],An[Rn]=null,pr=An[--Rn],An[Rn]=null}var vn=null,_n=null,ft=!1,Un=null;function dg(i,l){var d=In(5,null,null,0);d.elementType="DELETED",d.stateNode=l,d.return=i,l=i.deletions,l===null?(i.deletions=[d],i.flags|=16):l.push(d)}function hg(i,l){switch(i.tag){case 5:var d=i.type;return l=l.nodeType!==1||d.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(i.stateNode=l,vn=i,_n=Ir(l.firstChild),!0):!1;case 6:return l=i.pendingProps===""||l.nodeType!==3?null:l,l!==null?(i.stateNode=l,vn=i,_n=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(d=os!==null?{id:pr,overflow:mr}:null,i.memoizedState={dehydrated:l,treeContext:d,retryLane:1073741824},d=In(18,null,null,0),d.stateNode=l,d.return=i,i.child=d,vn=i,_n=null,!0):!1;default:return!1}}function Uu(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Bu(i){if(ft){var l=_n;if(l){var d=l;if(!hg(i,l)){if(Uu(i))throw Error(n(418));l=Ir(d.nextSibling);var m=vn;l&&hg(i,l)?dg(m,d):(i.flags=i.flags&-4097|2,ft=!1,vn=i)}}else{if(Uu(i))throw Error(n(418));i.flags=i.flags&-4097|2,ft=!1,vn=i}}}function fg(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;vn=i}function al(i){if(i!==vn)return!1;if(!ft)return fg(i),ft=!0,!1;var l;if((l=i.tag!==3)&&!(l=i.tag!==5)&&(l=i.type,l=l!=="head"&&l!=="body"&&!Ou(i.type,i.memoizedProps)),l&&(l=_n)){if(Uu(i))throw pg(),Error(n(418));for(;l;)dg(i,l),l=Ir(l.nextSibling)}if(fg(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));e:{for(i=i.nextSibling,l=0;i;){if(i.nodeType===8){var d=i.data;if(d==="/$"){if(l===0){_n=Ir(i.nextSibling);break e}l--}else d!=="$"&&d!=="$!"&&d!=="$?"||l++}i=i.nextSibling}_n=null}}else _n=vn?Ir(i.stateNode.nextSibling):null;return!0}function pg(){for(var i=_n;i;)i=Ir(i.nextSibling)}function ei(){_n=vn=null,ft=!1}function Vu(i){Un===null?Un=[i]:Un.push(i)}var yS=O.ReactCurrentBatchConfig;function xo(i,l,d){if(i=d.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var m=d.stateNode}if(!m)throw Error(n(147,i));var x=m,_=""+i;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===_?l.ref:(l=function(E){var I=x.refs;E===null?delete I[_]:I[_]=E},l._stringRef=_,l)}if(typeof i!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,i))}return i}function ll(i,l){throw i=Object.prototype.toString.call(l),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":i))}function mg(i){var l=i._init;return l(i._payload)}function gg(i){function l($,F){if(i){var U=$.deletions;U===null?($.deletions=[F],$.flags|=16):U.push(F)}}function d($,F){if(!i)return null;for(;F!==null;)l($,F),F=F.sibling;return null}function m($,F){for($=new Map;F!==null;)F.key!==null?$.set(F.key,F):$.set(F.index,F),F=F.sibling;return $}function x($,F){return $=Kr($,F),$.index=0,$.sibling=null,$}function _($,F,U){return $.index=U,i?(U=$.alternate,U!==null?(U=U.index,U<F?($.flags|=2,F):U):($.flags|=2,F)):($.flags|=1048576,F)}function E($){return i&&$.alternate===null&&($.flags|=2),$}function I($,F,U,de){return F===null||F.tag!==6?(F=Ld(U,$.mode,de),F.return=$,F):(F=x(F,U),F.return=$,F)}function z($,F,U,de){var Ce=U.type;return Ce===M?ie($,F,U.props.children,de,U.key):F!==null&&(F.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ne&&mg(Ce)===F.type)?(de=x(F,U.props),de.ref=xo($,F,U),de.return=$,de):(de=Pl(U.type,U.key,U.props,null,$.mode,de),de.ref=xo($,F,U),de.return=$,de)}function q($,F,U,de){return F===null||F.tag!==4||F.stateNode.containerInfo!==U.containerInfo||F.stateNode.implementation!==U.implementation?(F=Id(U,$.mode,de),F.return=$,F):(F=x(F,U.children||[]),F.return=$,F)}function ie($,F,U,de,Ce){return F===null||F.tag!==7?(F=ms(U,$.mode,de,Ce),F.return=$,F):(F=x(F,U),F.return=$,F)}function oe($,F,U){if(typeof F=="string"&&F!==""||typeof F=="number")return F=Ld(""+F,$.mode,U),F.return=$,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case T:return U=Pl(F.type,F.key,F.props,null,$.mode,U),U.ref=xo($,null,F),U.return=$,U;case N:return F=Id(F,$.mode,U),F.return=$,F;case ne:var de=F._init;return oe($,de(F._payload),U)}if(be(F)||ce(F))return F=ms(F,$.mode,U,null),F.return=$,F;ll($,F)}return null}function se($,F,U,de){var Ce=F!==null?F.key:null;if(typeof U=="string"&&U!==""||typeof U=="number")return Ce!==null?null:I($,F,""+U,de);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case T:return U.key===Ce?z($,F,U,de):null;case N:return U.key===Ce?q($,F,U,de):null;case ne:return Ce=U._init,se($,F,Ce(U._payload),de)}if(be(U)||ce(U))return Ce!==null?null:ie($,F,U,de,null);ll($,U)}return null}function xe($,F,U,de,Ce){if(typeof de=="string"&&de!==""||typeof de=="number")return $=$.get(U)||null,I(F,$,""+de,Ce);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case T:return $=$.get(de.key===null?U:de.key)||null,z(F,$,de,Ce);case N:return $=$.get(de.key===null?U:de.key)||null,q(F,$,de,Ce);case ne:var Ae=de._init;return xe($,F,U,Ae(de._payload),Ce)}if(be(de)||ce(de))return $=$.get(U)||null,ie(F,$,de,Ce,null);ll(F,de)}return null}function ke($,F,U,de){for(var Ce=null,Ae=null,Re=F,Me=F=0,Dt=null;Re!==null&&Me<U.length;Me++){Re.index>Me?(Dt=Re,Re=null):Dt=Re.sibling;var Ze=se($,Re,U[Me],de);if(Ze===null){Re===null&&(Re=Dt);break}i&&Re&&Ze.alternate===null&&l($,Re),F=_(Ze,F,Me),Ae===null?Ce=Ze:Ae.sibling=Ze,Ae=Ze,Re=Dt}if(Me===U.length)return d($,Re),ft&&as($,Me),Ce;if(Re===null){for(;Me<U.length;Me++)Re=oe($,U[Me],de),Re!==null&&(F=_(Re,F,Me),Ae===null?Ce=Re:Ae.sibling=Re,Ae=Re);return ft&&as($,Me),Ce}for(Re=m($,Re);Me<U.length;Me++)Dt=xe(Re,$,Me,U[Me],de),Dt!==null&&(i&&Dt.alternate!==null&&Re.delete(Dt.key===null?Me:Dt.key),F=_(Dt,F,Me),Ae===null?Ce=Dt:Ae.sibling=Dt,Ae=Dt);return i&&Re.forEach(function(Wr){return l($,Wr)}),ft&&as($,Me),Ce}function Ee($,F,U,de){var Ce=ce(U);if(typeof Ce!="function")throw Error(n(150));if(U=Ce.call(U),U==null)throw Error(n(151));for(var Ae=Ce=null,Re=F,Me=F=0,Dt=null,Ze=U.next();Re!==null&&!Ze.done;Me++,Ze=U.next()){Re.index>Me?(Dt=Re,Re=null):Dt=Re.sibling;var Wr=se($,Re,Ze.value,de);if(Wr===null){Re===null&&(Re=Dt);break}i&&Re&&Wr.alternate===null&&l($,Re),F=_(Wr,F,Me),Ae===null?Ce=Wr:Ae.sibling=Wr,Ae=Wr,Re=Dt}if(Ze.done)return d($,Re),ft&&as($,Me),Ce;if(Re===null){for(;!Ze.done;Me++,Ze=U.next())Ze=oe($,Ze.value,de),Ze!==null&&(F=_(Ze,F,Me),Ae===null?Ce=Ze:Ae.sibling=Ze,Ae=Ze);return ft&&as($,Me),Ce}for(Re=m($,Re);!Ze.done;Me++,Ze=U.next())Ze=xe(Re,$,Me,Ze.value,de),Ze!==null&&(i&&Ze.alternate!==null&&Re.delete(Ze.key===null?Me:Ze.key),F=_(Ze,F,Me),Ae===null?Ce=Ze:Ae.sibling=Ze,Ae=Ze);return i&&Re.forEach(function(XS){return l($,XS)}),ft&&as($,Me),Ce}function kt($,F,U,de){if(typeof U=="object"&&U!==null&&U.type===M&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case T:e:{for(var Ce=U.key,Ae=F;Ae!==null;){if(Ae.key===Ce){if(Ce=U.type,Ce===M){if(Ae.tag===7){d($,Ae.sibling),F=x(Ae,U.props.children),F.return=$,$=F;break e}}else if(Ae.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ne&&mg(Ce)===Ae.type){d($,Ae.sibling),F=x(Ae,U.props),F.ref=xo($,Ae,U),F.return=$,$=F;break e}d($,Ae);break}else l($,Ae);Ae=Ae.sibling}U.type===M?(F=ms(U.props.children,$.mode,de,U.key),F.return=$,$=F):(de=Pl(U.type,U.key,U.props,null,$.mode,de),de.ref=xo($,F,U),de.return=$,$=de)}return E($);case N:e:{for(Ae=U.key;F!==null;){if(F.key===Ae)if(F.tag===4&&F.stateNode.containerInfo===U.containerInfo&&F.stateNode.implementation===U.implementation){d($,F.sibling),F=x(F,U.children||[]),F.return=$,$=F;break e}else{d($,F);break}else l($,F);F=F.sibling}F=Id(U,$.mode,de),F.return=$,$=F}return E($);case ne:return Ae=U._init,kt($,F,Ae(U._payload),de)}if(be(U))return ke($,F,U,de);if(ce(U))return Ee($,F,U,de);ll($,U)}return typeof U=="string"&&U!==""||typeof U=="number"?(U=""+U,F!==null&&F.tag===6?(d($,F.sibling),F=x(F,U),F.return=$,$=F):(d($,F),F=Ld(U,$.mode,de),F.return=$,$=F),E($)):d($,F)}return kt}var ti=gg(!0),yg=gg(!1),cl=Dr(null),ul=null,ni=null,qu=null;function Hu(){qu=ni=ul=null}function Ku(i){var l=cl.current;dt(cl),i._currentValue=l}function Wu(i,l,d){for(;i!==null;){var m=i.alternate;if((i.childLanes&l)!==l?(i.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),i===d)break;i=i.return}}function ri(i,l){ul=i,qu=ni=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&l)!==0&&(un=!0),i.firstContext=null)}function Pn(i){var l=i._currentValue;if(qu!==i)if(i={context:i,memoizedValue:l,next:null},ni===null){if(ul===null)throw Error(n(308));ni=i,ul.dependencies={lanes:0,firstContext:i}}else ni=ni.next=i;return l}var ls=null;function Gu(i){ls===null?ls=[i]:ls.push(i)}function xg(i,l,d,m){var x=l.interleaved;return x===null?(d.next=d,Gu(l)):(d.next=x.next,x.next=d),l.interleaved=d,gr(i,m)}function gr(i,l){i.lanes|=l;var d=i.alternate;for(d!==null&&(d.lanes|=l),d=i,i=i.return;i!==null;)i.childLanes|=l,d=i.alternate,d!==null&&(d.childLanes|=l),d=i,i=i.return;return d.tag===3?d.stateNode:null}var Fr=!1;function Ju(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vg(i,l){i=i.updateQueue,l.updateQueue===i&&(l.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function yr(i,l){return{eventTime:i,lane:l,tag:0,payload:null,callback:null,next:null}}function $r(i,l,d){var m=i.updateQueue;if(m===null)return null;if(m=m.shared,(Ye&2)!==0){var x=m.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),m.pending=l,gr(i,d)}return x=m.interleaved,x===null?(l.next=l,Gu(m)):(l.next=x.next,x.next=l),m.interleaved=l,gr(i,d)}function dl(i,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194240)!==0)){var m=l.lanes;m&=i.pendingLanes,d|=m,l.lanes=d,cu(i,d)}}function _g(i,l){var d=i.updateQueue,m=i.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var x=null,_=null;if(d=d.firstBaseUpdate,d!==null){do{var E={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};_===null?x=_=E:_=_.next=E,d=d.next}while(d!==null);_===null?x=_=l:_=_.next=l}else x=_=l;d={baseState:m.baseState,firstBaseUpdate:x,lastBaseUpdate:_,shared:m.shared,effects:m.effects},i.updateQueue=d;return}i=d.lastBaseUpdate,i===null?d.firstBaseUpdate=l:i.next=l,d.lastBaseUpdate=l}function hl(i,l,d,m){var x=i.updateQueue;Fr=!1;var _=x.firstBaseUpdate,E=x.lastBaseUpdate,I=x.shared.pending;if(I!==null){x.shared.pending=null;var z=I,q=z.next;z.next=null,E===null?_=q:E.next=q,E=z;var ie=i.alternate;ie!==null&&(ie=ie.updateQueue,I=ie.lastBaseUpdate,I!==E&&(I===null?ie.firstBaseUpdate=q:I.next=q,ie.lastBaseUpdate=z))}if(_!==null){var oe=x.baseState;E=0,ie=q=z=null,I=_;do{var se=I.lane,xe=I.eventTime;if((m&se)===se){ie!==null&&(ie=ie.next={eventTime:xe,lane:0,tag:I.tag,payload:I.payload,callback:I.callback,next:null});e:{var ke=i,Ee=I;switch(se=l,xe=d,Ee.tag){case 1:if(ke=Ee.payload,typeof ke=="function"){oe=ke.call(xe,oe,se);break e}oe=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Ee.payload,se=typeof ke=="function"?ke.call(xe,oe,se):ke,se==null)break e;oe=A({},oe,se);break e;case 2:Fr=!0}}I.callback!==null&&I.lane!==0&&(i.flags|=64,se=x.effects,se===null?x.effects=[I]:se.push(I))}else xe={eventTime:xe,lane:se,tag:I.tag,payload:I.payload,callback:I.callback,next:null},ie===null?(q=ie=xe,z=oe):ie=ie.next=xe,E|=se;if(I=I.next,I===null){if(I=x.shared.pending,I===null)break;se=I,I=se.next,se.next=null,x.lastBaseUpdate=se,x.shared.pending=null}}while(!0);if(ie===null&&(z=oe),x.baseState=z,x.firstBaseUpdate=q,x.lastBaseUpdate=ie,l=x.shared.interleaved,l!==null){x=l;do E|=x.lane,x=x.next;while(x!==l)}else _===null&&(x.shared.lanes=0);ds|=E,i.lanes=E,i.memoizedState=oe}}function bg(i,l,d){if(i=l.effects,l.effects=null,i!==null)for(l=0;l<i.length;l++){var m=i[l],x=m.callback;if(x!==null){if(m.callback=null,m=d,typeof x!="function")throw Error(n(191,x));x.call(m)}}}var vo={},rr=Dr(vo),_o=Dr(vo),bo=Dr(vo);function cs(i){if(i===vo)throw Error(n(174));return i}function Xu(i,l){switch(at(bo,l),at(_o,i),at(rr,vo),i=l.nodeType,i){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:le(null,"");break;default:i=i===8?l.parentNode:l,l=i.namespaceURI||null,i=i.tagName,l=le(l,i)}dt(rr),at(rr,l)}function si(){dt(rr),dt(_o),dt(bo)}function wg(i){cs(bo.current);var l=cs(rr.current),d=le(l,i.type);l!==d&&(at(_o,i),at(rr,d))}function Yu(i){_o.current===i&&(dt(rr),dt(_o))}var pt=Dr(0);function fl(i){for(var l=i;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Qu=[];function Zu(){for(var i=0;i<Qu.length;i++)Qu[i]._workInProgressVersionPrimary=null;Qu.length=0}var pl=O.ReactCurrentDispatcher,ed=O.ReactCurrentBatchConfig,us=0,mt=null,Nt=null,Lt=null,ml=!1,wo=!1,ko=0,xS=0;function Ht(){throw Error(n(321))}function td(i,l){if(l===null)return!1;for(var d=0;d<l.length&&d<i.length;d++)if(!$n(i[d],l[d]))return!1;return!0}function nd(i,l,d,m,x,_){if(us=_,mt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,pl.current=i===null||i.memoizedState===null?wS:kS,i=d(m,x),wo){_=0;do{if(wo=!1,ko=0,25<=_)throw Error(n(301));_+=1,Lt=Nt=null,l.updateQueue=null,pl.current=SS,i=d(m,x)}while(wo)}if(pl.current=xl,l=Nt!==null&&Nt.next!==null,us=0,Lt=Nt=mt=null,ml=!1,l)throw Error(n(300));return i}function rd(){var i=ko!==0;return ko=0,i}function sr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lt===null?mt.memoizedState=Lt=i:Lt=Lt.next=i,Lt}function On(){if(Nt===null){var i=mt.alternate;i=i!==null?i.memoizedState:null}else i=Nt.next;var l=Lt===null?mt.memoizedState:Lt.next;if(l!==null)Lt=l,Nt=i;else{if(i===null)throw Error(n(310));Nt=i,i={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},Lt===null?mt.memoizedState=Lt=i:Lt=Lt.next=i}return Lt}function So(i,l){return typeof l=="function"?l(i):l}function sd(i){var l=On(),d=l.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=i;var m=Nt,x=m.baseQueue,_=d.pending;if(_!==null){if(x!==null){var E=x.next;x.next=_.next,_.next=E}m.baseQueue=x=_,d.pending=null}if(x!==null){_=x.next,m=m.baseState;var I=E=null,z=null,q=_;do{var ie=q.lane;if((us&ie)===ie)z!==null&&(z=z.next={lane:0,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null}),m=q.hasEagerState?q.eagerState:i(m,q.action);else{var oe={lane:ie,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null};z===null?(I=z=oe,E=m):z=z.next=oe,mt.lanes|=ie,ds|=ie}q=q.next}while(q!==null&&q!==_);z===null?E=m:z.next=I,$n(m,l.memoizedState)||(un=!0),l.memoizedState=m,l.baseState=E,l.baseQueue=z,d.lastRenderedState=m}if(i=d.interleaved,i!==null){x=i;do _=x.lane,mt.lanes|=_,ds|=_,x=x.next;while(x!==i)}else x===null&&(d.lanes=0);return[l.memoizedState,d.dispatch]}function id(i){var l=On(),d=l.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=i;var m=d.dispatch,x=d.pending,_=l.memoizedState;if(x!==null){d.pending=null;var E=x=x.next;do _=i(_,E.action),E=E.next;while(E!==x);$n(_,l.memoizedState)||(un=!0),l.memoizedState=_,l.baseQueue===null&&(l.baseState=_),d.lastRenderedState=_}return[_,m]}function kg(){}function Sg(i,l){var d=mt,m=On(),x=l(),_=!$n(m.memoizedState,x);if(_&&(m.memoizedState=x,un=!0),m=m.queue,od(Cg.bind(null,d,m,i),[i]),m.getSnapshot!==l||_||Lt!==null&&Lt.memoizedState.tag&1){if(d.flags|=2048,jo(9,Eg.bind(null,d,m,x,l),void 0,null),It===null)throw Error(n(349));(us&30)!==0||jg(d,l,x)}return x}function jg(i,l,d){i.flags|=16384,i={getSnapshot:l,value:d},l=mt.updateQueue,l===null?(l={lastEffect:null,stores:null},mt.updateQueue=l,l.stores=[i]):(d=l.stores,d===null?l.stores=[i]:d.push(i))}function Eg(i,l,d,m){l.value=d,l.getSnapshot=m,Tg(l)&&Ng(i)}function Cg(i,l,d){return d(function(){Tg(l)&&Ng(i)})}function Tg(i){var l=i.getSnapshot;i=i.value;try{var d=l();return!$n(i,d)}catch{return!0}}function Ng(i){var l=gr(i,1);l!==null&&Hn(l,i,1,-1)}function Ag(i){var l=sr();return typeof i=="function"&&(i=i()),l.memoizedState=l.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:So,lastRenderedState:i},l.queue=i,i=i.dispatch=bS.bind(null,mt,i),[l.memoizedState,i]}function jo(i,l,d,m){return i={tag:i,create:l,destroy:d,deps:m,next:null},l=mt.updateQueue,l===null?(l={lastEffect:null,stores:null},mt.updateQueue=l,l.lastEffect=i.next=i):(d=l.lastEffect,d===null?l.lastEffect=i.next=i:(m=d.next,d.next=i,i.next=m,l.lastEffect=i)),i}function Rg(){return On().memoizedState}function gl(i,l,d,m){var x=sr();mt.flags|=i,x.memoizedState=jo(1|l,d,void 0,m===void 0?null:m)}function yl(i,l,d,m){var x=On();m=m===void 0?null:m;var _=void 0;if(Nt!==null){var E=Nt.memoizedState;if(_=E.destroy,m!==null&&td(m,E.deps)){x.memoizedState=jo(l,d,_,m);return}}mt.flags|=i,x.memoizedState=jo(1|l,d,_,m)}function Pg(i,l){return gl(8390656,8,i,l)}function od(i,l){return yl(2048,8,i,l)}function Og(i,l){return yl(4,2,i,l)}function Lg(i,l){return yl(4,4,i,l)}function Ig(i,l){if(typeof l=="function")return i=i(),l(i),function(){l(null)};if(l!=null)return i=i(),l.current=i,function(){l.current=null}}function Dg(i,l,d){return d=d!=null?d.concat([i]):null,yl(4,4,Ig.bind(null,l,i),d)}function ad(){}function Mg(i,l){var d=On();l=l===void 0?null:l;var m=d.memoizedState;return m!==null&&l!==null&&td(l,m[1])?m[0]:(d.memoizedState=[i,l],i)}function zg(i,l){var d=On();l=l===void 0?null:l;var m=d.memoizedState;return m!==null&&l!==null&&td(l,m[1])?m[0]:(i=i(),d.memoizedState=[i,l],i)}function Fg(i,l,d){return(us&21)===0?(i.baseState&&(i.baseState=!1,un=!0),i.memoizedState=d):($n(d,l)||(d=mm(),mt.lanes|=d,ds|=d,i.baseState=!0),l)}function vS(i,l){var d=rt;rt=d!==0&&4>d?d:4,i(!0);var m=ed.transition;ed.transition={};try{i(!1),l()}finally{rt=d,ed.transition=m}}function $g(){return On().memoizedState}function _S(i,l,d){var m=qr(i);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Ug(i))Bg(l,d);else if(d=xg(i,l,d,m),d!==null){var x=nn();Hn(d,i,m,x),Vg(d,l,m)}}function bS(i,l,d){var m=qr(i),x={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Ug(i))Bg(l,x);else{var _=i.alternate;if(i.lanes===0&&(_===null||_.lanes===0)&&(_=l.lastRenderedReducer,_!==null))try{var E=l.lastRenderedState,I=_(E,d);if(x.hasEagerState=!0,x.eagerState=I,$n(I,E)){var z=l.interleaved;z===null?(x.next=x,Gu(l)):(x.next=z.next,z.next=x),l.interleaved=x;return}}catch{}d=xg(i,l,x,m),d!==null&&(x=nn(),Hn(d,i,m,x),Vg(d,l,m))}}function Ug(i){var l=i.alternate;return i===mt||l!==null&&l===mt}function Bg(i,l){wo=ml=!0;var d=i.pending;d===null?l.next=l:(l.next=d.next,d.next=l),i.pending=l}function Vg(i,l,d){if((d&4194240)!==0){var m=l.lanes;m&=i.pendingLanes,d|=m,l.lanes=d,cu(i,d)}}var xl={readContext:Pn,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},wS={readContext:Pn,useCallback:function(i,l){return sr().memoizedState=[i,l===void 0?null:l],i},useContext:Pn,useEffect:Pg,useImperativeHandle:function(i,l,d){return d=d!=null?d.concat([i]):null,gl(4194308,4,Ig.bind(null,l,i),d)},useLayoutEffect:function(i,l){return gl(4194308,4,i,l)},useInsertionEffect:function(i,l){return gl(4,2,i,l)},useMemo:function(i,l){var d=sr();return l=l===void 0?null:l,i=i(),d.memoizedState=[i,l],i},useReducer:function(i,l,d){var m=sr();return l=d!==void 0?d(l):l,m.memoizedState=m.baseState=l,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:l},m.queue=i,i=i.dispatch=_S.bind(null,mt,i),[m.memoizedState,i]},useRef:function(i){var l=sr();return i={current:i},l.memoizedState=i},useState:Ag,useDebugValue:ad,useDeferredValue:function(i){return sr().memoizedState=i},useTransition:function(){var i=Ag(!1),l=i[0];return i=vS.bind(null,i[1]),sr().memoizedState=i,[l,i]},useMutableSource:function(){},useSyncExternalStore:function(i,l,d){var m=mt,x=sr();if(ft){if(d===void 0)throw Error(n(407));d=d()}else{if(d=l(),It===null)throw Error(n(349));(us&30)!==0||jg(m,l,d)}x.memoizedState=d;var _={value:d,getSnapshot:l};return x.queue=_,Pg(Cg.bind(null,m,_,i),[i]),m.flags|=2048,jo(9,Eg.bind(null,m,_,d,l),void 0,null),d},useId:function(){var i=sr(),l=It.identifierPrefix;if(ft){var d=mr,m=pr;d=(m&~(1<<32-Fn(m)-1)).toString(32)+d,l=":"+l+"R"+d,d=ko++,0<d&&(l+="H"+d.toString(32)),l+=":"}else d=xS++,l=":"+l+"r"+d.toString(32)+":";return i.memoizedState=l},unstable_isNewReconciler:!1},kS={readContext:Pn,useCallback:Mg,useContext:Pn,useEffect:od,useImperativeHandle:Dg,useInsertionEffect:Og,useLayoutEffect:Lg,useMemo:zg,useReducer:sd,useRef:Rg,useState:function(){return sd(So)},useDebugValue:ad,useDeferredValue:function(i){var l=On();return Fg(l,Nt.memoizedState,i)},useTransition:function(){var i=sd(So)[0],l=On().memoizedState;return[i,l]},useMutableSource:kg,useSyncExternalStore:Sg,useId:$g,unstable_isNewReconciler:!1},SS={readContext:Pn,useCallback:Mg,useContext:Pn,useEffect:od,useImperativeHandle:Dg,useInsertionEffect:Og,useLayoutEffect:Lg,useMemo:zg,useReducer:id,useRef:Rg,useState:function(){return id(So)},useDebugValue:ad,useDeferredValue:function(i){var l=On();return Nt===null?l.memoizedState=i:Fg(l,Nt.memoizedState,i)},useTransition:function(){var i=id(So)[0],l=On().memoizedState;return[i,l]},useMutableSource:kg,useSyncExternalStore:Sg,useId:$g,unstable_isNewReconciler:!1};function Bn(i,l){if(i&&i.defaultProps){l=A({},l),i=i.defaultProps;for(var d in i)l[d]===void 0&&(l[d]=i[d]);return l}return l}function ld(i,l,d,m){l=i.memoizedState,d=d(m,l),d=d==null?l:A({},l,d),i.memoizedState=d,i.lanes===0&&(i.updateQueue.baseState=d)}var vl={isMounted:function(i){return(i=i._reactInternals)?rs(i)===i:!1},enqueueSetState:function(i,l,d){i=i._reactInternals;var m=nn(),x=qr(i),_=yr(m,x);_.payload=l,d!=null&&(_.callback=d),l=$r(i,_,x),l!==null&&(Hn(l,i,x,m),dl(l,i,x))},enqueueReplaceState:function(i,l,d){i=i._reactInternals;var m=nn(),x=qr(i),_=yr(m,x);_.tag=1,_.payload=l,d!=null&&(_.callback=d),l=$r(i,_,x),l!==null&&(Hn(l,i,x,m),dl(l,i,x))},enqueueForceUpdate:function(i,l){i=i._reactInternals;var d=nn(),m=qr(i),x=yr(d,m);x.tag=2,l!=null&&(x.callback=l),l=$r(i,x,m),l!==null&&(Hn(l,i,m,d),dl(l,i,m))}};function qg(i,l,d,m,x,_,E){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(m,_,E):l.prototype&&l.prototype.isPureReactComponent?!uo(d,m)||!uo(x,_):!0}function Hg(i,l,d){var m=!1,x=Mr,_=l.contextType;return typeof _=="object"&&_!==null?_=Pn(_):(x=cn(l)?is:qt.current,m=l.contextTypes,_=(m=m!=null)?Ys(i,x):Mr),l=new l(d,_),i.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=vl,i.stateNode=l,l._reactInternals=i,m&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=x,i.__reactInternalMemoizedMaskedChildContext=_),l}function Kg(i,l,d,m){i=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,m),l.state!==i&&vl.enqueueReplaceState(l,l.state,null)}function cd(i,l,d,m){var x=i.stateNode;x.props=d,x.state=i.memoizedState,x.refs={},Ju(i);var _=l.contextType;typeof _=="object"&&_!==null?x.context=Pn(_):(_=cn(l)?is:qt.current,x.context=Ys(i,_)),x.state=i.memoizedState,_=l.getDerivedStateFromProps,typeof _=="function"&&(ld(i,l,_,d),x.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(l=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),l!==x.state&&vl.enqueueReplaceState(x,x.state,null),hl(i,d,x,m),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308)}function ii(i,l){try{var d="",m=l;do d+=me(m),m=m.return;while(m);var x=d}catch(_){x=`
5
+ `+x[E].replace(" at new "," at ");return i.displayName&&z.includes("<anonymous>")&&(z=z.replace("<anonymous>",i.displayName)),z}while(1<=E&&0<=I);break}}}finally{P=!1,Error.prepareStackTrace=d}return(i=i?i.displayName||i.name:"")?G(i):""}function Ne(i){switch(i.tag){case 5:return G(i.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return i=ve(i.type,!1),i;case 11:return i=ve(i.type.render,!1),i;case 1:return i=ve(i.type,!0),i;default:return""}}function fe(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case M:return"Fragment";case N:return"Portal";case U:return"Profiler";case V:return"StrictMode";case he:return"Suspense";case K:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case Q:return(i.displayName||"Context")+".Consumer";case L:return(i._context.displayName||"Context")+".Provider";case Y:var l=i.render;return i=i.displayName,i||(i=l.displayName||l.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case W:return l=i.displayName||null,l!==null?l:fe(i.type)||"Memo";case ne:l=i._payload,i=i._init;try{return fe(i(l))}catch{}}return null}function Ae(i){var l=i.type;switch(i.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=l.render,i=i.displayName||i.name||"",l.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(l);case 8:return l===V?"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 l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function _e(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function me(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function tt(i){var l=me(i)?"checked":"value",d=Object.getOwnPropertyDescriptor(i.constructor.prototype,l),m=""+i[l];if(!i.hasOwnProperty(l)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var x=d.get,_=d.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return x.call(this)},set:function(E){m=""+E,_.call(this,E)}}),Object.defineProperty(i,l,{enumerable:d.enumerable}),{getValue:function(){return m},setValue:function(E){m=""+E},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function Ot(i){i._valueTracker||(i._valueTracker=tt(i))}function Zt(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var d=l.getValue(),m="";return i&&(m=me(i)?i.checked?"true":"false":i.value),i=m,i!==d?(l.setValue(i),!0):!1}function Rn(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function er(i,l){var d=l.checked;return A({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??i._wrapperState.initialChecked})}function ee(i,l){var d=l.defaultValue==null?"":l.defaultValue,m=l.checked!=null?l.checked:l.defaultChecked;d=_e(l.value!=null?l.value:d),i._wrapperState={initialChecked:m,initialValue:d,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function Me(i,l){l=l.checked,l!=null&&j(i,"checked",l,!1)}function te(i,l){Me(i,l);var d=_e(l.value),m=l.type;if(d!=null)m==="number"?(d===0&&i.value===""||i.value!=d)&&(i.value=""+d):i.value!==""+d&&(i.value=""+d);else if(m==="submit"||m==="reset"){i.removeAttribute("value");return}l.hasOwnProperty("value")?je(i,l.type,d):l.hasOwnProperty("defaultValue")&&je(i,l.type,_e(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(i.defaultChecked=!!l.defaultChecked)}function ge(i,l,d){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var m=l.type;if(!(m!=="submit"&&m!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+i._wrapperState.initialValue,d||l===i.value||(i.value=l),i.defaultValue=l}d=i.name,d!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,d!==""&&(i.name=d)}function je(i,l,d){(l!=="number"||Rn(i.ownerDocument)!==i)&&(d==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+d&&(i.defaultValue=""+d))}var be=Array.isArray;function $e(i,l,d,m){if(i=i.options,l){l={};for(var x=0;x<d.length;x++)l["$"+d[x]]=!0;for(d=0;d<i.length;d++)x=l.hasOwnProperty("$"+i[d].value),i[d].selected!==x&&(i[d].selected=x),x&&m&&(i[d].defaultSelected=!0)}else{for(d=""+_e(d),l=null,x=0;x<i.length;x++){if(i[x].value===d){i[x].selected=!0,m&&(i[x].defaultSelected=!0);return}l!==null||i[x].disabled||(l=i[x])}l!==null&&(l.selected=!0)}}function Se(i,l){if(l.dangerouslySetInnerHTML!=null)throw Error(n(91));return A({},l,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function Qe(i,l){var d=l.value;if(d==null){if(d=l.children,l=l.defaultValue,d!=null){if(l!=null)throw Error(n(92));if(be(d)){if(1<d.length)throw Error(n(93));d=d[0]}l=d}l==null&&(l=""),d=l}i._wrapperState={initialValue:_e(d)}}function nt(i,l){var d=_e(l.value),m=_e(l.defaultValue);d!=null&&(d=""+d,d!==i.value&&(i.value=d),l.defaultValue==null&&i.defaultValue!==d&&(i.defaultValue=d)),m!=null&&(i.defaultValue=""+m)}function rt(i){var l=i.textContent;l===i._wrapperState.initialValue&&l!==""&&l!==null&&(i.value=l)}function Z(i){switch(i){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 le(i,l){return i==null||i==="http://www.w3.org/1999/xhtml"?Z(l):i==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var we,Ue=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,d,m,x){MSApp.execUnsafeLocalFunction(function(){return i(l,d,m,x)})}:i})(function(i,l){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=l;else{for(we=we||document.createElement("div"),we.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=we.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;l.firstChild;)i.appendChild(l.firstChild)}});function qe(i,l){if(l){var d=i.firstChild;if(d&&d===i.lastChild&&d.nodeType===3){d.nodeValue=l;return}}i.textContent=l}var ot={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},Mt=["Webkit","ms","Moz","O"];Object.keys(ot).forEach(function(i){Mt.forEach(function(l){l=l+i.charAt(0).toUpperCase()+i.substring(1),ot[l]=ot[i]})});function St(i,l,d){return l==null||typeof l=="boolean"||l===""?"":d||typeof l!="number"||l===0||ot.hasOwnProperty(i)&&ot[i]?(""+l).trim():l+"px"}function an(i,l){i=i.style;for(var d in l)if(l.hasOwnProperty(d)){var m=d.indexOf("--")===0,x=St(d,l[d],m);d==="float"&&(d="cssFloat"),m?i.setProperty(d,x):i[d]=x}}var en=A({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 Ke(i,l){if(l){if(en[i]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(n(137,i));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(n(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(n(61))}if(l.style!=null&&typeof l.style!="object")throw Error(n(62))}}function ln(i,l){if(i.indexOf("-")===-1)return typeof l.is=="string";switch(i){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 tn=null;function tu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var nu=null,$s=null,Us=null;function tm(i){if(i=yo(i)){if(typeof nu!="function")throw Error(n(280));var l=i.stateNode;l&&(l=tl(l),nu(i.stateNode,i.type,l))}}function nm(i){$s?Us?Us.push(i):Us=[i]:$s=i}function rm(){if($s){var i=$s,l=Us;if(Us=$s=null,tm(i),l)for(i=0;i<l.length;i++)tm(l[i])}}function sm(i,l){return i(l)}function im(){}var ru=!1;function om(i,l,d){if(ru)return i(l,d);ru=!0;try{return sm(i,l,d)}finally{ru=!1,($s!==null||Us!==null)&&(im(),rm())}}function Ji(i,l){var d=i.stateNode;if(d===null)return null;var m=tl(d);if(m===null)return null;d=m[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(i=i.type,m=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!m;break e;default:i=!1}if(i)return null;if(d&&typeof d!="function")throw Error(n(231,l,typeof d));return d}var su=!1;if(c)try{var Xi={};Object.defineProperty(Xi,"passive",{get:function(){su=!0}}),window.addEventListener("test",Xi,Xi),window.removeEventListener("test",Xi,Xi)}catch{su=!1}function r1(i,l,d,m,x,_,E,I,z){var q=Array.prototype.slice.call(arguments,3);try{l.apply(d,q)}catch(ie){this.onError(ie)}}var Yi=!1,Oa=null,La=!1,iu=null,s1={onError:function(i){Yi=!0,Oa=i}};function i1(i,l,d,m,x,_,E,I,z){Yi=!1,Oa=null,r1.apply(s1,arguments)}function o1(i,l,d,m,x,_,E,I,z){if(i1.apply(this,arguments),Yi){if(Yi){var q=Oa;Yi=!1,Oa=null}else throw Error(n(198));La||(La=!0,iu=q)}}function rs(i){var l=i,d=i;if(i.alternate)for(;l.return;)l=l.return;else{i=l;do l=i,(l.flags&4098)!==0&&(d=l.return),i=l.return;while(i)}return l.tag===3?d:null}function am(i){if(i.tag===13){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function lm(i){if(rs(i)!==i)throw Error(n(188))}function a1(i){var l=i.alternate;if(!l){if(l=rs(i),l===null)throw Error(n(188));return l!==i?null:i}for(var d=i,m=l;;){var x=d.return;if(x===null)break;var _=x.alternate;if(_===null){if(m=x.return,m!==null){d=m;continue}break}if(x.child===_.child){for(_=x.child;_;){if(_===d)return lm(x),i;if(_===m)return lm(x),l;_=_.sibling}throw Error(n(188))}if(d.return!==m.return)d=x,m=_;else{for(var E=!1,I=x.child;I;){if(I===d){E=!0,d=x,m=_;break}if(I===m){E=!0,m=x,d=_;break}I=I.sibling}if(!E){for(I=_.child;I;){if(I===d){E=!0,d=_,m=x;break}if(I===m){E=!0,m=_,d=x;break}I=I.sibling}if(!E)throw Error(n(189))}}if(d.alternate!==m)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?i:l}function cm(i){return i=a1(i),i!==null?um(i):null}function um(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var l=um(i);if(l!==null)return l;i=i.sibling}return null}var dm=t.unstable_scheduleCallback,hm=t.unstable_cancelCallback,l1=t.unstable_shouldYield,c1=t.unstable_requestPaint,bt=t.unstable_now,u1=t.unstable_getCurrentPriorityLevel,ou=t.unstable_ImmediatePriority,fm=t.unstable_UserBlockingPriority,Ia=t.unstable_NormalPriority,d1=t.unstable_LowPriority,pm=t.unstable_IdlePriority,Da=null,tr=null;function h1(i){if(tr&&typeof tr.onCommitFiberRoot=="function")try{tr.onCommitFiberRoot(Da,i,void 0,(i.current.flags&128)===128)}catch{}}var Un=Math.clz32?Math.clz32:m1,f1=Math.log,p1=Math.LN2;function m1(i){return i>>>=0,i===0?32:31-(f1(i)/p1|0)|0}var Ma=64,za=4194304;function Qi(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function Fa(i,l){var d=i.pendingLanes;if(d===0)return 0;var m=0,x=i.suspendedLanes,_=i.pingedLanes,E=d&268435455;if(E!==0){var I=E&~x;I!==0?m=Qi(I):(_&=E,_!==0&&(m=Qi(_)))}else E=d&~x,E!==0?m=Qi(E):_!==0&&(m=Qi(_));if(m===0)return 0;if(l!==0&&l!==m&&(l&x)===0&&(x=m&-m,_=l&-l,x>=_||x===16&&(_&4194240)!==0))return l;if((m&4)!==0&&(m|=d&16),l=i.entangledLanes,l!==0)for(i=i.entanglements,l&=m;0<l;)d=31-Un(l),x=1<<d,m|=i[d],l&=~x;return m}function g1(i,l){switch(i){case 1:case 2:case 4:return l+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 l+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 y1(i,l){for(var d=i.suspendedLanes,m=i.pingedLanes,x=i.expirationTimes,_=i.pendingLanes;0<_;){var E=31-Un(_),I=1<<E,z=x[E];z===-1?((I&d)===0||(I&m)!==0)&&(x[E]=g1(I,l)):z<=l&&(i.expiredLanes|=I),_&=~I}}function au(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function mm(){var i=Ma;return Ma<<=1,(Ma&4194240)===0&&(Ma=64),i}function lu(i){for(var l=[],d=0;31>d;d++)l.push(i);return l}function Zi(i,l,d){i.pendingLanes|=l,l!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,l=31-Un(l),i[l]=d}function x1(i,l){var d=i.pendingLanes&~l;i.pendingLanes=l,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=l,i.mutableReadLanes&=l,i.entangledLanes&=l,l=i.entanglements;var m=i.eventTimes;for(i=i.expirationTimes;0<d;){var x=31-Un(d),_=1<<x;l[x]=0,m[x]=-1,i[x]=-1,d&=~_}}function cu(i,l){var d=i.entangledLanes|=l;for(i=i.entanglements;d;){var m=31-Un(d),x=1<<m;x&l|i[m]&l&&(i[m]|=l),d&=~x}}var st=0;function gm(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var ym,uu,xm,vm,_m,du=!1,$a=[],Nr=null,Ar=null,Rr=null,eo=new Map,to=new Map,Pr=[],v1="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 bm(i,l){switch(i){case"focusin":case"focusout":Nr=null;break;case"dragenter":case"dragleave":Ar=null;break;case"mouseover":case"mouseout":Rr=null;break;case"pointerover":case"pointerout":eo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":to.delete(l.pointerId)}}function no(i,l,d,m,x,_){return i===null||i.nativeEvent!==_?(i={blockedOn:l,domEventName:d,eventSystemFlags:m,nativeEvent:_,targetContainers:[x]},l!==null&&(l=yo(l),l!==null&&uu(l)),i):(i.eventSystemFlags|=m,l=i.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),i)}function _1(i,l,d,m,x){switch(l){case"focusin":return Nr=no(Nr,i,l,d,m,x),!0;case"dragenter":return Ar=no(Ar,i,l,d,m,x),!0;case"mouseover":return Rr=no(Rr,i,l,d,m,x),!0;case"pointerover":var _=x.pointerId;return eo.set(_,no(eo.get(_)||null,i,l,d,m,x)),!0;case"gotpointercapture":return _=x.pointerId,to.set(_,no(to.get(_)||null,i,l,d,m,x)),!0}return!1}function wm(i){var l=ss(i.target);if(l!==null){var d=rs(l);if(d!==null){if(l=d.tag,l===13){if(l=am(d),l!==null){i.blockedOn=l,_m(i.priority,function(){xm(d)});return}}else if(l===3&&d.stateNode.current.memoizedState.isDehydrated){i.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Ua(i){if(i.blockedOn!==null)return!1;for(var l=i.targetContainers;0<l.length;){var d=fu(i.domEventName,i.eventSystemFlags,l[0],i.nativeEvent);if(d===null){d=i.nativeEvent;var m=new d.constructor(d.type,d);tn=m,d.target.dispatchEvent(m),tn=null}else return l=yo(d),l!==null&&uu(l),i.blockedOn=d,!1;l.shift()}return!0}function km(i,l,d){Ua(i)&&d.delete(l)}function b1(){du=!1,Nr!==null&&Ua(Nr)&&(Nr=null),Ar!==null&&Ua(Ar)&&(Ar=null),Rr!==null&&Ua(Rr)&&(Rr=null),eo.forEach(km),to.forEach(km)}function ro(i,l){i.blockedOn===l&&(i.blockedOn=null,du||(du=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,b1)))}function so(i){function l(x){return ro(x,i)}if(0<$a.length){ro($a[0],i);for(var d=1;d<$a.length;d++){var m=$a[d];m.blockedOn===i&&(m.blockedOn=null)}}for(Nr!==null&&ro(Nr,i),Ar!==null&&ro(Ar,i),Rr!==null&&ro(Rr,i),eo.forEach(l),to.forEach(l),d=0;d<Pr.length;d++)m=Pr[d],m.blockedOn===i&&(m.blockedOn=null);for(;0<Pr.length&&(d=Pr[0],d.blockedOn===null);)wm(d),d.blockedOn===null&&Pr.shift()}var Bs=O.ReactCurrentBatchConfig,Ba=!0;function w1(i,l,d,m){var x=st,_=Bs.transition;Bs.transition=null;try{st=1,hu(i,l,d,m)}finally{st=x,Bs.transition=_}}function k1(i,l,d,m){var x=st,_=Bs.transition;Bs.transition=null;try{st=4,hu(i,l,d,m)}finally{st=x,Bs.transition=_}}function hu(i,l,d,m){if(Ba){var x=fu(i,l,d,m);if(x===null)Au(i,l,m,Va,d),bm(i,m);else if(_1(x,i,l,d,m))m.stopPropagation();else if(bm(i,m),l&4&&-1<v1.indexOf(i)){for(;x!==null;){var _=yo(x);if(_!==null&&ym(_),_=fu(i,l,d,m),_===null&&Au(i,l,m,Va,d),_===x)break;x=_}x!==null&&m.stopPropagation()}else Au(i,l,m,null,d)}}var Va=null;function fu(i,l,d,m){if(Va=null,i=tu(m),i=ss(i),i!==null)if(l=rs(i),l===null)i=null;else if(d=l.tag,d===13){if(i=am(l),i!==null)return i;i=null}else if(d===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;i=null}else l!==i&&(i=null);return Va=i,null}function Sm(i){switch(i){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(u1()){case ou:return 1;case fm:return 4;case Ia:case d1:return 16;case pm:return 536870912;default:return 16}default:return 16}}var Or=null,pu=null,qa=null;function jm(){if(qa)return qa;var i,l=pu,d=l.length,m,x="value"in Or?Or.value:Or.textContent,_=x.length;for(i=0;i<d&&l[i]===x[i];i++);var E=d-i;for(m=1;m<=E&&l[d-m]===x[_-m];m++);return qa=x.slice(i,1<m?1-m:void 0)}function Ha(i){var l=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&l===13&&(i=13)):i=l,i===10&&(i=13),32<=i||i===13?i:0}function Ka(){return!0}function Em(){return!1}function vn(i){function l(d,m,x,_,E){this._reactName=d,this._targetInst=x,this.type=m,this.nativeEvent=_,this.target=E,this.currentTarget=null;for(var I in i)i.hasOwnProperty(I)&&(d=i[I],this[I]=d?d(_):_[I]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Ka:Em,this.isPropagationStopped=Em,this}return A(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Ka)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Ka)},persist:function(){},isPersistent:Ka}),l}var Vs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mu=vn(Vs),io=A({},Vs,{view:0,detail:0}),S1=vn(io),gu,yu,oo,Wa=A({},io,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vu,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==oo&&(oo&&i.type==="mousemove"?(gu=i.screenX-oo.screenX,yu=i.screenY-oo.screenY):yu=gu=0,oo=i),gu)},movementY:function(i){return"movementY"in i?i.movementY:yu}}),Cm=vn(Wa),j1=A({},Wa,{dataTransfer:0}),E1=vn(j1),C1=A({},io,{relatedTarget:0}),xu=vn(C1),T1=A({},Vs,{animationName:0,elapsedTime:0,pseudoElement:0}),N1=vn(T1),A1=A({},Vs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),R1=vn(A1),P1=A({},Vs,{data:0}),Tm=vn(P1),O1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},L1={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"},I1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function D1(i){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(i):(i=I1[i])?!!l[i]:!1}function vu(){return D1}var M1=A({},io,{key:function(i){if(i.key){var l=O1[i.key]||i.key;if(l!=="Unidentified")return l}return i.type==="keypress"?(i=Ha(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?L1[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vu,charCode:function(i){return i.type==="keypress"?Ha(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ha(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),z1=vn(M1),F1=A({},Wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nm=vn(F1),$1=A({},io,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vu}),U1=vn($1),B1=A({},Vs,{propertyName:0,elapsedTime:0,pseudoElement:0}),V1=vn(B1),q1=A({},Wa,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),H1=vn(q1),K1=[9,13,27,32],_u=c&&"CompositionEvent"in window,ao=null;c&&"documentMode"in document&&(ao=document.documentMode);var W1=c&&"TextEvent"in window&&!ao,Am=c&&(!_u||ao&&8<ao&&11>=ao),Rm=" ",Pm=!1;function Om(i,l){switch(i){case"keyup":return K1.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lm(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var qs=!1;function G1(i,l){switch(i){case"compositionend":return Lm(l);case"keypress":return l.which!==32?null:(Pm=!0,Rm);case"textInput":return i=l.data,i===Rm&&Pm?null:i;default:return null}}function J1(i,l){if(qs)return i==="compositionend"||!_u&&Om(i,l)?(i=jm(),qa=pu=Or=null,qs=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Am&&l.locale!=="ko"?null:l.data;default:return null}}var X1={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 Im(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l==="input"?!!X1[i.type]:l==="textarea"}function Dm(i,l,d,m){nm(m),l=Qa(l,"onChange"),0<l.length&&(d=new mu("onChange","change",null,d,m),i.push({event:d,listeners:l}))}var lo=null,co=null;function Y1(i){eg(i,0)}function Ga(i){var l=Js(i);if(Zt(l))return i}function Q1(i,l){if(i==="change")return l}var Mm=!1;if(c){var bu;if(c){var wu="oninput"in document;if(!wu){var zm=document.createElement("div");zm.setAttribute("oninput","return;"),wu=typeof zm.oninput=="function"}bu=wu}else bu=!1;Mm=bu&&(!document.documentMode||9<document.documentMode)}function Fm(){lo&&(lo.detachEvent("onpropertychange",$m),co=lo=null)}function $m(i){if(i.propertyName==="value"&&Ga(co)){var l=[];Dm(l,co,i,tu(i)),om(Y1,l)}}function Z1(i,l,d){i==="focusin"?(Fm(),lo=l,co=d,lo.attachEvent("onpropertychange",$m)):i==="focusout"&&Fm()}function eS(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Ga(co)}function tS(i,l){if(i==="click")return Ga(l)}function nS(i,l){if(i==="input"||i==="change")return Ga(l)}function rS(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var Bn=typeof Object.is=="function"?Object.is:rS;function uo(i,l){if(Bn(i,l))return!0;if(typeof i!="object"||i===null||typeof l!="object"||l===null)return!1;var d=Object.keys(i),m=Object.keys(l);if(d.length!==m.length)return!1;for(m=0;m<d.length;m++){var x=d[m];if(!u.call(l,x)||!Bn(i[x],l[x]))return!1}return!0}function Um(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Bm(i,l){var d=Um(i);i=0;for(var m;d;){if(d.nodeType===3){if(m=i+d.textContent.length,i<=l&&m>=l)return{node:d,offset:l-i};i=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Um(d)}}function Vm(i,l){return i&&l?i===l?!0:i&&i.nodeType===3?!1:l&&l.nodeType===3?Vm(i,l.parentNode):"contains"in i?i.contains(l):i.compareDocumentPosition?!!(i.compareDocumentPosition(l)&16):!1:!1}function qm(){for(var i=window,l=Rn();l instanceof i.HTMLIFrameElement;){try{var d=typeof l.contentWindow.location.href=="string"}catch{d=!1}if(d)i=l.contentWindow;else break;l=Rn(i.document)}return l}function ku(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l&&(l==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||l==="textarea"||i.contentEditable==="true")}function sS(i){var l=qm(),d=i.focusedElem,m=i.selectionRange;if(l!==d&&d&&d.ownerDocument&&Vm(d.ownerDocument.documentElement,d)){if(m!==null&&ku(d)){if(l=m.start,i=m.end,i===void 0&&(i=l),"selectionStart"in d)d.selectionStart=l,d.selectionEnd=Math.min(i,d.value.length);else if(i=(l=d.ownerDocument||document)&&l.defaultView||window,i.getSelection){i=i.getSelection();var x=d.textContent.length,_=Math.min(m.start,x);m=m.end===void 0?_:Math.min(m.end,x),!i.extend&&_>m&&(x=m,m=_,_=x),x=Bm(d,_);var E=Bm(d,m);x&&E&&(i.rangeCount!==1||i.anchorNode!==x.node||i.anchorOffset!==x.offset||i.focusNode!==E.node||i.focusOffset!==E.offset)&&(l=l.createRange(),l.setStart(x.node,x.offset),i.removeAllRanges(),_>m?(i.addRange(l),i.extend(E.node,E.offset)):(l.setEnd(E.node,E.offset),i.addRange(l)))}}for(l=[],i=d;i=i.parentNode;)i.nodeType===1&&l.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<l.length;d++)i=l[d],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var iS=c&&"documentMode"in document&&11>=document.documentMode,Hs=null,Su=null,ho=null,ju=!1;function Hm(i,l,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;ju||Hs==null||Hs!==Rn(m)||(m=Hs,"selectionStart"in m&&ku(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),ho&&uo(ho,m)||(ho=m,m=Qa(Su,"onSelect"),0<m.length&&(l=new mu("onSelect","select",null,l,d),i.push({event:l,listeners:m}),l.target=Hs)))}function Ja(i,l){var d={};return d[i.toLowerCase()]=l.toLowerCase(),d["Webkit"+i]="webkit"+l,d["Moz"+i]="moz"+l,d}var Ks={animationend:Ja("Animation","AnimationEnd"),animationiteration:Ja("Animation","AnimationIteration"),animationstart:Ja("Animation","AnimationStart"),transitionend:Ja("Transition","TransitionEnd")},Eu={},Km={};c&&(Km=document.createElement("div").style,"AnimationEvent"in window||(delete Ks.animationend.animation,delete Ks.animationiteration.animation,delete Ks.animationstart.animation),"TransitionEvent"in window||delete Ks.transitionend.transition);function Xa(i){if(Eu[i])return Eu[i];if(!Ks[i])return i;var l=Ks[i],d;for(d in l)if(l.hasOwnProperty(d)&&d in Km)return Eu[i]=l[d];return i}var Wm=Xa("animationend"),Gm=Xa("animationiteration"),Jm=Xa("animationstart"),Xm=Xa("transitionend"),Ym=new Map,Qm="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(i,l){Ym.set(i,l),o(l,[i])}for(var Cu=0;Cu<Qm.length;Cu++){var Tu=Qm[Cu],oS=Tu.toLowerCase(),aS=Tu[0].toUpperCase()+Tu.slice(1);Lr(oS,"on"+aS)}Lr(Wm,"onAnimationEnd"),Lr(Gm,"onAnimationIteration"),Lr(Jm,"onAnimationStart"),Lr("dblclick","onDoubleClick"),Lr("focusin","onFocus"),Lr("focusout","onBlur"),Lr(Xm,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fo="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(" "),lS=new Set("cancel close invalid load scroll toggle".split(" ").concat(fo));function Zm(i,l,d){var m=i.type||"unknown-event";i.currentTarget=d,o1(m,l,void 0,i),i.currentTarget=null}function eg(i,l){l=(l&4)!==0;for(var d=0;d<i.length;d++){var m=i[d],x=m.event;m=m.listeners;e:{var _=void 0;if(l)for(var E=m.length-1;0<=E;E--){var I=m[E],z=I.instance,q=I.currentTarget;if(I=I.listener,z!==_&&x.isPropagationStopped())break e;Zm(x,I,q),_=z}else for(E=0;E<m.length;E++){if(I=m[E],z=I.instance,q=I.currentTarget,I=I.listener,z!==_&&x.isPropagationStopped())break e;Zm(x,I,q),_=z}}}if(La)throw i=iu,La=!1,iu=null,i}function ut(i,l){var d=l[Du];d===void 0&&(d=l[Du]=new Set);var m=i+"__bubble";d.has(m)||(tg(l,i,2,!1),d.add(m))}function Nu(i,l,d){var m=0;l&&(m|=4),tg(d,i,m,l)}var Ya="_reactListening"+Math.random().toString(36).slice(2);function po(i){if(!i[Ya]){i[Ya]=!0,r.forEach(function(d){d!=="selectionchange"&&(lS.has(d)||Nu(d,!1,i),Nu(d,!0,i))});var l=i.nodeType===9?i:i.ownerDocument;l===null||l[Ya]||(l[Ya]=!0,Nu("selectionchange",!1,l))}}function tg(i,l,d,m){switch(Sm(l)){case 1:var x=w1;break;case 4:x=k1;break;default:x=hu}d=x.bind(null,l,d,i),x=void 0,!su||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),m?x!==void 0?i.addEventListener(l,d,{capture:!0,passive:x}):i.addEventListener(l,d,!0):x!==void 0?i.addEventListener(l,d,{passive:x}):i.addEventListener(l,d,!1)}function Au(i,l,d,m,x){var _=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var E=m.tag;if(E===3||E===4){var I=m.stateNode.containerInfo;if(I===x||I.nodeType===8&&I.parentNode===x)break;if(E===4)for(E=m.return;E!==null;){var z=E.tag;if((z===3||z===4)&&(z=E.stateNode.containerInfo,z===x||z.nodeType===8&&z.parentNode===x))return;E=E.return}for(;I!==null;){if(E=ss(I),E===null)return;if(z=E.tag,z===5||z===6){m=_=E;continue e}I=I.parentNode}}m=m.return}om(function(){var q=_,ie=tu(d),oe=[];e:{var se=Ym.get(i);if(se!==void 0){var ye=mu,ke=i;switch(i){case"keypress":if(Ha(d)===0)break e;case"keydown":case"keyup":ye=z1;break;case"focusin":ke="focus",ye=xu;break;case"focusout":ke="blur",ye=xu;break;case"beforeblur":case"afterblur":ye=xu;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ye=Cm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ye=E1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ye=U1;break;case Wm:case Gm:case Jm:ye=N1;break;case Xm:ye=V1;break;case"scroll":ye=S1;break;case"wheel":ye=H1;break;case"copy":case"cut":case"paste":ye=R1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ye=Nm}var Ee=(l&4)!==0,wt=!Ee&&i==="scroll",$=Ee?se!==null?se+"Capture":null:se;Ee=[];for(var F=q,B;F!==null;){B=F;var de=B.stateNode;if(B.tag===5&&de!==null&&(B=de,$!==null&&(de=Ji(F,$),de!=null&&Ee.push(mo(F,de,B)))),wt)break;F=F.return}0<Ee.length&&(se=new ye(se,ke,null,d,ie),oe.push({event:se,listeners:Ee}))}}if((l&7)===0){e:{if(se=i==="mouseover"||i==="pointerover",ye=i==="mouseout"||i==="pointerout",se&&d!==tn&&(ke=d.relatedTarget||d.fromElement)&&(ss(ke)||ke[hr]))break e;if((ye||se)&&(se=ie.window===ie?ie:(se=ie.ownerDocument)?se.defaultView||se.parentWindow:window,ye?(ke=d.relatedTarget||d.toElement,ye=q,ke=ke?ss(ke):null,ke!==null&&(wt=rs(ke),ke!==wt||ke.tag!==5&&ke.tag!==6)&&(ke=null)):(ye=null,ke=q),ye!==ke)){if(Ee=Cm,de="onMouseLeave",$="onMouseEnter",F="mouse",(i==="pointerout"||i==="pointerover")&&(Ee=Nm,de="onPointerLeave",$="onPointerEnter",F="pointer"),wt=ye==null?se:Js(ye),B=ke==null?se:Js(ke),se=new Ee(de,F+"leave",ye,d,ie),se.target=wt,se.relatedTarget=B,de=null,ss(ie)===q&&(Ee=new Ee($,F+"enter",ke,d,ie),Ee.target=B,Ee.relatedTarget=wt,de=Ee),wt=de,ye&&ke)t:{for(Ee=ye,$=ke,F=0,B=Ee;B;B=Ws(B))F++;for(B=0,de=$;de;de=Ws(de))B++;for(;0<F-B;)Ee=Ws(Ee),F--;for(;0<B-F;)$=Ws($),B--;for(;F--;){if(Ee===$||$!==null&&Ee===$.alternate)break t;Ee=Ws(Ee),$=Ws($)}Ee=null}else Ee=null;ye!==null&&ng(oe,se,ye,Ee,!1),ke!==null&&wt!==null&&ng(oe,wt,ke,Ee,!0)}}e:{if(se=q?Js(q):window,ye=se.nodeName&&se.nodeName.toLowerCase(),ye==="select"||ye==="input"&&se.type==="file")var Ce=Q1;else if(Im(se))if(Mm)Ce=nS;else{Ce=eS;var Re=Z1}else(ye=se.nodeName)&&ye.toLowerCase()==="input"&&(se.type==="checkbox"||se.type==="radio")&&(Ce=tS);if(Ce&&(Ce=Ce(i,q))){Dm(oe,Ce,d,ie);break e}Re&&Re(i,se,q),i==="focusout"&&(Re=se._wrapperState)&&Re.controlled&&se.type==="number"&&je(se,"number",se.value)}switch(Re=q?Js(q):window,i){case"focusin":(Im(Re)||Re.contentEditable==="true")&&(Hs=Re,Su=q,ho=null);break;case"focusout":ho=Su=Hs=null;break;case"mousedown":ju=!0;break;case"contextmenu":case"mouseup":case"dragend":ju=!1,Hm(oe,d,ie);break;case"selectionchange":if(iS)break;case"keydown":case"keyup":Hm(oe,d,ie)}var Pe;if(_u)e:{switch(i){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else qs?Om(i,d)&&(ze="onCompositionEnd"):i==="keydown"&&d.keyCode===229&&(ze="onCompositionStart");ze&&(Am&&d.locale!=="ko"&&(qs||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&qs&&(Pe=jm()):(Or=ie,pu="value"in Or?Or.value:Or.textContent,qs=!0)),Re=Qa(q,ze),0<Re.length&&(ze=new Tm(ze,i,null,d,ie),oe.push({event:ze,listeners:Re}),Pe?ze.data=Pe:(Pe=Lm(d),Pe!==null&&(ze.data=Pe)))),(Pe=W1?G1(i,d):J1(i,d))&&(q=Qa(q,"onBeforeInput"),0<q.length&&(ie=new Tm("onBeforeInput","beforeinput",null,d,ie),oe.push({event:ie,listeners:q}),ie.data=Pe))}eg(oe,l)})}function mo(i,l,d){return{instance:i,listener:l,currentTarget:d}}function Qa(i,l){for(var d=l+"Capture",m=[];i!==null;){var x=i,_=x.stateNode;x.tag===5&&_!==null&&(x=_,_=Ji(i,d),_!=null&&m.unshift(mo(i,_,x)),_=Ji(i,l),_!=null&&m.push(mo(i,_,x))),i=i.return}return m}function Ws(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function ng(i,l,d,m,x){for(var _=l._reactName,E=[];d!==null&&d!==m;){var I=d,z=I.alternate,q=I.stateNode;if(z!==null&&z===m)break;I.tag===5&&q!==null&&(I=q,x?(z=Ji(d,_),z!=null&&E.unshift(mo(d,z,I))):x||(z=Ji(d,_),z!=null&&E.push(mo(d,z,I)))),d=d.return}E.length!==0&&i.push({event:l,listeners:E})}var cS=/\r\n?/g,uS=/\u0000|\uFFFD/g;function rg(i){return(typeof i=="string"?i:""+i).replace(cS,`
6
+ `).replace(uS,"")}function Za(i,l,d){if(l=rg(l),rg(i)!==l&&d)throw Error(n(425))}function el(){}var Ru=null,Pu=null;function Ou(i,l){return i==="textarea"||i==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Lu=typeof setTimeout=="function"?setTimeout:void 0,dS=typeof clearTimeout=="function"?clearTimeout:void 0,sg=typeof Promise=="function"?Promise:void 0,hS=typeof queueMicrotask=="function"?queueMicrotask:typeof sg<"u"?function(i){return sg.resolve(null).then(i).catch(fS)}:Lu;function fS(i){setTimeout(function(){throw i})}function Iu(i,l){var d=l,m=0;do{var x=d.nextSibling;if(i.removeChild(d),x&&x.nodeType===8)if(d=x.data,d==="/$"){if(m===0){i.removeChild(x),so(l);return}m--}else d!=="$"&&d!=="$?"&&d!=="$!"||m++;d=x}while(d);so(l)}function Ir(i){for(;i!=null;i=i.nextSibling){var l=i.nodeType;if(l===1||l===3)break;if(l===8){if(l=i.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return i}function ig(i){i=i.previousSibling;for(var l=0;i;){if(i.nodeType===8){var d=i.data;if(d==="$"||d==="$!"||d==="$?"){if(l===0)return i;l--}else d==="/$"&&l++}i=i.previousSibling}return null}var Gs=Math.random().toString(36).slice(2),nr="__reactFiber$"+Gs,go="__reactProps$"+Gs,hr="__reactContainer$"+Gs,Du="__reactEvents$"+Gs,pS="__reactListeners$"+Gs,mS="__reactHandles$"+Gs;function ss(i){var l=i[nr];if(l)return l;for(var d=i.parentNode;d;){if(l=d[hr]||d[nr]){if(d=l.alternate,l.child!==null||d!==null&&d.child!==null)for(i=ig(i);i!==null;){if(d=i[nr])return d;i=ig(i)}return l}i=d,d=i.parentNode}return null}function yo(i){return i=i[nr]||i[hr],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function Js(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(n(33))}function tl(i){return i[go]||null}var Mu=[],Xs=-1;function Dr(i){return{current:i}}function dt(i){0>Xs||(i.current=Mu[Xs],Mu[Xs]=null,Xs--)}function at(i,l){Xs++,Mu[Xs]=i.current,i.current=l}var Mr={},qt=Dr(Mr),cn=Dr(!1),is=Mr;function Ys(i,l){var d=i.type.contextTypes;if(!d)return Mr;var m=i.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===l)return m.__reactInternalMemoizedMaskedChildContext;var x={},_;for(_ in d)x[_]=l[_];return m&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=l,i.__reactInternalMemoizedMaskedChildContext=x),x}function un(i){return i=i.childContextTypes,i!=null}function nl(){dt(cn),dt(qt)}function og(i,l,d){if(qt.current!==Mr)throw Error(n(168));at(qt,l),at(cn,d)}function ag(i,l,d){var m=i.stateNode;if(l=l.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var x in m)if(!(x in l))throw Error(n(108,Ae(i)||"Unknown",x));return A({},d,m)}function rl(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Mr,is=qt.current,at(qt,i),at(cn,cn.current),!0}function lg(i,l,d){var m=i.stateNode;if(!m)throw Error(n(169));d?(i=ag(i,l,is),m.__reactInternalMemoizedMergedChildContext=i,dt(cn),dt(qt),at(qt,i)):dt(cn),at(cn,d)}var fr=null,sl=!1,zu=!1;function cg(i){fr===null?fr=[i]:fr.push(i)}function gS(i){sl=!0,cg(i)}function zr(){if(!zu&&fr!==null){zu=!0;var i=0,l=st;try{var d=fr;for(st=1;i<d.length;i++){var m=d[i];do m=m(!0);while(m!==null)}fr=null,sl=!1}catch(x){throw fr!==null&&(fr=fr.slice(i+1)),dm(ou,zr),x}finally{st=l,zu=!1}}return null}var Qs=[],Zs=0,il=null,ol=0,Pn=[],On=0,os=null,pr=1,mr="";function as(i,l){Qs[Zs++]=ol,Qs[Zs++]=il,il=i,ol=l}function ug(i,l,d){Pn[On++]=pr,Pn[On++]=mr,Pn[On++]=os,os=i;var m=pr;i=mr;var x=32-Un(m)-1;m&=~(1<<x),d+=1;var _=32-Un(l)+x;if(30<_){var E=x-x%5;_=(m&(1<<E)-1).toString(32),m>>=E,x-=E,pr=1<<32-Un(l)+x|d<<x|m,mr=_+i}else pr=1<<_|d<<x|m,mr=i}function Fu(i){i.return!==null&&(as(i,1),ug(i,1,0))}function $u(i){for(;i===il;)il=Qs[--Zs],Qs[Zs]=null,ol=Qs[--Zs],Qs[Zs]=null;for(;i===os;)os=Pn[--On],Pn[On]=null,mr=Pn[--On],Pn[On]=null,pr=Pn[--On],Pn[On]=null}var _n=null,bn=null,ft=!1,Vn=null;function dg(i,l){var d=Mn(5,null,null,0);d.elementType="DELETED",d.stateNode=l,d.return=i,l=i.deletions,l===null?(i.deletions=[d],i.flags|=16):l.push(d)}function hg(i,l){switch(i.tag){case 5:var d=i.type;return l=l.nodeType!==1||d.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(i.stateNode=l,_n=i,bn=Ir(l.firstChild),!0):!1;case 6:return l=i.pendingProps===""||l.nodeType!==3?null:l,l!==null?(i.stateNode=l,_n=i,bn=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(d=os!==null?{id:pr,overflow:mr}:null,i.memoizedState={dehydrated:l,treeContext:d,retryLane:1073741824},d=Mn(18,null,null,0),d.stateNode=l,d.return=i,i.child=d,_n=i,bn=null,!0):!1;default:return!1}}function Uu(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Bu(i){if(ft){var l=bn;if(l){var d=l;if(!hg(i,l)){if(Uu(i))throw Error(n(418));l=Ir(d.nextSibling);var m=_n;l&&hg(i,l)?dg(m,d):(i.flags=i.flags&-4097|2,ft=!1,_n=i)}}else{if(Uu(i))throw Error(n(418));i.flags=i.flags&-4097|2,ft=!1,_n=i}}}function fg(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;_n=i}function al(i){if(i!==_n)return!1;if(!ft)return fg(i),ft=!0,!1;var l;if((l=i.tag!==3)&&!(l=i.tag!==5)&&(l=i.type,l=l!=="head"&&l!=="body"&&!Ou(i.type,i.memoizedProps)),l&&(l=bn)){if(Uu(i))throw pg(),Error(n(418));for(;l;)dg(i,l),l=Ir(l.nextSibling)}if(fg(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));e:{for(i=i.nextSibling,l=0;i;){if(i.nodeType===8){var d=i.data;if(d==="/$"){if(l===0){bn=Ir(i.nextSibling);break e}l--}else d!=="$"&&d!=="$!"&&d!=="$?"||l++}i=i.nextSibling}bn=null}}else bn=_n?Ir(i.stateNode.nextSibling):null;return!0}function pg(){for(var i=bn;i;)i=Ir(i.nextSibling)}function ei(){bn=_n=null,ft=!1}function Vu(i){Vn===null?Vn=[i]:Vn.push(i)}var yS=O.ReactCurrentBatchConfig;function xo(i,l,d){if(i=d.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var m=d.stateNode}if(!m)throw Error(n(147,i));var x=m,_=""+i;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===_?l.ref:(l=function(E){var I=x.refs;E===null?delete I[_]:I[_]=E},l._stringRef=_,l)}if(typeof i!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,i))}return i}function ll(i,l){throw i=Object.prototype.toString.call(l),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":i))}function mg(i){var l=i._init;return l(i._payload)}function gg(i){function l($,F){if(i){var B=$.deletions;B===null?($.deletions=[F],$.flags|=16):B.push(F)}}function d($,F){if(!i)return null;for(;F!==null;)l($,F),F=F.sibling;return null}function m($,F){for($=new Map;F!==null;)F.key!==null?$.set(F.key,F):$.set(F.index,F),F=F.sibling;return $}function x($,F){return $=Kr($,F),$.index=0,$.sibling=null,$}function _($,F,B){return $.index=B,i?(B=$.alternate,B!==null?(B=B.index,B<F?($.flags|=2,F):B):($.flags|=2,F)):($.flags|=1048576,F)}function E($){return i&&$.alternate===null&&($.flags|=2),$}function I($,F,B,de){return F===null||F.tag!==6?(F=Ld(B,$.mode,de),F.return=$,F):(F=x(F,B),F.return=$,F)}function z($,F,B,de){var Ce=B.type;return Ce===M?ie($,F,B.props.children,de,B.key):F!==null&&(F.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ne&&mg(Ce)===F.type)?(de=x(F,B.props),de.ref=xo($,F,B),de.return=$,de):(de=Pl(B.type,B.key,B.props,null,$.mode,de),de.ref=xo($,F,B),de.return=$,de)}function q($,F,B,de){return F===null||F.tag!==4||F.stateNode.containerInfo!==B.containerInfo||F.stateNode.implementation!==B.implementation?(F=Id(B,$.mode,de),F.return=$,F):(F=x(F,B.children||[]),F.return=$,F)}function ie($,F,B,de,Ce){return F===null||F.tag!==7?(F=ms(B,$.mode,de,Ce),F.return=$,F):(F=x(F,B),F.return=$,F)}function oe($,F,B){if(typeof F=="string"&&F!==""||typeof F=="number")return F=Ld(""+F,$.mode,B),F.return=$,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case T:return B=Pl(F.type,F.key,F.props,null,$.mode,B),B.ref=xo($,null,F),B.return=$,B;case N:return F=Id(F,$.mode,B),F.return=$,F;case ne:var de=F._init;return oe($,de(F._payload),B)}if(be(F)||ce(F))return F=ms(F,$.mode,B,null),F.return=$,F;ll($,F)}return null}function se($,F,B,de){var Ce=F!==null?F.key:null;if(typeof B=="string"&&B!==""||typeof B=="number")return Ce!==null?null:I($,F,""+B,de);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case T:return B.key===Ce?z($,F,B,de):null;case N:return B.key===Ce?q($,F,B,de):null;case ne:return Ce=B._init,se($,F,Ce(B._payload),de)}if(be(B)||ce(B))return Ce!==null?null:ie($,F,B,de,null);ll($,B)}return null}function ye($,F,B,de,Ce){if(typeof de=="string"&&de!==""||typeof de=="number")return $=$.get(B)||null,I(F,$,""+de,Ce);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case T:return $=$.get(de.key===null?B:de.key)||null,z(F,$,de,Ce);case N:return $=$.get(de.key===null?B:de.key)||null,q(F,$,de,Ce);case ne:var Re=de._init;return ye($,F,B,Re(de._payload),Ce)}if(be(de)||ce(de))return $=$.get(B)||null,ie(F,$,de,Ce,null);ll(F,de)}return null}function ke($,F,B,de){for(var Ce=null,Re=null,Pe=F,ze=F=0,Dt=null;Pe!==null&&ze<B.length;ze++){Pe.index>ze?(Dt=Pe,Pe=null):Dt=Pe.sibling;var Ze=se($,Pe,B[ze],de);if(Ze===null){Pe===null&&(Pe=Dt);break}i&&Pe&&Ze.alternate===null&&l($,Pe),F=_(Ze,F,ze),Re===null?Ce=Ze:Re.sibling=Ze,Re=Ze,Pe=Dt}if(ze===B.length)return d($,Pe),ft&&as($,ze),Ce;if(Pe===null){for(;ze<B.length;ze++)Pe=oe($,B[ze],de),Pe!==null&&(F=_(Pe,F,ze),Re===null?Ce=Pe:Re.sibling=Pe,Re=Pe);return ft&&as($,ze),Ce}for(Pe=m($,Pe);ze<B.length;ze++)Dt=ye(Pe,$,ze,B[ze],de),Dt!==null&&(i&&Dt.alternate!==null&&Pe.delete(Dt.key===null?ze:Dt.key),F=_(Dt,F,ze),Re===null?Ce=Dt:Re.sibling=Dt,Re=Dt);return i&&Pe.forEach(function(Wr){return l($,Wr)}),ft&&as($,ze),Ce}function Ee($,F,B,de){var Ce=ce(B);if(typeof Ce!="function")throw Error(n(150));if(B=Ce.call(B),B==null)throw Error(n(151));for(var Re=Ce=null,Pe=F,ze=F=0,Dt=null,Ze=B.next();Pe!==null&&!Ze.done;ze++,Ze=B.next()){Pe.index>ze?(Dt=Pe,Pe=null):Dt=Pe.sibling;var Wr=se($,Pe,Ze.value,de);if(Wr===null){Pe===null&&(Pe=Dt);break}i&&Pe&&Wr.alternate===null&&l($,Pe),F=_(Wr,F,ze),Re===null?Ce=Wr:Re.sibling=Wr,Re=Wr,Pe=Dt}if(Ze.done)return d($,Pe),ft&&as($,ze),Ce;if(Pe===null){for(;!Ze.done;ze++,Ze=B.next())Ze=oe($,Ze.value,de),Ze!==null&&(F=_(Ze,F,ze),Re===null?Ce=Ze:Re.sibling=Ze,Re=Ze);return ft&&as($,ze),Ce}for(Pe=m($,Pe);!Ze.done;ze++,Ze=B.next())Ze=ye(Pe,$,ze,Ze.value,de),Ze!==null&&(i&&Ze.alternate!==null&&Pe.delete(Ze.key===null?ze:Ze.key),F=_(Ze,F,ze),Re===null?Ce=Ze:Re.sibling=Ze,Re=Ze);return i&&Pe.forEach(function(XS){return l($,XS)}),ft&&as($,ze),Ce}function wt($,F,B,de){if(typeof B=="object"&&B!==null&&B.type===M&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case T:e:{for(var Ce=B.key,Re=F;Re!==null;){if(Re.key===Ce){if(Ce=B.type,Ce===M){if(Re.tag===7){d($,Re.sibling),F=x(Re,B.props.children),F.return=$,$=F;break e}}else if(Re.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ne&&mg(Ce)===Re.type){d($,Re.sibling),F=x(Re,B.props),F.ref=xo($,Re,B),F.return=$,$=F;break e}d($,Re);break}else l($,Re);Re=Re.sibling}B.type===M?(F=ms(B.props.children,$.mode,de,B.key),F.return=$,$=F):(de=Pl(B.type,B.key,B.props,null,$.mode,de),de.ref=xo($,F,B),de.return=$,$=de)}return E($);case N:e:{for(Re=B.key;F!==null;){if(F.key===Re)if(F.tag===4&&F.stateNode.containerInfo===B.containerInfo&&F.stateNode.implementation===B.implementation){d($,F.sibling),F=x(F,B.children||[]),F.return=$,$=F;break e}else{d($,F);break}else l($,F);F=F.sibling}F=Id(B,$.mode,de),F.return=$,$=F}return E($);case ne:return Re=B._init,wt($,F,Re(B._payload),de)}if(be(B))return ke($,F,B,de);if(ce(B))return Ee($,F,B,de);ll($,B)}return typeof B=="string"&&B!==""||typeof B=="number"?(B=""+B,F!==null&&F.tag===6?(d($,F.sibling),F=x(F,B),F.return=$,$=F):(d($,F),F=Ld(B,$.mode,de),F.return=$,$=F),E($)):d($,F)}return wt}var ti=gg(!0),yg=gg(!1),cl=Dr(null),ul=null,ni=null,qu=null;function Hu(){qu=ni=ul=null}function Ku(i){var l=cl.current;dt(cl),i._currentValue=l}function Wu(i,l,d){for(;i!==null;){var m=i.alternate;if((i.childLanes&l)!==l?(i.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),i===d)break;i=i.return}}function ri(i,l){ul=i,qu=ni=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&l)!==0&&(dn=!0),i.firstContext=null)}function Ln(i){var l=i._currentValue;if(qu!==i)if(i={context:i,memoizedValue:l,next:null},ni===null){if(ul===null)throw Error(n(308));ni=i,ul.dependencies={lanes:0,firstContext:i}}else ni=ni.next=i;return l}var ls=null;function Gu(i){ls===null?ls=[i]:ls.push(i)}function xg(i,l,d,m){var x=l.interleaved;return x===null?(d.next=d,Gu(l)):(d.next=x.next,x.next=d),l.interleaved=d,gr(i,m)}function gr(i,l){i.lanes|=l;var d=i.alternate;for(d!==null&&(d.lanes|=l),d=i,i=i.return;i!==null;)i.childLanes|=l,d=i.alternate,d!==null&&(d.childLanes|=l),d=i,i=i.return;return d.tag===3?d.stateNode:null}var Fr=!1;function Ju(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vg(i,l){i=i.updateQueue,l.updateQueue===i&&(l.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function yr(i,l){return{eventTime:i,lane:l,tag:0,payload:null,callback:null,next:null}}function $r(i,l,d){var m=i.updateQueue;if(m===null)return null;if(m=m.shared,(Ye&2)!==0){var x=m.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),m.pending=l,gr(i,d)}return x=m.interleaved,x===null?(l.next=l,Gu(m)):(l.next=x.next,x.next=l),m.interleaved=l,gr(i,d)}function dl(i,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194240)!==0)){var m=l.lanes;m&=i.pendingLanes,d|=m,l.lanes=d,cu(i,d)}}function _g(i,l){var d=i.updateQueue,m=i.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var x=null,_=null;if(d=d.firstBaseUpdate,d!==null){do{var E={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};_===null?x=_=E:_=_.next=E,d=d.next}while(d!==null);_===null?x=_=l:_=_.next=l}else x=_=l;d={baseState:m.baseState,firstBaseUpdate:x,lastBaseUpdate:_,shared:m.shared,effects:m.effects},i.updateQueue=d;return}i=d.lastBaseUpdate,i===null?d.firstBaseUpdate=l:i.next=l,d.lastBaseUpdate=l}function hl(i,l,d,m){var x=i.updateQueue;Fr=!1;var _=x.firstBaseUpdate,E=x.lastBaseUpdate,I=x.shared.pending;if(I!==null){x.shared.pending=null;var z=I,q=z.next;z.next=null,E===null?_=q:E.next=q,E=z;var ie=i.alternate;ie!==null&&(ie=ie.updateQueue,I=ie.lastBaseUpdate,I!==E&&(I===null?ie.firstBaseUpdate=q:I.next=q,ie.lastBaseUpdate=z))}if(_!==null){var oe=x.baseState;E=0,ie=q=z=null,I=_;do{var se=I.lane,ye=I.eventTime;if((m&se)===se){ie!==null&&(ie=ie.next={eventTime:ye,lane:0,tag:I.tag,payload:I.payload,callback:I.callback,next:null});e:{var ke=i,Ee=I;switch(se=l,ye=d,Ee.tag){case 1:if(ke=Ee.payload,typeof ke=="function"){oe=ke.call(ye,oe,se);break e}oe=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Ee.payload,se=typeof ke=="function"?ke.call(ye,oe,se):ke,se==null)break e;oe=A({},oe,se);break e;case 2:Fr=!0}}I.callback!==null&&I.lane!==0&&(i.flags|=64,se=x.effects,se===null?x.effects=[I]:se.push(I))}else ye={eventTime:ye,lane:se,tag:I.tag,payload:I.payload,callback:I.callback,next:null},ie===null?(q=ie=ye,z=oe):ie=ie.next=ye,E|=se;if(I=I.next,I===null){if(I=x.shared.pending,I===null)break;se=I,I=se.next,se.next=null,x.lastBaseUpdate=se,x.shared.pending=null}}while(!0);if(ie===null&&(z=oe),x.baseState=z,x.firstBaseUpdate=q,x.lastBaseUpdate=ie,l=x.shared.interleaved,l!==null){x=l;do E|=x.lane,x=x.next;while(x!==l)}else _===null&&(x.shared.lanes=0);ds|=E,i.lanes=E,i.memoizedState=oe}}function bg(i,l,d){if(i=l.effects,l.effects=null,i!==null)for(l=0;l<i.length;l++){var m=i[l],x=m.callback;if(x!==null){if(m.callback=null,m=d,typeof x!="function")throw Error(n(191,x));x.call(m)}}}var vo={},rr=Dr(vo),_o=Dr(vo),bo=Dr(vo);function cs(i){if(i===vo)throw Error(n(174));return i}function Xu(i,l){switch(at(bo,l),at(_o,i),at(rr,vo),i=l.nodeType,i){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:le(null,"");break;default:i=i===8?l.parentNode:l,l=i.namespaceURI||null,i=i.tagName,l=le(l,i)}dt(rr),at(rr,l)}function si(){dt(rr),dt(_o),dt(bo)}function wg(i){cs(bo.current);var l=cs(rr.current),d=le(l,i.type);l!==d&&(at(_o,i),at(rr,d))}function Yu(i){_o.current===i&&(dt(rr),dt(_o))}var pt=Dr(0);function fl(i){for(var l=i;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Qu=[];function Zu(){for(var i=0;i<Qu.length;i++)Qu[i]._workInProgressVersionPrimary=null;Qu.length=0}var pl=O.ReactCurrentDispatcher,ed=O.ReactCurrentBatchConfig,us=0,mt=null,Tt=null,Lt=null,ml=!1,wo=!1,ko=0,xS=0;function Ht(){throw Error(n(321))}function td(i,l){if(l===null)return!1;for(var d=0;d<l.length&&d<i.length;d++)if(!Bn(i[d],l[d]))return!1;return!0}function nd(i,l,d,m,x,_){if(us=_,mt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,pl.current=i===null||i.memoizedState===null?wS:kS,i=d(m,x),wo){_=0;do{if(wo=!1,ko=0,25<=_)throw Error(n(301));_+=1,Lt=Tt=null,l.updateQueue=null,pl.current=SS,i=d(m,x)}while(wo)}if(pl.current=xl,l=Tt!==null&&Tt.next!==null,us=0,Lt=Tt=mt=null,ml=!1,l)throw Error(n(300));return i}function rd(){var i=ko!==0;return ko=0,i}function sr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lt===null?mt.memoizedState=Lt=i:Lt=Lt.next=i,Lt}function In(){if(Tt===null){var i=mt.alternate;i=i!==null?i.memoizedState:null}else i=Tt.next;var l=Lt===null?mt.memoizedState:Lt.next;if(l!==null)Lt=l,Tt=i;else{if(i===null)throw Error(n(310));Tt=i,i={memoizedState:Tt.memoizedState,baseState:Tt.baseState,baseQueue:Tt.baseQueue,queue:Tt.queue,next:null},Lt===null?mt.memoizedState=Lt=i:Lt=Lt.next=i}return Lt}function So(i,l){return typeof l=="function"?l(i):l}function sd(i){var l=In(),d=l.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=i;var m=Tt,x=m.baseQueue,_=d.pending;if(_!==null){if(x!==null){var E=x.next;x.next=_.next,_.next=E}m.baseQueue=x=_,d.pending=null}if(x!==null){_=x.next,m=m.baseState;var I=E=null,z=null,q=_;do{var ie=q.lane;if((us&ie)===ie)z!==null&&(z=z.next={lane:0,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null}),m=q.hasEagerState?q.eagerState:i(m,q.action);else{var oe={lane:ie,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null};z===null?(I=z=oe,E=m):z=z.next=oe,mt.lanes|=ie,ds|=ie}q=q.next}while(q!==null&&q!==_);z===null?E=m:z.next=I,Bn(m,l.memoizedState)||(dn=!0),l.memoizedState=m,l.baseState=E,l.baseQueue=z,d.lastRenderedState=m}if(i=d.interleaved,i!==null){x=i;do _=x.lane,mt.lanes|=_,ds|=_,x=x.next;while(x!==i)}else x===null&&(d.lanes=0);return[l.memoizedState,d.dispatch]}function id(i){var l=In(),d=l.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=i;var m=d.dispatch,x=d.pending,_=l.memoizedState;if(x!==null){d.pending=null;var E=x=x.next;do _=i(_,E.action),E=E.next;while(E!==x);Bn(_,l.memoizedState)||(dn=!0),l.memoizedState=_,l.baseQueue===null&&(l.baseState=_),d.lastRenderedState=_}return[_,m]}function kg(){}function Sg(i,l){var d=mt,m=In(),x=l(),_=!Bn(m.memoizedState,x);if(_&&(m.memoizedState=x,dn=!0),m=m.queue,od(Cg.bind(null,d,m,i),[i]),m.getSnapshot!==l||_||Lt!==null&&Lt.memoizedState.tag&1){if(d.flags|=2048,jo(9,Eg.bind(null,d,m,x,l),void 0,null),It===null)throw Error(n(349));(us&30)!==0||jg(d,l,x)}return x}function jg(i,l,d){i.flags|=16384,i={getSnapshot:l,value:d},l=mt.updateQueue,l===null?(l={lastEffect:null,stores:null},mt.updateQueue=l,l.stores=[i]):(d=l.stores,d===null?l.stores=[i]:d.push(i))}function Eg(i,l,d,m){l.value=d,l.getSnapshot=m,Tg(l)&&Ng(i)}function Cg(i,l,d){return d(function(){Tg(l)&&Ng(i)})}function Tg(i){var l=i.getSnapshot;i=i.value;try{var d=l();return!Bn(i,d)}catch{return!0}}function Ng(i){var l=gr(i,1);l!==null&&Wn(l,i,1,-1)}function Ag(i){var l=sr();return typeof i=="function"&&(i=i()),l.memoizedState=l.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:So,lastRenderedState:i},l.queue=i,i=i.dispatch=bS.bind(null,mt,i),[l.memoizedState,i]}function jo(i,l,d,m){return i={tag:i,create:l,destroy:d,deps:m,next:null},l=mt.updateQueue,l===null?(l={lastEffect:null,stores:null},mt.updateQueue=l,l.lastEffect=i.next=i):(d=l.lastEffect,d===null?l.lastEffect=i.next=i:(m=d.next,d.next=i,i.next=m,l.lastEffect=i)),i}function Rg(){return In().memoizedState}function gl(i,l,d,m){var x=sr();mt.flags|=i,x.memoizedState=jo(1|l,d,void 0,m===void 0?null:m)}function yl(i,l,d,m){var x=In();m=m===void 0?null:m;var _=void 0;if(Tt!==null){var E=Tt.memoizedState;if(_=E.destroy,m!==null&&td(m,E.deps)){x.memoizedState=jo(l,d,_,m);return}}mt.flags|=i,x.memoizedState=jo(1|l,d,_,m)}function Pg(i,l){return gl(8390656,8,i,l)}function od(i,l){return yl(2048,8,i,l)}function Og(i,l){return yl(4,2,i,l)}function Lg(i,l){return yl(4,4,i,l)}function Ig(i,l){if(typeof l=="function")return i=i(),l(i),function(){l(null)};if(l!=null)return i=i(),l.current=i,function(){l.current=null}}function Dg(i,l,d){return d=d!=null?d.concat([i]):null,yl(4,4,Ig.bind(null,l,i),d)}function ad(){}function Mg(i,l){var d=In();l=l===void 0?null:l;var m=d.memoizedState;return m!==null&&l!==null&&td(l,m[1])?m[0]:(d.memoizedState=[i,l],i)}function zg(i,l){var d=In();l=l===void 0?null:l;var m=d.memoizedState;return m!==null&&l!==null&&td(l,m[1])?m[0]:(i=i(),d.memoizedState=[i,l],i)}function Fg(i,l,d){return(us&21)===0?(i.baseState&&(i.baseState=!1,dn=!0),i.memoizedState=d):(Bn(d,l)||(d=mm(),mt.lanes|=d,ds|=d,i.baseState=!0),l)}function vS(i,l){var d=st;st=d!==0&&4>d?d:4,i(!0);var m=ed.transition;ed.transition={};try{i(!1),l()}finally{st=d,ed.transition=m}}function $g(){return In().memoizedState}function _S(i,l,d){var m=qr(i);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Ug(i))Bg(l,d);else if(d=xg(i,l,d,m),d!==null){var x=rn();Wn(d,i,m,x),Vg(d,l,m)}}function bS(i,l,d){var m=qr(i),x={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Ug(i))Bg(l,x);else{var _=i.alternate;if(i.lanes===0&&(_===null||_.lanes===0)&&(_=l.lastRenderedReducer,_!==null))try{var E=l.lastRenderedState,I=_(E,d);if(x.hasEagerState=!0,x.eagerState=I,Bn(I,E)){var z=l.interleaved;z===null?(x.next=x,Gu(l)):(x.next=z.next,z.next=x),l.interleaved=x;return}}catch{}d=xg(i,l,x,m),d!==null&&(x=rn(),Wn(d,i,m,x),Vg(d,l,m))}}function Ug(i){var l=i.alternate;return i===mt||l!==null&&l===mt}function Bg(i,l){wo=ml=!0;var d=i.pending;d===null?l.next=l:(l.next=d.next,d.next=l),i.pending=l}function Vg(i,l,d){if((d&4194240)!==0){var m=l.lanes;m&=i.pendingLanes,d|=m,l.lanes=d,cu(i,d)}}var xl={readContext:Ln,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},wS={readContext:Ln,useCallback:function(i,l){return sr().memoizedState=[i,l===void 0?null:l],i},useContext:Ln,useEffect:Pg,useImperativeHandle:function(i,l,d){return d=d!=null?d.concat([i]):null,gl(4194308,4,Ig.bind(null,l,i),d)},useLayoutEffect:function(i,l){return gl(4194308,4,i,l)},useInsertionEffect:function(i,l){return gl(4,2,i,l)},useMemo:function(i,l){var d=sr();return l=l===void 0?null:l,i=i(),d.memoizedState=[i,l],i},useReducer:function(i,l,d){var m=sr();return l=d!==void 0?d(l):l,m.memoizedState=m.baseState=l,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:l},m.queue=i,i=i.dispatch=_S.bind(null,mt,i),[m.memoizedState,i]},useRef:function(i){var l=sr();return i={current:i},l.memoizedState=i},useState:Ag,useDebugValue:ad,useDeferredValue:function(i){return sr().memoizedState=i},useTransition:function(){var i=Ag(!1),l=i[0];return i=vS.bind(null,i[1]),sr().memoizedState=i,[l,i]},useMutableSource:function(){},useSyncExternalStore:function(i,l,d){var m=mt,x=sr();if(ft){if(d===void 0)throw Error(n(407));d=d()}else{if(d=l(),It===null)throw Error(n(349));(us&30)!==0||jg(m,l,d)}x.memoizedState=d;var _={value:d,getSnapshot:l};return x.queue=_,Pg(Cg.bind(null,m,_,i),[i]),m.flags|=2048,jo(9,Eg.bind(null,m,_,d,l),void 0,null),d},useId:function(){var i=sr(),l=It.identifierPrefix;if(ft){var d=mr,m=pr;d=(m&~(1<<32-Un(m)-1)).toString(32)+d,l=":"+l+"R"+d,d=ko++,0<d&&(l+="H"+d.toString(32)),l+=":"}else d=xS++,l=":"+l+"r"+d.toString(32)+":";return i.memoizedState=l},unstable_isNewReconciler:!1},kS={readContext:Ln,useCallback:Mg,useContext:Ln,useEffect:od,useImperativeHandle:Dg,useInsertionEffect:Og,useLayoutEffect:Lg,useMemo:zg,useReducer:sd,useRef:Rg,useState:function(){return sd(So)},useDebugValue:ad,useDeferredValue:function(i){var l=In();return Fg(l,Tt.memoizedState,i)},useTransition:function(){var i=sd(So)[0],l=In().memoizedState;return[i,l]},useMutableSource:kg,useSyncExternalStore:Sg,useId:$g,unstable_isNewReconciler:!1},SS={readContext:Ln,useCallback:Mg,useContext:Ln,useEffect:od,useImperativeHandle:Dg,useInsertionEffect:Og,useLayoutEffect:Lg,useMemo:zg,useReducer:id,useRef:Rg,useState:function(){return id(So)},useDebugValue:ad,useDeferredValue:function(i){var l=In();return Tt===null?l.memoizedState=i:Fg(l,Tt.memoizedState,i)},useTransition:function(){var i=id(So)[0],l=In().memoizedState;return[i,l]},useMutableSource:kg,useSyncExternalStore:Sg,useId:$g,unstable_isNewReconciler:!1};function qn(i,l){if(i&&i.defaultProps){l=A({},l),i=i.defaultProps;for(var d in i)l[d]===void 0&&(l[d]=i[d]);return l}return l}function ld(i,l,d,m){l=i.memoizedState,d=d(m,l),d=d==null?l:A({},l,d),i.memoizedState=d,i.lanes===0&&(i.updateQueue.baseState=d)}var vl={isMounted:function(i){return(i=i._reactInternals)?rs(i)===i:!1},enqueueSetState:function(i,l,d){i=i._reactInternals;var m=rn(),x=qr(i),_=yr(m,x);_.payload=l,d!=null&&(_.callback=d),l=$r(i,_,x),l!==null&&(Wn(l,i,x,m),dl(l,i,x))},enqueueReplaceState:function(i,l,d){i=i._reactInternals;var m=rn(),x=qr(i),_=yr(m,x);_.tag=1,_.payload=l,d!=null&&(_.callback=d),l=$r(i,_,x),l!==null&&(Wn(l,i,x,m),dl(l,i,x))},enqueueForceUpdate:function(i,l){i=i._reactInternals;var d=rn(),m=qr(i),x=yr(d,m);x.tag=2,l!=null&&(x.callback=l),l=$r(i,x,m),l!==null&&(Wn(l,i,m,d),dl(l,i,m))}};function qg(i,l,d,m,x,_,E){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(m,_,E):l.prototype&&l.prototype.isPureReactComponent?!uo(d,m)||!uo(x,_):!0}function Hg(i,l,d){var m=!1,x=Mr,_=l.contextType;return typeof _=="object"&&_!==null?_=Ln(_):(x=un(l)?is:qt.current,m=l.contextTypes,_=(m=m!=null)?Ys(i,x):Mr),l=new l(d,_),i.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=vl,i.stateNode=l,l._reactInternals=i,m&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=x,i.__reactInternalMemoizedMaskedChildContext=_),l}function Kg(i,l,d,m){i=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,m),l.state!==i&&vl.enqueueReplaceState(l,l.state,null)}function cd(i,l,d,m){var x=i.stateNode;x.props=d,x.state=i.memoizedState,x.refs={},Ju(i);var _=l.contextType;typeof _=="object"&&_!==null?x.context=Ln(_):(_=un(l)?is:qt.current,x.context=Ys(i,_)),x.state=i.memoizedState,_=l.getDerivedStateFromProps,typeof _=="function"&&(ld(i,l,_,d),x.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(l=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),l!==x.state&&vl.enqueueReplaceState(x,x.state,null),hl(i,d,x,m),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308)}function ii(i,l){try{var d="",m=l;do d+=Ne(m),m=m.return;while(m);var x=d}catch(_){x=`
7
7
  Error generating stack: `+_.message+`
8
- `+_.stack}return{value:i,source:l,stack:x,digest:null}}function ud(i,l,d){return{value:i,source:null,stack:d??null,digest:l??null}}function dd(i,l){try{console.error(l.value)}catch(d){setTimeout(function(){throw d})}}var jS=typeof WeakMap=="function"?WeakMap:Map;function Wg(i,l,d){d=yr(-1,d),d.tag=3,d.payload={element:null};var m=l.value;return d.callback=function(){El||(El=!0,Ed=m),dd(i,l)},d}function Gg(i,l,d){d=yr(-1,d),d.tag=3;var m=i.type.getDerivedStateFromError;if(typeof m=="function"){var x=l.value;d.payload=function(){return m(x)},d.callback=function(){dd(i,l)}}var _=i.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(d.callback=function(){dd(i,l),typeof m!="function"&&(Br===null?Br=new Set([this]):Br.add(this));var E=l.stack;this.componentDidCatch(l.value,{componentStack:E!==null?E:""})}),d}function Jg(i,l,d){var m=i.pingCache;if(m===null){m=i.pingCache=new jS;var x=new Set;m.set(l,x)}else x=m.get(l),x===void 0&&(x=new Set,m.set(l,x));x.has(d)||(x.add(d),i=FS.bind(null,i,l,d),l.then(i,i))}function Xg(i){do{var l;if((l=i.tag===13)&&(l=i.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return i;i=i.return}while(i!==null);return null}function Yg(i,l,d,m,x){return(i.mode&1)===0?(i===l?i.flags|=65536:(i.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(l=yr(-1,1),l.tag=2,$r(d,l,1))),d.lanes|=1),i):(i.flags|=65536,i.lanes=x,i)}var ES=O.ReactCurrentOwner,un=!1;function tn(i,l,d,m){l.child=i===null?yg(l,null,d,m):ti(l,i.child,d,m)}function Qg(i,l,d,m,x){d=d.render;var _=l.ref;return ri(l,x),m=nd(i,l,d,m,_,x),d=rd(),i!==null&&!un?(l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~x,xr(i,l,x)):(ft&&d&&Fu(l),l.flags|=1,tn(i,l,m,x),l.child)}function Zg(i,l,d,m,x){if(i===null){var _=d.type;return typeof _=="function"&&!Od(_)&&_.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(l.tag=15,l.type=_,ey(i,l,_,m,x)):(i=Pl(d.type,null,m,l,l.mode,x),i.ref=l.ref,i.return=l,l.child=i)}if(_=i.child,(i.lanes&x)===0){var E=_.memoizedProps;if(d=d.compare,d=d!==null?d:uo,d(E,m)&&i.ref===l.ref)return xr(i,l,x)}return l.flags|=1,i=Kr(_,m),i.ref=l.ref,i.return=l,l.child=i}function ey(i,l,d,m,x){if(i!==null){var _=i.memoizedProps;if(uo(_,m)&&i.ref===l.ref)if(un=!1,l.pendingProps=m=_,(i.lanes&x)!==0)(i.flags&131072)!==0&&(un=!0);else return l.lanes=i.lanes,xr(i,l,x)}return hd(i,l,d,m,x)}function ty(i,l,d){var m=l.pendingProps,x=m.children,_=i!==null?i.memoizedState:null;if(m.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},at(ai,bn),bn|=d;else{if((d&1073741824)===0)return i=_!==null?_.baseLanes|d:d,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:i,cachePool:null,transitions:null},l.updateQueue=null,at(ai,bn),bn|=i,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=_!==null?_.baseLanes:d,at(ai,bn),bn|=m}else _!==null?(m=_.baseLanes|d,l.memoizedState=null):m=d,at(ai,bn),bn|=m;return tn(i,l,x,d),l.child}function ny(i,l){var d=l.ref;(i===null&&d!==null||i!==null&&i.ref!==d)&&(l.flags|=512,l.flags|=2097152)}function hd(i,l,d,m,x){var _=cn(d)?is:qt.current;return _=Ys(l,_),ri(l,x),d=nd(i,l,d,m,_,x),m=rd(),i!==null&&!un?(l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~x,xr(i,l,x)):(ft&&m&&Fu(l),l.flags|=1,tn(i,l,d,x),l.child)}function ry(i,l,d,m,x){if(cn(d)){var _=!0;rl(l)}else _=!1;if(ri(l,x),l.stateNode===null)bl(i,l),Hg(l,d,m),cd(l,d,m,x),m=!0;else if(i===null){var E=l.stateNode,I=l.memoizedProps;E.props=I;var z=E.context,q=d.contextType;typeof q=="object"&&q!==null?q=Pn(q):(q=cn(d)?is:qt.current,q=Ys(l,q));var ie=d.getDerivedStateFromProps,oe=typeof ie=="function"||typeof E.getSnapshotBeforeUpdate=="function";oe||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(I!==m||z!==q)&&Kg(l,E,m,q),Fr=!1;var se=l.memoizedState;E.state=se,hl(l,m,E,x),z=l.memoizedState,I!==m||se!==z||ln.current||Fr?(typeof ie=="function"&&(ld(l,d,ie,m),z=l.memoizedState),(I=Fr||qg(l,d,I,m,se,z,q))?(oe||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(l.flags|=4194308)):(typeof E.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=z),E.props=m,E.state=z,E.context=q,m=I):(typeof E.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{E=l.stateNode,vg(i,l),I=l.memoizedProps,q=l.type===l.elementType?I:Bn(l.type,I),E.props=q,oe=l.pendingProps,se=E.context,z=d.contextType,typeof z=="object"&&z!==null?z=Pn(z):(z=cn(d)?is:qt.current,z=Ys(l,z));var xe=d.getDerivedStateFromProps;(ie=typeof xe=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(I!==oe||se!==z)&&Kg(l,E,m,z),Fr=!1,se=l.memoizedState,E.state=se,hl(l,m,E,x);var ke=l.memoizedState;I!==oe||se!==ke||ln.current||Fr?(typeof xe=="function"&&(ld(l,d,xe,m),ke=l.memoizedState),(q=Fr||qg(l,d,q,m,se,ke,z)||!1)?(ie||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(m,ke,z),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(m,ke,z)),typeof E.componentDidUpdate=="function"&&(l.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof E.componentDidUpdate!="function"||I===i.memoizedProps&&se===i.memoizedState||(l.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||I===i.memoizedProps&&se===i.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=ke),E.props=m,E.state=ke,E.context=z,m=q):(typeof E.componentDidUpdate!="function"||I===i.memoizedProps&&se===i.memoizedState||(l.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||I===i.memoizedProps&&se===i.memoizedState||(l.flags|=1024),m=!1)}return fd(i,l,d,m,_,x)}function fd(i,l,d,m,x,_){ny(i,l);var E=(l.flags&128)!==0;if(!m&&!E)return x&&lg(l,d,!1),xr(i,l,_);m=l.stateNode,ES.current=l;var I=E&&typeof d.getDerivedStateFromError!="function"?null:m.render();return l.flags|=1,i!==null&&E?(l.child=ti(l,i.child,null,_),l.child=ti(l,null,I,_)):tn(i,l,I,_),l.memoizedState=m.state,x&&lg(l,d,!0),l.child}function sy(i){var l=i.stateNode;l.pendingContext?og(i,l.pendingContext,l.pendingContext!==l.context):l.context&&og(i,l.context,!1),Xu(i,l.containerInfo)}function iy(i,l,d,m,x){return ei(),Vu(x),l.flags|=256,tn(i,l,d,m),l.child}var pd={dehydrated:null,treeContext:null,retryLane:0};function md(i){return{baseLanes:i,cachePool:null,transitions:null}}function oy(i,l,d){var m=l.pendingProps,x=pt.current,_=!1,E=(l.flags&128)!==0,I;if((I=E)||(I=i!==null&&i.memoizedState===null?!1:(x&2)!==0),I?(_=!0,l.flags&=-129):(i===null||i.memoizedState!==null)&&(x|=1),at(pt,x&1),i===null)return Bu(l),i=l.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((l.mode&1)===0?l.lanes=1:i.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(E=m.children,i=m.fallback,_?(m=l.mode,_=l.child,E={mode:"hidden",children:E},(m&1)===0&&_!==null?(_.childLanes=0,_.pendingProps=E):_=Ol(E,m,0,null),i=ms(i,m,d,null),_.return=l,i.return=l,_.sibling=i,l.child=_,l.child.memoizedState=md(d),l.memoizedState=pd,i):gd(l,E));if(x=i.memoizedState,x!==null&&(I=x.dehydrated,I!==null))return CS(i,l,E,m,I,x,d);if(_){_=m.fallback,E=l.mode,x=i.child,I=x.sibling;var z={mode:"hidden",children:m.children};return(E&1)===0&&l.child!==x?(m=l.child,m.childLanes=0,m.pendingProps=z,l.deletions=null):(m=Kr(x,z),m.subtreeFlags=x.subtreeFlags&14680064),I!==null?_=Kr(I,_):(_=ms(_,E,d,null),_.flags|=2),_.return=l,m.return=l,m.sibling=_,l.child=m,m=_,_=l.child,E=i.child.memoizedState,E=E===null?md(d):{baseLanes:E.baseLanes|d,cachePool:null,transitions:E.transitions},_.memoizedState=E,_.childLanes=i.childLanes&~d,l.memoizedState=pd,m}return _=i.child,i=_.sibling,m=Kr(_,{mode:"visible",children:m.children}),(l.mode&1)===0&&(m.lanes=d),m.return=l,m.sibling=null,i!==null&&(d=l.deletions,d===null?(l.deletions=[i],l.flags|=16):d.push(i)),l.child=m,l.memoizedState=null,m}function gd(i,l){return l=Ol({mode:"visible",children:l},i.mode,0,null),l.return=i,i.child=l}function _l(i,l,d,m){return m!==null&&Vu(m),ti(l,i.child,null,d),i=gd(l,l.pendingProps.children),i.flags|=2,l.memoizedState=null,i}function CS(i,l,d,m,x,_,E){if(d)return l.flags&256?(l.flags&=-257,m=ud(Error(n(422))),_l(i,l,E,m)):l.memoizedState!==null?(l.child=i.child,l.flags|=128,null):(_=m.fallback,x=l.mode,m=Ol({mode:"visible",children:m.children},x,0,null),_=ms(_,x,E,null),_.flags|=2,m.return=l,_.return=l,m.sibling=_,l.child=m,(l.mode&1)!==0&&ti(l,i.child,null,E),l.child.memoizedState=md(E),l.memoizedState=pd,_);if((l.mode&1)===0)return _l(i,l,E,null);if(x.data==="$!"){if(m=x.nextSibling&&x.nextSibling.dataset,m)var I=m.dgst;return m=I,_=Error(n(419)),m=ud(_,m,void 0),_l(i,l,E,m)}if(I=(E&i.childLanes)!==0,un||I){if(m=It,m!==null){switch(E&-E){case 4:x=2;break;case 16:x=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:x=32;break;case 536870912:x=268435456;break;default:x=0}x=(x&(m.suspendedLanes|E))!==0?0:x,x!==0&&x!==_.retryLane&&(_.retryLane=x,gr(i,x),Hn(m,i,x,-1))}return Pd(),m=ud(Error(n(421))),_l(i,l,E,m)}return x.data==="$?"?(l.flags|=128,l.child=i.child,l=$S.bind(null,i),x._reactRetry=l,null):(i=_.treeContext,_n=Ir(x.nextSibling),vn=l,ft=!0,Un=null,i!==null&&(An[Rn++]=pr,An[Rn++]=mr,An[Rn++]=os,pr=i.id,mr=i.overflow,os=l),l=gd(l,m.children),l.flags|=4096,l)}function ay(i,l,d){i.lanes|=l;var m=i.alternate;m!==null&&(m.lanes|=l),Wu(i.return,l,d)}function yd(i,l,d,m,x){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:d,tailMode:x}:(_.isBackwards=l,_.rendering=null,_.renderingStartTime=0,_.last=m,_.tail=d,_.tailMode=x)}function ly(i,l,d){var m=l.pendingProps,x=m.revealOrder,_=m.tail;if(tn(i,l,m.children,d),m=pt.current,(m&2)!==0)m=m&1|2,l.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=l.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&ay(i,d,l);else if(i.tag===19)ay(i,d,l);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break e;for(;i.sibling===null;){if(i.return===null||i.return===l)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}m&=1}if(at(pt,m),(l.mode&1)===0)l.memoizedState=null;else switch(x){case"forwards":for(d=l.child,x=null;d!==null;)i=d.alternate,i!==null&&fl(i)===null&&(x=d),d=d.sibling;d=x,d===null?(x=l.child,l.child=null):(x=d.sibling,d.sibling=null),yd(l,!1,x,d,_);break;case"backwards":for(d=null,x=l.child,l.child=null;x!==null;){if(i=x.alternate,i!==null&&fl(i)===null){l.child=x;break}i=x.sibling,x.sibling=d,d=x,x=i}yd(l,!0,d,null,_);break;case"together":yd(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function bl(i,l){(l.mode&1)===0&&i!==null&&(i.alternate=null,l.alternate=null,l.flags|=2)}function xr(i,l,d){if(i!==null&&(l.dependencies=i.dependencies),ds|=l.lanes,(d&l.childLanes)===0)return null;if(i!==null&&l.child!==i.child)throw Error(n(153));if(l.child!==null){for(i=l.child,d=Kr(i,i.pendingProps),l.child=d,d.return=l;i.sibling!==null;)i=i.sibling,d=d.sibling=Kr(i,i.pendingProps),d.return=l;d.sibling=null}return l.child}function TS(i,l,d){switch(l.tag){case 3:sy(l),ei();break;case 5:wg(l);break;case 1:cn(l.type)&&rl(l);break;case 4:Xu(l,l.stateNode.containerInfo);break;case 10:var m=l.type._context,x=l.memoizedProps.value;at(cl,m._currentValue),m._currentValue=x;break;case 13:if(m=l.memoizedState,m!==null)return m.dehydrated!==null?(at(pt,pt.current&1),l.flags|=128,null):(d&l.child.childLanes)!==0?oy(i,l,d):(at(pt,pt.current&1),i=xr(i,l,d),i!==null?i.sibling:null);at(pt,pt.current&1);break;case 19:if(m=(d&l.childLanes)!==0,(i.flags&128)!==0){if(m)return ly(i,l,d);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),at(pt,pt.current),m)break;return null;case 22:case 23:return l.lanes=0,ty(i,l,d)}return xr(i,l,d)}var cy,xd,uy,dy;cy=function(i,l){for(var d=l.child;d!==null;){if(d.tag===5||d.tag===6)i.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},xd=function(){},uy=function(i,l,d,m){var x=i.memoizedProps;if(x!==m){i=l.stateNode,cs(rr.current);var _=null;switch(d){case"input":x=er(i,x),m=er(i,m),_=[];break;case"select":x=A({},x,{value:void 0}),m=A({},m,{value:void 0}),_=[];break;case"textarea":x=Se(i,x),m=Se(i,m),_=[];break;default:typeof x.onClick!="function"&&typeof m.onClick=="function"&&(i.onclick=el)}Ke(d,m);var E;d=null;for(q in x)if(!m.hasOwnProperty(q)&&x.hasOwnProperty(q)&&x[q]!=null)if(q==="style"){var I=x[q];for(E in I)I.hasOwnProperty(E)&&(d||(d={}),d[E]="")}else q!=="dangerouslySetInnerHTML"&&q!=="children"&&q!=="suppressContentEditableWarning"&&q!=="suppressHydrationWarning"&&q!=="autoFocus"&&(s.hasOwnProperty(q)?_||(_=[]):(_=_||[]).push(q,null));for(q in m){var z=m[q];if(I=x?.[q],m.hasOwnProperty(q)&&z!==I&&(z!=null||I!=null))if(q==="style")if(I){for(E in I)!I.hasOwnProperty(E)||z&&z.hasOwnProperty(E)||(d||(d={}),d[E]="");for(E in z)z.hasOwnProperty(E)&&I[E]!==z[E]&&(d||(d={}),d[E]=z[E])}else d||(_||(_=[]),_.push(q,d)),d=z;else q==="dangerouslySetInnerHTML"?(z=z?z.__html:void 0,I=I?I.__html:void 0,z!=null&&I!==z&&(_=_||[]).push(q,z)):q==="children"?typeof z!="string"&&typeof z!="number"||(_=_||[]).push(q,""+z):q!=="suppressContentEditableWarning"&&q!=="suppressHydrationWarning"&&(s.hasOwnProperty(q)?(z!=null&&q==="onScroll"&&ut("scroll",i),_||I===z||(_=[])):(_=_||[]).push(q,z))}d&&(_=_||[]).push("style",d);var q=_;(l.updateQueue=q)&&(l.flags|=4)}},dy=function(i,l,d,m){d!==m&&(l.flags|=4)};function Eo(i,l){if(!ft)switch(i.tailMode){case"hidden":l=i.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?i.tail=null:d.sibling=null;break;case"collapsed":d=i.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?l||i.tail===null?i.tail=null:i.tail.sibling=null:m.sibling=null}}function Kt(i){var l=i.alternate!==null&&i.alternate.child===i.child,d=0,m=0;if(l)for(var x=i.child;x!==null;)d|=x.lanes|x.childLanes,m|=x.subtreeFlags&14680064,m|=x.flags&14680064,x.return=i,x=x.sibling;else for(x=i.child;x!==null;)d|=x.lanes|x.childLanes,m|=x.subtreeFlags,m|=x.flags,x.return=i,x=x.sibling;return i.subtreeFlags|=m,i.childLanes=d,l}function NS(i,l,d){var m=l.pendingProps;switch($u(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(l),null;case 1:return cn(l.type)&&nl(),Kt(l),null;case 3:return m=l.stateNode,si(),dt(ln),dt(qt),Zu(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(i===null||i.child===null)&&(al(l)?l.flags|=4:i===null||i.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Un!==null&&(Nd(Un),Un=null))),xd(i,l),Kt(l),null;case 5:Yu(l);var x=cs(bo.current);if(d=l.type,i!==null&&l.stateNode!=null)uy(i,l,d,m,x),i.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!m){if(l.stateNode===null)throw Error(n(166));return Kt(l),null}if(i=cs(rr.current),al(l)){m=l.stateNode,d=l.type;var _=l.memoizedProps;switch(m[nr]=l,m[go]=_,i=(l.mode&1)!==0,d){case"dialog":ut("cancel",m),ut("close",m);break;case"iframe":case"object":case"embed":ut("load",m);break;case"video":case"audio":for(x=0;x<fo.length;x++)ut(fo[x],m);break;case"source":ut("error",m);break;case"img":case"image":case"link":ut("error",m),ut("load",m);break;case"details":ut("toggle",m);break;case"input":ee(m,_),ut("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!_.multiple},ut("invalid",m);break;case"textarea":Qe(m,_),ut("invalid",m)}Ke(d,_),x=null;for(var E in _)if(_.hasOwnProperty(E)){var I=_[E];E==="children"?typeof I=="string"?m.textContent!==I&&(_.suppressHydrationWarning!==!0&&Za(m.textContent,I,i),x=["children",I]):typeof I=="number"&&m.textContent!==""+I&&(_.suppressHydrationWarning!==!0&&Za(m.textContent,I,i),x=["children",""+I]):s.hasOwnProperty(E)&&I!=null&&E==="onScroll"&&ut("scroll",m)}switch(d){case"input":bt(m),ge(m,_,!0);break;case"textarea":bt(m),nt(m);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(m.onclick=el)}m=x,l.updateQueue=m,m!==null&&(l.flags|=4)}else{E=x.nodeType===9?x:x.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Z(d)),i==="http://www.w3.org/1999/xhtml"?d==="script"?(i=E.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof m.is=="string"?i=E.createElement(d,{is:m.is}):(i=E.createElement(d),d==="select"&&(E=i,m.multiple?E.multiple=!0:m.size&&(E.size=m.size))):i=E.createElementNS(i,d),i[nr]=l,i[go]=m,cy(i,l,!1,!1),l.stateNode=i;e:{switch(E=an(d,m),d){case"dialog":ut("cancel",i),ut("close",i),x=m;break;case"iframe":case"object":case"embed":ut("load",i),x=m;break;case"video":case"audio":for(x=0;x<fo.length;x++)ut(fo[x],i);x=m;break;case"source":ut("error",i),x=m;break;case"img":case"image":case"link":ut("error",i),ut("load",i),x=m;break;case"details":ut("toggle",i),x=m;break;case"input":ee(i,m),x=er(i,m),ut("invalid",i);break;case"option":x=m;break;case"select":i._wrapperState={wasMultiple:!!m.multiple},x=A({},m,{value:void 0}),ut("invalid",i);break;case"textarea":Qe(i,m),x=Se(i,m),ut("invalid",i);break;default:x=m}Ke(d,x),I=x;for(_ in I)if(I.hasOwnProperty(_)){var z=I[_];_==="style"?on(i,z):_==="dangerouslySetInnerHTML"?(z=z?z.__html:void 0,z!=null&&$e(i,z)):_==="children"?typeof z=="string"?(d!=="textarea"||z!=="")&&qe(i,z):typeof z=="number"&&qe(i,""+z):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(s.hasOwnProperty(_)?z!=null&&_==="onScroll"&&ut("scroll",i):z!=null&&j(i,_,z,E))}switch(d){case"input":bt(i),ge(i,m,!1);break;case"textarea":bt(i),nt(i);break;case"option":m.value!=null&&i.setAttribute("value",""+pe(m.value));break;case"select":i.multiple=!!m.multiple,_=m.value,_!=null?Fe(i,!!m.multiple,_,!1):m.defaultValue!=null&&Fe(i,!!m.multiple,m.defaultValue,!0);break;default:typeof x.onClick=="function"&&(i.onclick=el)}switch(d){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Kt(l),null;case 6:if(i&&l.stateNode!=null)dy(i,l,i.memoizedProps,m);else{if(typeof m!="string"&&l.stateNode===null)throw Error(n(166));if(d=cs(bo.current),cs(rr.current),al(l)){if(m=l.stateNode,d=l.memoizedProps,m[nr]=l,(_=m.nodeValue!==d)&&(i=vn,i!==null))switch(i.tag){case 3:Za(m.nodeValue,d,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&Za(m.nodeValue,d,(i.mode&1)!==0)}_&&(l.flags|=4)}else m=(d.nodeType===9?d:d.ownerDocument).createTextNode(m),m[nr]=l,l.stateNode=m}return Kt(l),null;case 13:if(dt(pt),m=l.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(ft&&_n!==null&&(l.mode&1)!==0&&(l.flags&128)===0)pg(),ei(),l.flags|=98560,_=!1;else if(_=al(l),m!==null&&m.dehydrated!==null){if(i===null){if(!_)throw Error(n(318));if(_=l.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));_[nr]=l}else ei(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Kt(l),_=!1}else Un!==null&&(Nd(Un),Un=null),_=!0;if(!_)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=d,l):(m=m!==null,m!==(i!==null&&i.memoizedState!==null)&&m&&(l.child.flags|=8192,(l.mode&1)!==0&&(i===null||(pt.current&1)!==0?At===0&&(At=3):Pd())),l.updateQueue!==null&&(l.flags|=4),Kt(l),null);case 4:return si(),xd(i,l),i===null&&po(l.stateNode.containerInfo),Kt(l),null;case 10:return Ku(l.type._context),Kt(l),null;case 17:return cn(l.type)&&nl(),Kt(l),null;case 19:if(dt(pt),_=l.memoizedState,_===null)return Kt(l),null;if(m=(l.flags&128)!==0,E=_.rendering,E===null)if(m)Eo(_,!1);else{if(At!==0||i!==null&&(i.flags&128)!==0)for(i=l.child;i!==null;){if(E=fl(i),E!==null){for(l.flags|=128,Eo(_,!1),m=E.updateQueue,m!==null&&(l.updateQueue=m,l.flags|=4),l.subtreeFlags=0,m=d,d=l.child;d!==null;)_=d,i=m,_.flags&=14680066,E=_.alternate,E===null?(_.childLanes=0,_.lanes=i,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=E.childLanes,_.lanes=E.lanes,_.child=E.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=E.memoizedProps,_.memoizedState=E.memoizedState,_.updateQueue=E.updateQueue,_.type=E.type,i=E.dependencies,_.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),d=d.sibling;return at(pt,pt.current&1|2),l.child}i=i.sibling}_.tail!==null&&wt()>li&&(l.flags|=128,m=!0,Eo(_,!1),l.lanes=4194304)}else{if(!m)if(i=fl(E),i!==null){if(l.flags|=128,m=!0,d=i.updateQueue,d!==null&&(l.updateQueue=d,l.flags|=4),Eo(_,!0),_.tail===null&&_.tailMode==="hidden"&&!E.alternate&&!ft)return Kt(l),null}else 2*wt()-_.renderingStartTime>li&&d!==1073741824&&(l.flags|=128,m=!0,Eo(_,!1),l.lanes=4194304);_.isBackwards?(E.sibling=l.child,l.child=E):(d=_.last,d!==null?d.sibling=E:l.child=E,_.last=E)}return _.tail!==null?(l=_.tail,_.rendering=l,_.tail=l.sibling,_.renderingStartTime=wt(),l.sibling=null,d=pt.current,at(pt,m?d&1|2:d&1),l):(Kt(l),null);case 22:case 23:return Rd(),m=l.memoizedState!==null,i!==null&&i.memoizedState!==null!==m&&(l.flags|=8192),m&&(l.mode&1)!==0?(bn&1073741824)!==0&&(Kt(l),l.subtreeFlags&6&&(l.flags|=8192)):Kt(l),null;case 24:return null;case 25:return null}throw Error(n(156,l.tag))}function AS(i,l){switch($u(l),l.tag){case 1:return cn(l.type)&&nl(),i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 3:return si(),dt(ln),dt(qt),Zu(),i=l.flags,(i&65536)!==0&&(i&128)===0?(l.flags=i&-65537|128,l):null;case 5:return Yu(l),null;case 13:if(dt(pt),i=l.memoizedState,i!==null&&i.dehydrated!==null){if(l.alternate===null)throw Error(n(340));ei()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 19:return dt(pt),null;case 4:return si(),null;case 10:return Ku(l.type._context),null;case 22:case 23:return Rd(),null;case 24:return null;default:return null}}var wl=!1,Wt=!1,RS=typeof WeakSet=="function"?WeakSet:Set,ve=null;function oi(i,l){var d=i.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){xt(i,l,m)}else d.current=null}function vd(i,l,d){try{d()}catch(m){xt(i,l,m)}}var hy=!1;function PS(i,l){if(Ru=Ba,i=qm(),ku(i)){if("selectionStart"in i)var d={start:i.selectionStart,end:i.selectionEnd};else e:{d=(d=i.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var x=m.anchorOffset,_=m.focusNode;m=m.focusOffset;try{d.nodeType,_.nodeType}catch{d=null;break e}var E=0,I=-1,z=-1,q=0,ie=0,oe=i,se=null;t:for(;;){for(var xe;oe!==d||x!==0&&oe.nodeType!==3||(I=E+x),oe!==_||m!==0&&oe.nodeType!==3||(z=E+m),oe.nodeType===3&&(E+=oe.nodeValue.length),(xe=oe.firstChild)!==null;)se=oe,oe=xe;for(;;){if(oe===i)break t;if(se===d&&++q===x&&(I=E),se===_&&++ie===m&&(z=E),(xe=oe.nextSibling)!==null)break;oe=se,se=oe.parentNode}oe=xe}d=I===-1||z===-1?null:{start:I,end:z}}else d=null}d=d||{start:0,end:0}}else d=null;for(Pu={focusedElem:i,selectionRange:d},Ba=!1,ve=l;ve!==null;)if(l=ve,i=l.child,(l.subtreeFlags&1028)!==0&&i!==null)i.return=l,ve=i;else for(;ve!==null;){l=ve;try{var ke=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(ke!==null){var Ee=ke.memoizedProps,kt=ke.memoizedState,$=l.stateNode,F=$.getSnapshotBeforeUpdate(l.elementType===l.type?Ee:Bn(l.type,Ee),kt);$.__reactInternalSnapshotBeforeUpdate=F}break;case 3:var U=l.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(de){xt(l,l.return,de)}if(i=l.sibling,i!==null){i.return=l.return,ve=i;break}ve=l.return}return ke=hy,hy=!1,ke}function Co(i,l,d){var m=l.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var x=m=m.next;do{if((x.tag&i)===i){var _=x.destroy;x.destroy=void 0,_!==void 0&&vd(l,d,_)}x=x.next}while(x!==m)}}function kl(i,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var d=l=l.next;do{if((d.tag&i)===i){var m=d.create;d.destroy=m()}d=d.next}while(d!==l)}}function _d(i){var l=i.ref;if(l!==null){var d=i.stateNode;i.tag,i=d,typeof l=="function"?l(i):l.current=i}}function fy(i){var l=i.alternate;l!==null&&(i.alternate=null,fy(l)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(l=i.stateNode,l!==null&&(delete l[nr],delete l[go],delete l[Du],delete l[pS],delete l[mS])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function py(i){return i.tag===5||i.tag===3||i.tag===4}function my(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||py(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function bd(i,l,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,l?d.nodeType===8?d.parentNode.insertBefore(i,l):d.insertBefore(i,l):(d.nodeType===8?(l=d.parentNode,l.insertBefore(i,d)):(l=d,l.appendChild(i)),d=d._reactRootContainer,d!=null||l.onclick!==null||(l.onclick=el));else if(m!==4&&(i=i.child,i!==null))for(bd(i,l,d),i=i.sibling;i!==null;)bd(i,l,d),i=i.sibling}function wd(i,l,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,l?d.insertBefore(i,l):d.appendChild(i);else if(m!==4&&(i=i.child,i!==null))for(wd(i,l,d),i=i.sibling;i!==null;)wd(i,l,d),i=i.sibling}var zt=null,Vn=!1;function Ur(i,l,d){for(d=d.child;d!==null;)gy(i,l,d),d=d.sibling}function gy(i,l,d){if(tr&&typeof tr.onCommitFiberUnmount=="function")try{tr.onCommitFiberUnmount(Da,d)}catch{}switch(d.tag){case 5:Wt||oi(d,l);case 6:var m=zt,x=Vn;zt=null,Ur(i,l,d),zt=m,Vn=x,zt!==null&&(Vn?(i=zt,d=d.stateNode,i.nodeType===8?i.parentNode.removeChild(d):i.removeChild(d)):zt.removeChild(d.stateNode));break;case 18:zt!==null&&(Vn?(i=zt,d=d.stateNode,i.nodeType===8?Iu(i.parentNode,d):i.nodeType===1&&Iu(i,d),so(i)):Iu(zt,d.stateNode));break;case 4:m=zt,x=Vn,zt=d.stateNode.containerInfo,Vn=!0,Ur(i,l,d),zt=m,Vn=x;break;case 0:case 11:case 14:case 15:if(!Wt&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){x=m=m.next;do{var _=x,E=_.destroy;_=_.tag,E!==void 0&&((_&2)!==0||(_&4)!==0)&&vd(d,l,E),x=x.next}while(x!==m)}Ur(i,l,d);break;case 1:if(!Wt&&(oi(d,l),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(I){xt(d,l,I)}Ur(i,l,d);break;case 21:Ur(i,l,d);break;case 22:d.mode&1?(Wt=(m=Wt)||d.memoizedState!==null,Ur(i,l,d),Wt=m):Ur(i,l,d);break;default:Ur(i,l,d)}}function yy(i){var l=i.updateQueue;if(l!==null){i.updateQueue=null;var d=i.stateNode;d===null&&(d=i.stateNode=new RS),l.forEach(function(m){var x=US.bind(null,i,m);d.has(m)||(d.add(m),m.then(x,x))})}}function qn(i,l){var d=l.deletions;if(d!==null)for(var m=0;m<d.length;m++){var x=d[m];try{var _=i,E=l,I=E;e:for(;I!==null;){switch(I.tag){case 5:zt=I.stateNode,Vn=!1;break e;case 3:zt=I.stateNode.containerInfo,Vn=!0;break e;case 4:zt=I.stateNode.containerInfo,Vn=!0;break e}I=I.return}if(zt===null)throw Error(n(160));gy(_,E,x),zt=null,Vn=!1;var z=x.alternate;z!==null&&(z.return=null),x.return=null}catch(q){xt(x,l,q)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)xy(l,i),l=l.sibling}function xy(i,l){var d=i.alternate,m=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(qn(l,i),ir(i),m&4){try{Co(3,i,i.return),kl(3,i)}catch(Ee){xt(i,i.return,Ee)}try{Co(5,i,i.return)}catch(Ee){xt(i,i.return,Ee)}}break;case 1:qn(l,i),ir(i),m&512&&d!==null&&oi(d,d.return);break;case 5:if(qn(l,i),ir(i),m&512&&d!==null&&oi(d,d.return),i.flags&32){var x=i.stateNode;try{qe(x,"")}catch(Ee){xt(i,i.return,Ee)}}if(m&4&&(x=i.stateNode,x!=null)){var _=i.memoizedProps,E=d!==null?d.memoizedProps:_,I=i.type,z=i.updateQueue;if(i.updateQueue=null,z!==null)try{I==="input"&&_.type==="radio"&&_.name!=null&&De(x,_),an(I,E);var q=an(I,_);for(E=0;E<z.length;E+=2){var ie=z[E],oe=z[E+1];ie==="style"?on(x,oe):ie==="dangerouslySetInnerHTML"?$e(x,oe):ie==="children"?qe(x,oe):j(x,ie,oe,q)}switch(I){case"input":te(x,_);break;case"textarea":tt(x,_);break;case"select":var se=x._wrapperState.wasMultiple;x._wrapperState.wasMultiple=!!_.multiple;var xe=_.value;xe!=null?Fe(x,!!_.multiple,xe,!1):se!==!!_.multiple&&(_.defaultValue!=null?Fe(x,!!_.multiple,_.defaultValue,!0):Fe(x,!!_.multiple,_.multiple?[]:"",!1))}x[go]=_}catch(Ee){xt(i,i.return,Ee)}}break;case 6:if(qn(l,i),ir(i),m&4){if(i.stateNode===null)throw Error(n(162));x=i.stateNode,_=i.memoizedProps;try{x.nodeValue=_}catch(Ee){xt(i,i.return,Ee)}}break;case 3:if(qn(l,i),ir(i),m&4&&d!==null&&d.memoizedState.isDehydrated)try{so(l.containerInfo)}catch(Ee){xt(i,i.return,Ee)}break;case 4:qn(l,i),ir(i);break;case 13:qn(l,i),ir(i),x=i.child,x.flags&8192&&(_=x.memoizedState!==null,x.stateNode.isHidden=_,!_||x.alternate!==null&&x.alternate.memoizedState!==null||(jd=wt())),m&4&&yy(i);break;case 22:if(ie=d!==null&&d.memoizedState!==null,i.mode&1?(Wt=(q=Wt)||ie,qn(l,i),Wt=q):qn(l,i),ir(i),m&8192){if(q=i.memoizedState!==null,(i.stateNode.isHidden=q)&&!ie&&(i.mode&1)!==0)for(ve=i,ie=i.child;ie!==null;){for(oe=ve=ie;ve!==null;){switch(se=ve,xe=se.child,se.tag){case 0:case 11:case 14:case 15:Co(4,se,se.return);break;case 1:oi(se,se.return);var ke=se.stateNode;if(typeof ke.componentWillUnmount=="function"){m=se,d=se.return;try{l=m,ke.props=l.memoizedProps,ke.state=l.memoizedState,ke.componentWillUnmount()}catch(Ee){xt(m,d,Ee)}}break;case 5:oi(se,se.return);break;case 22:if(se.memoizedState!==null){by(oe);continue}}xe!==null?(xe.return=se,ve=xe):by(oe)}ie=ie.sibling}e:for(ie=null,oe=i;;){if(oe.tag===5){if(ie===null){ie=oe;try{x=oe.stateNode,q?(_=x.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(I=oe.stateNode,z=oe.memoizedProps.style,E=z!=null&&z.hasOwnProperty("display")?z.display:null,I.style.display=jt("display",E))}catch(Ee){xt(i,i.return,Ee)}}}else if(oe.tag===6){if(ie===null)try{oe.stateNode.nodeValue=q?"":oe.memoizedProps}catch(Ee){xt(i,i.return,Ee)}}else if((oe.tag!==22&&oe.tag!==23||oe.memoizedState===null||oe===i)&&oe.child!==null){oe.child.return=oe,oe=oe.child;continue}if(oe===i)break e;for(;oe.sibling===null;){if(oe.return===null||oe.return===i)break e;ie===oe&&(ie=null),oe=oe.return}ie===oe&&(ie=null),oe.sibling.return=oe.return,oe=oe.sibling}}break;case 19:qn(l,i),ir(i),m&4&&yy(i);break;case 21:break;default:qn(l,i),ir(i)}}function ir(i){var l=i.flags;if(l&2){try{e:{for(var d=i.return;d!==null;){if(py(d)){var m=d;break e}d=d.return}throw Error(n(160))}switch(m.tag){case 5:var x=m.stateNode;m.flags&32&&(qe(x,""),m.flags&=-33);var _=my(i);wd(i,_,x);break;case 3:case 4:var E=m.stateNode.containerInfo,I=my(i);bd(i,I,E);break;default:throw Error(n(161))}}catch(z){xt(i,i.return,z)}i.flags&=-3}l&4096&&(i.flags&=-4097)}function OS(i,l,d){ve=i,vy(i)}function vy(i,l,d){for(var m=(i.mode&1)!==0;ve!==null;){var x=ve,_=x.child;if(x.tag===22&&m){var E=x.memoizedState!==null||wl;if(!E){var I=x.alternate,z=I!==null&&I.memoizedState!==null||Wt;I=wl;var q=Wt;if(wl=E,(Wt=z)&&!q)for(ve=x;ve!==null;)E=ve,z=E.child,E.tag===22&&E.memoizedState!==null?wy(x):z!==null?(z.return=E,ve=z):wy(x);for(;_!==null;)ve=_,vy(_),_=_.sibling;ve=x,wl=I,Wt=q}_y(i)}else(x.subtreeFlags&8772)!==0&&_!==null?(_.return=x,ve=_):_y(i)}}function _y(i){for(;ve!==null;){var l=ve;if((l.flags&8772)!==0){var d=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:Wt||kl(5,l);break;case 1:var m=l.stateNode;if(l.flags&4&&!Wt)if(d===null)m.componentDidMount();else{var x=l.elementType===l.type?d.memoizedProps:Bn(l.type,d.memoizedProps);m.componentDidUpdate(x,d.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var _=l.updateQueue;_!==null&&bg(l,_,m);break;case 3:var E=l.updateQueue;if(E!==null){if(d=null,l.child!==null)switch(l.child.tag){case 5:d=l.child.stateNode;break;case 1:d=l.child.stateNode}bg(l,E,d)}break;case 5:var I=l.stateNode;if(d===null&&l.flags&4){d=I;var z=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":z.autoFocus&&d.focus();break;case"img":z.src&&(d.src=z.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var q=l.alternate;if(q!==null){var ie=q.memoizedState;if(ie!==null){var oe=ie.dehydrated;oe!==null&&so(oe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Wt||l.flags&512&&_d(l)}catch(se){xt(l,l.return,se)}}if(l===i){ve=null;break}if(d=l.sibling,d!==null){d.return=l.return,ve=d;break}ve=l.return}}function by(i){for(;ve!==null;){var l=ve;if(l===i){ve=null;break}var d=l.sibling;if(d!==null){d.return=l.return,ve=d;break}ve=l.return}}function wy(i){for(;ve!==null;){var l=ve;try{switch(l.tag){case 0:case 11:case 15:var d=l.return;try{kl(4,l)}catch(z){xt(l,d,z)}break;case 1:var m=l.stateNode;if(typeof m.componentDidMount=="function"){var x=l.return;try{m.componentDidMount()}catch(z){xt(l,x,z)}}var _=l.return;try{_d(l)}catch(z){xt(l,_,z)}break;case 5:var E=l.return;try{_d(l)}catch(z){xt(l,E,z)}}}catch(z){xt(l,l.return,z)}if(l===i){ve=null;break}var I=l.sibling;if(I!==null){I.return=l.return,ve=I;break}ve=l.return}}var LS=Math.ceil,Sl=O.ReactCurrentDispatcher,kd=O.ReactCurrentOwner,Ln=O.ReactCurrentBatchConfig,Ye=0,It=null,Et=null,Ft=0,bn=0,ai=Dr(0),At=0,To=null,ds=0,jl=0,Sd=0,No=null,dn=null,jd=0,li=1/0,vr=null,El=!1,Ed=null,Br=null,Cl=!1,Vr=null,Tl=0,Ao=0,Cd=null,Nl=-1,Al=0;function nn(){return(Ye&6)!==0?wt():Nl!==-1?Nl:Nl=wt()}function qr(i){return(i.mode&1)===0?1:(Ye&2)!==0&&Ft!==0?Ft&-Ft:yS.transition!==null?(Al===0&&(Al=mm()),Al):(i=rt,i!==0||(i=window.event,i=i===void 0?16:Sm(i.type)),i)}function Hn(i,l,d,m){if(50<Ao)throw Ao=0,Cd=null,Error(n(185));Zi(i,d,m),((Ye&2)===0||i!==It)&&(i===It&&((Ye&2)===0&&(jl|=d),At===4&&Hr(i,Ft)),hn(i,m),d===1&&Ye===0&&(l.mode&1)===0&&(li=wt()+500,sl&&zr()))}function hn(i,l){var d=i.callbackNode;y1(i,l);var m=Fa(i,i===It?Ft:0);if(m===0)d!==null&&hm(d),i.callbackNode=null,i.callbackPriority=0;else if(l=m&-m,i.callbackPriority!==l){if(d!=null&&hm(d),l===1)i.tag===0?gS(Sy.bind(null,i)):cg(Sy.bind(null,i)),hS(function(){(Ye&6)===0&&zr()}),d=null;else{switch(gm(m)){case 1:d=ou;break;case 4:d=fm;break;case 16:d=Ia;break;case 536870912:d=pm;break;default:d=Ia}d=Py(d,ky.bind(null,i))}i.callbackPriority=l,i.callbackNode=d}}function ky(i,l){if(Nl=-1,Al=0,(Ye&6)!==0)throw Error(n(327));var d=i.callbackNode;if(ci()&&i.callbackNode!==d)return null;var m=Fa(i,i===It?Ft:0);if(m===0)return null;if((m&30)!==0||(m&i.expiredLanes)!==0||l)l=Rl(i,m);else{l=m;var x=Ye;Ye|=2;var _=Ey();(It!==i||Ft!==l)&&(vr=null,li=wt()+500,fs(i,l));do try{MS();break}catch(I){jy(i,I)}while(!0);Hu(),Sl.current=_,Ye=x,Et!==null?l=0:(It=null,Ft=0,l=At)}if(l!==0){if(l===2&&(x=au(i),x!==0&&(m=x,l=Td(i,x))),l===1)throw d=To,fs(i,0),Hr(i,m),hn(i,wt()),d;if(l===6)Hr(i,m);else{if(x=i.current.alternate,(m&30)===0&&!IS(x)&&(l=Rl(i,m),l===2&&(_=au(i),_!==0&&(m=_,l=Td(i,_))),l===1))throw d=To,fs(i,0),Hr(i,m),hn(i,wt()),d;switch(i.finishedWork=x,i.finishedLanes=m,l){case 0:case 1:throw Error(n(345));case 2:ps(i,dn,vr);break;case 3:if(Hr(i,m),(m&130023424)===m&&(l=jd+500-wt(),10<l)){if(Fa(i,0)!==0)break;if(x=i.suspendedLanes,(x&m)!==m){nn(),i.pingedLanes|=i.suspendedLanes&x;break}i.timeoutHandle=Lu(ps.bind(null,i,dn,vr),l);break}ps(i,dn,vr);break;case 4:if(Hr(i,m),(m&4194240)===m)break;for(l=i.eventTimes,x=-1;0<m;){var E=31-Fn(m);_=1<<E,E=l[E],E>x&&(x=E),m&=~_}if(m=x,m=wt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*LS(m/1960))-m,10<m){i.timeoutHandle=Lu(ps.bind(null,i,dn,vr),m);break}ps(i,dn,vr);break;case 5:ps(i,dn,vr);break;default:throw Error(n(329))}}}return hn(i,wt()),i.callbackNode===d?ky.bind(null,i):null}function Td(i,l){var d=No;return i.current.memoizedState.isDehydrated&&(fs(i,l).flags|=256),i=Rl(i,l),i!==2&&(l=dn,dn=d,l!==null&&Nd(l)),i}function Nd(i){dn===null?dn=i:dn.push.apply(dn,i)}function IS(i){for(var l=i;;){if(l.flags&16384){var d=l.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var m=0;m<d.length;m++){var x=d[m],_=x.getSnapshot;x=x.value;try{if(!$n(_(),x))return!1}catch{return!1}}}if(d=l.child,l.subtreeFlags&16384&&d!==null)d.return=l,l=d;else{if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Hr(i,l){for(l&=~Sd,l&=~jl,i.suspendedLanes|=l,i.pingedLanes&=~l,i=i.expirationTimes;0<l;){var d=31-Fn(l),m=1<<d;i[d]=-1,l&=~m}}function Sy(i){if((Ye&6)!==0)throw Error(n(327));ci();var l=Fa(i,0);if((l&1)===0)return hn(i,wt()),null;var d=Rl(i,l);if(i.tag!==0&&d===2){var m=au(i);m!==0&&(l=m,d=Td(i,m))}if(d===1)throw d=To,fs(i,0),Hr(i,l),hn(i,wt()),d;if(d===6)throw Error(n(345));return i.finishedWork=i.current.alternate,i.finishedLanes=l,ps(i,dn,vr),hn(i,wt()),null}function Ad(i,l){var d=Ye;Ye|=1;try{return i(l)}finally{Ye=d,Ye===0&&(li=wt()+500,sl&&zr())}}function hs(i){Vr!==null&&Vr.tag===0&&(Ye&6)===0&&ci();var l=Ye;Ye|=1;var d=Ln.transition,m=rt;try{if(Ln.transition=null,rt=1,i)return i()}finally{rt=m,Ln.transition=d,Ye=l,(Ye&6)===0&&zr()}}function Rd(){bn=ai.current,dt(ai)}function fs(i,l){i.finishedWork=null,i.finishedLanes=0;var d=i.timeoutHandle;if(d!==-1&&(i.timeoutHandle=-1,dS(d)),Et!==null)for(d=Et.return;d!==null;){var m=d;switch($u(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&nl();break;case 3:si(),dt(ln),dt(qt),Zu();break;case 5:Yu(m);break;case 4:si();break;case 13:dt(pt);break;case 19:dt(pt);break;case 10:Ku(m.type._context);break;case 22:case 23:Rd()}d=d.return}if(It=i,Et=i=Kr(i.current,null),Ft=bn=l,At=0,To=null,Sd=jl=ds=0,dn=No=null,ls!==null){for(l=0;l<ls.length;l++)if(d=ls[l],m=d.interleaved,m!==null){d.interleaved=null;var x=m.next,_=d.pending;if(_!==null){var E=_.next;_.next=x,m.next=E}d.pending=m}ls=null}return i}function jy(i,l){do{var d=Et;try{if(Hu(),pl.current=xl,ml){for(var m=mt.memoizedState;m!==null;){var x=m.queue;x!==null&&(x.pending=null),m=m.next}ml=!1}if(us=0,Lt=Nt=mt=null,wo=!1,ko=0,kd.current=null,d===null||d.return===null){At=1,To=l,Et=null;break}e:{var _=i,E=d.return,I=d,z=l;if(l=Ft,I.flags|=32768,z!==null&&typeof z=="object"&&typeof z.then=="function"){var q=z,ie=I,oe=ie.tag;if((ie.mode&1)===0&&(oe===0||oe===11||oe===15)){var se=ie.alternate;se?(ie.updateQueue=se.updateQueue,ie.memoizedState=se.memoizedState,ie.lanes=se.lanes):(ie.updateQueue=null,ie.memoizedState=null)}var xe=Xg(E);if(xe!==null){xe.flags&=-257,Yg(xe,E,I,_,l),xe.mode&1&&Jg(_,q,l),l=xe,z=q;var ke=l.updateQueue;if(ke===null){var Ee=new Set;Ee.add(z),l.updateQueue=Ee}else ke.add(z);break e}else{if((l&1)===0){Jg(_,q,l),Pd();break e}z=Error(n(426))}}else if(ft&&I.mode&1){var kt=Xg(E);if(kt!==null){(kt.flags&65536)===0&&(kt.flags|=256),Yg(kt,E,I,_,l),Vu(ii(z,I));break e}}_=z=ii(z,I),At!==4&&(At=2),No===null?No=[_]:No.push(_),_=E;do{switch(_.tag){case 3:_.flags|=65536,l&=-l,_.lanes|=l;var $=Wg(_,z,l);_g(_,$);break e;case 1:I=z;var F=_.type,U=_.stateNode;if((_.flags&128)===0&&(typeof F.getDerivedStateFromError=="function"||U!==null&&typeof U.componentDidCatch=="function"&&(Br===null||!Br.has(U)))){_.flags|=65536,l&=-l,_.lanes|=l;var de=Gg(_,I,l);_g(_,de);break e}}_=_.return}while(_!==null)}Ty(d)}catch(Ce){l=Ce,Et===d&&d!==null&&(Et=d=d.return);continue}break}while(!0)}function Ey(){var i=Sl.current;return Sl.current=xl,i===null?xl:i}function Pd(){(At===0||At===3||At===2)&&(At=4),It===null||(ds&268435455)===0&&(jl&268435455)===0||Hr(It,Ft)}function Rl(i,l){var d=Ye;Ye|=2;var m=Ey();(It!==i||Ft!==l)&&(vr=null,fs(i,l));do try{DS();break}catch(x){jy(i,x)}while(!0);if(Hu(),Ye=d,Sl.current=m,Et!==null)throw Error(n(261));return It=null,Ft=0,At}function DS(){for(;Et!==null;)Cy(Et)}function MS(){for(;Et!==null&&!l1();)Cy(Et)}function Cy(i){var l=Ry(i.alternate,i,bn);i.memoizedProps=i.pendingProps,l===null?Ty(i):Et=l,kd.current=null}function Ty(i){var l=i;do{var d=l.alternate;if(i=l.return,(l.flags&32768)===0){if(d=NS(d,l,bn),d!==null){Et=d;return}}else{if(d=AS(d,l),d!==null){d.flags&=32767,Et=d;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{At=6,Et=null;return}}if(l=l.sibling,l!==null){Et=l;return}Et=l=i}while(l!==null);At===0&&(At=5)}function ps(i,l,d){var m=rt,x=Ln.transition;try{Ln.transition=null,rt=1,zS(i,l,d,m)}finally{Ln.transition=x,rt=m}return null}function zS(i,l,d,m){do ci();while(Vr!==null);if((Ye&6)!==0)throw Error(n(327));d=i.finishedWork;var x=i.finishedLanes;if(d===null)return null;if(i.finishedWork=null,i.finishedLanes=0,d===i.current)throw Error(n(177));i.callbackNode=null,i.callbackPriority=0;var _=d.lanes|d.childLanes;if(x1(i,_),i===It&&(Et=It=null,Ft=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Cl||(Cl=!0,Py(Ia,function(){return ci(),null})),_=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||_){_=Ln.transition,Ln.transition=null;var E=rt;rt=1;var I=Ye;Ye|=4,kd.current=null,PS(i,d),xy(d,i),sS(Pu),Ba=!!Ru,Pu=Ru=null,i.current=d,OS(d),c1(),Ye=I,rt=E,Ln.transition=_}else i.current=d;if(Cl&&(Cl=!1,Vr=i,Tl=x),_=i.pendingLanes,_===0&&(Br=null),h1(d.stateNode),hn(i,wt()),l!==null)for(m=i.onRecoverableError,d=0;d<l.length;d++)x=l[d],m(x.value,{componentStack:x.stack,digest:x.digest});if(El)throw El=!1,i=Ed,Ed=null,i;return(Tl&1)!==0&&i.tag!==0&&ci(),_=i.pendingLanes,(_&1)!==0?i===Cd?Ao++:(Ao=0,Cd=i):Ao=0,zr(),null}function ci(){if(Vr!==null){var i=gm(Tl),l=Ln.transition,d=rt;try{if(Ln.transition=null,rt=16>i?16:i,Vr===null)var m=!1;else{if(i=Vr,Vr=null,Tl=0,(Ye&6)!==0)throw Error(n(331));var x=Ye;for(Ye|=4,ve=i.current;ve!==null;){var _=ve,E=_.child;if((ve.flags&16)!==0){var I=_.deletions;if(I!==null){for(var z=0;z<I.length;z++){var q=I[z];for(ve=q;ve!==null;){var ie=ve;switch(ie.tag){case 0:case 11:case 15:Co(8,ie,_)}var oe=ie.child;if(oe!==null)oe.return=ie,ve=oe;else for(;ve!==null;){ie=ve;var se=ie.sibling,xe=ie.return;if(fy(ie),ie===q){ve=null;break}if(se!==null){se.return=xe,ve=se;break}ve=xe}}}var ke=_.alternate;if(ke!==null){var Ee=ke.child;if(Ee!==null){ke.child=null;do{var kt=Ee.sibling;Ee.sibling=null,Ee=kt}while(Ee!==null)}}ve=_}}if((_.subtreeFlags&2064)!==0&&E!==null)E.return=_,ve=E;else e:for(;ve!==null;){if(_=ve,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:Co(9,_,_.return)}var $=_.sibling;if($!==null){$.return=_.return,ve=$;break e}ve=_.return}}var F=i.current;for(ve=F;ve!==null;){E=ve;var U=E.child;if((E.subtreeFlags&2064)!==0&&U!==null)U.return=E,ve=U;else e:for(E=F;ve!==null;){if(I=ve,(I.flags&2048)!==0)try{switch(I.tag){case 0:case 11:case 15:kl(9,I)}}catch(Ce){xt(I,I.return,Ce)}if(I===E){ve=null;break e}var de=I.sibling;if(de!==null){de.return=I.return,ve=de;break e}ve=I.return}}if(Ye=x,zr(),tr&&typeof tr.onPostCommitFiberRoot=="function")try{tr.onPostCommitFiberRoot(Da,i)}catch{}m=!0}return m}finally{rt=d,Ln.transition=l}}return!1}function Ny(i,l,d){l=ii(d,l),l=Wg(i,l,1),i=$r(i,l,1),l=nn(),i!==null&&(Zi(i,1,l),hn(i,l))}function xt(i,l,d){if(i.tag===3)Ny(i,i,d);else for(;l!==null;){if(l.tag===3){Ny(l,i,d);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Br===null||!Br.has(m))){i=ii(d,i),i=Gg(l,i,1),l=$r(l,i,1),i=nn(),l!==null&&(Zi(l,1,i),hn(l,i));break}}l=l.return}}function FS(i,l,d){var m=i.pingCache;m!==null&&m.delete(l),l=nn(),i.pingedLanes|=i.suspendedLanes&d,It===i&&(Ft&d)===d&&(At===4||At===3&&(Ft&130023424)===Ft&&500>wt()-jd?fs(i,0):Sd|=d),hn(i,l)}function Ay(i,l){l===0&&((i.mode&1)===0?l=1:(l=za,za<<=1,(za&130023424)===0&&(za=4194304)));var d=nn();i=gr(i,l),i!==null&&(Zi(i,l,d),hn(i,d))}function $S(i){var l=i.memoizedState,d=0;l!==null&&(d=l.retryLane),Ay(i,d)}function US(i,l){var d=0;switch(i.tag){case 13:var m=i.stateNode,x=i.memoizedState;x!==null&&(d=x.retryLane);break;case 19:m=i.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(l),Ay(i,d)}var Ry;Ry=function(i,l,d){if(i!==null)if(i.memoizedProps!==l.pendingProps||ln.current)un=!0;else{if((i.lanes&d)===0&&(l.flags&128)===0)return un=!1,TS(i,l,d);un=(i.flags&131072)!==0}else un=!1,ft&&(l.flags&1048576)!==0&&ug(l,ol,l.index);switch(l.lanes=0,l.tag){case 2:var m=l.type;bl(i,l),i=l.pendingProps;var x=Ys(l,qt.current);ri(l,d),x=nd(null,l,m,i,x,d);var _=rd();return l.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,cn(m)?(_=!0,rl(l)):_=!1,l.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,Ju(l),x.updater=vl,l.stateNode=x,x._reactInternals=l,cd(l,m,i,d),l=fd(null,l,m,!0,_,d)):(l.tag=0,ft&&_&&Fu(l),tn(null,l,x,d),l=l.child),l;case 16:m=l.elementType;e:{switch(bl(i,l),i=l.pendingProps,x=m._init,m=x(m._payload),l.type=m,x=l.tag=VS(m),i=Bn(m,i),x){case 0:l=hd(null,l,m,i,d);break e;case 1:l=ry(null,l,m,i,d);break e;case 11:l=Qg(null,l,m,i,d);break e;case 14:l=Zg(null,l,m,Bn(m.type,i),d);break e}throw Error(n(306,m,""))}return l;case 0:return m=l.type,x=l.pendingProps,x=l.elementType===m?x:Bn(m,x),hd(i,l,m,x,d);case 1:return m=l.type,x=l.pendingProps,x=l.elementType===m?x:Bn(m,x),ry(i,l,m,x,d);case 3:e:{if(sy(l),i===null)throw Error(n(387));m=l.pendingProps,_=l.memoizedState,x=_.element,vg(i,l),hl(l,m,null,d);var E=l.memoizedState;if(m=E.element,_.isDehydrated)if(_={element:m,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},l.updateQueue.baseState=_,l.memoizedState=_,l.flags&256){x=ii(Error(n(423)),l),l=iy(i,l,m,d,x);break e}else if(m!==x){x=ii(Error(n(424)),l),l=iy(i,l,m,d,x);break e}else for(_n=Ir(l.stateNode.containerInfo.firstChild),vn=l,ft=!0,Un=null,d=yg(l,null,m,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(ei(),m===x){l=xr(i,l,d);break e}tn(i,l,m,d)}l=l.child}return l;case 5:return wg(l),i===null&&Bu(l),m=l.type,x=l.pendingProps,_=i!==null?i.memoizedProps:null,E=x.children,Ou(m,x)?E=null:_!==null&&Ou(m,_)&&(l.flags|=32),ny(i,l),tn(i,l,E,d),l.child;case 6:return i===null&&Bu(l),null;case 13:return oy(i,l,d);case 4:return Xu(l,l.stateNode.containerInfo),m=l.pendingProps,i===null?l.child=ti(l,null,m,d):tn(i,l,m,d),l.child;case 11:return m=l.type,x=l.pendingProps,x=l.elementType===m?x:Bn(m,x),Qg(i,l,m,x,d);case 7:return tn(i,l,l.pendingProps,d),l.child;case 8:return tn(i,l,l.pendingProps.children,d),l.child;case 12:return tn(i,l,l.pendingProps.children,d),l.child;case 10:e:{if(m=l.type._context,x=l.pendingProps,_=l.memoizedProps,E=x.value,at(cl,m._currentValue),m._currentValue=E,_!==null)if($n(_.value,E)){if(_.children===x.children&&!ln.current){l=xr(i,l,d);break e}}else for(_=l.child,_!==null&&(_.return=l);_!==null;){var I=_.dependencies;if(I!==null){E=_.child;for(var z=I.firstContext;z!==null;){if(z.context===m){if(_.tag===1){z=yr(-1,d&-d),z.tag=2;var q=_.updateQueue;if(q!==null){q=q.shared;var ie=q.pending;ie===null?z.next=z:(z.next=ie.next,ie.next=z),q.pending=z}}_.lanes|=d,z=_.alternate,z!==null&&(z.lanes|=d),Wu(_.return,d,l),I.lanes|=d;break}z=z.next}}else if(_.tag===10)E=_.type===l.type?null:_.child;else if(_.tag===18){if(E=_.return,E===null)throw Error(n(341));E.lanes|=d,I=E.alternate,I!==null&&(I.lanes|=d),Wu(E,d,l),E=_.sibling}else E=_.child;if(E!==null)E.return=_;else for(E=_;E!==null;){if(E===l){E=null;break}if(_=E.sibling,_!==null){_.return=E.return,E=_;break}E=E.return}_=E}tn(i,l,x.children,d),l=l.child}return l;case 9:return x=l.type,m=l.pendingProps.children,ri(l,d),x=Pn(x),m=m(x),l.flags|=1,tn(i,l,m,d),l.child;case 14:return m=l.type,x=Bn(m,l.pendingProps),x=Bn(m.type,x),Zg(i,l,m,x,d);case 15:return ey(i,l,l.type,l.pendingProps,d);case 17:return m=l.type,x=l.pendingProps,x=l.elementType===m?x:Bn(m,x),bl(i,l),l.tag=1,cn(m)?(i=!0,rl(l)):i=!1,ri(l,d),Hg(l,m,x),cd(l,m,x,d),fd(null,l,m,!0,i,d);case 19:return ly(i,l,d);case 22:return ty(i,l,d)}throw Error(n(156,l.tag))};function Py(i,l){return dm(i,l)}function BS(i,l,d,m){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function In(i,l,d,m){return new BS(i,l,d,m)}function Od(i){return i=i.prototype,!(!i||!i.isReactComponent)}function VS(i){if(typeof i=="function")return Od(i)?1:0;if(i!=null){if(i=i.$$typeof,i===Y)return 11;if(i===W)return 14}return 2}function Kr(i,l){var d=i.alternate;return d===null?(d=In(i.tag,l,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=l,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&14680064,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,l=i.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d}function Pl(i,l,d,m,x,_){var E=2;if(m=i,typeof i=="function")Od(i)&&(E=1);else if(typeof i=="string")E=5;else e:switch(i){case M:return ms(d.children,x,_,l);case V:E=8,x|=8;break;case B:return i=In(12,d,l,x|2),i.elementType=B,i.lanes=_,i;case he:return i=In(13,d,l,x),i.elementType=he,i.lanes=_,i;case K:return i=In(19,d,l,x),i.elementType=K,i.lanes=_,i;case re:return Ol(d,x,_,l);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case L:E=10;break e;case Q:E=9;break e;case Y:E=11;break e;case W:E=14;break e;case ne:E=16,m=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return l=In(E,d,l,x),l.elementType=i,l.type=m,l.lanes=_,l}function ms(i,l,d,m){return i=In(7,i,m,l),i.lanes=d,i}function Ol(i,l,d,m){return i=In(22,i,m,l),i.elementType=re,i.lanes=d,i.stateNode={isHidden:!1},i}function Ld(i,l,d){return i=In(6,i,null,l),i.lanes=d,i}function Id(i,l,d){return l=In(4,i.children!==null?i.children:[],i.key,l),l.lanes=d,l.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},l}function qS(i,l,d,m,x){this.tag=l,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=lu(0),this.expirationTimes=lu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lu(0),this.identifierPrefix=m,this.onRecoverableError=x,this.mutableSourceEagerHydrationData=null}function Dd(i,l,d,m,x,_,E,I,z){return i=new qS(i,l,d,I,z),l===1?(l=1,_===!0&&(l|=8)):l=0,_=In(3,null,null,l),i.current=_,_.stateNode=i,_.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ju(_),i}function HS(i,l,d){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:m==null?null:""+m,children:i,containerInfo:l,implementation:d}}function Oy(i){if(!i)return Mr;i=i._reactInternals;e:{if(rs(i)!==i||i.tag!==1)throw Error(n(170));var l=i;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(cn(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(n(171))}if(i.tag===1){var d=i.type;if(cn(d))return ag(i,d,l)}return l}function Ly(i,l,d,m,x,_,E,I,z){return i=Dd(d,m,!0,i,x,_,E,I,z),i.context=Oy(null),d=i.current,m=nn(),x=qr(d),_=yr(m,x),_.callback=l??null,$r(d,_,x),i.current.lanes=x,Zi(i,x,m),hn(i,m),i}function Ll(i,l,d,m){var x=l.current,_=nn(),E=qr(x);return d=Oy(d),l.context===null?l.context=d:l.pendingContext=d,l=yr(_,E),l.payload={element:i},m=m===void 0?null:m,m!==null&&(l.callback=m),i=$r(x,l,E),i!==null&&(Hn(i,x,E,_),dl(i,x,E)),E}function Il(i){return i=i.current,i.child?(i.child.tag===5,i.child.stateNode):null}function Iy(i,l){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d<l?d:l}}function Md(i,l){Iy(i,l),(i=i.alternate)&&Iy(i,l)}function KS(){return null}var Dy=typeof reportError=="function"?reportError:function(i){console.error(i)};function zd(i){this._internalRoot=i}Dl.prototype.render=zd.prototype.render=function(i){var l=this._internalRoot;if(l===null)throw Error(n(409));Ll(i,l,null,null)},Dl.prototype.unmount=zd.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var l=i.containerInfo;hs(function(){Ll(null,i,null,null)}),l[hr]=null}};function Dl(i){this._internalRoot=i}Dl.prototype.unstable_scheduleHydration=function(i){if(i){var l=vm();i={blockedOn:null,target:i,priority:l};for(var d=0;d<Pr.length&&l!==0&&l<Pr[d].priority;d++);Pr.splice(d,0,i),d===0&&wm(i)}};function Fd(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Ml(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function My(){}function WS(i,l,d,m,x){if(x){if(typeof m=="function"){var _=m;m=function(){var q=Il(E);_.call(q)}}var E=Ly(l,m,i,0,null,!1,!1,"",My);return i._reactRootContainer=E,i[hr]=E.current,po(i.nodeType===8?i.parentNode:i),hs(),E}for(;x=i.lastChild;)i.removeChild(x);if(typeof m=="function"){var I=m;m=function(){var q=Il(z);I.call(q)}}var z=Dd(i,0,!1,null,null,!1,!1,"",My);return i._reactRootContainer=z,i[hr]=z.current,po(i.nodeType===8?i.parentNode:i),hs(function(){Ll(l,z,d,m)}),z}function zl(i,l,d,m,x){var _=d._reactRootContainer;if(_){var E=_;if(typeof x=="function"){var I=x;x=function(){var z=Il(E);I.call(z)}}Ll(l,E,i,x)}else E=WS(d,l,i,x,m);return Il(E)}ym=function(i){switch(i.tag){case 3:var l=i.stateNode;if(l.current.memoizedState.isDehydrated){var d=Qi(l.pendingLanes);d!==0&&(cu(l,d|1),hn(l,wt()),(Ye&6)===0&&(li=wt()+500,zr()))}break;case 13:hs(function(){var m=gr(i,1);if(m!==null){var x=nn();Hn(m,i,1,x)}}),Md(i,1)}},uu=function(i){if(i.tag===13){var l=gr(i,134217728);if(l!==null){var d=nn();Hn(l,i,134217728,d)}Md(i,134217728)}},xm=function(i){if(i.tag===13){var l=qr(i),d=gr(i,l);if(d!==null){var m=nn();Hn(d,i,l,m)}Md(i,l)}},vm=function(){return rt},_m=function(i,l){var d=rt;try{return rt=i,l()}finally{rt=d}},nu=function(i,l,d){switch(l){case"input":if(te(i,d),l=d.name,d.type==="radio"&&l!=null){for(d=i;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<d.length;l++){var m=d[l];if(m!==i&&m.form===i.form){var x=tl(m);if(!x)throw Error(n(90));Qn(m),te(m,x)}}}break;case"textarea":tt(i,d);break;case"select":l=d.value,l!=null&&Fe(i,!!d.multiple,l,!1)}},sm=Ad,im=hs;var GS={usingClientEntryPoint:!1,Events:[yo,Js,tl,nm,rm,Ad]},Ro={findFiberByHostInstance:ss,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},JS={bundleType:Ro.bundleType,version:Ro.version,rendererPackageName:Ro.rendererPackageName,rendererConfig:Ro.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:O.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=cm(i),i===null?null:i.stateNode},findFiberByHostInstance:Ro.findFiberByHostInstance||KS,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 Fl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fl.isDisabled&&Fl.supportsFiber)try{Da=Fl.inject(JS),tr=Fl}catch{}}return fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=GS,fn.createPortal=function(i,l){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Fd(l))throw Error(n(200));return HS(i,l,null,d)},fn.createRoot=function(i,l){if(!Fd(i))throw Error(n(299));var d=!1,m="",x=Dy;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onRecoverableError!==void 0&&(x=l.onRecoverableError)),l=Dd(i,1,!1,null,null,d,!1,m,x),i[hr]=l.current,po(i.nodeType===8?i.parentNode:i),new zd(l)},fn.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var l=i._reactInternals;if(l===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=cm(l),i=i===null?null:i.stateNode,i},fn.flushSync=function(i){return hs(i)},fn.hydrate=function(i,l,d){if(!Ml(l))throw Error(n(200));return zl(null,i,l,!0,d)},fn.hydrateRoot=function(i,l,d){if(!Fd(i))throw Error(n(405));var m=d!=null&&d.hydratedSources||null,x=!1,_="",E=Dy;if(d!=null&&(d.unstable_strictMode===!0&&(x=!0),d.identifierPrefix!==void 0&&(_=d.identifierPrefix),d.onRecoverableError!==void 0&&(E=d.onRecoverableError)),l=Ly(l,null,i,1,d??null,x,!1,_,E),i[hr]=l.current,po(i),m)for(i=0;i<m.length;i++)d=m[i],x=d._getVersion,x=x(d._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[d,x]:l.mutableSourceEagerHydrationData.push(d,x);return new Dl(l)},fn.render=function(i,l,d){if(!Ml(l))throw Error(n(200));return zl(null,i,l,!1,d)},fn.unmountComponentAtNode=function(i){if(!Ml(i))throw Error(n(40));return i._reactRootContainer?(hs(function(){zl(null,null,i,!1,function(){i._reactRootContainer=null,i[hr]=null})}),!0):!1},fn.unstable_batchedUpdates=Ad,fn.unstable_renderSubtreeIntoContainer=function(i,l,d,m){if(!Ml(d))throw Error(n(200));if(i==null||i._reactInternals===void 0)throw Error(n(38));return zl(i,l,d,!1,m)},fn.version="18.3.1-next-f1338f8080-20240426",fn}var Hy;function rj(){if(Hy)return Bd.exports;Hy=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(),Bd.exports=nj(),Bd.exports}var Ky;function sj(){if(Ky)return $l;Ky=1;var e=rj();return $l.createRoot=e.createRoot,$l.hydrateRoot=e.hydrateRoot,$l}var ij=sj();const oj=Ac(ij);var aj={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 lj=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),fe=(e,t)=>{const n=R.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:a,className:c="",children:u,...f},p)=>R.createElement("svg",{ref:p,...aj,width:s,height:s,stroke:r,strokeWidth:a?Number(o)*24/Number(s):o,className:["lucide",`lucide-${lj(e)}`,c].join(" "),...f},[...t.map(([g,y])=>R.createElement(g,y)),...Array.isArray(u)?u:[u]]));return n.displayName=`${e}`,n};const cj=fe("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);const kr=fe("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 Wy=fe("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 f_=fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const uj=fe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const dj=fe("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 p_=fe("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 hj=fe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);const m_=fe("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 fj=fe("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 pj=fe("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 mj=fe("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 gj=fe("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 Ns=fe("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 As=fe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Ls=fe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const yj=fe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const tc=fe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const g_=fe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const xj=fe("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const vj=fe("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);const Gy=fe("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 Li=fe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const y_=fe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const zf=fe("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 x_=fe("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 sa=fe("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 _j=fe("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 $h=fe("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 Bi=fe("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 Ii=fe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const bj=fe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const wj=fe("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 kj=fe("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const Oo=fe("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 Ff=fe("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 Jy=fe("HeartOff",[["line",{x1:"2",y1:"2",x2:"22",y2:"22",key:"1w4vcy"}],["path",{d:"M16.5 16.5 12 21l-7-7c-1.5-1.45-3-3.2-3-5.5a5.5 5.5 0 0 1 2.14-4.35",key:"3mpagl"}],["path",{d:"M8.76 3.1c1.15.22 2.13.78 3.24 1.9 1.5-1.5 2.74-2 4.5-2A5.5 5.5 0 0 1 22 8.5c0 2.12-1.3 3.78-2.67 5.17",key:"1gh3v3"}]]);const v_=fe("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 Sj=fe("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 jj=fe("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 Ej=fe("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 Cj=fe("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);const Tj=fe("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 Pt=fe("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Nj=fe("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 Xy=fe("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 Yy=fe("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 Aj=fe("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 Uh=fe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const Bh=fe("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);const Rj=fe("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 Pj=fe("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 Oj=fe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const Lj=fe("PauseCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);const Qy=fe("PlayCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);const Ij=fe("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);const $f=fe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const _a=fe("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 Vh=fe("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);const Dj=fe("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 wr=fe("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 ia=fe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const Mj=fe("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);const cc=fe("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 Uf=fe("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 zj=fe("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 Fj=fe("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);const $j=fe("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);const Uj=fe("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 qh=fe("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 uc=fe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const Bf=fe("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 Bj=fe("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 Pc=fe("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 Zy=fe("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 ex=fe("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 gs=fe("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 Tn=fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Vt=fe("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Vf=R.createContext({});function qf(e){const t=R.useRef(null);return t.current===null&&(t.current=e()),t.current}const Oc=R.createContext(null),Hf=R.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class Vj extends R.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 qj({children:e,isPresent:t}){const n=R.useId(),r=R.useRef(null),s=R.useRef({width:0,height:0,top:0,left:0}),{nonce:o}=R.useContext(Hf);return R.useInsertionEffect(()=>{const{width:a,height:c,top:u,left:f}=s.current;if(t||!r.current||!a||!c)return;r.current.dataset.motionPopId=n;const p=document.createElement("style");return o&&(p.nonce=o),document.head.appendChild(p),p.sheet&&p.sheet.insertRule(`
8
+ `+_.stack}return{value:i,source:l,stack:x,digest:null}}function ud(i,l,d){return{value:i,source:null,stack:d??null,digest:l??null}}function dd(i,l){try{console.error(l.value)}catch(d){setTimeout(function(){throw d})}}var jS=typeof WeakMap=="function"?WeakMap:Map;function Wg(i,l,d){d=yr(-1,d),d.tag=3,d.payload={element:null};var m=l.value;return d.callback=function(){El||(El=!0,Ed=m),dd(i,l)},d}function Gg(i,l,d){d=yr(-1,d),d.tag=3;var m=i.type.getDerivedStateFromError;if(typeof m=="function"){var x=l.value;d.payload=function(){return m(x)},d.callback=function(){dd(i,l)}}var _=i.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(d.callback=function(){dd(i,l),typeof m!="function"&&(Br===null?Br=new Set([this]):Br.add(this));var E=l.stack;this.componentDidCatch(l.value,{componentStack:E!==null?E:""})}),d}function Jg(i,l,d){var m=i.pingCache;if(m===null){m=i.pingCache=new jS;var x=new Set;m.set(l,x)}else x=m.get(l),x===void 0&&(x=new Set,m.set(l,x));x.has(d)||(x.add(d),i=FS.bind(null,i,l,d),l.then(i,i))}function Xg(i){do{var l;if((l=i.tag===13)&&(l=i.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return i;i=i.return}while(i!==null);return null}function Yg(i,l,d,m,x){return(i.mode&1)===0?(i===l?i.flags|=65536:(i.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(l=yr(-1,1),l.tag=2,$r(d,l,1))),d.lanes|=1),i):(i.flags|=65536,i.lanes=x,i)}var ES=O.ReactCurrentOwner,dn=!1;function nn(i,l,d,m){l.child=i===null?yg(l,null,d,m):ti(l,i.child,d,m)}function Qg(i,l,d,m,x){d=d.render;var _=l.ref;return ri(l,x),m=nd(i,l,d,m,_,x),d=rd(),i!==null&&!dn?(l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~x,xr(i,l,x)):(ft&&d&&Fu(l),l.flags|=1,nn(i,l,m,x),l.child)}function Zg(i,l,d,m,x){if(i===null){var _=d.type;return typeof _=="function"&&!Od(_)&&_.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(l.tag=15,l.type=_,ey(i,l,_,m,x)):(i=Pl(d.type,null,m,l,l.mode,x),i.ref=l.ref,i.return=l,l.child=i)}if(_=i.child,(i.lanes&x)===0){var E=_.memoizedProps;if(d=d.compare,d=d!==null?d:uo,d(E,m)&&i.ref===l.ref)return xr(i,l,x)}return l.flags|=1,i=Kr(_,m),i.ref=l.ref,i.return=l,l.child=i}function ey(i,l,d,m,x){if(i!==null){var _=i.memoizedProps;if(uo(_,m)&&i.ref===l.ref)if(dn=!1,l.pendingProps=m=_,(i.lanes&x)!==0)(i.flags&131072)!==0&&(dn=!0);else return l.lanes=i.lanes,xr(i,l,x)}return hd(i,l,d,m,x)}function ty(i,l,d){var m=l.pendingProps,x=m.children,_=i!==null?i.memoizedState:null;if(m.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},at(ai,wn),wn|=d;else{if((d&1073741824)===0)return i=_!==null?_.baseLanes|d:d,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:i,cachePool:null,transitions:null},l.updateQueue=null,at(ai,wn),wn|=i,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=_!==null?_.baseLanes:d,at(ai,wn),wn|=m}else _!==null?(m=_.baseLanes|d,l.memoizedState=null):m=d,at(ai,wn),wn|=m;return nn(i,l,x,d),l.child}function ny(i,l){var d=l.ref;(i===null&&d!==null||i!==null&&i.ref!==d)&&(l.flags|=512,l.flags|=2097152)}function hd(i,l,d,m,x){var _=un(d)?is:qt.current;return _=Ys(l,_),ri(l,x),d=nd(i,l,d,m,_,x),m=rd(),i!==null&&!dn?(l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~x,xr(i,l,x)):(ft&&m&&Fu(l),l.flags|=1,nn(i,l,d,x),l.child)}function ry(i,l,d,m,x){if(un(d)){var _=!0;rl(l)}else _=!1;if(ri(l,x),l.stateNode===null)bl(i,l),Hg(l,d,m),cd(l,d,m,x),m=!0;else if(i===null){var E=l.stateNode,I=l.memoizedProps;E.props=I;var z=E.context,q=d.contextType;typeof q=="object"&&q!==null?q=Ln(q):(q=un(d)?is:qt.current,q=Ys(l,q));var ie=d.getDerivedStateFromProps,oe=typeof ie=="function"||typeof E.getSnapshotBeforeUpdate=="function";oe||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(I!==m||z!==q)&&Kg(l,E,m,q),Fr=!1;var se=l.memoizedState;E.state=se,hl(l,m,E,x),z=l.memoizedState,I!==m||se!==z||cn.current||Fr?(typeof ie=="function"&&(ld(l,d,ie,m),z=l.memoizedState),(I=Fr||qg(l,d,I,m,se,z,q))?(oe||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(l.flags|=4194308)):(typeof E.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=z),E.props=m,E.state=z,E.context=q,m=I):(typeof E.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{E=l.stateNode,vg(i,l),I=l.memoizedProps,q=l.type===l.elementType?I:qn(l.type,I),E.props=q,oe=l.pendingProps,se=E.context,z=d.contextType,typeof z=="object"&&z!==null?z=Ln(z):(z=un(d)?is:qt.current,z=Ys(l,z));var ye=d.getDerivedStateFromProps;(ie=typeof ye=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(I!==oe||se!==z)&&Kg(l,E,m,z),Fr=!1,se=l.memoizedState,E.state=se,hl(l,m,E,x);var ke=l.memoizedState;I!==oe||se!==ke||cn.current||Fr?(typeof ye=="function"&&(ld(l,d,ye,m),ke=l.memoizedState),(q=Fr||qg(l,d,q,m,se,ke,z)||!1)?(ie||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(m,ke,z),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(m,ke,z)),typeof E.componentDidUpdate=="function"&&(l.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof E.componentDidUpdate!="function"||I===i.memoizedProps&&se===i.memoizedState||(l.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||I===i.memoizedProps&&se===i.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=ke),E.props=m,E.state=ke,E.context=z,m=q):(typeof E.componentDidUpdate!="function"||I===i.memoizedProps&&se===i.memoizedState||(l.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||I===i.memoizedProps&&se===i.memoizedState||(l.flags|=1024),m=!1)}return fd(i,l,d,m,_,x)}function fd(i,l,d,m,x,_){ny(i,l);var E=(l.flags&128)!==0;if(!m&&!E)return x&&lg(l,d,!1),xr(i,l,_);m=l.stateNode,ES.current=l;var I=E&&typeof d.getDerivedStateFromError!="function"?null:m.render();return l.flags|=1,i!==null&&E?(l.child=ti(l,i.child,null,_),l.child=ti(l,null,I,_)):nn(i,l,I,_),l.memoizedState=m.state,x&&lg(l,d,!0),l.child}function sy(i){var l=i.stateNode;l.pendingContext?og(i,l.pendingContext,l.pendingContext!==l.context):l.context&&og(i,l.context,!1),Xu(i,l.containerInfo)}function iy(i,l,d,m,x){return ei(),Vu(x),l.flags|=256,nn(i,l,d,m),l.child}var pd={dehydrated:null,treeContext:null,retryLane:0};function md(i){return{baseLanes:i,cachePool:null,transitions:null}}function oy(i,l,d){var m=l.pendingProps,x=pt.current,_=!1,E=(l.flags&128)!==0,I;if((I=E)||(I=i!==null&&i.memoizedState===null?!1:(x&2)!==0),I?(_=!0,l.flags&=-129):(i===null||i.memoizedState!==null)&&(x|=1),at(pt,x&1),i===null)return Bu(l),i=l.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((l.mode&1)===0?l.lanes=1:i.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(E=m.children,i=m.fallback,_?(m=l.mode,_=l.child,E={mode:"hidden",children:E},(m&1)===0&&_!==null?(_.childLanes=0,_.pendingProps=E):_=Ol(E,m,0,null),i=ms(i,m,d,null),_.return=l,i.return=l,_.sibling=i,l.child=_,l.child.memoizedState=md(d),l.memoizedState=pd,i):gd(l,E));if(x=i.memoizedState,x!==null&&(I=x.dehydrated,I!==null))return CS(i,l,E,m,I,x,d);if(_){_=m.fallback,E=l.mode,x=i.child,I=x.sibling;var z={mode:"hidden",children:m.children};return(E&1)===0&&l.child!==x?(m=l.child,m.childLanes=0,m.pendingProps=z,l.deletions=null):(m=Kr(x,z),m.subtreeFlags=x.subtreeFlags&14680064),I!==null?_=Kr(I,_):(_=ms(_,E,d,null),_.flags|=2),_.return=l,m.return=l,m.sibling=_,l.child=m,m=_,_=l.child,E=i.child.memoizedState,E=E===null?md(d):{baseLanes:E.baseLanes|d,cachePool:null,transitions:E.transitions},_.memoizedState=E,_.childLanes=i.childLanes&~d,l.memoizedState=pd,m}return _=i.child,i=_.sibling,m=Kr(_,{mode:"visible",children:m.children}),(l.mode&1)===0&&(m.lanes=d),m.return=l,m.sibling=null,i!==null&&(d=l.deletions,d===null?(l.deletions=[i],l.flags|=16):d.push(i)),l.child=m,l.memoizedState=null,m}function gd(i,l){return l=Ol({mode:"visible",children:l},i.mode,0,null),l.return=i,i.child=l}function _l(i,l,d,m){return m!==null&&Vu(m),ti(l,i.child,null,d),i=gd(l,l.pendingProps.children),i.flags|=2,l.memoizedState=null,i}function CS(i,l,d,m,x,_,E){if(d)return l.flags&256?(l.flags&=-257,m=ud(Error(n(422))),_l(i,l,E,m)):l.memoizedState!==null?(l.child=i.child,l.flags|=128,null):(_=m.fallback,x=l.mode,m=Ol({mode:"visible",children:m.children},x,0,null),_=ms(_,x,E,null),_.flags|=2,m.return=l,_.return=l,m.sibling=_,l.child=m,(l.mode&1)!==0&&ti(l,i.child,null,E),l.child.memoizedState=md(E),l.memoizedState=pd,_);if((l.mode&1)===0)return _l(i,l,E,null);if(x.data==="$!"){if(m=x.nextSibling&&x.nextSibling.dataset,m)var I=m.dgst;return m=I,_=Error(n(419)),m=ud(_,m,void 0),_l(i,l,E,m)}if(I=(E&i.childLanes)!==0,dn||I){if(m=It,m!==null){switch(E&-E){case 4:x=2;break;case 16:x=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:x=32;break;case 536870912:x=268435456;break;default:x=0}x=(x&(m.suspendedLanes|E))!==0?0:x,x!==0&&x!==_.retryLane&&(_.retryLane=x,gr(i,x),Wn(m,i,x,-1))}return Pd(),m=ud(Error(n(421))),_l(i,l,E,m)}return x.data==="$?"?(l.flags|=128,l.child=i.child,l=$S.bind(null,i),x._reactRetry=l,null):(i=_.treeContext,bn=Ir(x.nextSibling),_n=l,ft=!0,Vn=null,i!==null&&(Pn[On++]=pr,Pn[On++]=mr,Pn[On++]=os,pr=i.id,mr=i.overflow,os=l),l=gd(l,m.children),l.flags|=4096,l)}function ay(i,l,d){i.lanes|=l;var m=i.alternate;m!==null&&(m.lanes|=l),Wu(i.return,l,d)}function yd(i,l,d,m,x){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:d,tailMode:x}:(_.isBackwards=l,_.rendering=null,_.renderingStartTime=0,_.last=m,_.tail=d,_.tailMode=x)}function ly(i,l,d){var m=l.pendingProps,x=m.revealOrder,_=m.tail;if(nn(i,l,m.children,d),m=pt.current,(m&2)!==0)m=m&1|2,l.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=l.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&ay(i,d,l);else if(i.tag===19)ay(i,d,l);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break e;for(;i.sibling===null;){if(i.return===null||i.return===l)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}m&=1}if(at(pt,m),(l.mode&1)===0)l.memoizedState=null;else switch(x){case"forwards":for(d=l.child,x=null;d!==null;)i=d.alternate,i!==null&&fl(i)===null&&(x=d),d=d.sibling;d=x,d===null?(x=l.child,l.child=null):(x=d.sibling,d.sibling=null),yd(l,!1,x,d,_);break;case"backwards":for(d=null,x=l.child,l.child=null;x!==null;){if(i=x.alternate,i!==null&&fl(i)===null){l.child=x;break}i=x.sibling,x.sibling=d,d=x,x=i}yd(l,!0,d,null,_);break;case"together":yd(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function bl(i,l){(l.mode&1)===0&&i!==null&&(i.alternate=null,l.alternate=null,l.flags|=2)}function xr(i,l,d){if(i!==null&&(l.dependencies=i.dependencies),ds|=l.lanes,(d&l.childLanes)===0)return null;if(i!==null&&l.child!==i.child)throw Error(n(153));if(l.child!==null){for(i=l.child,d=Kr(i,i.pendingProps),l.child=d,d.return=l;i.sibling!==null;)i=i.sibling,d=d.sibling=Kr(i,i.pendingProps),d.return=l;d.sibling=null}return l.child}function TS(i,l,d){switch(l.tag){case 3:sy(l),ei();break;case 5:wg(l);break;case 1:un(l.type)&&rl(l);break;case 4:Xu(l,l.stateNode.containerInfo);break;case 10:var m=l.type._context,x=l.memoizedProps.value;at(cl,m._currentValue),m._currentValue=x;break;case 13:if(m=l.memoizedState,m!==null)return m.dehydrated!==null?(at(pt,pt.current&1),l.flags|=128,null):(d&l.child.childLanes)!==0?oy(i,l,d):(at(pt,pt.current&1),i=xr(i,l,d),i!==null?i.sibling:null);at(pt,pt.current&1);break;case 19:if(m=(d&l.childLanes)!==0,(i.flags&128)!==0){if(m)return ly(i,l,d);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),at(pt,pt.current),m)break;return null;case 22:case 23:return l.lanes=0,ty(i,l,d)}return xr(i,l,d)}var cy,xd,uy,dy;cy=function(i,l){for(var d=l.child;d!==null;){if(d.tag===5||d.tag===6)i.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},xd=function(){},uy=function(i,l,d,m){var x=i.memoizedProps;if(x!==m){i=l.stateNode,cs(rr.current);var _=null;switch(d){case"input":x=er(i,x),m=er(i,m),_=[];break;case"select":x=A({},x,{value:void 0}),m=A({},m,{value:void 0}),_=[];break;case"textarea":x=Se(i,x),m=Se(i,m),_=[];break;default:typeof x.onClick!="function"&&typeof m.onClick=="function"&&(i.onclick=el)}Ke(d,m);var E;d=null;for(q in x)if(!m.hasOwnProperty(q)&&x.hasOwnProperty(q)&&x[q]!=null)if(q==="style"){var I=x[q];for(E in I)I.hasOwnProperty(E)&&(d||(d={}),d[E]="")}else q!=="dangerouslySetInnerHTML"&&q!=="children"&&q!=="suppressContentEditableWarning"&&q!=="suppressHydrationWarning"&&q!=="autoFocus"&&(s.hasOwnProperty(q)?_||(_=[]):(_=_||[]).push(q,null));for(q in m){var z=m[q];if(I=x?.[q],m.hasOwnProperty(q)&&z!==I&&(z!=null||I!=null))if(q==="style")if(I){for(E in I)!I.hasOwnProperty(E)||z&&z.hasOwnProperty(E)||(d||(d={}),d[E]="");for(E in z)z.hasOwnProperty(E)&&I[E]!==z[E]&&(d||(d={}),d[E]=z[E])}else d||(_||(_=[]),_.push(q,d)),d=z;else q==="dangerouslySetInnerHTML"?(z=z?z.__html:void 0,I=I?I.__html:void 0,z!=null&&I!==z&&(_=_||[]).push(q,z)):q==="children"?typeof z!="string"&&typeof z!="number"||(_=_||[]).push(q,""+z):q!=="suppressContentEditableWarning"&&q!=="suppressHydrationWarning"&&(s.hasOwnProperty(q)?(z!=null&&q==="onScroll"&&ut("scroll",i),_||I===z||(_=[])):(_=_||[]).push(q,z))}d&&(_=_||[]).push("style",d);var q=_;(l.updateQueue=q)&&(l.flags|=4)}},dy=function(i,l,d,m){d!==m&&(l.flags|=4)};function Eo(i,l){if(!ft)switch(i.tailMode){case"hidden":l=i.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?i.tail=null:d.sibling=null;break;case"collapsed":d=i.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?l||i.tail===null?i.tail=null:i.tail.sibling=null:m.sibling=null}}function Kt(i){var l=i.alternate!==null&&i.alternate.child===i.child,d=0,m=0;if(l)for(var x=i.child;x!==null;)d|=x.lanes|x.childLanes,m|=x.subtreeFlags&14680064,m|=x.flags&14680064,x.return=i,x=x.sibling;else for(x=i.child;x!==null;)d|=x.lanes|x.childLanes,m|=x.subtreeFlags,m|=x.flags,x.return=i,x=x.sibling;return i.subtreeFlags|=m,i.childLanes=d,l}function NS(i,l,d){var m=l.pendingProps;switch($u(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(l),null;case 1:return un(l.type)&&nl(),Kt(l),null;case 3:return m=l.stateNode,si(),dt(cn),dt(qt),Zu(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(i===null||i.child===null)&&(al(l)?l.flags|=4:i===null||i.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Vn!==null&&(Nd(Vn),Vn=null))),xd(i,l),Kt(l),null;case 5:Yu(l);var x=cs(bo.current);if(d=l.type,i!==null&&l.stateNode!=null)uy(i,l,d,m,x),i.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!m){if(l.stateNode===null)throw Error(n(166));return Kt(l),null}if(i=cs(rr.current),al(l)){m=l.stateNode,d=l.type;var _=l.memoizedProps;switch(m[nr]=l,m[go]=_,i=(l.mode&1)!==0,d){case"dialog":ut("cancel",m),ut("close",m);break;case"iframe":case"object":case"embed":ut("load",m);break;case"video":case"audio":for(x=0;x<fo.length;x++)ut(fo[x],m);break;case"source":ut("error",m);break;case"img":case"image":case"link":ut("error",m),ut("load",m);break;case"details":ut("toggle",m);break;case"input":ee(m,_),ut("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!_.multiple},ut("invalid",m);break;case"textarea":Qe(m,_),ut("invalid",m)}Ke(d,_),x=null;for(var E in _)if(_.hasOwnProperty(E)){var I=_[E];E==="children"?typeof I=="string"?m.textContent!==I&&(_.suppressHydrationWarning!==!0&&Za(m.textContent,I,i),x=["children",I]):typeof I=="number"&&m.textContent!==""+I&&(_.suppressHydrationWarning!==!0&&Za(m.textContent,I,i),x=["children",""+I]):s.hasOwnProperty(E)&&I!=null&&E==="onScroll"&&ut("scroll",m)}switch(d){case"input":Ot(m),ge(m,_,!0);break;case"textarea":Ot(m),rt(m);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(m.onclick=el)}m=x,l.updateQueue=m,m!==null&&(l.flags|=4)}else{E=x.nodeType===9?x:x.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Z(d)),i==="http://www.w3.org/1999/xhtml"?d==="script"?(i=E.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof m.is=="string"?i=E.createElement(d,{is:m.is}):(i=E.createElement(d),d==="select"&&(E=i,m.multiple?E.multiple=!0:m.size&&(E.size=m.size))):i=E.createElementNS(i,d),i[nr]=l,i[go]=m,cy(i,l,!1,!1),l.stateNode=i;e:{switch(E=ln(d,m),d){case"dialog":ut("cancel",i),ut("close",i),x=m;break;case"iframe":case"object":case"embed":ut("load",i),x=m;break;case"video":case"audio":for(x=0;x<fo.length;x++)ut(fo[x],i);x=m;break;case"source":ut("error",i),x=m;break;case"img":case"image":case"link":ut("error",i),ut("load",i),x=m;break;case"details":ut("toggle",i),x=m;break;case"input":ee(i,m),x=er(i,m),ut("invalid",i);break;case"option":x=m;break;case"select":i._wrapperState={wasMultiple:!!m.multiple},x=A({},m,{value:void 0}),ut("invalid",i);break;case"textarea":Qe(i,m),x=Se(i,m),ut("invalid",i);break;default:x=m}Ke(d,x),I=x;for(_ in I)if(I.hasOwnProperty(_)){var z=I[_];_==="style"?an(i,z):_==="dangerouslySetInnerHTML"?(z=z?z.__html:void 0,z!=null&&Ue(i,z)):_==="children"?typeof z=="string"?(d!=="textarea"||z!=="")&&qe(i,z):typeof z=="number"&&qe(i,""+z):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(s.hasOwnProperty(_)?z!=null&&_==="onScroll"&&ut("scroll",i):z!=null&&j(i,_,z,E))}switch(d){case"input":Ot(i),ge(i,m,!1);break;case"textarea":Ot(i),rt(i);break;case"option":m.value!=null&&i.setAttribute("value",""+_e(m.value));break;case"select":i.multiple=!!m.multiple,_=m.value,_!=null?$e(i,!!m.multiple,_,!1):m.defaultValue!=null&&$e(i,!!m.multiple,m.defaultValue,!0);break;default:typeof x.onClick=="function"&&(i.onclick=el)}switch(d){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Kt(l),null;case 6:if(i&&l.stateNode!=null)dy(i,l,i.memoizedProps,m);else{if(typeof m!="string"&&l.stateNode===null)throw Error(n(166));if(d=cs(bo.current),cs(rr.current),al(l)){if(m=l.stateNode,d=l.memoizedProps,m[nr]=l,(_=m.nodeValue!==d)&&(i=_n,i!==null))switch(i.tag){case 3:Za(m.nodeValue,d,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&Za(m.nodeValue,d,(i.mode&1)!==0)}_&&(l.flags|=4)}else m=(d.nodeType===9?d:d.ownerDocument).createTextNode(m),m[nr]=l,l.stateNode=m}return Kt(l),null;case 13:if(dt(pt),m=l.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(ft&&bn!==null&&(l.mode&1)!==0&&(l.flags&128)===0)pg(),ei(),l.flags|=98560,_=!1;else if(_=al(l),m!==null&&m.dehydrated!==null){if(i===null){if(!_)throw Error(n(318));if(_=l.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));_[nr]=l}else ei(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Kt(l),_=!1}else Vn!==null&&(Nd(Vn),Vn=null),_=!0;if(!_)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=d,l):(m=m!==null,m!==(i!==null&&i.memoizedState!==null)&&m&&(l.child.flags|=8192,(l.mode&1)!==0&&(i===null||(pt.current&1)!==0?Nt===0&&(Nt=3):Pd())),l.updateQueue!==null&&(l.flags|=4),Kt(l),null);case 4:return si(),xd(i,l),i===null&&po(l.stateNode.containerInfo),Kt(l),null;case 10:return Ku(l.type._context),Kt(l),null;case 17:return un(l.type)&&nl(),Kt(l),null;case 19:if(dt(pt),_=l.memoizedState,_===null)return Kt(l),null;if(m=(l.flags&128)!==0,E=_.rendering,E===null)if(m)Eo(_,!1);else{if(Nt!==0||i!==null&&(i.flags&128)!==0)for(i=l.child;i!==null;){if(E=fl(i),E!==null){for(l.flags|=128,Eo(_,!1),m=E.updateQueue,m!==null&&(l.updateQueue=m,l.flags|=4),l.subtreeFlags=0,m=d,d=l.child;d!==null;)_=d,i=m,_.flags&=14680066,E=_.alternate,E===null?(_.childLanes=0,_.lanes=i,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=E.childLanes,_.lanes=E.lanes,_.child=E.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=E.memoizedProps,_.memoizedState=E.memoizedState,_.updateQueue=E.updateQueue,_.type=E.type,i=E.dependencies,_.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),d=d.sibling;return at(pt,pt.current&1|2),l.child}i=i.sibling}_.tail!==null&&bt()>li&&(l.flags|=128,m=!0,Eo(_,!1),l.lanes=4194304)}else{if(!m)if(i=fl(E),i!==null){if(l.flags|=128,m=!0,d=i.updateQueue,d!==null&&(l.updateQueue=d,l.flags|=4),Eo(_,!0),_.tail===null&&_.tailMode==="hidden"&&!E.alternate&&!ft)return Kt(l),null}else 2*bt()-_.renderingStartTime>li&&d!==1073741824&&(l.flags|=128,m=!0,Eo(_,!1),l.lanes=4194304);_.isBackwards?(E.sibling=l.child,l.child=E):(d=_.last,d!==null?d.sibling=E:l.child=E,_.last=E)}return _.tail!==null?(l=_.tail,_.rendering=l,_.tail=l.sibling,_.renderingStartTime=bt(),l.sibling=null,d=pt.current,at(pt,m?d&1|2:d&1),l):(Kt(l),null);case 22:case 23:return Rd(),m=l.memoizedState!==null,i!==null&&i.memoizedState!==null!==m&&(l.flags|=8192),m&&(l.mode&1)!==0?(wn&1073741824)!==0&&(Kt(l),l.subtreeFlags&6&&(l.flags|=8192)):Kt(l),null;case 24:return null;case 25:return null}throw Error(n(156,l.tag))}function AS(i,l){switch($u(l),l.tag){case 1:return un(l.type)&&nl(),i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 3:return si(),dt(cn),dt(qt),Zu(),i=l.flags,(i&65536)!==0&&(i&128)===0?(l.flags=i&-65537|128,l):null;case 5:return Yu(l),null;case 13:if(dt(pt),i=l.memoizedState,i!==null&&i.dehydrated!==null){if(l.alternate===null)throw Error(n(340));ei()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 19:return dt(pt),null;case 4:return si(),null;case 10:return Ku(l.type._context),null;case 22:case 23:return Rd(),null;case 24:return null;default:return null}}var wl=!1,Wt=!1,RS=typeof WeakSet=="function"?WeakSet:Set,xe=null;function oi(i,l){var d=i.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){xt(i,l,m)}else d.current=null}function vd(i,l,d){try{d()}catch(m){xt(i,l,m)}}var hy=!1;function PS(i,l){if(Ru=Ba,i=qm(),ku(i)){if("selectionStart"in i)var d={start:i.selectionStart,end:i.selectionEnd};else e:{d=(d=i.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var x=m.anchorOffset,_=m.focusNode;m=m.focusOffset;try{d.nodeType,_.nodeType}catch{d=null;break e}var E=0,I=-1,z=-1,q=0,ie=0,oe=i,se=null;t:for(;;){for(var ye;oe!==d||x!==0&&oe.nodeType!==3||(I=E+x),oe!==_||m!==0&&oe.nodeType!==3||(z=E+m),oe.nodeType===3&&(E+=oe.nodeValue.length),(ye=oe.firstChild)!==null;)se=oe,oe=ye;for(;;){if(oe===i)break t;if(se===d&&++q===x&&(I=E),se===_&&++ie===m&&(z=E),(ye=oe.nextSibling)!==null)break;oe=se,se=oe.parentNode}oe=ye}d=I===-1||z===-1?null:{start:I,end:z}}else d=null}d=d||{start:0,end:0}}else d=null;for(Pu={focusedElem:i,selectionRange:d},Ba=!1,xe=l;xe!==null;)if(l=xe,i=l.child,(l.subtreeFlags&1028)!==0&&i!==null)i.return=l,xe=i;else for(;xe!==null;){l=xe;try{var ke=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(ke!==null){var Ee=ke.memoizedProps,wt=ke.memoizedState,$=l.stateNode,F=$.getSnapshotBeforeUpdate(l.elementType===l.type?Ee:qn(l.type,Ee),wt);$.__reactInternalSnapshotBeforeUpdate=F}break;case 3:var B=l.stateNode.containerInfo;B.nodeType===1?B.textContent="":B.nodeType===9&&B.documentElement&&B.removeChild(B.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(de){xt(l,l.return,de)}if(i=l.sibling,i!==null){i.return=l.return,xe=i;break}xe=l.return}return ke=hy,hy=!1,ke}function Co(i,l,d){var m=l.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var x=m=m.next;do{if((x.tag&i)===i){var _=x.destroy;x.destroy=void 0,_!==void 0&&vd(l,d,_)}x=x.next}while(x!==m)}}function kl(i,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var d=l=l.next;do{if((d.tag&i)===i){var m=d.create;d.destroy=m()}d=d.next}while(d!==l)}}function _d(i){var l=i.ref;if(l!==null){var d=i.stateNode;i.tag,i=d,typeof l=="function"?l(i):l.current=i}}function fy(i){var l=i.alternate;l!==null&&(i.alternate=null,fy(l)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(l=i.stateNode,l!==null&&(delete l[nr],delete l[go],delete l[Du],delete l[pS],delete l[mS])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function py(i){return i.tag===5||i.tag===3||i.tag===4}function my(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||py(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function bd(i,l,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,l?d.nodeType===8?d.parentNode.insertBefore(i,l):d.insertBefore(i,l):(d.nodeType===8?(l=d.parentNode,l.insertBefore(i,d)):(l=d,l.appendChild(i)),d=d._reactRootContainer,d!=null||l.onclick!==null||(l.onclick=el));else if(m!==4&&(i=i.child,i!==null))for(bd(i,l,d),i=i.sibling;i!==null;)bd(i,l,d),i=i.sibling}function wd(i,l,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,l?d.insertBefore(i,l):d.appendChild(i);else if(m!==4&&(i=i.child,i!==null))for(wd(i,l,d),i=i.sibling;i!==null;)wd(i,l,d),i=i.sibling}var zt=null,Hn=!1;function Ur(i,l,d){for(d=d.child;d!==null;)gy(i,l,d),d=d.sibling}function gy(i,l,d){if(tr&&typeof tr.onCommitFiberUnmount=="function")try{tr.onCommitFiberUnmount(Da,d)}catch{}switch(d.tag){case 5:Wt||oi(d,l);case 6:var m=zt,x=Hn;zt=null,Ur(i,l,d),zt=m,Hn=x,zt!==null&&(Hn?(i=zt,d=d.stateNode,i.nodeType===8?i.parentNode.removeChild(d):i.removeChild(d)):zt.removeChild(d.stateNode));break;case 18:zt!==null&&(Hn?(i=zt,d=d.stateNode,i.nodeType===8?Iu(i.parentNode,d):i.nodeType===1&&Iu(i,d),so(i)):Iu(zt,d.stateNode));break;case 4:m=zt,x=Hn,zt=d.stateNode.containerInfo,Hn=!0,Ur(i,l,d),zt=m,Hn=x;break;case 0:case 11:case 14:case 15:if(!Wt&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){x=m=m.next;do{var _=x,E=_.destroy;_=_.tag,E!==void 0&&((_&2)!==0||(_&4)!==0)&&vd(d,l,E),x=x.next}while(x!==m)}Ur(i,l,d);break;case 1:if(!Wt&&(oi(d,l),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(I){xt(d,l,I)}Ur(i,l,d);break;case 21:Ur(i,l,d);break;case 22:d.mode&1?(Wt=(m=Wt)||d.memoizedState!==null,Ur(i,l,d),Wt=m):Ur(i,l,d);break;default:Ur(i,l,d)}}function yy(i){var l=i.updateQueue;if(l!==null){i.updateQueue=null;var d=i.stateNode;d===null&&(d=i.stateNode=new RS),l.forEach(function(m){var x=US.bind(null,i,m);d.has(m)||(d.add(m),m.then(x,x))})}}function Kn(i,l){var d=l.deletions;if(d!==null)for(var m=0;m<d.length;m++){var x=d[m];try{var _=i,E=l,I=E;e:for(;I!==null;){switch(I.tag){case 5:zt=I.stateNode,Hn=!1;break e;case 3:zt=I.stateNode.containerInfo,Hn=!0;break e;case 4:zt=I.stateNode.containerInfo,Hn=!0;break e}I=I.return}if(zt===null)throw Error(n(160));gy(_,E,x),zt=null,Hn=!1;var z=x.alternate;z!==null&&(z.return=null),x.return=null}catch(q){xt(x,l,q)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)xy(l,i),l=l.sibling}function xy(i,l){var d=i.alternate,m=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(Kn(l,i),ir(i),m&4){try{Co(3,i,i.return),kl(3,i)}catch(Ee){xt(i,i.return,Ee)}try{Co(5,i,i.return)}catch(Ee){xt(i,i.return,Ee)}}break;case 1:Kn(l,i),ir(i),m&512&&d!==null&&oi(d,d.return);break;case 5:if(Kn(l,i),ir(i),m&512&&d!==null&&oi(d,d.return),i.flags&32){var x=i.stateNode;try{qe(x,"")}catch(Ee){xt(i,i.return,Ee)}}if(m&4&&(x=i.stateNode,x!=null)){var _=i.memoizedProps,E=d!==null?d.memoizedProps:_,I=i.type,z=i.updateQueue;if(i.updateQueue=null,z!==null)try{I==="input"&&_.type==="radio"&&_.name!=null&&Me(x,_),ln(I,E);var q=ln(I,_);for(E=0;E<z.length;E+=2){var ie=z[E],oe=z[E+1];ie==="style"?an(x,oe):ie==="dangerouslySetInnerHTML"?Ue(x,oe):ie==="children"?qe(x,oe):j(x,ie,oe,q)}switch(I){case"input":te(x,_);break;case"textarea":nt(x,_);break;case"select":var se=x._wrapperState.wasMultiple;x._wrapperState.wasMultiple=!!_.multiple;var ye=_.value;ye!=null?$e(x,!!_.multiple,ye,!1):se!==!!_.multiple&&(_.defaultValue!=null?$e(x,!!_.multiple,_.defaultValue,!0):$e(x,!!_.multiple,_.multiple?[]:"",!1))}x[go]=_}catch(Ee){xt(i,i.return,Ee)}}break;case 6:if(Kn(l,i),ir(i),m&4){if(i.stateNode===null)throw Error(n(162));x=i.stateNode,_=i.memoizedProps;try{x.nodeValue=_}catch(Ee){xt(i,i.return,Ee)}}break;case 3:if(Kn(l,i),ir(i),m&4&&d!==null&&d.memoizedState.isDehydrated)try{so(l.containerInfo)}catch(Ee){xt(i,i.return,Ee)}break;case 4:Kn(l,i),ir(i);break;case 13:Kn(l,i),ir(i),x=i.child,x.flags&8192&&(_=x.memoizedState!==null,x.stateNode.isHidden=_,!_||x.alternate!==null&&x.alternate.memoizedState!==null||(jd=bt())),m&4&&yy(i);break;case 22:if(ie=d!==null&&d.memoizedState!==null,i.mode&1?(Wt=(q=Wt)||ie,Kn(l,i),Wt=q):Kn(l,i),ir(i),m&8192){if(q=i.memoizedState!==null,(i.stateNode.isHidden=q)&&!ie&&(i.mode&1)!==0)for(xe=i,ie=i.child;ie!==null;){for(oe=xe=ie;xe!==null;){switch(se=xe,ye=se.child,se.tag){case 0:case 11:case 14:case 15:Co(4,se,se.return);break;case 1:oi(se,se.return);var ke=se.stateNode;if(typeof ke.componentWillUnmount=="function"){m=se,d=se.return;try{l=m,ke.props=l.memoizedProps,ke.state=l.memoizedState,ke.componentWillUnmount()}catch(Ee){xt(m,d,Ee)}}break;case 5:oi(se,se.return);break;case 22:if(se.memoizedState!==null){by(oe);continue}}ye!==null?(ye.return=se,xe=ye):by(oe)}ie=ie.sibling}e:for(ie=null,oe=i;;){if(oe.tag===5){if(ie===null){ie=oe;try{x=oe.stateNode,q?(_=x.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(I=oe.stateNode,z=oe.memoizedProps.style,E=z!=null&&z.hasOwnProperty("display")?z.display:null,I.style.display=St("display",E))}catch(Ee){xt(i,i.return,Ee)}}}else if(oe.tag===6){if(ie===null)try{oe.stateNode.nodeValue=q?"":oe.memoizedProps}catch(Ee){xt(i,i.return,Ee)}}else if((oe.tag!==22&&oe.tag!==23||oe.memoizedState===null||oe===i)&&oe.child!==null){oe.child.return=oe,oe=oe.child;continue}if(oe===i)break e;for(;oe.sibling===null;){if(oe.return===null||oe.return===i)break e;ie===oe&&(ie=null),oe=oe.return}ie===oe&&(ie=null),oe.sibling.return=oe.return,oe=oe.sibling}}break;case 19:Kn(l,i),ir(i),m&4&&yy(i);break;case 21:break;default:Kn(l,i),ir(i)}}function ir(i){var l=i.flags;if(l&2){try{e:{for(var d=i.return;d!==null;){if(py(d)){var m=d;break e}d=d.return}throw Error(n(160))}switch(m.tag){case 5:var x=m.stateNode;m.flags&32&&(qe(x,""),m.flags&=-33);var _=my(i);wd(i,_,x);break;case 3:case 4:var E=m.stateNode.containerInfo,I=my(i);bd(i,I,E);break;default:throw Error(n(161))}}catch(z){xt(i,i.return,z)}i.flags&=-3}l&4096&&(i.flags&=-4097)}function OS(i,l,d){xe=i,vy(i)}function vy(i,l,d){for(var m=(i.mode&1)!==0;xe!==null;){var x=xe,_=x.child;if(x.tag===22&&m){var E=x.memoizedState!==null||wl;if(!E){var I=x.alternate,z=I!==null&&I.memoizedState!==null||Wt;I=wl;var q=Wt;if(wl=E,(Wt=z)&&!q)for(xe=x;xe!==null;)E=xe,z=E.child,E.tag===22&&E.memoizedState!==null?wy(x):z!==null?(z.return=E,xe=z):wy(x);for(;_!==null;)xe=_,vy(_),_=_.sibling;xe=x,wl=I,Wt=q}_y(i)}else(x.subtreeFlags&8772)!==0&&_!==null?(_.return=x,xe=_):_y(i)}}function _y(i){for(;xe!==null;){var l=xe;if((l.flags&8772)!==0){var d=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:Wt||kl(5,l);break;case 1:var m=l.stateNode;if(l.flags&4&&!Wt)if(d===null)m.componentDidMount();else{var x=l.elementType===l.type?d.memoizedProps:qn(l.type,d.memoizedProps);m.componentDidUpdate(x,d.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var _=l.updateQueue;_!==null&&bg(l,_,m);break;case 3:var E=l.updateQueue;if(E!==null){if(d=null,l.child!==null)switch(l.child.tag){case 5:d=l.child.stateNode;break;case 1:d=l.child.stateNode}bg(l,E,d)}break;case 5:var I=l.stateNode;if(d===null&&l.flags&4){d=I;var z=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":z.autoFocus&&d.focus();break;case"img":z.src&&(d.src=z.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var q=l.alternate;if(q!==null){var ie=q.memoizedState;if(ie!==null){var oe=ie.dehydrated;oe!==null&&so(oe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Wt||l.flags&512&&_d(l)}catch(se){xt(l,l.return,se)}}if(l===i){xe=null;break}if(d=l.sibling,d!==null){d.return=l.return,xe=d;break}xe=l.return}}function by(i){for(;xe!==null;){var l=xe;if(l===i){xe=null;break}var d=l.sibling;if(d!==null){d.return=l.return,xe=d;break}xe=l.return}}function wy(i){for(;xe!==null;){var l=xe;try{switch(l.tag){case 0:case 11:case 15:var d=l.return;try{kl(4,l)}catch(z){xt(l,d,z)}break;case 1:var m=l.stateNode;if(typeof m.componentDidMount=="function"){var x=l.return;try{m.componentDidMount()}catch(z){xt(l,x,z)}}var _=l.return;try{_d(l)}catch(z){xt(l,_,z)}break;case 5:var E=l.return;try{_d(l)}catch(z){xt(l,E,z)}}}catch(z){xt(l,l.return,z)}if(l===i){xe=null;break}var I=l.sibling;if(I!==null){I.return=l.return,xe=I;break}xe=l.return}}var LS=Math.ceil,Sl=O.ReactCurrentDispatcher,kd=O.ReactCurrentOwner,Dn=O.ReactCurrentBatchConfig,Ye=0,It=null,jt=null,Ft=0,wn=0,ai=Dr(0),Nt=0,To=null,ds=0,jl=0,Sd=0,No=null,hn=null,jd=0,li=1/0,vr=null,El=!1,Ed=null,Br=null,Cl=!1,Vr=null,Tl=0,Ao=0,Cd=null,Nl=-1,Al=0;function rn(){return(Ye&6)!==0?bt():Nl!==-1?Nl:Nl=bt()}function qr(i){return(i.mode&1)===0?1:(Ye&2)!==0&&Ft!==0?Ft&-Ft:yS.transition!==null?(Al===0&&(Al=mm()),Al):(i=st,i!==0||(i=window.event,i=i===void 0?16:Sm(i.type)),i)}function Wn(i,l,d,m){if(50<Ao)throw Ao=0,Cd=null,Error(n(185));Zi(i,d,m),((Ye&2)===0||i!==It)&&(i===It&&((Ye&2)===0&&(jl|=d),Nt===4&&Hr(i,Ft)),fn(i,m),d===1&&Ye===0&&(l.mode&1)===0&&(li=bt()+500,sl&&zr()))}function fn(i,l){var d=i.callbackNode;y1(i,l);var m=Fa(i,i===It?Ft:0);if(m===0)d!==null&&hm(d),i.callbackNode=null,i.callbackPriority=0;else if(l=m&-m,i.callbackPriority!==l){if(d!=null&&hm(d),l===1)i.tag===0?gS(Sy.bind(null,i)):cg(Sy.bind(null,i)),hS(function(){(Ye&6)===0&&zr()}),d=null;else{switch(gm(m)){case 1:d=ou;break;case 4:d=fm;break;case 16:d=Ia;break;case 536870912:d=pm;break;default:d=Ia}d=Py(d,ky.bind(null,i))}i.callbackPriority=l,i.callbackNode=d}}function ky(i,l){if(Nl=-1,Al=0,(Ye&6)!==0)throw Error(n(327));var d=i.callbackNode;if(ci()&&i.callbackNode!==d)return null;var m=Fa(i,i===It?Ft:0);if(m===0)return null;if((m&30)!==0||(m&i.expiredLanes)!==0||l)l=Rl(i,m);else{l=m;var x=Ye;Ye|=2;var _=Ey();(It!==i||Ft!==l)&&(vr=null,li=bt()+500,fs(i,l));do try{MS();break}catch(I){jy(i,I)}while(!0);Hu(),Sl.current=_,Ye=x,jt!==null?l=0:(It=null,Ft=0,l=Nt)}if(l!==0){if(l===2&&(x=au(i),x!==0&&(m=x,l=Td(i,x))),l===1)throw d=To,fs(i,0),Hr(i,m),fn(i,bt()),d;if(l===6)Hr(i,m);else{if(x=i.current.alternate,(m&30)===0&&!IS(x)&&(l=Rl(i,m),l===2&&(_=au(i),_!==0&&(m=_,l=Td(i,_))),l===1))throw d=To,fs(i,0),Hr(i,m),fn(i,bt()),d;switch(i.finishedWork=x,i.finishedLanes=m,l){case 0:case 1:throw Error(n(345));case 2:ps(i,hn,vr);break;case 3:if(Hr(i,m),(m&130023424)===m&&(l=jd+500-bt(),10<l)){if(Fa(i,0)!==0)break;if(x=i.suspendedLanes,(x&m)!==m){rn(),i.pingedLanes|=i.suspendedLanes&x;break}i.timeoutHandle=Lu(ps.bind(null,i,hn,vr),l);break}ps(i,hn,vr);break;case 4:if(Hr(i,m),(m&4194240)===m)break;for(l=i.eventTimes,x=-1;0<m;){var E=31-Un(m);_=1<<E,E=l[E],E>x&&(x=E),m&=~_}if(m=x,m=bt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*LS(m/1960))-m,10<m){i.timeoutHandle=Lu(ps.bind(null,i,hn,vr),m);break}ps(i,hn,vr);break;case 5:ps(i,hn,vr);break;default:throw Error(n(329))}}}return fn(i,bt()),i.callbackNode===d?ky.bind(null,i):null}function Td(i,l){var d=No;return i.current.memoizedState.isDehydrated&&(fs(i,l).flags|=256),i=Rl(i,l),i!==2&&(l=hn,hn=d,l!==null&&Nd(l)),i}function Nd(i){hn===null?hn=i:hn.push.apply(hn,i)}function IS(i){for(var l=i;;){if(l.flags&16384){var d=l.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var m=0;m<d.length;m++){var x=d[m],_=x.getSnapshot;x=x.value;try{if(!Bn(_(),x))return!1}catch{return!1}}}if(d=l.child,l.subtreeFlags&16384&&d!==null)d.return=l,l=d;else{if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Hr(i,l){for(l&=~Sd,l&=~jl,i.suspendedLanes|=l,i.pingedLanes&=~l,i=i.expirationTimes;0<l;){var d=31-Un(l),m=1<<d;i[d]=-1,l&=~m}}function Sy(i){if((Ye&6)!==0)throw Error(n(327));ci();var l=Fa(i,0);if((l&1)===0)return fn(i,bt()),null;var d=Rl(i,l);if(i.tag!==0&&d===2){var m=au(i);m!==0&&(l=m,d=Td(i,m))}if(d===1)throw d=To,fs(i,0),Hr(i,l),fn(i,bt()),d;if(d===6)throw Error(n(345));return i.finishedWork=i.current.alternate,i.finishedLanes=l,ps(i,hn,vr),fn(i,bt()),null}function Ad(i,l){var d=Ye;Ye|=1;try{return i(l)}finally{Ye=d,Ye===0&&(li=bt()+500,sl&&zr())}}function hs(i){Vr!==null&&Vr.tag===0&&(Ye&6)===0&&ci();var l=Ye;Ye|=1;var d=Dn.transition,m=st;try{if(Dn.transition=null,st=1,i)return i()}finally{st=m,Dn.transition=d,Ye=l,(Ye&6)===0&&zr()}}function Rd(){wn=ai.current,dt(ai)}function fs(i,l){i.finishedWork=null,i.finishedLanes=0;var d=i.timeoutHandle;if(d!==-1&&(i.timeoutHandle=-1,dS(d)),jt!==null)for(d=jt.return;d!==null;){var m=d;switch($u(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&nl();break;case 3:si(),dt(cn),dt(qt),Zu();break;case 5:Yu(m);break;case 4:si();break;case 13:dt(pt);break;case 19:dt(pt);break;case 10:Ku(m.type._context);break;case 22:case 23:Rd()}d=d.return}if(It=i,jt=i=Kr(i.current,null),Ft=wn=l,Nt=0,To=null,Sd=jl=ds=0,hn=No=null,ls!==null){for(l=0;l<ls.length;l++)if(d=ls[l],m=d.interleaved,m!==null){d.interleaved=null;var x=m.next,_=d.pending;if(_!==null){var E=_.next;_.next=x,m.next=E}d.pending=m}ls=null}return i}function jy(i,l){do{var d=jt;try{if(Hu(),pl.current=xl,ml){for(var m=mt.memoizedState;m!==null;){var x=m.queue;x!==null&&(x.pending=null),m=m.next}ml=!1}if(us=0,Lt=Tt=mt=null,wo=!1,ko=0,kd.current=null,d===null||d.return===null){Nt=1,To=l,jt=null;break}e:{var _=i,E=d.return,I=d,z=l;if(l=Ft,I.flags|=32768,z!==null&&typeof z=="object"&&typeof z.then=="function"){var q=z,ie=I,oe=ie.tag;if((ie.mode&1)===0&&(oe===0||oe===11||oe===15)){var se=ie.alternate;se?(ie.updateQueue=se.updateQueue,ie.memoizedState=se.memoizedState,ie.lanes=se.lanes):(ie.updateQueue=null,ie.memoizedState=null)}var ye=Xg(E);if(ye!==null){ye.flags&=-257,Yg(ye,E,I,_,l),ye.mode&1&&Jg(_,q,l),l=ye,z=q;var ke=l.updateQueue;if(ke===null){var Ee=new Set;Ee.add(z),l.updateQueue=Ee}else ke.add(z);break e}else{if((l&1)===0){Jg(_,q,l),Pd();break e}z=Error(n(426))}}else if(ft&&I.mode&1){var wt=Xg(E);if(wt!==null){(wt.flags&65536)===0&&(wt.flags|=256),Yg(wt,E,I,_,l),Vu(ii(z,I));break e}}_=z=ii(z,I),Nt!==4&&(Nt=2),No===null?No=[_]:No.push(_),_=E;do{switch(_.tag){case 3:_.flags|=65536,l&=-l,_.lanes|=l;var $=Wg(_,z,l);_g(_,$);break e;case 1:I=z;var F=_.type,B=_.stateNode;if((_.flags&128)===0&&(typeof F.getDerivedStateFromError=="function"||B!==null&&typeof B.componentDidCatch=="function"&&(Br===null||!Br.has(B)))){_.flags|=65536,l&=-l,_.lanes|=l;var de=Gg(_,I,l);_g(_,de);break e}}_=_.return}while(_!==null)}Ty(d)}catch(Ce){l=Ce,jt===d&&d!==null&&(jt=d=d.return);continue}break}while(!0)}function Ey(){var i=Sl.current;return Sl.current=xl,i===null?xl:i}function Pd(){(Nt===0||Nt===3||Nt===2)&&(Nt=4),It===null||(ds&268435455)===0&&(jl&268435455)===0||Hr(It,Ft)}function Rl(i,l){var d=Ye;Ye|=2;var m=Ey();(It!==i||Ft!==l)&&(vr=null,fs(i,l));do try{DS();break}catch(x){jy(i,x)}while(!0);if(Hu(),Ye=d,Sl.current=m,jt!==null)throw Error(n(261));return It=null,Ft=0,Nt}function DS(){for(;jt!==null;)Cy(jt)}function MS(){for(;jt!==null&&!l1();)Cy(jt)}function Cy(i){var l=Ry(i.alternate,i,wn);i.memoizedProps=i.pendingProps,l===null?Ty(i):jt=l,kd.current=null}function Ty(i){var l=i;do{var d=l.alternate;if(i=l.return,(l.flags&32768)===0){if(d=NS(d,l,wn),d!==null){jt=d;return}}else{if(d=AS(d,l),d!==null){d.flags&=32767,jt=d;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{Nt=6,jt=null;return}}if(l=l.sibling,l!==null){jt=l;return}jt=l=i}while(l!==null);Nt===0&&(Nt=5)}function ps(i,l,d){var m=st,x=Dn.transition;try{Dn.transition=null,st=1,zS(i,l,d,m)}finally{Dn.transition=x,st=m}return null}function zS(i,l,d,m){do ci();while(Vr!==null);if((Ye&6)!==0)throw Error(n(327));d=i.finishedWork;var x=i.finishedLanes;if(d===null)return null;if(i.finishedWork=null,i.finishedLanes=0,d===i.current)throw Error(n(177));i.callbackNode=null,i.callbackPriority=0;var _=d.lanes|d.childLanes;if(x1(i,_),i===It&&(jt=It=null,Ft=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Cl||(Cl=!0,Py(Ia,function(){return ci(),null})),_=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||_){_=Dn.transition,Dn.transition=null;var E=st;st=1;var I=Ye;Ye|=4,kd.current=null,PS(i,d),xy(d,i),sS(Pu),Ba=!!Ru,Pu=Ru=null,i.current=d,OS(d),c1(),Ye=I,st=E,Dn.transition=_}else i.current=d;if(Cl&&(Cl=!1,Vr=i,Tl=x),_=i.pendingLanes,_===0&&(Br=null),h1(d.stateNode),fn(i,bt()),l!==null)for(m=i.onRecoverableError,d=0;d<l.length;d++)x=l[d],m(x.value,{componentStack:x.stack,digest:x.digest});if(El)throw El=!1,i=Ed,Ed=null,i;return(Tl&1)!==0&&i.tag!==0&&ci(),_=i.pendingLanes,(_&1)!==0?i===Cd?Ao++:(Ao=0,Cd=i):Ao=0,zr(),null}function ci(){if(Vr!==null){var i=gm(Tl),l=Dn.transition,d=st;try{if(Dn.transition=null,st=16>i?16:i,Vr===null)var m=!1;else{if(i=Vr,Vr=null,Tl=0,(Ye&6)!==0)throw Error(n(331));var x=Ye;for(Ye|=4,xe=i.current;xe!==null;){var _=xe,E=_.child;if((xe.flags&16)!==0){var I=_.deletions;if(I!==null){for(var z=0;z<I.length;z++){var q=I[z];for(xe=q;xe!==null;){var ie=xe;switch(ie.tag){case 0:case 11:case 15:Co(8,ie,_)}var oe=ie.child;if(oe!==null)oe.return=ie,xe=oe;else for(;xe!==null;){ie=xe;var se=ie.sibling,ye=ie.return;if(fy(ie),ie===q){xe=null;break}if(se!==null){se.return=ye,xe=se;break}xe=ye}}}var ke=_.alternate;if(ke!==null){var Ee=ke.child;if(Ee!==null){ke.child=null;do{var wt=Ee.sibling;Ee.sibling=null,Ee=wt}while(Ee!==null)}}xe=_}}if((_.subtreeFlags&2064)!==0&&E!==null)E.return=_,xe=E;else e:for(;xe!==null;){if(_=xe,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:Co(9,_,_.return)}var $=_.sibling;if($!==null){$.return=_.return,xe=$;break e}xe=_.return}}var F=i.current;for(xe=F;xe!==null;){E=xe;var B=E.child;if((E.subtreeFlags&2064)!==0&&B!==null)B.return=E,xe=B;else e:for(E=F;xe!==null;){if(I=xe,(I.flags&2048)!==0)try{switch(I.tag){case 0:case 11:case 15:kl(9,I)}}catch(Ce){xt(I,I.return,Ce)}if(I===E){xe=null;break e}var de=I.sibling;if(de!==null){de.return=I.return,xe=de;break e}xe=I.return}}if(Ye=x,zr(),tr&&typeof tr.onPostCommitFiberRoot=="function")try{tr.onPostCommitFiberRoot(Da,i)}catch{}m=!0}return m}finally{st=d,Dn.transition=l}}return!1}function Ny(i,l,d){l=ii(d,l),l=Wg(i,l,1),i=$r(i,l,1),l=rn(),i!==null&&(Zi(i,1,l),fn(i,l))}function xt(i,l,d){if(i.tag===3)Ny(i,i,d);else for(;l!==null;){if(l.tag===3){Ny(l,i,d);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Br===null||!Br.has(m))){i=ii(d,i),i=Gg(l,i,1),l=$r(l,i,1),i=rn(),l!==null&&(Zi(l,1,i),fn(l,i));break}}l=l.return}}function FS(i,l,d){var m=i.pingCache;m!==null&&m.delete(l),l=rn(),i.pingedLanes|=i.suspendedLanes&d,It===i&&(Ft&d)===d&&(Nt===4||Nt===3&&(Ft&130023424)===Ft&&500>bt()-jd?fs(i,0):Sd|=d),fn(i,l)}function Ay(i,l){l===0&&((i.mode&1)===0?l=1:(l=za,za<<=1,(za&130023424)===0&&(za=4194304)));var d=rn();i=gr(i,l),i!==null&&(Zi(i,l,d),fn(i,d))}function $S(i){var l=i.memoizedState,d=0;l!==null&&(d=l.retryLane),Ay(i,d)}function US(i,l){var d=0;switch(i.tag){case 13:var m=i.stateNode,x=i.memoizedState;x!==null&&(d=x.retryLane);break;case 19:m=i.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(l),Ay(i,d)}var Ry;Ry=function(i,l,d){if(i!==null)if(i.memoizedProps!==l.pendingProps||cn.current)dn=!0;else{if((i.lanes&d)===0&&(l.flags&128)===0)return dn=!1,TS(i,l,d);dn=(i.flags&131072)!==0}else dn=!1,ft&&(l.flags&1048576)!==0&&ug(l,ol,l.index);switch(l.lanes=0,l.tag){case 2:var m=l.type;bl(i,l),i=l.pendingProps;var x=Ys(l,qt.current);ri(l,d),x=nd(null,l,m,i,x,d);var _=rd();return l.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,un(m)?(_=!0,rl(l)):_=!1,l.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,Ju(l),x.updater=vl,l.stateNode=x,x._reactInternals=l,cd(l,m,i,d),l=fd(null,l,m,!0,_,d)):(l.tag=0,ft&&_&&Fu(l),nn(null,l,x,d),l=l.child),l;case 16:m=l.elementType;e:{switch(bl(i,l),i=l.pendingProps,x=m._init,m=x(m._payload),l.type=m,x=l.tag=VS(m),i=qn(m,i),x){case 0:l=hd(null,l,m,i,d);break e;case 1:l=ry(null,l,m,i,d);break e;case 11:l=Qg(null,l,m,i,d);break e;case 14:l=Zg(null,l,m,qn(m.type,i),d);break e}throw Error(n(306,m,""))}return l;case 0:return m=l.type,x=l.pendingProps,x=l.elementType===m?x:qn(m,x),hd(i,l,m,x,d);case 1:return m=l.type,x=l.pendingProps,x=l.elementType===m?x:qn(m,x),ry(i,l,m,x,d);case 3:e:{if(sy(l),i===null)throw Error(n(387));m=l.pendingProps,_=l.memoizedState,x=_.element,vg(i,l),hl(l,m,null,d);var E=l.memoizedState;if(m=E.element,_.isDehydrated)if(_={element:m,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},l.updateQueue.baseState=_,l.memoizedState=_,l.flags&256){x=ii(Error(n(423)),l),l=iy(i,l,m,d,x);break e}else if(m!==x){x=ii(Error(n(424)),l),l=iy(i,l,m,d,x);break e}else for(bn=Ir(l.stateNode.containerInfo.firstChild),_n=l,ft=!0,Vn=null,d=yg(l,null,m,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(ei(),m===x){l=xr(i,l,d);break e}nn(i,l,m,d)}l=l.child}return l;case 5:return wg(l),i===null&&Bu(l),m=l.type,x=l.pendingProps,_=i!==null?i.memoizedProps:null,E=x.children,Ou(m,x)?E=null:_!==null&&Ou(m,_)&&(l.flags|=32),ny(i,l),nn(i,l,E,d),l.child;case 6:return i===null&&Bu(l),null;case 13:return oy(i,l,d);case 4:return Xu(l,l.stateNode.containerInfo),m=l.pendingProps,i===null?l.child=ti(l,null,m,d):nn(i,l,m,d),l.child;case 11:return m=l.type,x=l.pendingProps,x=l.elementType===m?x:qn(m,x),Qg(i,l,m,x,d);case 7:return nn(i,l,l.pendingProps,d),l.child;case 8:return nn(i,l,l.pendingProps.children,d),l.child;case 12:return nn(i,l,l.pendingProps.children,d),l.child;case 10:e:{if(m=l.type._context,x=l.pendingProps,_=l.memoizedProps,E=x.value,at(cl,m._currentValue),m._currentValue=E,_!==null)if(Bn(_.value,E)){if(_.children===x.children&&!cn.current){l=xr(i,l,d);break e}}else for(_=l.child,_!==null&&(_.return=l);_!==null;){var I=_.dependencies;if(I!==null){E=_.child;for(var z=I.firstContext;z!==null;){if(z.context===m){if(_.tag===1){z=yr(-1,d&-d),z.tag=2;var q=_.updateQueue;if(q!==null){q=q.shared;var ie=q.pending;ie===null?z.next=z:(z.next=ie.next,ie.next=z),q.pending=z}}_.lanes|=d,z=_.alternate,z!==null&&(z.lanes|=d),Wu(_.return,d,l),I.lanes|=d;break}z=z.next}}else if(_.tag===10)E=_.type===l.type?null:_.child;else if(_.tag===18){if(E=_.return,E===null)throw Error(n(341));E.lanes|=d,I=E.alternate,I!==null&&(I.lanes|=d),Wu(E,d,l),E=_.sibling}else E=_.child;if(E!==null)E.return=_;else for(E=_;E!==null;){if(E===l){E=null;break}if(_=E.sibling,_!==null){_.return=E.return,E=_;break}E=E.return}_=E}nn(i,l,x.children,d),l=l.child}return l;case 9:return x=l.type,m=l.pendingProps.children,ri(l,d),x=Ln(x),m=m(x),l.flags|=1,nn(i,l,m,d),l.child;case 14:return m=l.type,x=qn(m,l.pendingProps),x=qn(m.type,x),Zg(i,l,m,x,d);case 15:return ey(i,l,l.type,l.pendingProps,d);case 17:return m=l.type,x=l.pendingProps,x=l.elementType===m?x:qn(m,x),bl(i,l),l.tag=1,un(m)?(i=!0,rl(l)):i=!1,ri(l,d),Hg(l,m,x),cd(l,m,x,d),fd(null,l,m,!0,i,d);case 19:return ly(i,l,d);case 22:return ty(i,l,d)}throw Error(n(156,l.tag))};function Py(i,l){return dm(i,l)}function BS(i,l,d,m){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mn(i,l,d,m){return new BS(i,l,d,m)}function Od(i){return i=i.prototype,!(!i||!i.isReactComponent)}function VS(i){if(typeof i=="function")return Od(i)?1:0;if(i!=null){if(i=i.$$typeof,i===Y)return 11;if(i===W)return 14}return 2}function Kr(i,l){var d=i.alternate;return d===null?(d=Mn(i.tag,l,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=l,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&14680064,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,l=i.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d}function Pl(i,l,d,m,x,_){var E=2;if(m=i,typeof i=="function")Od(i)&&(E=1);else if(typeof i=="string")E=5;else e:switch(i){case M:return ms(d.children,x,_,l);case V:E=8,x|=8;break;case U:return i=Mn(12,d,l,x|2),i.elementType=U,i.lanes=_,i;case he:return i=Mn(13,d,l,x),i.elementType=he,i.lanes=_,i;case K:return i=Mn(19,d,l,x),i.elementType=K,i.lanes=_,i;case re:return Ol(d,x,_,l);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case L:E=10;break e;case Q:E=9;break e;case Y:E=11;break e;case W:E=14;break e;case ne:E=16,m=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return l=Mn(E,d,l,x),l.elementType=i,l.type=m,l.lanes=_,l}function ms(i,l,d,m){return i=Mn(7,i,m,l),i.lanes=d,i}function Ol(i,l,d,m){return i=Mn(22,i,m,l),i.elementType=re,i.lanes=d,i.stateNode={isHidden:!1},i}function Ld(i,l,d){return i=Mn(6,i,null,l),i.lanes=d,i}function Id(i,l,d){return l=Mn(4,i.children!==null?i.children:[],i.key,l),l.lanes=d,l.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},l}function qS(i,l,d,m,x){this.tag=l,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=lu(0),this.expirationTimes=lu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lu(0),this.identifierPrefix=m,this.onRecoverableError=x,this.mutableSourceEagerHydrationData=null}function Dd(i,l,d,m,x,_,E,I,z){return i=new qS(i,l,d,I,z),l===1?(l=1,_===!0&&(l|=8)):l=0,_=Mn(3,null,null,l),i.current=_,_.stateNode=i,_.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ju(_),i}function HS(i,l,d){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:m==null?null:""+m,children:i,containerInfo:l,implementation:d}}function Oy(i){if(!i)return Mr;i=i._reactInternals;e:{if(rs(i)!==i||i.tag!==1)throw Error(n(170));var l=i;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(un(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(n(171))}if(i.tag===1){var d=i.type;if(un(d))return ag(i,d,l)}return l}function Ly(i,l,d,m,x,_,E,I,z){return i=Dd(d,m,!0,i,x,_,E,I,z),i.context=Oy(null),d=i.current,m=rn(),x=qr(d),_=yr(m,x),_.callback=l??null,$r(d,_,x),i.current.lanes=x,Zi(i,x,m),fn(i,m),i}function Ll(i,l,d,m){var x=l.current,_=rn(),E=qr(x);return d=Oy(d),l.context===null?l.context=d:l.pendingContext=d,l=yr(_,E),l.payload={element:i},m=m===void 0?null:m,m!==null&&(l.callback=m),i=$r(x,l,E),i!==null&&(Wn(i,x,E,_),dl(i,x,E)),E}function Il(i){return i=i.current,i.child?(i.child.tag===5,i.child.stateNode):null}function Iy(i,l){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d<l?d:l}}function Md(i,l){Iy(i,l),(i=i.alternate)&&Iy(i,l)}function KS(){return null}var Dy=typeof reportError=="function"?reportError:function(i){console.error(i)};function zd(i){this._internalRoot=i}Dl.prototype.render=zd.prototype.render=function(i){var l=this._internalRoot;if(l===null)throw Error(n(409));Ll(i,l,null,null)},Dl.prototype.unmount=zd.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var l=i.containerInfo;hs(function(){Ll(null,i,null,null)}),l[hr]=null}};function Dl(i){this._internalRoot=i}Dl.prototype.unstable_scheduleHydration=function(i){if(i){var l=vm();i={blockedOn:null,target:i,priority:l};for(var d=0;d<Pr.length&&l!==0&&l<Pr[d].priority;d++);Pr.splice(d,0,i),d===0&&wm(i)}};function Fd(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Ml(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function My(){}function WS(i,l,d,m,x){if(x){if(typeof m=="function"){var _=m;m=function(){var q=Il(E);_.call(q)}}var E=Ly(l,m,i,0,null,!1,!1,"",My);return i._reactRootContainer=E,i[hr]=E.current,po(i.nodeType===8?i.parentNode:i),hs(),E}for(;x=i.lastChild;)i.removeChild(x);if(typeof m=="function"){var I=m;m=function(){var q=Il(z);I.call(q)}}var z=Dd(i,0,!1,null,null,!1,!1,"",My);return i._reactRootContainer=z,i[hr]=z.current,po(i.nodeType===8?i.parentNode:i),hs(function(){Ll(l,z,d,m)}),z}function zl(i,l,d,m,x){var _=d._reactRootContainer;if(_){var E=_;if(typeof x=="function"){var I=x;x=function(){var z=Il(E);I.call(z)}}Ll(l,E,i,x)}else E=WS(d,l,i,x,m);return Il(E)}ym=function(i){switch(i.tag){case 3:var l=i.stateNode;if(l.current.memoizedState.isDehydrated){var d=Qi(l.pendingLanes);d!==0&&(cu(l,d|1),fn(l,bt()),(Ye&6)===0&&(li=bt()+500,zr()))}break;case 13:hs(function(){var m=gr(i,1);if(m!==null){var x=rn();Wn(m,i,1,x)}}),Md(i,1)}},uu=function(i){if(i.tag===13){var l=gr(i,134217728);if(l!==null){var d=rn();Wn(l,i,134217728,d)}Md(i,134217728)}},xm=function(i){if(i.tag===13){var l=qr(i),d=gr(i,l);if(d!==null){var m=rn();Wn(d,i,l,m)}Md(i,l)}},vm=function(){return st},_m=function(i,l){var d=st;try{return st=i,l()}finally{st=d}},nu=function(i,l,d){switch(l){case"input":if(te(i,d),l=d.name,d.type==="radio"&&l!=null){for(d=i;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<d.length;l++){var m=d[l];if(m!==i&&m.form===i.form){var x=tl(m);if(!x)throw Error(n(90));Zt(m),te(m,x)}}}break;case"textarea":nt(i,d);break;case"select":l=d.value,l!=null&&$e(i,!!d.multiple,l,!1)}},sm=Ad,im=hs;var GS={usingClientEntryPoint:!1,Events:[yo,Js,tl,nm,rm,Ad]},Ro={findFiberByHostInstance:ss,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},JS={bundleType:Ro.bundleType,version:Ro.version,rendererPackageName:Ro.rendererPackageName,rendererConfig:Ro.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:O.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=cm(i),i===null?null:i.stateNode},findFiberByHostInstance:Ro.findFiberByHostInstance||KS,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 Fl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fl.isDisabled&&Fl.supportsFiber)try{Da=Fl.inject(JS),tr=Fl}catch{}}return pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=GS,pn.createPortal=function(i,l){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Fd(l))throw Error(n(200));return HS(i,l,null,d)},pn.createRoot=function(i,l){if(!Fd(i))throw Error(n(299));var d=!1,m="",x=Dy;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onRecoverableError!==void 0&&(x=l.onRecoverableError)),l=Dd(i,1,!1,null,null,d,!1,m,x),i[hr]=l.current,po(i.nodeType===8?i.parentNode:i),new zd(l)},pn.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var l=i._reactInternals;if(l===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=cm(l),i=i===null?null:i.stateNode,i},pn.flushSync=function(i){return hs(i)},pn.hydrate=function(i,l,d){if(!Ml(l))throw Error(n(200));return zl(null,i,l,!0,d)},pn.hydrateRoot=function(i,l,d){if(!Fd(i))throw Error(n(405));var m=d!=null&&d.hydratedSources||null,x=!1,_="",E=Dy;if(d!=null&&(d.unstable_strictMode===!0&&(x=!0),d.identifierPrefix!==void 0&&(_=d.identifierPrefix),d.onRecoverableError!==void 0&&(E=d.onRecoverableError)),l=Ly(l,null,i,1,d??null,x,!1,_,E),i[hr]=l.current,po(i),m)for(i=0;i<m.length;i++)d=m[i],x=d._getVersion,x=x(d._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[d,x]:l.mutableSourceEagerHydrationData.push(d,x);return new Dl(l)},pn.render=function(i,l,d){if(!Ml(l))throw Error(n(200));return zl(null,i,l,!1,d)},pn.unmountComponentAtNode=function(i){if(!Ml(i))throw Error(n(40));return i._reactRootContainer?(hs(function(){zl(null,null,i,!1,function(){i._reactRootContainer=null,i[hr]=null})}),!0):!1},pn.unstable_batchedUpdates=Ad,pn.unstable_renderSubtreeIntoContainer=function(i,l,d,m){if(!Ml(d))throw Error(n(200));if(i==null||i._reactInternals===void 0)throw Error(n(38));return zl(i,l,d,!1,m)},pn.version="18.3.1-next-f1338f8080-20240426",pn}var Hy;function rj(){if(Hy)return Bd.exports;Hy=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(),Bd.exports=nj(),Bd.exports}var Ky;function sj(){if(Ky)return $l;Ky=1;var e=rj();return $l.createRoot=e.createRoot,$l.hydrateRoot=e.hydrateRoot,$l}var ij=sj();const oj=Ac(ij);var aj={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 lj=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),pe=(e,t)=>{const n=R.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:a,className:c="",children:u,...f},p)=>R.createElement("svg",{ref:p,...aj,width:s,height:s,stroke:r,strokeWidth:a?Number(o)*24/Number(s):o,className:["lucide",`lucide-${lj(e)}`,c].join(" "),...f},[...t.map(([g,y])=>R.createElement(g,y)),...Array.isArray(u)?u:[u]]));return n.displayName=`${e}`,n};const cj=pe("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);const kr=pe("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 Wy=pe("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 f_=pe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const uj=pe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const dj=pe("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 p_=pe("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 hj=pe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);const m_=pe("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 fj=pe("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 pj=pe("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 mj=pe("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 gj=pe("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 Ns=pe("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 As=pe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Ls=pe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const yj=pe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const tc=pe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const g_=pe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const xj=pe("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const vj=pe("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);const Gy=pe("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 Li=pe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const y_=pe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const zf=pe("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 x_=pe("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 sa=pe("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 _j=pe("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 $h=pe("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 Bi=pe("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 Ii=pe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const bj=pe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const wj=pe("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 kj=pe("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const Oo=pe("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 Ff=pe("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 Jy=pe("HeartOff",[["line",{x1:"2",y1:"2",x2:"22",y2:"22",key:"1w4vcy"}],["path",{d:"M16.5 16.5 12 21l-7-7c-1.5-1.45-3-3.2-3-5.5a5.5 5.5 0 0 1 2.14-4.35",key:"3mpagl"}],["path",{d:"M8.76 3.1c1.15.22 2.13.78 3.24 1.9 1.5-1.5 2.74-2 4.5-2A5.5 5.5 0 0 1 22 8.5c0 2.12-1.3 3.78-2.67 5.17",key:"1gh3v3"}]]);const v_=pe("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 Sj=pe("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 jj=pe("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 Ej=pe("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 Cj=pe("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);const Tj=pe("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 Rt=pe("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Nj=pe("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 Xy=pe("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 Yy=pe("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 Aj=pe("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 Uh=pe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const Bh=pe("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);const Rj=pe("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 Pj=pe("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 Oj=pe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const Lj=pe("PauseCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);const Qy=pe("PlayCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);const Ij=pe("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);const $f=pe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const _a=pe("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 Vh=pe("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);const Dj=pe("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 wr=pe("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 ia=pe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const Mj=pe("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);const cc=pe("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 Uf=pe("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 zj=pe("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 Fj=pe("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);const $j=pe("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);const Uj=pe("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 qh=pe("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 uc=pe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const Bf=pe("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 Bj=pe("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 Pc=pe("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 Zy=pe("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 ex=pe("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 gs=pe("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 Nn=pe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Vt=pe("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Vf=R.createContext({});function qf(e){const t=R.useRef(null);return t.current===null&&(t.current=e()),t.current}const Oc=R.createContext(null),Hf=R.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class Vj extends R.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 qj({children:e,isPresent:t}){const n=R.useId(),r=R.useRef(null),s=R.useRef({width:0,height:0,top:0,left:0}),{nonce:o}=R.useContext(Hf);return R.useInsertionEffect(()=>{const{width:a,height:c,top:u,left:f}=s.current;if(t||!r.current||!a||!c)return;r.current.dataset.motionPopId=n;const p=document.createElement("style");return o&&(p.nonce=o),document.head.appendChild(p),p.sheet&&p.sheet.insertRule(`
9
9
  [data-motion-pop-id="${n}"] {
10
10
  position: absolute !important;
11
11
  width: ${a}px !important;
@@ -13,19 +13,19 @@ Error generating stack: `+_.message+`
13
13
  top: ${u}px !important;
14
14
  left: ${f}px !important;
15
15
  }
16
- `),()=>{document.head.removeChild(p)}},[t]),h.jsx(Vj,{isPresent:t,childRef:r,sizeRef:s,children:R.cloneElement(e,{ref:r})})}const Hj=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:o,mode:a})=>{const c=qf(Kj),u=R.useId(),f=R.useCallback(g=>{c.set(g,!0);for(const y of c.values())if(!y)return;r&&r()},[c,r]),p=R.useMemo(()=>({id:u,initial:t,isPresent:n,custom:s,onExitComplete:f,register:g=>(c.set(g,!1),()=>c.delete(g))}),o?[Math.random(),f]:[n,f]);return R.useMemo(()=>{c.forEach((g,y)=>c.set(y,!1))},[n]),R.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),a==="popLayout"&&(e=h.jsx(qj,{isPresent:n,children:e})),h.jsx(Oc.Provider,{value:p,children:e})};function Kj(){return new Map}function __(e=!0){const t=R.useContext(Oc);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,o=R.useId();R.useEffect(()=>{e&&s(o)},[e]);const a=R.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,a]:[!0]}const Ul=e=>e.key||"";function tx(e){const t=[];return R.Children.forEach(e,n=>{R.isValidElement(n)&&t.push(n)}),t}const Kf=typeof window<"u",b_=Kf?R.useLayoutEffect:R.useEffect,Ot=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:o="sync",propagate:a=!1})=>{const[c,u]=__(a),f=R.useMemo(()=>tx(e),[e]),p=a&&!c?[]:f.map(Ul),g=R.useRef(!0),y=R.useRef(f),v=qf(()=>new Map),[b,w]=R.useState(f),[k,S]=R.useState(f);b_(()=>{g.current=!1,y.current=f;for(let O=0;O<k.length;O++){const T=Ul(k[O]);p.includes(T)?v.delete(T):v.get(T)!==!0&&v.set(T,!1)}},[k,p.length,p.join("-")]);const C=[];if(f!==b){let O=[...f];for(let T=0;T<k.length;T++){const N=k[T],M=Ul(N);p.includes(M)||(O.splice(T,0,N),C.push(N))}o==="wait"&&C.length&&(O=C),S(tx(O)),w(f);return}const{forceRender:j}=R.useContext(Vf);return h.jsx(h.Fragment,{children:k.map(O=>{const T=Ul(O),N=a&&!c?!1:f===k||p.includes(T),M=()=>{if(v.has(T))v.set(T,!0);else return;let V=!0;v.forEach(B=>{B||(V=!1)}),V&&(j?.(),S(y.current),a&&u?.(),r&&r())};return h.jsx(Hj,{isPresent:N,initial:!g.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:s,mode:o,onExitComplete:N?void 0:M,children:O},T)})})},En=e=>e;let w_=En;function Wf(e){let t;return()=>(t===void 0&&(t=e()),t)}const Di=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},Sr=e=>e*1e3,jr=e=>e/1e3,Wj={useManualTiming:!1};function Gj(e){let t=new Set,n=new Set,r=!1,s=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function c(f){o.has(f)&&(u.schedule(f),e()),f(a)}const u={schedule:(f,p=!1,g=!1)=>{const v=g&&r?t:n;return p&&o.add(f),v.has(f)||v.add(f),f},cancel:f=>{n.delete(f),o.delete(f)},process:f=>{if(a=f,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(c),t.clear(),r=!1,s&&(s=!1,u.process(f))}};return u}const Bl=["read","resolveKeyframes","update","preRender","render","postRender"],Jj=40;function k_(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,a=Bl.reduce((S,C)=>(S[C]=Gj(o),S),{}),{read:c,resolveKeyframes:u,update:f,preRender:p,render:g,postRender:y}=a,v=()=>{const S=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(S-s.timestamp,Jj),1),s.timestamp=S,s.isProcessing=!0,c.process(s),u.process(s),f.process(s),p.process(s),g.process(s),y.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(v))},b=()=>{n=!0,r=!0,s.isProcessing||e(v)};return{schedule:Bl.reduce((S,C)=>{const j=a[C];return S[C]=(O,T=!1,N=!1)=>(n||b(),j.schedule(O,T,N)),S},{}),cancel:S=>{for(let C=0;C<Bl.length;C++)a[Bl[C]].cancel(S)},state:s,steps:a}}const{schedule:ht,cancel:Zr,state:Bt,steps:Hd}=k_(typeof requestAnimationFrame<"u"?requestAnimationFrame:En,!0),S_=R.createContext({strict:!1}),nx={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"]},Mi={};for(const e in nx)Mi[e]={isEnabled:t=>nx[e].some(n=>!!t[n])};function Xj(e){for(const t in e)Mi[t]={...Mi[t],...e[t]}}const Yj=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 dc(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Yj.has(e)}let j_=e=>!dc(e);function Qj(e){e&&(j_=t=>t.startsWith("on")?!dc(t):e(t))}try{Qj(require("@emotion/is-prop-valid").default)}catch{}function Zj(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(j_(s)||n===!0&&dc(s)||!t&&!dc(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function eE(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const Lc=R.createContext({});function oa(e){return typeof e=="string"||Array.isArray(e)}function Ic(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Gf=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Jf=["initial",...Gf];function Dc(e){return Ic(e.animate)||Jf.some(t=>oa(e[t]))}function E_(e){return!!(Dc(e)||e.variants)}function tE(e,t){if(Dc(e)){const{initial:n,animate:r}=e;return{initial:n===!1||oa(n)?n:void 0,animate:oa(r)?r:void 0}}return e.inherit!==!1?t:{}}function nE(e){const{initial:t,animate:n}=tE(e,R.useContext(Lc));return R.useMemo(()=>({initial:t,animate:n}),[rx(t),rx(n)])}function rx(e){return Array.isArray(e)?e.join(" "):e}const rE=Symbol.for("motionComponentSymbol");function Ei(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function sE(e,t,n){return R.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Ei(n)&&(n.current=r))},[t])}const Xf=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),iE="framerAppearId",C_="data-"+Xf(iE),{schedule:Yf}=k_(queueMicrotask,!1),T_=R.createContext({});function oE(e,t,n,r,s){var o,a;const{visualElement:c}=R.useContext(Lc),u=R.useContext(S_),f=R.useContext(Oc),p=R.useContext(Hf).reducedMotion,g=R.useRef(null);r=r||u.renderer,!g.current&&r&&(g.current=r(e,{visualState:t,parent:c,props:n,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:p}));const y=g.current,v=R.useContext(T_);y&&!y.projection&&s&&(y.type==="html"||y.type==="svg")&&aE(g.current,n,s,v);const b=R.useRef(!1);R.useInsertionEffect(()=>{y&&b.current&&y.update(n,f)});const w=n[C_],k=R.useRef(!!w&&!(!((o=window.MotionHandoffIsComplete)===null||o===void 0)&&o.call(window,w))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,w)));return b_(()=>{y&&(b.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),Yf.render(y.render),k.current&&y.animationState&&y.animationState.animateChanges())}),R.useEffect(()=>{y&&(!k.current&&y.animationState&&y.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var S;(S=window.MotionHandoffMarkAsComplete)===null||S===void 0||S.call(window,w)}),k.current=!1))}),y}function aE(e,t,n,r){const{layoutId:s,layout:o,drag:a,dragConstraints:c,layoutScroll:u,layoutRoot:f}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:N_(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!a||c&&Ei(c),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:f})}function N_(e){if(e)return e.options.allowProjection!==!1?e.projection:N_(e.parent)}function lE({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var o,a;e&&Xj(e);function c(f,p){let g;const y={...R.useContext(Hf),...f,layoutId:cE(f)},{isStatic:v}=y,b=nE(f),w=r(f,v);if(!v&&Kf){uE();const k=dE(y);g=k.MeasureLayout,b.visualElement=oE(s,w,y,t,k.ProjectionNode)}return h.jsxs(Lc.Provider,{value:b,children:[g&&b.visualElement?h.jsx(g,{visualElement:b.visualElement,...y}):null,n(s,f,sE(w,b.visualElement,p),w,v,b.visualElement)]})}c.displayName=`motion.${typeof s=="string"?s:`create(${(a=(o=s.displayName)!==null&&o!==void 0?o:s.name)!==null&&a!==void 0?a:""})`}`;const u=R.forwardRef(c);return u[rE]=s,u}function cE({layoutId:e}){const t=R.useContext(Vf).id;return t&&e!==void 0?t+"-"+e:e}function uE(e,t){R.useContext(S_).strict}function dE(e){const{drag:t,layout:n}=Mi;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const hE=["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 Qf(e){return typeof e!="string"||e.includes("-")?!1:!!(hE.indexOf(e)>-1||/[A-Z]/u.test(e))}function sx(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Zf(e,t,n,r){if(typeof t=="function"){const[s,o]=sx(r);t=t(n!==void 0?n:e.custom,s,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,o]=sx(r);t=t(n!==void 0?n:e.custom,s,o)}return t}const Hh=e=>Array.isArray(e),fE=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),pE=e=>Hh(e)?e[e.length-1]||0:e,Xt=e=>!!(e&&e.getVelocity);function nc(e){const t=Xt(e)?e.get():e;return fE(t)?t.toValue():t}function mE({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,o){const a={latestValues:gE(r,s,o,e),renderState:t()};return n&&(a.onMount=c=>n({props:r,current:c,...a}),a.onUpdate=c=>n(c)),a}const A_=e=>(t,n)=>{const r=R.useContext(Lc),s=R.useContext(Oc),o=()=>mE(e,t,r,s);return n?o():qf(o)};function gE(e,t,n,r){const s={},o=r(e,{});for(const y in o)s[y]=nc(o[y]);let{initial:a,animate:c}=e;const u=Dc(e),f=E_(e);t&&f&&!u&&e.inherit!==!1&&(a===void 0&&(a=t.initial),c===void 0&&(c=t.animate));let p=n?n.initial===!1:!1;p=p||a===!1;const g=p?c:a;if(g&&typeof g!="boolean"&&!Ic(g)){const y=Array.isArray(g)?g:[g];for(let v=0;v<y.length;v++){const b=Zf(e,y[v]);if(b){const{transitionEnd:w,transition:k,...S}=b;for(const C in S){let j=S[C];if(Array.isArray(j)){const O=p?j.length-1:0;j=j[O]}j!==null&&(s[C]=j)}for(const C in w)s[C]=w[C]}}}return s}const Vi=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],zs=new Set(Vi),R_=e=>t=>typeof t=="string"&&t.startsWith(e),P_=R_("--"),yE=R_("var(--"),ep=e=>yE(e)?xE.test(e.split("/*")[0].trim()):!1,xE=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,O_=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Er=(e,t,n)=>n>t?t:n<e?e:n,qi={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},aa={...qi,transform:e=>Er(0,1,e)},Vl={...qi,default:1},ba=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Xr=ba("deg"),cr=ba("%"),Le=ba("px"),vE=ba("vh"),_E=ba("vw"),ix={...cr,parse:e=>cr.parse(e)/100,transform:e=>cr.transform(e*100)},bE={borderWidth:Le,borderTopWidth:Le,borderRightWidth:Le,borderBottomWidth:Le,borderLeftWidth:Le,borderRadius:Le,radius:Le,borderTopLeftRadius:Le,borderTopRightRadius:Le,borderBottomRightRadius:Le,borderBottomLeftRadius:Le,width:Le,maxWidth:Le,height:Le,maxHeight:Le,top:Le,right:Le,bottom:Le,left:Le,padding:Le,paddingTop:Le,paddingRight:Le,paddingBottom:Le,paddingLeft:Le,margin:Le,marginTop:Le,marginRight:Le,marginBottom:Le,marginLeft:Le,backgroundPositionX:Le,backgroundPositionY:Le},wE={rotate:Xr,rotateX:Xr,rotateY:Xr,rotateZ:Xr,scale:Vl,scaleX:Vl,scaleY:Vl,scaleZ:Vl,skew:Xr,skewX:Xr,skewY:Xr,distance:Le,translateX:Le,translateY:Le,translateZ:Le,x:Le,y:Le,z:Le,perspective:Le,transformPerspective:Le,opacity:aa,originX:ix,originY:ix,originZ:Le},ox={...qi,transform:Math.round},tp={...bE,...wE,zIndex:ox,size:Le,fillOpacity:aa,strokeOpacity:aa,numOctaves:ox},kE={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},SE=Vi.length;function jE(e,t,n){let r="",s=!0;for(let o=0;o<SE;o++){const a=Vi[o],c=e[a];if(c===void 0)continue;let u=!0;if(typeof c=="number"?u=c===(a.startsWith("scale")?1:0):u=parseFloat(c)===0,!u||n){const f=O_(c,tp[a]);if(!u){s=!1;const p=kE[a]||a;r+=`${p}(${f}) `}n&&(t[a]=f)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function np(e,t,n){const{style:r,vars:s,transformOrigin:o}=e;let a=!1,c=!1;for(const u in t){const f=t[u];if(zs.has(u)){a=!0;continue}else if(P_(u)){s[u]=f;continue}else{const p=O_(f,tp[u]);u.startsWith("origin")?(c=!0,o[u]=p):r[u]=p}}if(t.transform||(a||n?r.transform=jE(t,e.transform,n):r.transform&&(r.transform="none")),c){const{originX:u="50%",originY:f="50%",originZ:p=0}=o;r.transformOrigin=`${u} ${f} ${p}`}}const EE={offset:"stroke-dashoffset",array:"stroke-dasharray"},CE={offset:"strokeDashoffset",array:"strokeDasharray"};function TE(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?EE:CE;e[o.offset]=Le.transform(-r);const a=Le.transform(t),c=Le.transform(n);e[o.array]=`${a} ${c}`}function ax(e,t,n){return typeof e=="string"?e:Le.transform(t+n*e)}function NE(e,t,n){const r=ax(t,e.x,e.width),s=ax(n,e.y,e.height);return`${r} ${s}`}function rp(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:o,pathLength:a,pathSpacing:c=1,pathOffset:u=0,...f},p,g){if(np(e,f,g),p){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:y,style:v,dimensions:b}=e;y.transform&&(b&&(v.transform=y.transform),delete y.transform),b&&(s!==void 0||o!==void 0||v.transform)&&(v.transformOrigin=NE(b,s!==void 0?s:.5,o!==void 0?o:.5)),t!==void 0&&(y.x=t),n!==void 0&&(y.y=n),r!==void 0&&(y.scale=r),a!==void 0&&TE(y,a,c,u,!1)}const sp=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),L_=()=>({...sp(),attrs:{}}),ip=e=>typeof e=="string"&&e.toLowerCase()==="svg";function I_(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const D_=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 M_(e,t,n,r){I_(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(D_.has(s)?s:Xf(s),t.attrs[s])}const hc={};function AE(e){Object.assign(hc,e)}function z_(e,{layout:t,layoutId:n}){return zs.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!hc[e]||e==="opacity")}function op(e,t,n){var r;const{style:s}=e,o={};for(const a in s)(Xt(s[a])||t.style&&Xt(t.style[a])||z_(a,e)||((r=n?.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(o[a]=s[a]);return o}function F_(e,t,n){const r=op(e,t,n);for(const s in e)if(Xt(e[s])||Xt(t[s])){const o=Vi.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[o]=e[s]}return r}function RE(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 lx=["x","y","width","height","cx","cy","r"],PE={useVisualState:A_({scrapeMotionValuesFromProps:F_,createRenderState:L_,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let o=!!e.drag;if(!o){for(const c in s)if(zs.has(c)){o=!0;break}}if(!o)return;let a=!t;if(t)for(let c=0;c<lx.length;c++){const u=lx[c];e[u]!==t[u]&&(a=!0)}a&&ht.read(()=>{RE(n,r),ht.render(()=>{rp(r,s,ip(n.tagName),e.transformTemplate),M_(n,r)})})}})},OE={useVisualState:A_({scrapeMotionValuesFromProps:op,createRenderState:sp})};function $_(e,t,n){for(const r in t)!Xt(t[r])&&!z_(r,n)&&(e[r]=t[r])}function LE({transformTemplate:e},t){return R.useMemo(()=>{const n=sp();return np(n,t,e),Object.assign({},n.vars,n.style)},[t])}function IE(e,t){const n=e.style||{},r={};return $_(r,n,e),Object.assign(r,LE(e,t)),r}function DE(e,t){const n={},r=IE(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 ME(e,t,n,r){const s=R.useMemo(()=>{const o=L_();return rp(o,t,ip(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};$_(o,e.style,e),s.style={...o,...s.style}}return s}function zE(e=!1){return(n,r,s,{latestValues:o},a)=>{const u=(Qf(n)?ME:DE)(r,o,a,n),f=Zj(r,typeof n=="string",e),p=n!==R.Fragment?{...f,...u,ref:s}:{},{children:g}=r,y=R.useMemo(()=>Xt(g)?g.get():g,[g]);return R.createElement(n,{...p,children:y})}}function FE(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...Qf(r)?PE:OE,preloadedFeatures:e,useRender:zE(s),createVisualElement:t,Component:r};return lE(a)}}function U_(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 Mc(e,t,n){const r=e.getProps();return Zf(r,t,n!==void 0?n:r.custom,e)}const $E=Wf(()=>window.ScrollTimeline!==void 0);class UE{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(s=>{if($E()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,o)=>{s&&s(),this.animations[o].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 BE extends UE{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function ap(e,t){return e?e[t]||e.default||e:void 0}const Kh=2e4;function B_(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Kh;)t+=n,r=e.next(t);return t>=Kh?1/0:t}function lp(e){return typeof e=="function"}function cx(e,t){e.timeline=t,e.onfinish=null}const cp=e=>Array.isArray(e)&&typeof e[0]=="number",VE={linearEasing:void 0};function qE(e,t){const n=Wf(e);return()=>{var r;return(r=VE[t])!==null&&r!==void 0?r:n()}}const fc=qE(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),V_=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let o=0;o<s;o++)r+=e(Di(0,s-1,o))+", ";return`linear(${r.substring(0,r.length-2)})`};function q_(e){return!!(typeof e=="function"&&fc()||!e||typeof e=="string"&&(e in Wh||fc())||cp(e)||Array.isArray(e)&&e.every(q_))}const Bo=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Wh={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Bo([0,.65,.55,1]),circOut:Bo([.55,0,1,.45]),backIn:Bo([.31,.01,.66,-.59]),backOut:Bo([.33,1.53,.69,.99])};function H_(e,t){if(e)return typeof e=="function"&&fc()?V_(e,t):cp(e)?Bo(e):Array.isArray(e)?e.map(n=>H_(n,t)||Wh.easeOut):Wh[e]}const Wn={x:!1,y:!1};function K_(){return Wn.x||Wn.y}function HE(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const o=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}function W_(e,t){const n=HE(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function ux(e){return t=>{t.pointerType==="touch"||K_()||e(t)}}function KE(e,t,n={}){const[r,s,o]=W_(e,n),a=ux(c=>{const{target:u}=c,f=t(c);if(typeof f!="function"||!u)return;const p=ux(g=>{f(g),u.removeEventListener("pointerleave",p)});u.addEventListener("pointerleave",p,s)});return r.forEach(c=>{c.addEventListener("pointerenter",a,s)}),o}const G_=(e,t)=>t?e===t?!0:G_(e,t.parentElement):!1,up=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,WE=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function GE(e){return WE.has(e.tagName)||e.tabIndex!==-1}const Vo=new WeakSet;function dx(e){return t=>{t.key==="Enter"&&e(t)}}function Kd(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const JE=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=dx(()=>{if(Vo.has(n))return;Kd(n,"down");const s=dx(()=>{Kd(n,"up")}),o=()=>Kd(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function hx(e){return up(e)&&!K_()}function XE(e,t,n={}){const[r,s,o]=W_(e,n),a=c=>{const u=c.currentTarget;if(!hx(c)||Vo.has(u))return;Vo.add(u);const f=t(c),p=(v,b)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",y),!(!hx(v)||!Vo.has(u))&&(Vo.delete(u),typeof f=="function"&&f(v,{success:b}))},g=v=>{p(v,n.useGlobalTarget||G_(u,v.target))},y=v=>{p(v,!1)};window.addEventListener("pointerup",g,s),window.addEventListener("pointercancel",y,s)};return r.forEach(c=>{!GE(c)&&c.getAttribute("tabindex")===null&&(c.tabIndex=0),(n.useGlobalTarget?window:c).addEventListener("pointerdown",a,s),c.addEventListener("focus",f=>JE(f,s),s)}),o}function YE(e){return e==="x"||e==="y"?Wn[e]?null:(Wn[e]=!0,()=>{Wn[e]=!1}):Wn.x||Wn.y?null:(Wn.x=Wn.y=!0,()=>{Wn.x=Wn.y=!1})}const J_=new Set(["width","height","top","left","right","bottom",...Vi]);let rc;function QE(){rc=void 0}const ur={now:()=>(rc===void 0&&ur.set(Bt.isProcessing||Wj.useManualTiming?Bt.timestamp:performance.now()),rc),set:e=>{rc=e,queueMicrotask(QE)}};function dp(e,t){e.indexOf(t)===-1&&e.push(t)}function hp(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class fp{constructor(){this.subscriptions=[]}add(t){return dp(this.subscriptions,t),()=>hp(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let o=0;o<s;o++){const a=this.subscriptions[o];a&&a(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function X_(e,t){return t?e*(1e3/t):0}const fx=30,ZE=e=>!isNaN(parseFloat(e));class eC{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const o=ur.now();this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&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=ur.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=ZE(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 fp);const r=this.events[t].add(n);return t==="change"?()=>{r(),ht.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=ur.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>fx)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,fx);return X_(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 la(e,t){return new eC(e,t)}function tC(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,la(n))}function nC(e,t){const n=Mc(e,t);let{transitionEnd:r={},transition:s={},...o}=n||{};o={...o,...r};for(const a in o){const c=pE(o[a]);tC(e,a,c)}}function rC(e){return!!(Xt(e)&&e.add)}function Gh(e,t){const n=e.getValue("willChange");if(rC(n))return n.add(t)}function Y_(e){return e.props[C_]}const Q_=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,sC=1e-7,iC=12;function oC(e,t,n,r,s){let o,a,c=0;do a=t+(n-t)/2,o=Q_(a,r,s)-e,o>0?n=a:t=a;while(Math.abs(o)>sC&&++c<iC);return a}function wa(e,t,n,r){if(e===t&&n===r)return En;const s=o=>oC(o,0,1,e,n);return o=>o===0||o===1?o:Q_(s(o),t,r)}const Z_=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,eb=e=>t=>1-e(1-t),tb=wa(.33,1.53,.69,.99),pp=eb(tb),nb=Z_(pp),rb=e=>(e*=2)<1?.5*pp(e):.5*(2-Math.pow(2,-10*(e-1))),mp=e=>1-Math.sin(Math.acos(e)),sb=eb(mp),ib=Z_(mp),ob=e=>/^0[^.\s]+$/u.test(e);function aC(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||ob(e):!0}const Ko=e=>Math.round(e*1e5)/1e5,gp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function lC(e){return e==null}const cC=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,yp=(e,t)=>n=>!!(typeof n=="string"&&cC.test(n)&&n.startsWith(e)||t&&!lC(n)&&Object.prototype.hasOwnProperty.call(n,t)),ab=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,o,a,c]=r.match(gp);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(a),alpha:c!==void 0?parseFloat(c):1}},uC=e=>Er(0,255,e),Wd={...qi,transform:e=>Math.round(uC(e))},Es={test:yp("rgb","red"),parse:ab("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Wd.transform(e)+", "+Wd.transform(t)+", "+Wd.transform(n)+", "+Ko(aa.transform(r))+")"};function dC(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Jh={test:yp("#"),parse:dC,transform:Es.transform},Ci={test:yp("hsl","hue"),parse:ab("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+cr.transform(Ko(t))+", "+cr.transform(Ko(n))+", "+Ko(aa.transform(r))+")"},Gt={test:e=>Es.test(e)||Jh.test(e)||Ci.test(e),parse:e=>Es.test(e)?Es.parse(e):Ci.test(e)?Ci.parse(e):Jh.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Es.transform(e):Ci.transform(e)},hC=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function fC(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(gp))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(hC))===null||n===void 0?void 0:n.length)||0)>0}const lb="number",cb="color",pC="var",mC="var(",px="${}",gC=/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 ca(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const c=t.replace(gC,u=>(Gt.test(u)?(r.color.push(o),s.push(cb),n.push(Gt.parse(u))):u.startsWith(mC)?(r.var.push(o),s.push(pC),n.push(u)):(r.number.push(o),s.push(lb),n.push(parseFloat(u))),++o,px)).split(px);return{values:n,split:c,indexes:r,types:s}}function ub(e){return ca(e).values}function db(e){const{split:t,types:n}=ca(e),r=t.length;return s=>{let o="";for(let a=0;a<r;a++)if(o+=t[a],s[a]!==void 0){const c=n[a];c===lb?o+=Ko(s[a]):c===cb?o+=Gt.transform(s[a]):o+=s[a]}return o}}const yC=e=>typeof e=="number"?0:e;function xC(e){const t=ub(e);return db(e)(t.map(yC))}const es={test:fC,parse:ub,createTransformer:db,getAnimatableNone:xC},vC=new Set(["brightness","contrast","saturate","opacity"]);function _C(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(gp)||[];if(!r)return e;const s=n.replace(r,"");let o=vC.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const bC=/\b([a-z-]*)\(.*?\)/gu,Xh={...es,getAnimatableNone:e=>{const t=e.match(bC);return t?t.map(_C).join(" "):e}},wC={...tp,color:Gt,backgroundColor:Gt,outlineColor:Gt,fill:Gt,stroke:Gt,borderColor:Gt,borderTopColor:Gt,borderRightColor:Gt,borderBottomColor:Gt,borderLeftColor:Gt,filter:Xh,WebkitFilter:Xh},xp=e=>wC[e];function hb(e,t){let n=xp(e);return n!==Xh&&(n=es),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const kC=new Set(["auto","none","0"]);function SC(e,t,n){let r=0,s;for(;r<e.length&&!s;){const o=e[r];typeof o=="string"&&!kC.has(o)&&ca(o).values.length&&(s=e[r]),r++}if(s&&n)for(const o of t)e[o]=hb(n,s)}const mx=e=>e===qi||e===Le,gx=(e,t)=>parseFloat(e.split(", ")[t]),yx=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return gx(s[1],t);{const o=r.match(/^matrix\((.+)\)$/u);return o?gx(o[1],e):0}},jC=new Set(["x","y","z"]),EC=Vi.filter(e=>!jC.has(e));function CC(e){const t=[];return EC.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const zi={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:yx(4,13),y:yx(5,14)};zi.translateX=zi.x;zi.translateY=zi.y;const Rs=new Set;let Yh=!1,Qh=!1;function fb(){if(Qh){const e=Array.from(Rs).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=CC(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([o,a])=>{var c;(c=r.getValue(o))===null||c===void 0||c.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Qh=!1,Yh=!1,Rs.forEach(e=>e.complete()),Rs.clear()}function pb(){Rs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Qh=!0)})}function TC(){pb(),fb()}class vp{constructor(t,n,r,s,o,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=o,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Rs.add(this),Yh||(Yh=!0,ht.read(pb),ht.resolveKeyframes(fb))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let o=0;o<t.length;o++)if(t[o]===null)if(o===0){const a=s?.get(),c=t[t.length-1];if(a!==void 0)t[0]=a;else if(r&&n){const u=r.readValue(n,c);u!=null&&(t[0]=u)}t[0]===void 0&&(t[0]=c),s&&a===void 0&&s.set(t[0])}else t[o]=t[o-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 mb=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),NC=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function AC(e){const t=NC.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function gb(e,t,n=1){const[r,s]=AC(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return mb(a)?parseFloat(a):a}return ep(s)?gb(s,t,n+1):s}const yb=e=>t=>t.test(e),RC={test:e=>e==="auto",parse:e=>e},xb=[qi,Le,cr,Xr,_E,vE,RC],xx=e=>xb.find(yb(e));class vb extends vp{constructor(t,n,r,s,o){super(t,n,r,s,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let f=t[u];if(typeof f=="string"&&(f=f.trim(),ep(f))){const p=gb(f,n.current);p!==void 0&&(t[u]=p),u===t.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!J_.has(r)||t.length!==2)return;const[s,o]=t,a=xx(s),c=xx(o);if(a!==c)if(mx(a)&&mx(c))for(let u=0;u<t.length;u++){const f=t[u];typeof f=="string"&&(t[u]=parseFloat(f))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)aC(t[s])&&r.push(s);r.length&&SC(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=zi[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var t;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const o=n.getValue(r);o&&o.jump(this.measuredOrigin,!1);const a=s.length-1,c=s[a];s[a]=zi[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(([u,f])=>{n.getValue(u).set(f)}),this.resolveNoneKeyframes()}}const vx=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(es.test(e)||e==="0")&&!e.startsWith("url("));function PC(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 OC(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],a=vx(s,t),c=vx(o,t);return!a||!c?!1:PC(e)||(n==="spring"||lp(n))&&r}const LC=e=>e!==null;function zc(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(LC),o=t&&n!=="loop"&&t%2===1?0:s.length-1;return!o||r===void 0?s[o]:r}const IC=40;class _b{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:a="loop",...c}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=ur.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:o,repeatType:a,...c},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>IC?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&TC(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=ur.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:o,delay:a,onComplete:c,onUpdate:u,isGenerator:f}=this.options;if(!f&&!OC(t,r,s,o))if(a)this.options.duration=0;else{u&&u(zc(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 yt=(e,t,n)=>e+(t-e)*n;function Gd(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 DC({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,o=0,a=0;if(!t)s=o=a=n;else{const c=n<.5?n*(1+t):n+t-n*t,u=2*n-c;s=Gd(u,c,e+1/3),o=Gd(u,c,e),a=Gd(u,c,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}function pc(e,t){return n=>n>0?t:e}const Jd=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},MC=[Jh,Es,Ci],zC=e=>MC.find(t=>t.test(e));function _x(e){const t=zC(e);if(!t)return!1;let n=t.parse(e);return t===Ci&&(n=DC(n)),n}const bx=(e,t)=>{const n=_x(e),r=_x(t);if(!n||!r)return pc(e,t);const s={...n};return o=>(s.red=Jd(n.red,r.red,o),s.green=Jd(n.green,r.green,o),s.blue=Jd(n.blue,r.blue,o),s.alpha=yt(n.alpha,r.alpha,o),Es.transform(s))},FC=(e,t)=>n=>t(e(n)),ka=(...e)=>e.reduce(FC),Zh=new Set(["none","hidden"]);function $C(e,t){return Zh.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function UC(e,t){return n=>yt(e,t,n)}function _p(e){return typeof e=="number"?UC:typeof e=="string"?ep(e)?pc:Gt.test(e)?bx:qC:Array.isArray(e)?bb:typeof e=="object"?Gt.test(e)?bx:BC:pc}function bb(e,t){const n=[...e],r=n.length,s=e.map((o,a)=>_p(o)(o,t[a]));return o=>{for(let a=0;a<r;a++)n[a]=s[a](o);return n}}function BC(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=_p(e[s])(e[s],t[s]));return s=>{for(const o in r)n[o]=r[o](s);return n}}function VC(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const a=t.types[o],c=e.indexes[a][s[a]],u=(n=e.values[c])!==null&&n!==void 0?n:0;r[o]=u,s[a]++}return r}const qC=(e,t)=>{const n=es.createTransformer(t),r=ca(e),s=ca(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Zh.has(e)&&!s.values.length||Zh.has(t)&&!r.values.length?$C(e,t):ka(bb(VC(r,s),s.values),n):pc(e,t)};function wb(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?yt(e,t,n):_p(e)(e,t)}const HC=5;function kb(e,t,n){const r=Math.max(t-HC,0);return X_(n-e(r),t-r)}const _t={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},Xd=.001;function KC({duration:e=_t.duration,bounce:t=_t.bounce,velocity:n=_t.velocity,mass:r=_t.mass}){let s,o,a=1-t;a=Er(_t.minDamping,_t.maxDamping,a),e=Er(_t.minDuration,_t.maxDuration,jr(e)),a<1?(s=f=>{const p=f*a,g=p*e,y=p-n,v=ef(f,a),b=Math.exp(-g);return Xd-y/v*b},o=f=>{const g=f*a*e,y=g*n+n,v=Math.pow(a,2)*Math.pow(f,2)*e,b=Math.exp(-g),w=ef(Math.pow(f,2),a);return(-s(f)+Xd>0?-1:1)*((y-v)*b)/w}):(s=f=>{const p=Math.exp(-f*e),g=(f-n)*e+1;return-Xd+p*g},o=f=>{const p=Math.exp(-f*e),g=(n-f)*(e*e);return p*g});const c=5/e,u=GC(s,o,c);if(e=Sr(e),isNaN(u))return{stiffness:_t.stiffness,damping:_t.damping,duration:e};{const f=Math.pow(u,2)*r;return{stiffness:f,damping:a*2*Math.sqrt(r*f),duration:e}}}const WC=12;function GC(e,t,n){let r=n;for(let s=1;s<WC;s++)r=r-e(r)/t(r);return r}function ef(e,t){return e*Math.sqrt(1-t*t)}const JC=["duration","bounce"],XC=["stiffness","damping","mass"];function wx(e,t){return t.some(n=>e[n]!==void 0)}function YC(e){let t={velocity:_t.velocity,stiffness:_t.stiffness,damping:_t.damping,mass:_t.mass,isResolvedFromDuration:!1,...e};if(!wx(e,XC)&&wx(e,JC))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,o=2*Er(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:_t.mass,stiffness:s,damping:o}}else{const n=KC(e);t={...t,...n,mass:_t.mass},t.isResolvedFromDuration=!0}return t}function Sb(e=_t.visualDuration,t=_t.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const o=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],c={done:!1,value:o},{stiffness:u,damping:f,mass:p,duration:g,velocity:y,isResolvedFromDuration:v}=YC({...n,velocity:-jr(n.velocity||0)}),b=y||0,w=f/(2*Math.sqrt(u*p)),k=a-o,S=jr(Math.sqrt(u/p)),C=Math.abs(k)<5;r||(r=C?_t.restSpeed.granular:_t.restSpeed.default),s||(s=C?_t.restDelta.granular:_t.restDelta.default);let j;if(w<1){const T=ef(S,w);j=N=>{const M=Math.exp(-w*S*N);return a-M*((b+w*S*k)/T*Math.sin(T*N)+k*Math.cos(T*N))}}else if(w===1)j=T=>a-Math.exp(-S*T)*(k+(b+S*k)*T);else{const T=S*Math.sqrt(w*w-1);j=N=>{const M=Math.exp(-w*S*N),V=Math.min(T*N,300);return a-M*((b+w*S*k)*Math.sinh(V)+T*k*Math.cosh(V))/T}}const O={calculatedDuration:v&&g||null,next:T=>{const N=j(T);if(v)c.done=T>=g;else{let M=0;w<1&&(M=T===0?Sr(b):kb(j,T,N));const V=Math.abs(M)<=r,B=Math.abs(a-N)<=s;c.done=V&&B}return c.value=c.done?a:N,c},toString:()=>{const T=Math.min(B_(O),Kh),N=V_(M=>O.next(T*M).value,T,30);return T+"ms "+N}};return O}function kx({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:a,min:c,max:u,restDelta:f=.5,restSpeed:p}){const g=e[0],y={done:!1,value:g},v=V=>c!==void 0&&V<c||u!==void 0&&V>u,b=V=>c===void 0?u:u===void 0||Math.abs(c-V)<Math.abs(u-V)?c:u;let w=n*t;const k=g+w,S=a===void 0?k:a(k);S!==k&&(w=S-g);const C=V=>-w*Math.exp(-V/r),j=V=>S+C(V),O=V=>{const B=C(V),L=j(V);y.done=Math.abs(B)<=f,y.value=y.done?S:L};let T,N;const M=V=>{v(y.value)&&(T=V,N=Sb({keyframes:[y.value,b(y.value)],velocity:kb(j,V,y.value),damping:s,stiffness:o,restDelta:f,restSpeed:p}))};return M(0),{calculatedDuration:null,next:V=>{let B=!1;return!N&&T===void 0&&(B=!0,O(V),M(V)),T!==void 0&&V>=T?N.next(V-T):(!B&&O(V),y)}}}const QC=wa(.42,0,1,1),ZC=wa(0,0,.58,1),jb=wa(.42,0,.58,1),e2=e=>Array.isArray(e)&&typeof e[0]!="number",t2={linear:En,easeIn:QC,easeInOut:jb,easeOut:ZC,circIn:mp,circInOut:ib,circOut:sb,backIn:pp,backInOut:nb,backOut:tb,anticipate:rb},Sx=e=>{if(cp(e)){w_(e.length===4);const[t,n,r,s]=e;return wa(t,n,r,s)}else if(typeof e=="string")return t2[e];return e};function n2(e,t,n){const r=[],s=n||wb,o=e.length-1;for(let a=0;a<o;a++){let c=s(e[a],e[a+1]);if(t){const u=Array.isArray(t)?t[a]||En:t;c=ka(u,c)}r.push(c)}return r}function r2(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const o=e.length;if(w_(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=n2(t,r,s),u=c.length,f=p=>{if(a&&p<e[0])return t[0];let g=0;if(u>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const y=Di(e[g],e[g+1],p);return c[g](y)};return n?p=>f(Er(e[0],e[o-1],p)):f}function s2(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Di(0,t,r);e.push(yt(n,1,s))}}function i2(e){const t=[0];return s2(t,e.length-1),t}function o2(e,t){return e.map(n=>n*t)}function a2(e,t){return e.map(()=>t||jb).splice(0,e.length-1)}function mc({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=e2(r)?r.map(Sx):Sx(r),o={done:!1,value:t[0]},a=o2(n&&n.length===t.length?n:i2(t),e),c=r2(a,t,{ease:Array.isArray(s)?s:a2(t,s)});return{calculatedDuration:e,next:u=>(o.value=c(u),o.done=u>=e,o)}}const l2=e=>{const t=({timestamp:n})=>e(n);return{start:()=>ht.update(t,!0),stop:()=>Zr(t),now:()=>Bt.isProcessing?Bt.timestamp:ur.now()}},c2={decay:kx,inertia:kx,tween:mc,keyframes:mc,spring:Sb},u2=e=>e/100;class bp extends _b{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:u}=this.options;u&&u()};const{name:n,motionValue:r,element:s,keyframes:o}=this.options,a=s?.KeyframeResolver||vp,c=(u,f)=>this.onKeyframesResolved(u,f);this.resolver=new a(o,c,n,r,s),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:s=0,repeatType:o,velocity:a=0}=this.options,c=lp(n)?n:c2[n]||mc;let u,f;c!==mc&&typeof t[0]!="number"&&(u=ka(u2,wb(t[0],t[1])),t=[0,100]);const p=c({...this.options,keyframes:t});o==="mirror"&&(f=c({...this.options,keyframes:[...t].reverse(),velocity:-a})),p.calculatedDuration===null&&(p.calculatedDuration=B_(p));const{calculatedDuration:g}=p,y=g+s,v=y*(r+1)-s;return{generator:p,mirroredGenerator:f,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:v}}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:V}=this.options;return{done:!0,value:V[V.length-1]}}const{finalKeyframe:s,generator:o,mirroredGenerator:a,mapPercentToKeyframes:c,keyframes:u,calculatedDuration:f,totalDuration:p,resolvedDuration:g}=r;if(this.startTime===null)return o.next(0);const{delay:y,repeat:v,repeatType:b,repeatDelay:w,onUpdate:k}=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 S=this.currentTime-y*(this.speed>=0?1:-1),C=this.speed>=0?S<0:S>p;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=p);let j=this.currentTime,O=o;if(v){const V=Math.min(this.currentTime,p)/g;let B=Math.floor(V),L=V%1;!L&&V>=1&&(L=1),L===1&&B--,B=Math.min(B,v+1),B%2&&(b==="reverse"?(L=1-L,w&&(L-=w/g)):b==="mirror"&&(O=a)),j=Er(0,1,L)*g}const T=C?{done:!1,value:u[0]}:O.next(j);c&&(T.value=c(T.value));let{done:N}=T;!C&&f!==null&&(N=this.speed>=0?this.currentTime>=p:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return M&&s!==void 0&&(T.value=zc(u,this.options,s)),k&&k(T.value),M&&this.finish(),T}get duration(){const{resolved:t}=this;return t?jr(t.calculatedDuration):0}get time(){return jr(this.currentTime)}set time(t){t=Sr(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=jr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=l2,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):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 d2=new Set(["opacity","clipPath","filter","transform"]);function h2(e,t,n,{delay:r=0,duration:s=300,repeat:o=0,repeatType:a="loop",ease:c="easeInOut",times:u}={}){const f={[t]:n};u&&(f.offset=u);const p=H_(c,s);return Array.isArray(p)&&(f.easing=p),e.animate(f,{delay:r,duration:s,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}const f2=Wf(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),gc=10,p2=2e4;function m2(e){return lp(e.type)||e.type==="spring"||!q_(e.ease)}function g2(e,t){const n=new bp({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let o=0;for(;!r.done&&o<p2;)r=n.sample(o),s.push(r.value),o+=gc;return{times:void 0,keyframes:s,duration:o-gc,ease:"linear"}}const Eb={anticipate:rb,backInOut:nb,circInOut:ib};function y2(e){return e in Eb}class jx extends _b{constructor(t){super(t);const{name:n,motionValue:r,element:s,keyframes:o}=this.options;this.resolver=new vb(o,(a,c)=>this.onKeyframesResolved(a,c),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:o,type:a,motionValue:c,name:u,startTime:f}=this.options;if(!c.owner||!c.owner.current)return!1;if(typeof o=="string"&&fc()&&y2(o)&&(o=Eb[o]),m2(this.options)){const{onComplete:g,onUpdate:y,motionValue:v,element:b,...w}=this.options,k=g2(t,w);t=k.keyframes,t.length===1&&(t[1]=t[0]),r=k.duration,s=k.times,o=k.ease,a="keyframes"}const p=h2(c.owner.current,u,t,{...this.options,duration:r,times:s,ease:o});return p.startTime=f??this.calcStartTime(),this.pendingTimeline?(cx(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:g}=this.options;c.set(zc(t,this.options,n)),g&&g(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:r,times:s,type:a,ease:o,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return jr(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return jr(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Sr(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;cx(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:s,type:o,ease:a,times:c}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:f,onUpdate:p,onComplete:g,element:y,...v}=this.options,b=new bp({...v,keyframes:r,duration:s,type:o,ease:a,times:c,isGenerator:!0}),w=Sr(this.time);f.setWithVelocity(b.sample(w-gc).value,b.sample(w).value,gc)}const{onStop:u}=this.options;u&&u(),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:s,repeatType:o,damping:a,type:c}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:f}=n.owner.getProps();return f2()&&r&&d2.has(r)&&!u&&!f&&!s&&o!=="mirror"&&a!==0&&c!=="inertia"}}const x2={type:"spring",stiffness:500,damping:25,restSpeed:10},v2=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),_2={type:"keyframes",duration:.8},b2={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},w2=(e,{keyframes:t})=>t.length>2?_2:zs.has(e)?e.startsWith("scale")?v2(t[1]):x2:b2;function k2({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:o,repeatType:a,repeatDelay:c,from:u,elapsed:f,...p}){return!!Object.keys(p).length}const wp=(e,t,n,r={},s,o)=>a=>{const c=ap(r,e)||{},u=c.delay||r.delay||0;let{elapsed:f=0}=r;f=f-Sr(u);let p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-f,onUpdate:y=>{t.set(y),c.onUpdate&&c.onUpdate(y)},onComplete:()=>{a(),c.onComplete&&c.onComplete()},name:e,motionValue:t,element:o?void 0:s};k2(c)||(p={...p,...w2(e,p)}),p.duration&&(p.duration=Sr(p.duration)),p.repeatDelay&&(p.repeatDelay=Sr(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(p.duration=0,p.delay===0&&(g=!0)),g&&!o&&t.get()!==void 0){const y=zc(p.keyframes,c);if(y!==void 0)return ht.update(()=>{p.onUpdate(y),p.onComplete()}),new BE([])}return!o&&jx.supports(p)?new jx(p):new bp(p)};function S2({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Cb(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var o;let{transition:a=e.getDefaultTransition(),transitionEnd:c,...u}=t;r&&(a=r);const f=[],p=s&&e.animationState&&e.animationState.getState()[s];for(const g in u){const y=e.getValue(g,(o=e.latestValues[g])!==null&&o!==void 0?o:null),v=u[g];if(v===void 0||p&&S2(p,g))continue;const b={delay:n,...ap(a||{},g)};let w=!1;if(window.MotionHandoffAnimation){const S=Y_(e);if(S){const C=window.MotionHandoffAnimation(S,g,ht);C!==null&&(b.startTime=C,w=!0)}}Gh(e,g),y.start(wp(g,y,v,e.shouldReduceMotion&&J_.has(g)?{type:!1}:b,e,w));const k=y.animation;k&&f.push(k)}return c&&Promise.all(f).then(()=>{ht.update(()=>{c&&nC(e,c)})}),f}function tf(e,t,n={}){var r;const s=Mc(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:o=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(o=n.transitionOverride);const a=s?()=>Promise.all(Cb(e,s,n)):()=>Promise.resolve(),c=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:p=0,staggerChildren:g,staggerDirection:y}=o;return j2(e,t,p+f,g,y,n)}:()=>Promise.resolve(),{when:u}=o;if(u){const[f,p]=u==="beforeChildren"?[a,c]:[c,a];return f().then(()=>p())}else return Promise.all([a(),c(n.delay)])}function j2(e,t,n=0,r=0,s=1,o){const a=[],c=(e.variantChildren.size-1)*r,u=s===1?(f=0)=>f*r:(f=0)=>c-f*r;return Array.from(e.variantChildren).sort(E2).forEach((f,p)=>{f.notify("AnimationStart",t),a.push(tf(f,t,{...o,delay:n+u(p)}).then(()=>f.notify("AnimationComplete",t)))}),Promise.all(a)}function E2(e,t){return e.sortNodePosition(t)}function C2(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(o=>tf(e,o,n));r=Promise.all(s)}else if(typeof t=="string")r=tf(e,t,n);else{const s=typeof t=="function"?Mc(e,t,n.custom):t;r=Promise.all(Cb(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const T2=Jf.length;function Tb(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Tb(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<T2;n++){const r=Jf[n],s=e.props[r];(oa(s)||s===!1)&&(t[r]=s)}return t}const N2=[...Gf].reverse(),A2=Gf.length;function R2(e){return t=>Promise.all(t.map(({animation:n,options:r})=>C2(e,n,r)))}function P2(e){let t=R2(e),n=Ex(),r=!0;const s=u=>(f,p)=>{var g;const y=Mc(e,p,u==="exit"?(g=e.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:v,transitionEnd:b,...w}=y;f={...f,...w,...b}}return f};function o(u){t=u(e)}function a(u){const{props:f}=e,p=Tb(e.parent)||{},g=[],y=new Set;let v={},b=1/0;for(let k=0;k<A2;k++){const S=N2[k],C=n[S],j=f[S]!==void 0?f[S]:p[S],O=oa(j),T=S===u?C.isActive:null;T===!1&&(b=k);let N=j===p[S]&&j!==f[S]&&O;if(N&&r&&e.manuallyAnimateOnMount&&(N=!1),C.protectedKeys={...v},!C.isActive&&T===null||!j&&!C.prevProp||Ic(j)||typeof j=="boolean")continue;const M=O2(C.prevProp,j);let V=M||S===u&&C.isActive&&!N&&O||k>b&&O,B=!1;const L=Array.isArray(j)?j:[j];let Q=L.reduce(s(S),{});T===!1&&(Q={});const{prevResolvedValues:Y={}}=C,he={...Y,...Q},K=re=>{V=!0,y.has(re)&&(B=!0,y.delete(re)),C.needsAnimating[re]=!0;const J=e.getValue(re);J&&(J.liveStyle=!1)};for(const re in he){const J=Q[re],ce=Y[re];if(v.hasOwnProperty(re))continue;let A=!1;Hh(J)&&Hh(ce)?A=!U_(J,ce):A=J!==ce,A?J!=null?K(re):y.add(re):J!==void 0&&y.has(re)?K(re):C.protectedKeys[re]=!0}C.prevProp=j,C.prevResolvedValues=Q,C.isActive&&(v={...v,...Q}),r&&e.blockInitialAnimation&&(V=!1),V&&(!(N&&M)||B)&&g.push(...L.map(re=>({animation:re,options:{type:S}})))}if(y.size){const k={};y.forEach(S=>{const C=e.getBaseTarget(S),j=e.getValue(S);j&&(j.liveStyle=!0),k[S]=C??null}),g.push({animation:k})}let w=!!g.length;return r&&(f.initial===!1||f.initial===f.animate)&&!e.manuallyAnimateOnMount&&(w=!1),r=!1,w?t(g):Promise.resolve()}function c(u,f){var p;if(n[u].isActive===f)return Promise.resolve();(p=e.variantChildren)===null||p===void 0||p.forEach(y=>{var v;return(v=y.animationState)===null||v===void 0?void 0:v.setActive(u,f)}),n[u].isActive=f;const g=a(u);for(const y in n)n[y].protectedKeys={};return g}return{animateChanges:a,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Ex(),r=!0}}}function O2(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!U_(t,e):!1}function ys(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ex(){return{animate:ys(!0),whileInView:ys(),whileHover:ys(),whileTap:ys(),whileDrag:ys(),whileFocus:ys(),exit:ys()}}class ts{constructor(t){this.isMounted=!1,this.node=t}update(){}}class L2 extends ts{constructor(t){super(t),t.animationState||(t.animationState=P2(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Ic(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 I2=0;class D2 extends ts{constructor(){super(...arguments),this.id=I2++}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 s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const M2={animation:{Feature:L2},exit:{Feature:D2}};function ua(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Sa(e){return{point:{x:e.pageX,y:e.pageY}}}const z2=e=>t=>up(t)&&e(t,Sa(t));function Wo(e,t,n,r){return ua(e,t,z2(n),r)}const Cx=(e,t)=>Math.abs(e-t);function F2(e,t){const n=Cx(e.x,t.x),r=Cx(e.y,t.y);return Math.sqrt(n**2+r**2)}class Nb{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:o=!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 g=Qd(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,v=F2(g.offset,{x:0,y:0})>=3;if(!y&&!v)return;const{point:b}=g,{timestamp:w}=Bt;this.history.push({...b,timestamp:w});const{onStart:k,onMove:S}=this.handlers;y||(k&&k(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Yd(y,this.transformPagePoint),ht.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:v,onSessionEnd:b,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Qd(g.type==="pointercancel"?this.lastMoveEventInfo:Yd(y,this.transformPagePoint),this.history);this.startEvent&&v&&v(g,k),b&&b(g,k)},!up(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const a=Sa(t),c=Yd(a,this.transformPagePoint),{point:u}=c,{timestamp:f}=Bt;this.history=[{...u,timestamp:f}];const{onSessionStart:p}=n;p&&p(t,Qd(c,this.history)),this.removeListeners=ka(Wo(this.contextWindow,"pointermove",this.handlePointerMove),Wo(this.contextWindow,"pointerup",this.handlePointerUp),Wo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Zr(this.updatePoint)}}function Yd(e,t){return t?{point:t(e.point)}:e}function Tx(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Qd({point:e},t){return{point:e,delta:Tx(e,Ab(t)),offset:Tx(e,$2(t)),velocity:U2(t,.1)}}function $2(e){return e[0]}function Ab(e){return e[e.length-1]}function U2(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=Ab(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Sr(t)));)n--;if(!r)return{x:0,y:0};const o=jr(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const Rb=1e-4,B2=1-Rb,V2=1+Rb,Pb=.01,q2=0-Pb,H2=0+Pb;function Nn(e){return e.max-e.min}function K2(e,t,n){return Math.abs(e-t)<=n}function Nx(e,t,n,r=.5){e.origin=r,e.originPoint=yt(t.min,t.max,e.origin),e.scale=Nn(n)/Nn(t),e.translate=yt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=B2&&e.scale<=V2||isNaN(e.scale))&&(e.scale=1),(e.translate>=q2&&e.translate<=H2||isNaN(e.translate))&&(e.translate=0)}function Go(e,t,n,r){Nx(e.x,t.x,n.x,r?r.originX:void 0),Nx(e.y,t.y,n.y,r?r.originY:void 0)}function Ax(e,t,n){e.min=n.min+t.min,e.max=e.min+Nn(t)}function W2(e,t,n){Ax(e.x,t.x,n.x),Ax(e.y,t.y,n.y)}function Rx(e,t,n){e.min=t.min-n.min,e.max=e.min+Nn(t)}function Jo(e,t,n){Rx(e.x,t.x,n.x),Rx(e.y,t.y,n.y)}function G2(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?yt(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?yt(n,e,r.max):Math.min(e,n)),e}function Px(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 J2(e,{top:t,left:n,bottom:r,right:s}){return{x:Px(e.x,n,s),y:Px(e.y,t,r)}}function Ox(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 X2(e,t){return{x:Ox(e.x,t.x),y:Ox(e.y,t.y)}}function Y2(e,t){let n=.5;const r=Nn(e),s=Nn(t);return s>r?n=Di(t.min,t.max-r,e.min):r>s&&(n=Di(e.min,e.max-s,t.min)),Er(0,1,n)}function Q2(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 nf=.35;function Z2(e=nf){return e===!1?e=0:e===!0&&(e=nf),{x:Lx(e,"left","right"),y:Lx(e,"top","bottom")}}function Lx(e,t,n){return{min:Ix(e,t),max:Ix(e,n)}}function Ix(e,t){return typeof e=="number"?e:e[t]||0}const Dx=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ti=()=>({x:Dx(),y:Dx()}),Mx=()=>({min:0,max:0}),St=()=>({x:Mx(),y:Mx()});function Mn(e){return[e("x"),e("y")]}function Ob({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function eT({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function tT(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 Zd(e){return e===void 0||e===1}function rf({scale:e,scaleX:t,scaleY:n}){return!Zd(e)||!Zd(t)||!Zd(n)}function bs(e){return rf(e)||Lb(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Lb(e){return zx(e.x)||zx(e.y)}function zx(e){return e&&e!=="0%"}function yc(e,t,n){const r=e-n,s=t*r;return n+s}function Fx(e,t,n,r,s){return s!==void 0&&(e=yc(e,s,r)),yc(e,n,r)+t}function sf(e,t=0,n=1,r,s){e.min=Fx(e.min,t,n,r,s),e.max=Fx(e.max,t,n,r,s)}function Ib(e,{x:t,y:n}){sf(e.x,t.translate,t.scale,t.originPoint),sf(e.y,n.translate,n.scale,n.originPoint)}const $x=.999999999999,Ux=1.0000000000001;function nT(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let o,a;for(let c=0;c<s;c++){o=n[c],a=o.projectionDelta;const{visualElement:u}=o.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Ai(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,Ib(e,a)),r&&bs(o.latestValues)&&Ai(e,o.latestValues))}t.x<Ux&&t.x>$x&&(t.x=1),t.y<Ux&&t.y>$x&&(t.y=1)}function Ni(e,t){e.min=e.min+t,e.max=e.max+t}function Bx(e,t,n,r,s=.5){const o=yt(e.min,e.max,s);sf(e,t,n,o,r)}function Ai(e,t){Bx(e.x,t.x,t.scaleX,t.scale,t.originX),Bx(e.y,t.y,t.scaleY,t.scale,t.originY)}function Db(e,t){return Ob(tT(e.getBoundingClientRect(),t))}function rT(e,t,n){const r=Db(e,n),{scroll:s}=t;return s&&(Ni(r.x,s.offset.x),Ni(r.y,s.offset.y)),r}const Mb=({current:e})=>e?e.ownerDocument.defaultView:null,sT=new WeakMap;class iT{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=St(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=p=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Sa(p).point)},o=(p,g)=>{const{drag:y,dragPropagation:v,onDragStart:b}=this.getProps();if(y&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=YE(y),!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),Mn(k=>{let S=this.getAxisMotionValue(k).get()||0;if(cr.test(S)){const{projection:C}=this.visualElement;if(C&&C.layout){const j=C.layout.layoutBox[k];j&&(S=Nn(j)*(parseFloat(S)/100))}}this.originPoint[k]=S}),b&&ht.postRender(()=>b(p,g)),Gh(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},a=(p,g)=>{const{dragPropagation:y,dragDirectionLock:v,onDirectionLock:b,onDrag:w}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:k}=g;if(v&&this.currentDirection===null){this.currentDirection=oT(k),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",g.point,k),this.updateAxis("y",g.point,k),this.visualElement.render(),w&&w(p,g)},c=(p,g)=>this.stop(p,g),u=()=>Mn(p=>{var g;return this.getAnimationState(p)==="paused"&&((g=this.getAxisMotionValue(p).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:f}=this.getProps();this.panSession=new Nb(t,{onSessionStart:s,onStart:o,onMove:a,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,contextWindow:Mb(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&ht.postRender(()=>o(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:s}=this.getProps();if(!r||!ql(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=G2(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,o=this.constraints;n&&Ei(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=J2(s.layoutBox,n):this.constraints=!1,this.elastic=Z2(r),o!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Mn(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Q2(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Ei(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=rT(r,s.root,this.visualElement.getTransformPagePoint());let a=X2(s.layout.layoutBox,o);if(n){const c=n(eT(a));this.hasMutatedConstraints=!!c,c&&(a=Ob(c))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},f=Mn(p=>{if(!ql(p,n,this.currentDirection))return;let g=u&&u[p]||{};a&&(g={min:0,max:0});const y=s?200:1e6,v=s?40:1e7,b={type:"inertia",velocity:r?t[p]:0,bounceStiffness:y,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...o,...g};return this.startAxisValueAnimation(p,b)});return Promise.all(f).then(c)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Gh(this.visualElement,t),r.start(wp(t,r,0,n,this.visualElement,!1))}stopAnimation(){Mn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Mn(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(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Mn(n=>{const{drag:r}=this.getProps();if(!ql(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:c}=s.layout.layoutBox[n];o.set(t[n]-yt(a,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Ei(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Mn(a=>{const c=this.getAxisMotionValue(a);if(c&&this.constraints!==!1){const u=c.get();s[a]=Y2({min:u,max:u},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Mn(a=>{if(!ql(a,t,null))return;const c=this.getAxisMotionValue(a),{min:u,max:f}=this.constraints[a];c.set(yt(u,f,s[a]))})}addListeners(){if(!this.visualElement.current)return;sT.set(this.visualElement,this);const t=this.visualElement.current,n=Wo(t,"pointerdown",u=>{const{drag:f,dragListener:p=!0}=this.getProps();f&&p&&this.start(u)}),r=()=>{const{dragConstraints:u}=this.getProps();Ei(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,o=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),ht.read(r);const a=ua(window,"resize",()=>this.scalePositionWithinConstraints()),c=s.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:f})=>{this.isDragging&&f&&(Mn(p=>{const g=this.getAxisMotionValue(p);g&&(this.originPoint[p]+=u[p].translate,g.set(g.get()+u[p].translate))}),this.visualElement.render())}));return()=>{a(),n(),o(),c&&c()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:a=nf,dragMomentum:c=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:a,dragMomentum:c}}}function ql(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function oT(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class aT extends ts{constructor(t){super(t),this.removeGroupControls=En,this.removeListeners=En,this.controls=new iT(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 Vx=e=>(t,n)=>{e&&ht.postRender(()=>e(t,n))};class lT extends ts{constructor(){super(...arguments),this.removePointerDownListener=En}onPointerDown(t){this.session=new Nb(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Mb(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Vx(t),onStart:Vx(n),onMove:r,onEnd:(o,a)=>{delete this.session,s&&ht.postRender(()=>s(o,a))}}}mount(){this.removePointerDownListener=Wo(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 sc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function qx(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Lo={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Le.test(e))e=parseFloat(e);else return e;const n=qx(e,t.target.x),r=qx(e,t.target.y);return`${n}% ${r}%`}},cT={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=es.parse(e);if(s.length>5)return r;const o=es.createTransformer(e),a=typeof s[0]!="number"?1:0,c=n.x.scale*t.x,u=n.y.scale*t.y;s[0+a]/=c,s[1+a]/=u;const f=yt(c,u,.5);return typeof s[2+a]=="number"&&(s[2+a]/=f),typeof s[3+a]=="number"&&(s[3+a]/=f),o(s)}};class uT extends R.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;AE(dT),o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),sc.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,s||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||ht.postRender(()=>{const c=a.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Yf.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function zb(e){const[t,n]=__(),r=R.useContext(Vf);return h.jsx(uT,{...e,layoutGroup:r,switchLayoutGroup:R.useContext(T_),isPresent:t,safeToRemove:n})}const dT={borderRadius:{...Lo,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Lo,borderTopRightRadius:Lo,borderBottomLeftRadius:Lo,borderBottomRightRadius:Lo,boxShadow:cT};function hT(e,t,n){const r=Xt(e)?e:la(e);return r.start(wp("",r,t,n)),r.animation}function fT(e){return e instanceof SVGElement&&e.tagName!=="svg"}const pT=(e,t)=>e.depth-t.depth;class mT{constructor(){this.children=[],this.isDirty=!1}add(t){dp(this.children,t),this.isDirty=!0}remove(t){hp(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(pT),this.isDirty=!1,this.children.forEach(t)}}function gT(e,t){const n=ur.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(Zr(r),e(o-t))};return ht.read(r,!0),()=>Zr(r)}const Fb=["TopLeft","TopRight","BottomLeft","BottomRight"],yT=Fb.length,Hx=e=>typeof e=="string"?parseFloat(e):e,Kx=e=>typeof e=="number"||Le.test(e);function xT(e,t,n,r,s,o){s?(e.opacity=yt(0,n.opacity!==void 0?n.opacity:1,vT(r)),e.opacityExit=yt(t.opacity!==void 0?t.opacity:1,0,_T(r))):o&&(e.opacity=yt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;a<yT;a++){const c=`border${Fb[a]}Radius`;let u=Wx(t,c),f=Wx(n,c);if(u===void 0&&f===void 0)continue;u||(u=0),f||(f=0),u===0||f===0||Kx(u)===Kx(f)?(e[c]=Math.max(yt(Hx(u),Hx(f),r),0),(cr.test(f)||cr.test(u))&&(e[c]+="%")):e[c]=f}(t.rotate||n.rotate)&&(e.rotate=yt(t.rotate||0,n.rotate||0,r))}function Wx(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const vT=$b(0,.5,sb),_T=$b(.5,.95,En);function $b(e,t,n){return r=>r<e?0:r>t?1:n(Di(e,t,r))}function Gx(e,t){e.min=t.min,e.max=t.max}function Dn(e,t){Gx(e.x,t.x),Gx(e.y,t.y)}function Jx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Xx(e,t,n,r,s){return e-=t,e=yc(e,1/n,r),s!==void 0&&(e=yc(e,1/s,r)),e}function bT(e,t=0,n=1,r=.5,s,o=e,a=e){if(cr.test(t)&&(t=parseFloat(t),t=yt(a.min,a.max,t/100)-a.min),typeof t!="number")return;let c=yt(o.min,o.max,r);e===o&&(c-=t),e.min=Xx(e.min,t,n,c,s),e.max=Xx(e.max,t,n,c,s)}function Yx(e,t,[n,r,s],o,a){bT(e,t[n],t[r],t[s],t.scale,o,a)}const wT=["x","scaleX","originX"],kT=["y","scaleY","originY"];function Qx(e,t,n,r){Yx(e.x,t,wT,n?n.x:void 0,r?r.x:void 0),Yx(e.y,t,kT,n?n.y:void 0,r?r.y:void 0)}function Zx(e){return e.translate===0&&e.scale===1}function Ub(e){return Zx(e.x)&&Zx(e.y)}function ev(e,t){return e.min===t.min&&e.max===t.max}function ST(e,t){return ev(e.x,t.x)&&ev(e.y,t.y)}function tv(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Bb(e,t){return tv(e.x,t.x)&&tv(e.y,t.y)}function nv(e){return Nn(e.x)/Nn(e.y)}function rv(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class jT{constructor(){this.members=[]}add(t){dp(this.members,t),t.scheduleRender()}remove(t){if(hp(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(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const o=this.members[s];if(o.isPresent!==!1){r=o;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:s}=t.options;s===!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 ET(e,t,n){let r="";const s=e.x.translate/t.x,o=e.y.translate/t.y,a=n?.z||0;if((s||o||a)&&(r=`translate3d(${s}px, ${o}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:f,rotate:p,rotateX:g,rotateY:y,skewX:v,skewY:b}=n;f&&(r=`perspective(${f}px) ${r}`),p&&(r+=`rotate(${p}deg) `),g&&(r+=`rotateX(${g}deg) `),y&&(r+=`rotateY(${y}deg) `),v&&(r+=`skewX(${v}deg) `),b&&(r+=`skewY(${b}deg) `)}const c=e.x.scale*t.x,u=e.y.scale*t.y;return(c!==1||u!==1)&&(r+=`scale(${c}, ${u})`),r||"none"}const ws={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},qo=typeof window<"u"&&window.MotionDebug!==void 0,eh=["","X","Y","Z"],CT={visibility:"hidden"},sv=1e3;let TT=0;function th(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Vb(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Y_(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ht,!(s||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Vb(r)}function qb({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},c=t?.()){this.id=TT++,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,qo&&(ws.totalNodes=ws.resolvedTargetDeltas=ws.recalculatedProjection=0),this.nodes.forEach(RT),this.nodes.forEach(DT),this.nodes.forEach(MT),this.nodes.forEach(PT),qo&&window.MotionDebug.record(ws)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,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 u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new mT)}addEventListener(a,c){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new fp),this.eventHandlers.get(a).add(c)}notifyListeners(a,...c){const u=this.eventHandlers.get(a);u&&u.notify(...c)}hasListeners(a){return this.eventHandlers.has(a)}mount(a,c=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=fT(a),this.instance=a;const{layoutId:u,layout:f,visualElement:p}=this.options;if(p&&!p.current&&p.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),c&&(f||u)&&(this.isLayoutDirty=!0),e){let g;const y=()=>this.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=gT(y,250),sc.hasAnimatedSinceResize&&(sc.hasAnimatedSinceResize=!1,this.nodes.forEach(ov))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&p&&(u||f)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:v,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||p.getDefaultTransition()||BT,{onLayoutAnimationStart:k,onLayoutAnimationComplete:S}=p.getProps(),C=!this.targetLayout||!Bb(this.targetLayout,b)||v,j=!y&&v;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,j);const O={...ap(w,"layout"),onPlay:k,onComplete:S};(p.shouldReduceMotion||this.options.layoutRoot)&&(O.delay=0,O.type=!1),this.startAnimation(O)}else y||ov(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Zr(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(zT),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Vb(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const g=this.path[p];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:c,layout:u}=this.options;if(c===void 0&&!u)return;const f=this.getTransformTemplate();this.prevTransformTemplateValue=f?f(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(iv);return}this.isUpdating||this.nodes.forEach(LT),this.isUpdating=!1,this.nodes.forEach(IT),this.nodes.forEach(NT),this.nodes.forEach(AT),this.clearAllSnapshots();const c=ur.now();Bt.delta=Er(0,1e3/60,c-Bt.timestamp),Bt.timestamp=c,Bt.isProcessing=!0,Hd.update.process(Bt),Hd.preRender.process(Bt),Hd.render.process(Bt),Bt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Yf.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(OT),this.sharedNodes.forEach(FT)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ht.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ht.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 u=0;u<this.path.length;u++)this.path[u].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=St(),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,a?a.layoutBox:void 0)}updateScroll(a="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(c=!1),c){const u=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:u,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!s)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!Ub(this.projectionDelta),u=this.getTransformTemplate(),f=u?u(this.latestValues,""):void 0,p=f!==this.prevTransformTemplateValue;a&&(c||bs(this.latestValues)||p)&&(s(this.instance,f),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const c=this.measurePageBox();let u=this.removeElementScroll(c);return a&&(u=this.removeTransform(u)),VT(u),{animationId:this.root.animationId,measuredBox:c,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var a;const{visualElement:c}=this.options;if(!c)return St();const u=c.measureViewportBox();if(!(((a=this.scroll)===null||a===void 0?void 0:a.wasRoot)||this.path.some(qT))){const{scroll:p}=this.root;p&&(Ni(u.x,p.offset.x),Ni(u.y,p.offset.y))}return u}removeElementScroll(a){var c;const u=St();if(Dn(u,a),!((c=this.scroll)===null||c===void 0)&&c.wasRoot)return u;for(let f=0;f<this.path.length;f++){const p=this.path[f],{scroll:g,options:y}=p;p!==this.root&&g&&y.layoutScroll&&(g.wasRoot&&Dn(u,a),Ni(u.x,g.offset.x),Ni(u.y,g.offset.y))}return u}applyTransform(a,c=!1){const u=St();Dn(u,a);for(let f=0;f<this.path.length;f++){const p=this.path[f];!c&&p.options.layoutScroll&&p.scroll&&p!==p.root&&Ai(u,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),bs(p.latestValues)&&Ai(u,p.latestValues)}return bs(this.latestValues)&&Ai(u,this.latestValues),u}removeTransform(a){const c=St();Dn(c,a);for(let u=0;u<this.path.length;u++){const f=this.path[u];if(!f.instance||!bs(f.latestValues))continue;rf(f.latestValues)&&f.updateSnapshot();const p=St(),g=f.measurePageBox();Dn(p,g),Qx(c,f.latestValues,f.snapshot?f.snapshot.layoutBox:void 0,p)}return bs(this.latestValues)&&Qx(c,this.latestValues),c}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.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!==Bt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var c;const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const f=!!this.resumingFrom||this!==u;if(!(a||f&&this.isSharedProjectionDirty||this.isProjectionDirty||!((c=this.parent)===null||c===void 0)&&c.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:g,layoutId:y}=this.options;if(!(!this.layout||!(g||y))){if(this.resolvedRelativeTargetAt=Bt.timestamp,!this.targetDelta&&!this.relativeTarget){const v=this.getClosestProjectingParent();v&&v.layout&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=St(),this.relativeTargetOrigin=St(),Jo(this.relativeTargetOrigin,this.layout.layoutBox,v.layout.layoutBox),Dn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=St(),this.targetWithTransforms=St()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),W2(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Dn(this.target,this.layout.layoutBox),Ib(this.target,this.targetDelta)):Dn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const v=this.getClosestProjectingParent();v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=St(),this.relativeTargetOrigin=St(),Jo(this.relativeTargetOrigin,this.target,v.target),Dn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}qo&&ws.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||rf(this.parent.latestValues)||Lb(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 a;const c=this.getLead(),u=!!this.resumingFrom||this!==c;let f=!0;if((this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty)&&(f=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(f=!1),this.resolvedRelativeTargetAt===Bt.timestamp&&(f=!1),f)return;const{layout:p,layoutId:g}=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||g))return;Dn(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,v=this.treeScale.y;nT(this.layoutCorrected,this.treeScale,this.path,u),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=St());const{target:b}=c;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Jx(this.prevProjectionDelta.x,this.projectionDelta.x),Jx(this.prevProjectionDelta.y,this.projectionDelta.y)),Go(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==y||this.treeScale.y!==v||!rv(this.projectionDelta.x,this.prevProjectionDelta.x)||!rv(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),qo&&ws.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var c;if((c=this.options.visualElement)===null||c===void 0||c.scheduleRender(),a){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ti(),this.projectionDelta=Ti(),this.projectionDeltaWithTransform=Ti()}setAnimationOrigin(a,c=!1){const u=this.snapshot,f=u?u.latestValues:{},p={...this.latestValues},g=Ti();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const y=St(),v=u?u.source:void 0,b=this.layout?this.layout.source:void 0,w=v!==b,k=this.getStack(),S=!k||k.members.length<=1,C=!!(w&&!S&&this.options.crossfade===!0&&!this.path.some(UT));this.animationProgress=0;let j;this.mixTargetDelta=O=>{const T=O/1e3;av(g.x,a.x,T),av(g.y,a.y,T),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Jo(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),$T(this.relativeTarget,this.relativeTargetOrigin,y,T),j&&ST(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=St()),Dn(j,this.relativeTarget)),w&&(this.animationValues=p,xT(p,f,this.latestValues,T,C,S)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Zr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ht.update(()=>{sc.hasAnimatedSinceResize=!0,this.currentAnimation=hT(0,sv,{...a,onUpdate:c=>{this.mixTargetDelta(c),a.onUpdate&&a.onUpdate(c)},onComplete:()=>{a.onComplete&&a.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 a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(sv),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:c,target:u,layout:f,latestValues:p}=a;if(!(!c||!u||!f)){if(this!==a&&this.layout&&f&&Hb(this.options.animationType,this.layout.layoutBox,f.layoutBox)){u=this.target||St();const g=Nn(this.layout.layoutBox.x);u.x.min=a.target.x.min,u.x.max=u.x.min+g;const y=Nn(this.layout.layoutBox.y);u.y.min=a.target.y.min,u.y.max=u.y.min+y}Dn(c,u),Ai(c,p),Go(this.projectionDeltaWithTransform,this.layoutCorrected,c,p)}}registerSharedNode(a,c){this.sharedNodes.has(a)||this.sharedNodes.set(a,new jT),this.sharedNodes.get(a).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 a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:c}=this.options;return c?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:c}=this.options;return c?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:c,preserveFollowOpacity:u}={}){const f=this.getStack();f&&f.promote(this,u),a&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let c=!1;const{latestValues:u}=a;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(c=!0),!c)return;const f={};u.z&&th("z",a,f,this.animationValues);for(let p=0;p<eh.length;p++)th(`rotate${eh[p]}`,a,f,this.animationValues),th(`skew${eh[p]}`,a,f,this.animationValues);a.render();for(const p in f)a.setStaticValue(p,f[p]),this.animationValues&&(this.animationValues[p]=f[p]);a.scheduleRender()}getProjectionStyles(a){var c,u;if(!this.instance||this.isSVG)return;if(!this.isVisible)return CT;const f={visibility:""},p=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,f.opacity="",f.pointerEvents=nc(a?.pointerEvents)||"",f.transform=p?p(this.latestValues,""):"none",f;const g=this.getLead();if(!this.projectionDelta||!this.layout||!g.target){const w={};return this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=nc(a?.pointerEvents)||""),this.hasProjected&&!bs(this.latestValues)&&(w.transform=p?p({},""):"none",this.hasProjected=!1),w}const y=g.animationValues||g.latestValues;this.applyTransformsToTarget(),f.transform=ET(this.projectionDeltaWithTransform,this.treeScale,y),p&&(f.transform=p(y,f.transform));const{x:v,y:b}=this.projectionDelta;f.transformOrigin=`${v.origin*100}% ${b.origin*100}% 0`,g.animationValues?f.opacity=g===this?(u=(c=y.opacity)!==null&&c!==void 0?c:this.latestValues.opacity)!==null&&u!==void 0?u:1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:f.opacity=g===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const w in hc){if(y[w]===void 0)continue;const{correct:k,applyTo:S}=hc[w],C=f.transform==="none"?y[w]:k(y[w],g);if(S){const j=S.length;for(let O=0;O<j;O++)f[S[O]]=C}else f[w]=C}return this.options.layoutId&&(f.pointerEvents=g===this?nc(a?.pointerEvents)||"":"none"),f}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var c;return(c=a.currentAnimation)===null||c===void 0?void 0:c.stop()}),this.root.nodes.forEach(iv),this.root.sharedNodes.clear()}}}function NT(e){e.updateLayout()}function AT(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:s}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;o==="size"?Mn(g=>{const y=a?n.measuredBox[g]:n.layoutBox[g],v=Nn(y);y.min=r[g].min,y.max=y.min+v}):Hb(o,n.layoutBox,r)&&Mn(g=>{const y=a?n.measuredBox[g]:n.layoutBox[g],v=Nn(r[g]);y.max=y.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[g].max=e.relativeTarget[g].min+v)});const c=Ti();Go(c,r,n.layoutBox);const u=Ti();a?Go(u,e.applyTransform(s,!0),n.measuredBox):Go(u,r,n.layoutBox);const f=!Ub(c);let p=!1;if(!e.resumeFrom){const g=e.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:v}=g;if(y&&v){const b=St();Jo(b,n.layoutBox,y.layoutBox);const w=St();Jo(w,r,v.layoutBox),Bb(b,w)||(p=!0),g.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=b,e.relativeParent=g)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:u,layoutDelta:c,hasLayoutChanged:f,hasRelativeTargetChanged:p})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function RT(e){qo&&ws.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 PT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function OT(e){e.clearSnapshot()}function iv(e){e.clearMeasurements()}function LT(e){e.isLayoutDirty=!1}function IT(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function ov(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function DT(e){e.resolveTargetDelta()}function MT(e){e.calcProjection()}function zT(e){e.resetSkewAndRotation()}function FT(e){e.removeLeadSnapshot()}function av(e,t,n){e.translate=yt(t.translate,0,n),e.scale=yt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function lv(e,t,n,r){e.min=yt(t.min,n.min,r),e.max=yt(t.max,n.max,r)}function $T(e,t,n,r){lv(e.x,t.x,n.x,r),lv(e.y,t.y,n.y,r)}function UT(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const BT={duration:.45,ease:[.4,0,.1,1]},cv=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),uv=cv("applewebkit/")&&!cv("chrome/")?Math.round:En;function dv(e){e.min=uv(e.min),e.max=uv(e.max)}function VT(e){dv(e.x),dv(e.y)}function Hb(e,t,n){return e==="position"||e==="preserve-aspect"&&!K2(nv(t),nv(n),.2)}function qT(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const HT=qb({attachResizeListener:(e,t)=>ua(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),nh={current:void 0},Kb=qb({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!nh.current){const e=new HT({});e.mount(window),e.setOptions({layoutScroll:!0}),nh.current=e}return nh.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),KT={pan:{Feature:lT},drag:{Feature:aT,ProjectionNode:Kb,MeasureLayout:zb}};function hv(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,o=r[s];o&&ht.postRender(()=>o(t,Sa(t)))}class WT extends ts{mount(){const{current:t}=this.node;t&&(this.unmount=KE(t,n=>(hv(this.node,n,"Start"),r=>hv(this.node,r,"End"))))}unmount(){}}class GT extends ts{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=ka(ua(this.node.current,"focus",()=>this.onFocus()),ua(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function fv(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),o=r[s];o&&ht.postRender(()=>o(t,Sa(t)))}class JT extends ts{mount(){const{current:t}=this.node;t&&(this.unmount=XE(t,n=>(fv(this.node,n,"Start"),(r,{success:s})=>fv(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const of=new WeakMap,rh=new WeakMap,XT=e=>{const t=of.get(e.target);t&&t(e)},YT=e=>{e.forEach(XT)};function QT({root:e,...t}){const n=e||document;rh.has(n)||rh.set(n,{});const r=rh.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(YT,{root:e,...t})),r[s]}function ZT(e,t,n){const r=QT(t);return of.set(e,n),r.observe(e),()=>{of.delete(e),r.unobserve(e)}}const eN={some:0,all:1};class tN extends ts{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:eN[s]},c=u=>{const{isIntersecting:f}=u;if(this.isInView===f||(this.isInView=f,o&&!f&&this.hasEnteredView))return;f&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",f);const{onViewportEnter:p,onViewportLeave:g}=this.node.getProps(),y=f?p:g;y&&y(u)};return ZT(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(nN(t,n))&&this.startObserver()}unmount(){}}function nN({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const rN={inView:{Feature:tN},tap:{Feature:JT},focus:{Feature:GT},hover:{Feature:WT}},sN={layout:{ProjectionNode:Kb,MeasureLayout:zb}},af={current:null},Wb={current:!1};function iN(){if(Wb.current=!0,!!Kf)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>af.current=e.matches;e.addListener(t),t()}else af.current=!1}const oN=[...xb,Gt,es],aN=e=>oN.find(yb(e)),pv=new WeakMap;function lN(e,t,n){for(const r in t){const s=t[r],o=n[r];if(Xt(s))e.addValue(r,s);else if(Xt(o))e.addValue(r,la(s,{owner:e}));else if(o!==s)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(r);e.addValue(r,la(a!==void 0?a:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const mv=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class cN{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:o,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=vp,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 v=ur.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,ht.render(this.render,!1,!0))};const{latestValues:u,renderState:f,onUpdate:p}=a;this.onUpdate=p,this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=f,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=Dc(n),this.isVariantNode=E_(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...y}=this.scrapeMotionValuesFromProps(n,{},this);for(const v in y){const b=y[v];u[v]!==void 0&&Xt(b)&&b.set(u[v],!1)}}mount(t){this.current=t,pv.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)),Wb.current||iN(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:af.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){pv.delete(this.current),this.projection&&this.projection.unmount(),Zr(this.notifyUpdate),Zr(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=zs.has(t),s=n.on("change",c=>{this.latestValues[t]=c,this.props.onUpdate&&ht.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),o(),a&&a(),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 Mi){const n=Mi[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):St()}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<mv.length;r++){const s=mv[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const o="on"+s,a=t[o];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=lN(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=la(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=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 s!=null&&(typeof s=="string"&&(mb(s)||ob(s))?s=parseFloat(s):!aN(s)&&es.test(n)&&(s=hb(t,n)),this.setBaseTarget(t,Xt(s)?s.get():s)),Xt(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const a=Zf(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[t])}if(r&&s!==void 0)return s;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Xt(o)?o:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new fp),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class Gb extends cN{constructor(){super(...arguments),this.KeyframeResolver=vb}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;Xt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function uN(e){return window.getComputedStyle(e)}class dN extends Gb{constructor(){super(...arguments),this.type="html",this.renderInstance=I_}readValueFromInstance(t,n){if(zs.has(n)){const r=xp(n);return r&&r.default||0}else{const r=uN(t),s=(P_(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Db(t,n)}build(t,n,r){np(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return op(t,n,r)}}class hN extends Gb{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=St}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(zs.has(n)){const r=xp(n);return r&&r.default||0}return n=D_.has(n)?n:Xf(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return F_(t,n,r)}build(t,n,r){rp(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){M_(t,n,r,s)}mount(t){this.isSVGTag=ip(t.tagName),super.mount(t)}}const fN=(e,t)=>Qf(e)?new hN(t):new dN(t,{allowProjection:e!==R.Fragment}),pN=FE({...M2,...rN,...KT,...sN},fN),Ue=eE(pN);function Jb(e,t){return function(){return e.apply(t,arguments)}}const{toString:mN}=Object.prototype,{getPrototypeOf:kp}=Object,{iterator:Fc,toStringTag:Xb}=Symbol,$c=(e=>t=>{const n=mN.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Yn=e=>(e=e.toLowerCase(),t=>$c(t)===e),Uc=e=>t=>typeof t===e,{isArray:Hi}=Array,Fi=Uc("undefined");function ja(e){return e!==null&&!Fi(e)&&e.constructor!==null&&!Fi(e.constructor)&&mn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Yb=Yn("ArrayBuffer");function gN(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Yb(e.buffer),t}const yN=Uc("string"),mn=Uc("function"),Qb=Uc("number"),Ea=e=>e!==null&&typeof e=="object",xN=e=>e===!0||e===!1,ic=e=>{if($c(e)!=="object")return!1;const t=kp(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Xb in e)&&!(Fc in e)},vN=e=>{if(!Ea(e)||ja(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},_N=Yn("Date"),bN=Yn("File"),wN=Yn("Blob"),kN=Yn("FileList"),SN=e=>Ea(e)&&mn(e.pipe),jN=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||mn(e.append)&&((t=$c(e))==="formdata"||t==="object"&&mn(e.toString)&&e.toString()==="[object FormData]"))},EN=Yn("URLSearchParams"),[CN,TN,NN,AN]=["ReadableStream","Request","Response","Headers"].map(Yn),RN=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ca(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Hi(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(ja(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;let c;for(r=0;r<a;r++)c=o[r],t.call(null,e[c],c,e)}}function Zb(e,t){if(ja(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const Cs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ew=e=>!Fi(e)&&e!==Cs;function lf(){const{caseless:e,skipUndefined:t}=ew(this)&&this||{},n={},r=(s,o)=>{const a=e&&Zb(n,o)||o;ic(n[a])&&ic(s)?n[a]=lf(n[a],s):ic(s)?n[a]=lf({},s):Hi(s)?n[a]=s.slice():(!t||!Fi(s))&&(n[a]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&Ca(arguments[s],r);return n}const PN=(e,t,n,{allOwnKeys:r}={})=>(Ca(t,(s,o)=>{n&&mn(s)?e[o]=Jb(s,n):e[o]=s},{allOwnKeys:r}),e),ON=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),LN=(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)},IN=(e,t,n,r)=>{let s,o,a;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)a=s[o],(!r||r(a,e,t))&&!c[a]&&(t[a]=e[a],c[a]=!0);e=n!==!1&&kp(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},DN=(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},MN=e=>{if(!e)return null;if(Hi(e))return e;let t=e.length;if(!Qb(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},zN=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&kp(Uint8Array)),FN=(e,t)=>{const r=(e&&e[Fc]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},$N=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},UN=Yn("HTMLFormElement"),BN=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),gv=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),VN=Yn("RegExp"),tw=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ca(n,(s,o)=>{let a;(a=t(s,o,e))!==!1&&(r[o]=a||s)}),Object.defineProperties(e,r)},qN=e=>{tw(e,(t,n)=>{if(mn(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(mn(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+"'")})}})},HN=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return Hi(e)?r(e):r(String(e).split(t)),n},KN=()=>{},WN=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function GN(e){return!!(e&&mn(e.append)&&e[Xb]==="FormData"&&e[Fc])}const JN=e=>{const t=new Array(10),n=(r,s)=>{if(Ea(r)){if(t.indexOf(r)>=0)return;if(ja(r))return r;if(!("toJSON"in r)){t[s]=r;const o=Hi(r)?[]:{};return Ca(r,(a,c)=>{const u=n(a,s+1);!Fi(u)&&(o[c]=u)}),t[s]=void 0,o}}return r};return n(e,0)},XN=Yn("AsyncFunction"),YN=e=>e&&(Ea(e)||mn(e))&&mn(e.then)&&mn(e.catch),nw=((e,t)=>e?setImmediate:t?((n,r)=>(Cs.addEventListener("message",({source:s,data:o})=>{s===Cs&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Cs.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",mn(Cs.postMessage)),QN=typeof queueMicrotask<"u"?queueMicrotask.bind(Cs):typeof process<"u"&&process.nextTick||nw,ZN=e=>e!=null&&mn(e[Fc]),H={isArray:Hi,isArrayBuffer:Yb,isBuffer:ja,isFormData:jN,isArrayBufferView:gN,isString:yN,isNumber:Qb,isBoolean:xN,isObject:Ea,isPlainObject:ic,isEmptyObject:vN,isReadableStream:CN,isRequest:TN,isResponse:NN,isHeaders:AN,isUndefined:Fi,isDate:_N,isFile:bN,isBlob:wN,isRegExp:VN,isFunction:mn,isStream:SN,isURLSearchParams:EN,isTypedArray:zN,isFileList:kN,forEach:Ca,merge:lf,extend:PN,trim:RN,stripBOM:ON,inherits:LN,toFlatObject:IN,kindOf:$c,kindOfTest:Yn,endsWith:DN,toArray:MN,forEachEntry:FN,matchAll:$N,isHTMLForm:UN,hasOwnProperty:gv,hasOwnProp:gv,reduceDescriptors:tw,freezeMethods:qN,toObjectSet:HN,toCamelCase:BN,noop:KN,toFiniteNumber:WN,findKey:Zb,global:Cs,isContextDefined:ew,isSpecCompliantForm:GN,toJSONObject:JN,isAsyncFn:XN,isThenable:YN,setImmediate:nw,asap:QN,isIterable:ZN};function Ve(e,t,n,r,s){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),s&&(this.response=s,this.status=s.status?s.status:null)}H.inherits(Ve,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:H.toJSONObject(this.config),code:this.code,status:this.status}}});const rw=Ve.prototype,sw={};["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=>{sw[e]={value:e}});Object.defineProperties(Ve,sw);Object.defineProperty(rw,"isAxiosError",{value:!0});Ve.from=(e,t,n,r,s,o)=>{const a=Object.create(rw);H.toFlatObject(e,a,function(p){return p!==Error.prototype},f=>f!=="isAxiosError");const c=e&&e.message?e.message:"Error",u=t==null&&e?e.code:t;return Ve.call(a,c,u,n,r,s),e&&a.cause==null&&Object.defineProperty(a,"cause",{value:e,configurable:!0}),a.name=e&&e.name||"Error",o&&Object.assign(a,o),a};const eA=null;function cf(e){return H.isPlainObject(e)||H.isArray(e)}function iw(e){return H.endsWith(e,"[]")?e.slice(0,-2):e}function yv(e,t,n){return e?e.concat(t).map(function(s,o){return s=iw(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function tA(e){return H.isArray(e)&&!e.some(cf)}const nA=H.toFlatObject(H,{},null,function(t){return/^is[A-Z]/.test(t)});function Bc(e,t,n){if(!H.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=H.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,k){return!H.isUndefined(k[w])});const r=n.metaTokens,s=n.visitor||p,o=n.dots,a=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&H.isSpecCompliantForm(t);if(!H.isFunction(s))throw new TypeError("visitor must be a function");function f(b){if(b===null)return"";if(H.isDate(b))return b.toISOString();if(H.isBoolean(b))return b.toString();if(!u&&H.isBlob(b))throw new Ve("Blob is not supported. Use a Buffer instead.");return H.isArrayBuffer(b)||H.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function p(b,w,k){let S=b;if(b&&!k&&typeof b=="object"){if(H.endsWith(w,"{}"))w=r?w:w.slice(0,-2),b=JSON.stringify(b);else if(H.isArray(b)&&tA(b)||(H.isFileList(b)||H.endsWith(w,"[]"))&&(S=H.toArray(b)))return w=iw(w),S.forEach(function(j,O){!(H.isUndefined(j)||j===null)&&t.append(a===!0?yv([w],O,o):a===null?w:w+"[]",f(j))}),!1}return cf(b)?!0:(t.append(yv(k,w,o),f(b)),!1)}const g=[],y=Object.assign(nA,{defaultVisitor:p,convertValue:f,isVisitable:cf});function v(b,w){if(!H.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+w.join("."));g.push(b),H.forEach(b,function(S,C){(!(H.isUndefined(S)||S===null)&&s.call(t,S,H.isString(C)?C.trim():C,w,y))===!0&&v(S,w?w.concat(C):[C])}),g.pop()}}if(!H.isObject(e))throw new TypeError("data must be an object");return v(e),t}function xv(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Sp(e,t){this._pairs=[],e&&Bc(e,this,t)}const ow=Sp.prototype;ow.append=function(t,n){this._pairs.push([t,n])};ow.toString=function(t){const n=t?function(r){return t.call(this,r,xv)}:xv;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function rA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function aw(e,t,n){if(!t)return e;const r=n&&n.encode||rA;H.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(t,n):o=H.isURLSearchParams(t)?t.toString():new Sp(t,n).toString(r),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class vv{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){H.forEach(this.handlers,function(r){r!==null&&t(r)})}}const lw={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},sA=typeof URLSearchParams<"u"?URLSearchParams:Sp,iA=typeof FormData<"u"?FormData:null,oA=typeof Blob<"u"?Blob:null,aA={isBrowser:!0,classes:{URLSearchParams:sA,FormData:iA,Blob:oA},protocols:["http","https","file","blob","url","data"]},jp=typeof window<"u"&&typeof document<"u",uf=typeof navigator=="object"&&navigator||void 0,lA=jp&&(!uf||["ReactNative","NativeScript","NS"].indexOf(uf.product)<0),cA=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",uA=jp&&window.location.href||"http://localhost",dA=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:jp,hasStandardBrowserEnv:lA,hasStandardBrowserWebWorkerEnv:cA,navigator:uf,origin:uA},Symbol.toStringTag,{value:"Module"})),Jt={...dA,...aA};function hA(e,t){return Bc(e,new Jt.classes.URLSearchParams,{visitor:function(n,r,s,o){return Jt.isNode&&H.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function fA(e){return H.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function pA(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function cw(e){function t(n,r,s,o){let a=n[o++];if(a==="__proto__")return!0;const c=Number.isFinite(+a),u=o>=n.length;return a=!a&&H.isArray(s)?s.length:a,u?(H.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!c):((!s[a]||!H.isObject(s[a]))&&(s[a]=[]),t(n,r,s[a],o)&&H.isArray(s[a])&&(s[a]=pA(s[a])),!c)}if(H.isFormData(e)&&H.isFunction(e.entries)){const n={};return H.forEachEntry(e,(r,s)=>{t(fA(r),s,n,0)}),n}return null}function mA(e,t,n){if(H.isString(e))try{return(t||JSON.parse)(e),H.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Ta={transitional:lw,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=H.isObject(t);if(o&&H.isHTMLForm(t)&&(t=new FormData(t)),H.isFormData(t))return s?JSON.stringify(cw(t)):t;if(H.isArrayBuffer(t)||H.isBuffer(t)||H.isStream(t)||H.isFile(t)||H.isBlob(t)||H.isReadableStream(t))return t;if(H.isArrayBufferView(t))return t.buffer;if(H.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return hA(t,this.formSerializer).toString();if((c=H.isFileList(t))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Bc(c?{"files[]":t}:t,u&&new u,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),mA(t)):t}],transformResponse:[function(t){const n=this.transitional||Ta.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(H.isResponse(t)||H.isReadableStream(t))return t;if(t&&H.isString(t)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(a)throw c.name==="SyntaxError"?Ve.from(c,Ve.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}}};H.forEach(["delete","get","head","post","put","patch"],e=>{Ta.headers[e]={}});const gA=H.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"]),yA=e=>{const t={};let n,r,s;return e&&e.split(`
17
- `).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||t[n]&&gA[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},_v=Symbol("internals");function Io(e){return e&&String(e).trim().toLowerCase()}function oc(e){return e===!1||e==null?e:H.isArray(e)?e.map(oc):String(e)}function xA(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 vA=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function sh(e,t,n,r,s){if(H.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!H.isString(t)){if(H.isString(r))return t.indexOf(r)!==-1;if(H.isRegExp(r))return r.test(t)}}function _A(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function bA(e,t){const n=H.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,a){return this[r].call(this,t,s,o,a)},configurable:!0})})}let gn=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,u,f){const p=Io(u);if(!p)throw new Error("header name must be a non-empty string");const g=H.findKey(s,p);(!g||s[g]===void 0||f===!0||f===void 0&&s[g]!==!1)&&(s[g||u]=oc(c))}const a=(c,u)=>H.forEach(c,(f,p)=>o(f,p,u));if(H.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(H.isString(t)&&(t=t.trim())&&!vA(t))a(yA(t),n);else if(H.isObject(t)&&H.isIterable(t)){let c={},u,f;for(const p of t){if(!H.isArray(p))throw TypeError("Object iterator must return a key-value pair");c[f=p[0]]=(u=c[f])?H.isArray(u)?[...u,p[1]]:[u,p[1]]:p[1]}a(c,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=Io(t),t){const r=H.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return xA(s);if(H.isFunction(n))return n.call(this,s,r);if(H.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Io(t),t){const r=H.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||sh(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(a){if(a=Io(a),a){const c=H.findKey(r,a);c&&(!n||sh(r,r[c],c,n))&&(delete r[c],s=!0)}}return H.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||sh(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return H.forEach(this,(s,o)=>{const a=H.findKey(r,o);if(a){n[a]=oc(s),delete n[o];return}const c=t?_A(o):String(o).trim();c!==o&&delete n[o],n[c]=oc(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return H.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&H.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(s=>r.set(s)),r}static accessor(t){const r=(this[_v]=this[_v]={accessors:{}}).accessors,s=this.prototype;function o(a){const c=Io(a);r[c]||(bA(s,a),r[c]=!0)}return H.isArray(t)?t.forEach(o):o(t),this}};gn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);H.reduceDescriptors(gn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});H.freezeMethods(gn);function ih(e,t){const n=this||Ta,r=t||n,s=gn.from(r.headers);let o=r.data;return H.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function uw(e){return!!(e&&e.__CANCEL__)}function Ki(e,t,n){Ve.call(this,e??"canceled",Ve.ERR_CANCELED,t,n),this.name="CanceledError"}H.inherits(Ki,Ve,{__CANCEL__:!0});function dw(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ve("Request failed with status code "+n.status,[Ve.ERR_BAD_REQUEST,Ve.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function wA(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function kA(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,a;return t=t!==void 0?t:1e3,function(u){const f=Date.now(),p=r[o];a||(a=f),n[s]=u,r[s]=f;let g=o,y=0;for(;g!==s;)y+=n[g++],g=g%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),f-a<t)return;const v=p&&f-p;return v?Math.round(y*1e3/v):void 0}}function SA(e,t){let n=0,r=1e3/t,s,o;const a=(f,p=Date.now())=>{n=p,s=null,o&&(clearTimeout(o),o=null),e(...f)};return[(...f)=>{const p=Date.now(),g=p-n;g>=r?a(f,p):(s=f,o||(o=setTimeout(()=>{o=null,a(s)},r-g)))},()=>s&&a(s)]}const xc=(e,t,n=3)=>{let r=0;const s=kA(50,250);return SA(o=>{const a=o.loaded,c=o.lengthComputable?o.total:void 0,u=a-r,f=s(u),p=a<=c;r=a;const g={loaded:a,total:c,progress:c?a/c:void 0,bytes:u,rate:f||void 0,estimated:f&&c&&p?(c-a)/f:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(g)},n)},bv=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},wv=e=>(...t)=>H.asap(()=>e(...t)),jA=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,EA=Jt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,a){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];H.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),H.isString(r)&&c.push(`path=${r}`),H.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),H.isString(a)&&c.push(`SameSite=${a}`),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 CA(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function TA(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function hw(e,t,n){let r=!CA(t);return e&&(r||n==!1)?TA(e,t):t}const kv=e=>e instanceof gn?{...e}:e;function Is(e,t){t=t||{};const n={};function r(f,p,g,y){return H.isPlainObject(f)&&H.isPlainObject(p)?H.merge.call({caseless:y},f,p):H.isPlainObject(p)?H.merge({},p):H.isArray(p)?p.slice():p}function s(f,p,g,y){if(H.isUndefined(p)){if(!H.isUndefined(f))return r(void 0,f,g,y)}else return r(f,p,g,y)}function o(f,p){if(!H.isUndefined(p))return r(void 0,p)}function a(f,p){if(H.isUndefined(p)){if(!H.isUndefined(f))return r(void 0,f)}else return r(void 0,p)}function c(f,p,g){if(g in t)return r(f,p);if(g in e)return r(void 0,f)}const u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c,headers:(f,p,g)=>s(kv(f),kv(p),g,!0)};return H.forEach(Object.keys({...e,...t}),function(p){const g=u[p]||s,y=g(e[p],t[p],p);H.isUndefined(y)&&g!==c||(n[p]=y)}),n}const fw=e=>{const t=Is({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:c}=t;if(t.headers=a=gn.from(a),t.url=aw(hw(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),H.isFormData(n)){if(Jt.hasStandardBrowserEnv||Jt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(H.isFunction(n.getHeaders)){const u=n.getHeaders(),f=["content-type","content-length"];Object.entries(u).forEach(([p,g])=>{f.includes(p.toLowerCase())&&a.set(p,g)})}}if(Jt.hasStandardBrowserEnv&&(r&&H.isFunction(r)&&(r=r(t)),r||r!==!1&&jA(t.url))){const u=s&&o&&EA.read(o);u&&a.set(s,u)}return t},NA=typeof XMLHttpRequest<"u",AA=NA&&function(e){return new Promise(function(n,r){const s=fw(e);let o=s.data;const a=gn.from(s.headers).normalize();let{responseType:c,onUploadProgress:u,onDownloadProgress:f}=s,p,g,y,v,b;function w(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(p),s.signal&&s.signal.removeEventListener("abort",p)}let k=new XMLHttpRequest;k.open(s.method.toUpperCase(),s.url,!0),k.timeout=s.timeout;function S(){if(!k)return;const j=gn.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),T={data:!c||c==="text"||c==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:j,config:e,request:k};dw(function(M){n(M),w()},function(M){r(M),w()},T),k=null}"onloadend"in k?k.onloadend=S:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(S)},k.onabort=function(){k&&(r(new Ve("Request aborted",Ve.ECONNABORTED,e,k)),k=null)},k.onerror=function(O){const T=O&&O.message?O.message:"Network Error",N=new Ve(T,Ve.ERR_NETWORK,e,k);N.event=O||null,r(N),k=null},k.ontimeout=function(){let O=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const T=s.transitional||lw;s.timeoutErrorMessage&&(O=s.timeoutErrorMessage),r(new Ve(O,T.clarifyTimeoutError?Ve.ETIMEDOUT:Ve.ECONNABORTED,e,k)),k=null},o===void 0&&a.setContentType(null),"setRequestHeader"in k&&H.forEach(a.toJSON(),function(O,T){k.setRequestHeader(T,O)}),H.isUndefined(s.withCredentials)||(k.withCredentials=!!s.withCredentials),c&&c!=="json"&&(k.responseType=s.responseType),f&&([y,b]=xc(f,!0),k.addEventListener("progress",y)),u&&k.upload&&([g,v]=xc(u),k.upload.addEventListener("progress",g),k.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(p=j=>{k&&(r(!j||j.type?new Ki(null,e,k):j),k.abort(),k=null)},s.cancelToken&&s.cancelToken.subscribe(p),s.signal&&(s.signal.aborted?p():s.signal.addEventListener("abort",p)));const C=wA(s.url);if(C&&Jt.protocols.indexOf(C)===-1){r(new Ve("Unsupported protocol "+C+":",Ve.ERR_BAD_REQUEST,e));return}k.send(o||null)})},RA=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(f){if(!s){s=!0,c();const p=f instanceof Error?f:this.reason;r.abort(p instanceof Ve?p:new Ki(p instanceof Error?p.message:p))}};let a=t&&setTimeout(()=>{a=null,o(new Ve(`timeout ${t} of ms exceeded`,Ve.ETIMEDOUT))},t);const c=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),e=null)};e.forEach(f=>f.addEventListener("abort",o));const{signal:u}=r;return u.unsubscribe=()=>H.asap(c),u}},PA=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},OA=async function*(e,t){for await(const n of LA(e))yield*PA(n,t)},LA=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()}},Sv=(e,t,n,r)=>{const s=OA(e,t);let o=0,a,c=u=>{a||(a=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:f,value:p}=await s.next();if(f){c(),u.close();return}let g=p.byteLength;if(n){let y=o+=g;n(y)}u.enqueue(new Uint8Array(p))}catch(f){throw c(f),f}},cancel(u){return c(u),s.return()}},{highWaterMark:2})},jv=64*1024,{isFunction:Hl}=H,IA=(({Request:e,Response:t})=>({Request:e,Response:t}))(H.global),{ReadableStream:Ev,TextEncoder:Cv}=H.global,Tv=(e,...t)=>{try{return!!e(...t)}catch{return!1}},DA=e=>{e=H.merge.call({skipUndefined:!0},IA,e);const{fetch:t,Request:n,Response:r}=e,s=t?Hl(t):typeof fetch=="function",o=Hl(n),a=Hl(r);if(!s)return!1;const c=s&&Hl(Ev),u=s&&(typeof Cv=="function"?(b=>w=>b.encode(w))(new Cv):async b=>new Uint8Array(await new n(b).arrayBuffer())),f=o&&c&&Tv(()=>{let b=!1;const w=new n(Jt.origin,{body:new Ev,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!w}),p=a&&c&&Tv(()=>H.isReadableStream(new r("").body)),g={stream:p&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(w,k)=>{let S=w&&w[b];if(S)return S.call(w);throw new Ve(`Response type '${b}' is not supported`,Ve.ERR_NOT_SUPPORT,k)})});const y=async b=>{if(b==null)return 0;if(H.isBlob(b))return b.size;if(H.isSpecCompliantForm(b))return(await new n(Jt.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(H.isArrayBufferView(b)||H.isArrayBuffer(b))return b.byteLength;if(H.isURLSearchParams(b)&&(b=b+""),H.isString(b))return(await u(b)).byteLength},v=async(b,w)=>{const k=H.toFiniteNumber(b.getContentLength());return k??y(w)};return async b=>{let{url:w,method:k,data:S,signal:C,cancelToken:j,timeout:O,onDownloadProgress:T,onUploadProgress:N,responseType:M,headers:V,withCredentials:B="same-origin",fetchOptions:L}=fw(b),Q=t||fetch;M=M?(M+"").toLowerCase():"text";let Y=RA([C,j&&j.toAbortSignal()],O),he=null;const K=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let W;try{if(N&&f&&k!=="get"&&k!=="head"&&(W=await v(V,S))!==0){let D=new n(w,{method:"POST",body:S,duplex:"half"}),G;if(H.isFormData(S)&&(G=D.headers.get("content-type"))&&V.setContentType(G),D.body){const[P,_e]=bv(W,xc(wv(N)));S=Sv(D.body,jv,P,_e)}}H.isString(B)||(B=B?"include":"omit");const ne=o&&"credentials"in n.prototype,re={...L,signal:Y,method:k.toUpperCase(),headers:V.normalize().toJSON(),body:S,duplex:"half",credentials:ne?B:void 0};he=o&&new n(w,re);let J=await(o?Q(he,L):Q(w,re));const ce=p&&(M==="stream"||M==="response");if(p&&(T||ce&&K)){const D={};["status","statusText","headers"].forEach(me=>{D[me]=J[me]});const G=H.toFiniteNumber(J.headers.get("content-length")),[P,_e]=T&&bv(G,xc(wv(T),!0))||[];J=new r(Sv(J.body,jv,P,()=>{_e&&_e(),K&&K()}),D)}M=M||"text";let A=await g[H.findKey(g,M)||"text"](J,b);return!ce&&K&&K(),await new Promise((D,G)=>{dw(D,G,{data:A,headers:gn.from(J.headers),status:J.status,statusText:J.statusText,config:b,request:he})})}catch(ne){throw K&&K(),ne&&ne.name==="TypeError"&&/Load failed|fetch/i.test(ne.message)?Object.assign(new Ve("Network Error",Ve.ERR_NETWORK,b,he),{cause:ne.cause||ne}):Ve.from(ne,ne&&ne.code,b,he)}}},MA=new Map,pw=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let a=o.length,c=a,u,f,p=MA;for(;c--;)u=o[c],f=p.get(u),f===void 0&&p.set(u,f=c?new Map:DA(t)),p=f;return f};pw();const Ep={http:eA,xhr:AA,fetch:{get:pw}};H.forEach(Ep,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Nv=e=>`- ${e}`,zA=e=>H.isFunction(e)||e===null||e===!1;function FA(e,t){e=H.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let a=0;a<n;a++){r=e[a];let c;if(s=r,!zA(r)&&(s=Ep[(c=String(r)).toLowerCase()],s===void 0))throw new Ve(`Unknown adapter '${c}'`);if(s&&(H.isFunction(s)||(s=s.get(t))))break;o[c||"#"+a]=s}if(!s){const a=Object.entries(o).map(([u,f])=>`adapter ${u} `+(f===!1?"is not supported by the environment":"is not available in the build"));let c=n?a.length>1?`since :
16
+ `),()=>{document.head.removeChild(p)}},[t]),h.jsx(Vj,{isPresent:t,childRef:r,sizeRef:s,children:R.cloneElement(e,{ref:r})})}const Hj=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:o,mode:a})=>{const c=qf(Kj),u=R.useId(),f=R.useCallback(g=>{c.set(g,!0);for(const y of c.values())if(!y)return;r&&r()},[c,r]),p=R.useMemo(()=>({id:u,initial:t,isPresent:n,custom:s,onExitComplete:f,register:g=>(c.set(g,!1),()=>c.delete(g))}),o?[Math.random(),f]:[n,f]);return R.useMemo(()=>{c.forEach((g,y)=>c.set(y,!1))},[n]),R.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),a==="popLayout"&&(e=h.jsx(qj,{isPresent:n,children:e})),h.jsx(Oc.Provider,{value:p,children:e})};function Kj(){return new Map}function __(e=!0){const t=R.useContext(Oc);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,o=R.useId();R.useEffect(()=>{e&&s(o)},[e]);const a=R.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,a]:[!0]}const Ul=e=>e.key||"";function tx(e){const t=[];return R.Children.forEach(e,n=>{R.isValidElement(n)&&t.push(n)}),t}const Kf=typeof window<"u",b_=Kf?R.useLayoutEffect:R.useEffect,Pt=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:o="sync",propagate:a=!1})=>{const[c,u]=__(a),f=R.useMemo(()=>tx(e),[e]),p=a&&!c?[]:f.map(Ul),g=R.useRef(!0),y=R.useRef(f),v=qf(()=>new Map),[b,w]=R.useState(f),[k,S]=R.useState(f);b_(()=>{g.current=!1,y.current=f;for(let O=0;O<k.length;O++){const T=Ul(k[O]);p.includes(T)?v.delete(T):v.get(T)!==!0&&v.set(T,!1)}},[k,p.length,p.join("-")]);const C=[];if(f!==b){let O=[...f];for(let T=0;T<k.length;T++){const N=k[T],M=Ul(N);p.includes(M)||(O.splice(T,0,N),C.push(N))}o==="wait"&&C.length&&(O=C),S(tx(O)),w(f);return}const{forceRender:j}=R.useContext(Vf);return h.jsx(h.Fragment,{children:k.map(O=>{const T=Ul(O),N=a&&!c?!1:f===k||p.includes(T),M=()=>{if(v.has(T))v.set(T,!0);else return;let V=!0;v.forEach(U=>{U||(V=!1)}),V&&(j?.(),S(y.current),a&&u?.(),r&&r())};return h.jsx(Hj,{isPresent:N,initial:!g.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:s,mode:o,onExitComplete:N?void 0:M,children:O},T)})})},Cn=e=>e;let w_=Cn;function Wf(e){let t;return()=>(t===void 0&&(t=e()),t)}const Di=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},Sr=e=>e*1e3,jr=e=>e/1e3,Wj={useManualTiming:!1};function Gj(e){let t=new Set,n=new Set,r=!1,s=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function c(f){o.has(f)&&(u.schedule(f),e()),f(a)}const u={schedule:(f,p=!1,g=!1)=>{const v=g&&r?t:n;return p&&o.add(f),v.has(f)||v.add(f),f},cancel:f=>{n.delete(f),o.delete(f)},process:f=>{if(a=f,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(c),t.clear(),r=!1,s&&(s=!1,u.process(f))}};return u}const Bl=["read","resolveKeyframes","update","preRender","render","postRender"],Jj=40;function k_(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,a=Bl.reduce((S,C)=>(S[C]=Gj(o),S),{}),{read:c,resolveKeyframes:u,update:f,preRender:p,render:g,postRender:y}=a,v=()=>{const S=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(S-s.timestamp,Jj),1),s.timestamp=S,s.isProcessing=!0,c.process(s),u.process(s),f.process(s),p.process(s),g.process(s),y.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(v))},b=()=>{n=!0,r=!0,s.isProcessing||e(v)};return{schedule:Bl.reduce((S,C)=>{const j=a[C];return S[C]=(O,T=!1,N=!1)=>(n||b(),j.schedule(O,T,N)),S},{}),cancel:S=>{for(let C=0;C<Bl.length;C++)a[Bl[C]].cancel(S)},state:s,steps:a}}const{schedule:ht,cancel:Zr,state:Bt,steps:Hd}=k_(typeof requestAnimationFrame<"u"?requestAnimationFrame:Cn,!0),S_=R.createContext({strict:!1}),nx={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"]},Mi={};for(const e in nx)Mi[e]={isEnabled:t=>nx[e].some(n=>!!t[n])};function Xj(e){for(const t in e)Mi[t]={...Mi[t],...e[t]}}const Yj=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 dc(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Yj.has(e)}let j_=e=>!dc(e);function Qj(e){e&&(j_=t=>t.startsWith("on")?!dc(t):e(t))}try{Qj(require("@emotion/is-prop-valid").default)}catch{}function Zj(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(j_(s)||n===!0&&dc(s)||!t&&!dc(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function eE(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const Lc=R.createContext({});function oa(e){return typeof e=="string"||Array.isArray(e)}function Ic(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Gf=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Jf=["initial",...Gf];function Dc(e){return Ic(e.animate)||Jf.some(t=>oa(e[t]))}function E_(e){return!!(Dc(e)||e.variants)}function tE(e,t){if(Dc(e)){const{initial:n,animate:r}=e;return{initial:n===!1||oa(n)?n:void 0,animate:oa(r)?r:void 0}}return e.inherit!==!1?t:{}}function nE(e){const{initial:t,animate:n}=tE(e,R.useContext(Lc));return R.useMemo(()=>({initial:t,animate:n}),[rx(t),rx(n)])}function rx(e){return Array.isArray(e)?e.join(" "):e}const rE=Symbol.for("motionComponentSymbol");function Ei(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function sE(e,t,n){return R.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Ei(n)&&(n.current=r))},[t])}const Xf=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),iE="framerAppearId",C_="data-"+Xf(iE),{schedule:Yf}=k_(queueMicrotask,!1),T_=R.createContext({});function oE(e,t,n,r,s){var o,a;const{visualElement:c}=R.useContext(Lc),u=R.useContext(S_),f=R.useContext(Oc),p=R.useContext(Hf).reducedMotion,g=R.useRef(null);r=r||u.renderer,!g.current&&r&&(g.current=r(e,{visualState:t,parent:c,props:n,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:p}));const y=g.current,v=R.useContext(T_);y&&!y.projection&&s&&(y.type==="html"||y.type==="svg")&&aE(g.current,n,s,v);const b=R.useRef(!1);R.useInsertionEffect(()=>{y&&b.current&&y.update(n,f)});const w=n[C_],k=R.useRef(!!w&&!(!((o=window.MotionHandoffIsComplete)===null||o===void 0)&&o.call(window,w))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,w)));return b_(()=>{y&&(b.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),Yf.render(y.render),k.current&&y.animationState&&y.animationState.animateChanges())}),R.useEffect(()=>{y&&(!k.current&&y.animationState&&y.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var S;(S=window.MotionHandoffMarkAsComplete)===null||S===void 0||S.call(window,w)}),k.current=!1))}),y}function aE(e,t,n,r){const{layoutId:s,layout:o,drag:a,dragConstraints:c,layoutScroll:u,layoutRoot:f}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:N_(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!a||c&&Ei(c),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:f})}function N_(e){if(e)return e.options.allowProjection!==!1?e.projection:N_(e.parent)}function lE({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var o,a;e&&Xj(e);function c(f,p){let g;const y={...R.useContext(Hf),...f,layoutId:cE(f)},{isStatic:v}=y,b=nE(f),w=r(f,v);if(!v&&Kf){uE();const k=dE(y);g=k.MeasureLayout,b.visualElement=oE(s,w,y,t,k.ProjectionNode)}return h.jsxs(Lc.Provider,{value:b,children:[g&&b.visualElement?h.jsx(g,{visualElement:b.visualElement,...y}):null,n(s,f,sE(w,b.visualElement,p),w,v,b.visualElement)]})}c.displayName=`motion.${typeof s=="string"?s:`create(${(a=(o=s.displayName)!==null&&o!==void 0?o:s.name)!==null&&a!==void 0?a:""})`}`;const u=R.forwardRef(c);return u[rE]=s,u}function cE({layoutId:e}){const t=R.useContext(Vf).id;return t&&e!==void 0?t+"-"+e:e}function uE(e,t){R.useContext(S_).strict}function dE(e){const{drag:t,layout:n}=Mi;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const hE=["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 Qf(e){return typeof e!="string"||e.includes("-")?!1:!!(hE.indexOf(e)>-1||/[A-Z]/u.test(e))}function sx(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Zf(e,t,n,r){if(typeof t=="function"){const[s,o]=sx(r);t=t(n!==void 0?n:e.custom,s,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,o]=sx(r);t=t(n!==void 0?n:e.custom,s,o)}return t}const Hh=e=>Array.isArray(e),fE=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),pE=e=>Hh(e)?e[e.length-1]||0:e,Xt=e=>!!(e&&e.getVelocity);function nc(e){const t=Xt(e)?e.get():e;return fE(t)?t.toValue():t}function mE({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,o){const a={latestValues:gE(r,s,o,e),renderState:t()};return n&&(a.onMount=c=>n({props:r,current:c,...a}),a.onUpdate=c=>n(c)),a}const A_=e=>(t,n)=>{const r=R.useContext(Lc),s=R.useContext(Oc),o=()=>mE(e,t,r,s);return n?o():qf(o)};function gE(e,t,n,r){const s={},o=r(e,{});for(const y in o)s[y]=nc(o[y]);let{initial:a,animate:c}=e;const u=Dc(e),f=E_(e);t&&f&&!u&&e.inherit!==!1&&(a===void 0&&(a=t.initial),c===void 0&&(c=t.animate));let p=n?n.initial===!1:!1;p=p||a===!1;const g=p?c:a;if(g&&typeof g!="boolean"&&!Ic(g)){const y=Array.isArray(g)?g:[g];for(let v=0;v<y.length;v++){const b=Zf(e,y[v]);if(b){const{transitionEnd:w,transition:k,...S}=b;for(const C in S){let j=S[C];if(Array.isArray(j)){const O=p?j.length-1:0;j=j[O]}j!==null&&(s[C]=j)}for(const C in w)s[C]=w[C]}}}return s}const Vi=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],zs=new Set(Vi),R_=e=>t=>typeof t=="string"&&t.startsWith(e),P_=R_("--"),yE=R_("var(--"),ep=e=>yE(e)?xE.test(e.split("/*")[0].trim()):!1,xE=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,O_=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Er=(e,t,n)=>n>t?t:n<e?e:n,qi={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},aa={...qi,transform:e=>Er(0,1,e)},Vl={...qi,default:1},ba=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Xr=ba("deg"),cr=ba("%"),Ie=ba("px"),vE=ba("vh"),_E=ba("vw"),ix={...cr,parse:e=>cr.parse(e)/100,transform:e=>cr.transform(e*100)},bE={borderWidth:Ie,borderTopWidth:Ie,borderRightWidth:Ie,borderBottomWidth:Ie,borderLeftWidth:Ie,borderRadius:Ie,radius:Ie,borderTopLeftRadius:Ie,borderTopRightRadius:Ie,borderBottomRightRadius:Ie,borderBottomLeftRadius:Ie,width:Ie,maxWidth:Ie,height:Ie,maxHeight:Ie,top:Ie,right:Ie,bottom:Ie,left:Ie,padding:Ie,paddingTop:Ie,paddingRight:Ie,paddingBottom:Ie,paddingLeft:Ie,margin:Ie,marginTop:Ie,marginRight:Ie,marginBottom:Ie,marginLeft:Ie,backgroundPositionX:Ie,backgroundPositionY:Ie},wE={rotate:Xr,rotateX:Xr,rotateY:Xr,rotateZ:Xr,scale:Vl,scaleX:Vl,scaleY:Vl,scaleZ:Vl,skew:Xr,skewX:Xr,skewY:Xr,distance:Ie,translateX:Ie,translateY:Ie,translateZ:Ie,x:Ie,y:Ie,z:Ie,perspective:Ie,transformPerspective:Ie,opacity:aa,originX:ix,originY:ix,originZ:Ie},ox={...qi,transform:Math.round},tp={...bE,...wE,zIndex:ox,size:Ie,fillOpacity:aa,strokeOpacity:aa,numOctaves:ox},kE={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},SE=Vi.length;function jE(e,t,n){let r="",s=!0;for(let o=0;o<SE;o++){const a=Vi[o],c=e[a];if(c===void 0)continue;let u=!0;if(typeof c=="number"?u=c===(a.startsWith("scale")?1:0):u=parseFloat(c)===0,!u||n){const f=O_(c,tp[a]);if(!u){s=!1;const p=kE[a]||a;r+=`${p}(${f}) `}n&&(t[a]=f)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function np(e,t,n){const{style:r,vars:s,transformOrigin:o}=e;let a=!1,c=!1;for(const u in t){const f=t[u];if(zs.has(u)){a=!0;continue}else if(P_(u)){s[u]=f;continue}else{const p=O_(f,tp[u]);u.startsWith("origin")?(c=!0,o[u]=p):r[u]=p}}if(t.transform||(a||n?r.transform=jE(t,e.transform,n):r.transform&&(r.transform="none")),c){const{originX:u="50%",originY:f="50%",originZ:p=0}=o;r.transformOrigin=`${u} ${f} ${p}`}}const EE={offset:"stroke-dashoffset",array:"stroke-dasharray"},CE={offset:"strokeDashoffset",array:"strokeDasharray"};function TE(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?EE:CE;e[o.offset]=Ie.transform(-r);const a=Ie.transform(t),c=Ie.transform(n);e[o.array]=`${a} ${c}`}function ax(e,t,n){return typeof e=="string"?e:Ie.transform(t+n*e)}function NE(e,t,n){const r=ax(t,e.x,e.width),s=ax(n,e.y,e.height);return`${r} ${s}`}function rp(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:o,pathLength:a,pathSpacing:c=1,pathOffset:u=0,...f},p,g){if(np(e,f,g),p){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:y,style:v,dimensions:b}=e;y.transform&&(b&&(v.transform=y.transform),delete y.transform),b&&(s!==void 0||o!==void 0||v.transform)&&(v.transformOrigin=NE(b,s!==void 0?s:.5,o!==void 0?o:.5)),t!==void 0&&(y.x=t),n!==void 0&&(y.y=n),r!==void 0&&(y.scale=r),a!==void 0&&TE(y,a,c,u,!1)}const sp=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),L_=()=>({...sp(),attrs:{}}),ip=e=>typeof e=="string"&&e.toLowerCase()==="svg";function I_(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const D_=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 M_(e,t,n,r){I_(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(D_.has(s)?s:Xf(s),t.attrs[s])}const hc={};function AE(e){Object.assign(hc,e)}function z_(e,{layout:t,layoutId:n}){return zs.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!hc[e]||e==="opacity")}function op(e,t,n){var r;const{style:s}=e,o={};for(const a in s)(Xt(s[a])||t.style&&Xt(t.style[a])||z_(a,e)||((r=n?.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(o[a]=s[a]);return o}function F_(e,t,n){const r=op(e,t,n);for(const s in e)if(Xt(e[s])||Xt(t[s])){const o=Vi.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[o]=e[s]}return r}function RE(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 lx=["x","y","width","height","cx","cy","r"],PE={useVisualState:A_({scrapeMotionValuesFromProps:F_,createRenderState:L_,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let o=!!e.drag;if(!o){for(const c in s)if(zs.has(c)){o=!0;break}}if(!o)return;let a=!t;if(t)for(let c=0;c<lx.length;c++){const u=lx[c];e[u]!==t[u]&&(a=!0)}a&&ht.read(()=>{RE(n,r),ht.render(()=>{rp(r,s,ip(n.tagName),e.transformTemplate),M_(n,r)})})}})},OE={useVisualState:A_({scrapeMotionValuesFromProps:op,createRenderState:sp})};function $_(e,t,n){for(const r in t)!Xt(t[r])&&!z_(r,n)&&(e[r]=t[r])}function LE({transformTemplate:e},t){return R.useMemo(()=>{const n=sp();return np(n,t,e),Object.assign({},n.vars,n.style)},[t])}function IE(e,t){const n=e.style||{},r={};return $_(r,n,e),Object.assign(r,LE(e,t)),r}function DE(e,t){const n={},r=IE(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 ME(e,t,n,r){const s=R.useMemo(()=>{const o=L_();return rp(o,t,ip(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};$_(o,e.style,e),s.style={...o,...s.style}}return s}function zE(e=!1){return(n,r,s,{latestValues:o},a)=>{const u=(Qf(n)?ME:DE)(r,o,a,n),f=Zj(r,typeof n=="string",e),p=n!==R.Fragment?{...f,...u,ref:s}:{},{children:g}=r,y=R.useMemo(()=>Xt(g)?g.get():g,[g]);return R.createElement(n,{...p,children:y})}}function FE(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...Qf(r)?PE:OE,preloadedFeatures:e,useRender:zE(s),createVisualElement:t,Component:r};return lE(a)}}function U_(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 Mc(e,t,n){const r=e.getProps();return Zf(r,t,n!==void 0?n:r.custom,e)}const $E=Wf(()=>window.ScrollTimeline!==void 0);class UE{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(s=>{if($E()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,o)=>{s&&s(),this.animations[o].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 BE extends UE{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function ap(e,t){return e?e[t]||e.default||e:void 0}const Kh=2e4;function B_(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Kh;)t+=n,r=e.next(t);return t>=Kh?1/0:t}function lp(e){return typeof e=="function"}function cx(e,t){e.timeline=t,e.onfinish=null}const cp=e=>Array.isArray(e)&&typeof e[0]=="number",VE={linearEasing:void 0};function qE(e,t){const n=Wf(e);return()=>{var r;return(r=VE[t])!==null&&r!==void 0?r:n()}}const fc=qE(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),V_=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let o=0;o<s;o++)r+=e(Di(0,s-1,o))+", ";return`linear(${r.substring(0,r.length-2)})`};function q_(e){return!!(typeof e=="function"&&fc()||!e||typeof e=="string"&&(e in Wh||fc())||cp(e)||Array.isArray(e)&&e.every(q_))}const Bo=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Wh={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Bo([0,.65,.55,1]),circOut:Bo([.55,0,1,.45]),backIn:Bo([.31,.01,.66,-.59]),backOut:Bo([.33,1.53,.69,.99])};function H_(e,t){if(e)return typeof e=="function"&&fc()?V_(e,t):cp(e)?Bo(e):Array.isArray(e)?e.map(n=>H_(n,t)||Wh.easeOut):Wh[e]}const Jn={x:!1,y:!1};function K_(){return Jn.x||Jn.y}function HE(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const o=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}function W_(e,t){const n=HE(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function ux(e){return t=>{t.pointerType==="touch"||K_()||e(t)}}function KE(e,t,n={}){const[r,s,o]=W_(e,n),a=ux(c=>{const{target:u}=c,f=t(c);if(typeof f!="function"||!u)return;const p=ux(g=>{f(g),u.removeEventListener("pointerleave",p)});u.addEventListener("pointerleave",p,s)});return r.forEach(c=>{c.addEventListener("pointerenter",a,s)}),o}const G_=(e,t)=>t?e===t?!0:G_(e,t.parentElement):!1,up=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,WE=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function GE(e){return WE.has(e.tagName)||e.tabIndex!==-1}const Vo=new WeakSet;function dx(e){return t=>{t.key==="Enter"&&e(t)}}function Kd(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const JE=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=dx(()=>{if(Vo.has(n))return;Kd(n,"down");const s=dx(()=>{Kd(n,"up")}),o=()=>Kd(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function hx(e){return up(e)&&!K_()}function XE(e,t,n={}){const[r,s,o]=W_(e,n),a=c=>{const u=c.currentTarget;if(!hx(c)||Vo.has(u))return;Vo.add(u);const f=t(c),p=(v,b)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",y),!(!hx(v)||!Vo.has(u))&&(Vo.delete(u),typeof f=="function"&&f(v,{success:b}))},g=v=>{p(v,n.useGlobalTarget||G_(u,v.target))},y=v=>{p(v,!1)};window.addEventListener("pointerup",g,s),window.addEventListener("pointercancel",y,s)};return r.forEach(c=>{!GE(c)&&c.getAttribute("tabindex")===null&&(c.tabIndex=0),(n.useGlobalTarget?window:c).addEventListener("pointerdown",a,s),c.addEventListener("focus",f=>JE(f,s),s)}),o}function YE(e){return e==="x"||e==="y"?Jn[e]?null:(Jn[e]=!0,()=>{Jn[e]=!1}):Jn.x||Jn.y?null:(Jn.x=Jn.y=!0,()=>{Jn.x=Jn.y=!1})}const J_=new Set(["width","height","top","left","right","bottom",...Vi]);let rc;function QE(){rc=void 0}const ur={now:()=>(rc===void 0&&ur.set(Bt.isProcessing||Wj.useManualTiming?Bt.timestamp:performance.now()),rc),set:e=>{rc=e,queueMicrotask(QE)}};function dp(e,t){e.indexOf(t)===-1&&e.push(t)}function hp(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class fp{constructor(){this.subscriptions=[]}add(t){return dp(this.subscriptions,t),()=>hp(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let o=0;o<s;o++){const a=this.subscriptions[o];a&&a(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function X_(e,t){return t?e*(1e3/t):0}const fx=30,ZE=e=>!isNaN(parseFloat(e));class eC{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const o=ur.now();this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&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=ur.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=ZE(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 fp);const r=this.events[t].add(n);return t==="change"?()=>{r(),ht.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=ur.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>fx)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,fx);return X_(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 la(e,t){return new eC(e,t)}function tC(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,la(n))}function nC(e,t){const n=Mc(e,t);let{transitionEnd:r={},transition:s={},...o}=n||{};o={...o,...r};for(const a in o){const c=pE(o[a]);tC(e,a,c)}}function rC(e){return!!(Xt(e)&&e.add)}function Gh(e,t){const n=e.getValue("willChange");if(rC(n))return n.add(t)}function Y_(e){return e.props[C_]}const Q_=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,sC=1e-7,iC=12;function oC(e,t,n,r,s){let o,a,c=0;do a=t+(n-t)/2,o=Q_(a,r,s)-e,o>0?n=a:t=a;while(Math.abs(o)>sC&&++c<iC);return a}function wa(e,t,n,r){if(e===t&&n===r)return Cn;const s=o=>oC(o,0,1,e,n);return o=>o===0||o===1?o:Q_(s(o),t,r)}const Z_=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,eb=e=>t=>1-e(1-t),tb=wa(.33,1.53,.69,.99),pp=eb(tb),nb=Z_(pp),rb=e=>(e*=2)<1?.5*pp(e):.5*(2-Math.pow(2,-10*(e-1))),mp=e=>1-Math.sin(Math.acos(e)),sb=eb(mp),ib=Z_(mp),ob=e=>/^0[^.\s]+$/u.test(e);function aC(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||ob(e):!0}const Ko=e=>Math.round(e*1e5)/1e5,gp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function lC(e){return e==null}const cC=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,yp=(e,t)=>n=>!!(typeof n=="string"&&cC.test(n)&&n.startsWith(e)||t&&!lC(n)&&Object.prototype.hasOwnProperty.call(n,t)),ab=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,o,a,c]=r.match(gp);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(a),alpha:c!==void 0?parseFloat(c):1}},uC=e=>Er(0,255,e),Wd={...qi,transform:e=>Math.round(uC(e))},Es={test:yp("rgb","red"),parse:ab("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Wd.transform(e)+", "+Wd.transform(t)+", "+Wd.transform(n)+", "+Ko(aa.transform(r))+")"};function dC(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Jh={test:yp("#"),parse:dC,transform:Es.transform},Ci={test:yp("hsl","hue"),parse:ab("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+cr.transform(Ko(t))+", "+cr.transform(Ko(n))+", "+Ko(aa.transform(r))+")"},Gt={test:e=>Es.test(e)||Jh.test(e)||Ci.test(e),parse:e=>Es.test(e)?Es.parse(e):Ci.test(e)?Ci.parse(e):Jh.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Es.transform(e):Ci.transform(e)},hC=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function fC(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(gp))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(hC))===null||n===void 0?void 0:n.length)||0)>0}const lb="number",cb="color",pC="var",mC="var(",px="${}",gC=/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 ca(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const c=t.replace(gC,u=>(Gt.test(u)?(r.color.push(o),s.push(cb),n.push(Gt.parse(u))):u.startsWith(mC)?(r.var.push(o),s.push(pC),n.push(u)):(r.number.push(o),s.push(lb),n.push(parseFloat(u))),++o,px)).split(px);return{values:n,split:c,indexes:r,types:s}}function ub(e){return ca(e).values}function db(e){const{split:t,types:n}=ca(e),r=t.length;return s=>{let o="";for(let a=0;a<r;a++)if(o+=t[a],s[a]!==void 0){const c=n[a];c===lb?o+=Ko(s[a]):c===cb?o+=Gt.transform(s[a]):o+=s[a]}return o}}const yC=e=>typeof e=="number"?0:e;function xC(e){const t=ub(e);return db(e)(t.map(yC))}const es={test:fC,parse:ub,createTransformer:db,getAnimatableNone:xC},vC=new Set(["brightness","contrast","saturate","opacity"]);function _C(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(gp)||[];if(!r)return e;const s=n.replace(r,"");let o=vC.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const bC=/\b([a-z-]*)\(.*?\)/gu,Xh={...es,getAnimatableNone:e=>{const t=e.match(bC);return t?t.map(_C).join(" "):e}},wC={...tp,color:Gt,backgroundColor:Gt,outlineColor:Gt,fill:Gt,stroke:Gt,borderColor:Gt,borderTopColor:Gt,borderRightColor:Gt,borderBottomColor:Gt,borderLeftColor:Gt,filter:Xh,WebkitFilter:Xh},xp=e=>wC[e];function hb(e,t){let n=xp(e);return n!==Xh&&(n=es),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const kC=new Set(["auto","none","0"]);function SC(e,t,n){let r=0,s;for(;r<e.length&&!s;){const o=e[r];typeof o=="string"&&!kC.has(o)&&ca(o).values.length&&(s=e[r]),r++}if(s&&n)for(const o of t)e[o]=hb(n,s)}const mx=e=>e===qi||e===Ie,gx=(e,t)=>parseFloat(e.split(", ")[t]),yx=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return gx(s[1],t);{const o=r.match(/^matrix\((.+)\)$/u);return o?gx(o[1],e):0}},jC=new Set(["x","y","z"]),EC=Vi.filter(e=>!jC.has(e));function CC(e){const t=[];return EC.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const zi={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:yx(4,13),y:yx(5,14)};zi.translateX=zi.x;zi.translateY=zi.y;const Rs=new Set;let Yh=!1,Qh=!1;function fb(){if(Qh){const e=Array.from(Rs).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=CC(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([o,a])=>{var c;(c=r.getValue(o))===null||c===void 0||c.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Qh=!1,Yh=!1,Rs.forEach(e=>e.complete()),Rs.clear()}function pb(){Rs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Qh=!0)})}function TC(){pb(),fb()}class vp{constructor(t,n,r,s,o,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=o,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Rs.add(this),Yh||(Yh=!0,ht.read(pb),ht.resolveKeyframes(fb))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let o=0;o<t.length;o++)if(t[o]===null)if(o===0){const a=s?.get(),c=t[t.length-1];if(a!==void 0)t[0]=a;else if(r&&n){const u=r.readValue(n,c);u!=null&&(t[0]=u)}t[0]===void 0&&(t[0]=c),s&&a===void 0&&s.set(t[0])}else t[o]=t[o-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 mb=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),NC=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function AC(e){const t=NC.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function gb(e,t,n=1){const[r,s]=AC(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return mb(a)?parseFloat(a):a}return ep(s)?gb(s,t,n+1):s}const yb=e=>t=>t.test(e),RC={test:e=>e==="auto",parse:e=>e},xb=[qi,Ie,cr,Xr,_E,vE,RC],xx=e=>xb.find(yb(e));class vb extends vp{constructor(t,n,r,s,o){super(t,n,r,s,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let f=t[u];if(typeof f=="string"&&(f=f.trim(),ep(f))){const p=gb(f,n.current);p!==void 0&&(t[u]=p),u===t.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!J_.has(r)||t.length!==2)return;const[s,o]=t,a=xx(s),c=xx(o);if(a!==c)if(mx(a)&&mx(c))for(let u=0;u<t.length;u++){const f=t[u];typeof f=="string"&&(t[u]=parseFloat(f))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)aC(t[s])&&r.push(s);r.length&&SC(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=zi[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var t;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const o=n.getValue(r);o&&o.jump(this.measuredOrigin,!1);const a=s.length-1,c=s[a];s[a]=zi[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(([u,f])=>{n.getValue(u).set(f)}),this.resolveNoneKeyframes()}}const vx=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(es.test(e)||e==="0")&&!e.startsWith("url("));function PC(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 OC(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],a=vx(s,t),c=vx(o,t);return!a||!c?!1:PC(e)||(n==="spring"||lp(n))&&r}const LC=e=>e!==null;function zc(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(LC),o=t&&n!=="loop"&&t%2===1?0:s.length-1;return!o||r===void 0?s[o]:r}const IC=40;class _b{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:a="loop",...c}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=ur.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:o,repeatType:a,...c},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>IC?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&TC(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=ur.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:o,delay:a,onComplete:c,onUpdate:u,isGenerator:f}=this.options;if(!f&&!OC(t,r,s,o))if(a)this.options.duration=0;else{u&&u(zc(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 yt=(e,t,n)=>e+(t-e)*n;function Gd(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 DC({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,o=0,a=0;if(!t)s=o=a=n;else{const c=n<.5?n*(1+t):n+t-n*t,u=2*n-c;s=Gd(u,c,e+1/3),o=Gd(u,c,e),a=Gd(u,c,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}function pc(e,t){return n=>n>0?t:e}const Jd=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},MC=[Jh,Es,Ci],zC=e=>MC.find(t=>t.test(e));function _x(e){const t=zC(e);if(!t)return!1;let n=t.parse(e);return t===Ci&&(n=DC(n)),n}const bx=(e,t)=>{const n=_x(e),r=_x(t);if(!n||!r)return pc(e,t);const s={...n};return o=>(s.red=Jd(n.red,r.red,o),s.green=Jd(n.green,r.green,o),s.blue=Jd(n.blue,r.blue,o),s.alpha=yt(n.alpha,r.alpha,o),Es.transform(s))},FC=(e,t)=>n=>t(e(n)),ka=(...e)=>e.reduce(FC),Zh=new Set(["none","hidden"]);function $C(e,t){return Zh.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function UC(e,t){return n=>yt(e,t,n)}function _p(e){return typeof e=="number"?UC:typeof e=="string"?ep(e)?pc:Gt.test(e)?bx:qC:Array.isArray(e)?bb:typeof e=="object"?Gt.test(e)?bx:BC:pc}function bb(e,t){const n=[...e],r=n.length,s=e.map((o,a)=>_p(o)(o,t[a]));return o=>{for(let a=0;a<r;a++)n[a]=s[a](o);return n}}function BC(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=_p(e[s])(e[s],t[s]));return s=>{for(const o in r)n[o]=r[o](s);return n}}function VC(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const a=t.types[o],c=e.indexes[a][s[a]],u=(n=e.values[c])!==null&&n!==void 0?n:0;r[o]=u,s[a]++}return r}const qC=(e,t)=>{const n=es.createTransformer(t),r=ca(e),s=ca(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Zh.has(e)&&!s.values.length||Zh.has(t)&&!r.values.length?$C(e,t):ka(bb(VC(r,s),s.values),n):pc(e,t)};function wb(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?yt(e,t,n):_p(e)(e,t)}const HC=5;function kb(e,t,n){const r=Math.max(t-HC,0);return X_(n-e(r),t-r)}const _t={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},Xd=.001;function KC({duration:e=_t.duration,bounce:t=_t.bounce,velocity:n=_t.velocity,mass:r=_t.mass}){let s,o,a=1-t;a=Er(_t.minDamping,_t.maxDamping,a),e=Er(_t.minDuration,_t.maxDuration,jr(e)),a<1?(s=f=>{const p=f*a,g=p*e,y=p-n,v=ef(f,a),b=Math.exp(-g);return Xd-y/v*b},o=f=>{const g=f*a*e,y=g*n+n,v=Math.pow(a,2)*Math.pow(f,2)*e,b=Math.exp(-g),w=ef(Math.pow(f,2),a);return(-s(f)+Xd>0?-1:1)*((y-v)*b)/w}):(s=f=>{const p=Math.exp(-f*e),g=(f-n)*e+1;return-Xd+p*g},o=f=>{const p=Math.exp(-f*e),g=(n-f)*(e*e);return p*g});const c=5/e,u=GC(s,o,c);if(e=Sr(e),isNaN(u))return{stiffness:_t.stiffness,damping:_t.damping,duration:e};{const f=Math.pow(u,2)*r;return{stiffness:f,damping:a*2*Math.sqrt(r*f),duration:e}}}const WC=12;function GC(e,t,n){let r=n;for(let s=1;s<WC;s++)r=r-e(r)/t(r);return r}function ef(e,t){return e*Math.sqrt(1-t*t)}const JC=["duration","bounce"],XC=["stiffness","damping","mass"];function wx(e,t){return t.some(n=>e[n]!==void 0)}function YC(e){let t={velocity:_t.velocity,stiffness:_t.stiffness,damping:_t.damping,mass:_t.mass,isResolvedFromDuration:!1,...e};if(!wx(e,XC)&&wx(e,JC))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,o=2*Er(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:_t.mass,stiffness:s,damping:o}}else{const n=KC(e);t={...t,...n,mass:_t.mass},t.isResolvedFromDuration=!0}return t}function Sb(e=_t.visualDuration,t=_t.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const o=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],c={done:!1,value:o},{stiffness:u,damping:f,mass:p,duration:g,velocity:y,isResolvedFromDuration:v}=YC({...n,velocity:-jr(n.velocity||0)}),b=y||0,w=f/(2*Math.sqrt(u*p)),k=a-o,S=jr(Math.sqrt(u/p)),C=Math.abs(k)<5;r||(r=C?_t.restSpeed.granular:_t.restSpeed.default),s||(s=C?_t.restDelta.granular:_t.restDelta.default);let j;if(w<1){const T=ef(S,w);j=N=>{const M=Math.exp(-w*S*N);return a-M*((b+w*S*k)/T*Math.sin(T*N)+k*Math.cos(T*N))}}else if(w===1)j=T=>a-Math.exp(-S*T)*(k+(b+S*k)*T);else{const T=S*Math.sqrt(w*w-1);j=N=>{const M=Math.exp(-w*S*N),V=Math.min(T*N,300);return a-M*((b+w*S*k)*Math.sinh(V)+T*k*Math.cosh(V))/T}}const O={calculatedDuration:v&&g||null,next:T=>{const N=j(T);if(v)c.done=T>=g;else{let M=0;w<1&&(M=T===0?Sr(b):kb(j,T,N));const V=Math.abs(M)<=r,U=Math.abs(a-N)<=s;c.done=V&&U}return c.value=c.done?a:N,c},toString:()=>{const T=Math.min(B_(O),Kh),N=V_(M=>O.next(T*M).value,T,30);return T+"ms "+N}};return O}function kx({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:a,min:c,max:u,restDelta:f=.5,restSpeed:p}){const g=e[0],y={done:!1,value:g},v=V=>c!==void 0&&V<c||u!==void 0&&V>u,b=V=>c===void 0?u:u===void 0||Math.abs(c-V)<Math.abs(u-V)?c:u;let w=n*t;const k=g+w,S=a===void 0?k:a(k);S!==k&&(w=S-g);const C=V=>-w*Math.exp(-V/r),j=V=>S+C(V),O=V=>{const U=C(V),L=j(V);y.done=Math.abs(U)<=f,y.value=y.done?S:L};let T,N;const M=V=>{v(y.value)&&(T=V,N=Sb({keyframes:[y.value,b(y.value)],velocity:kb(j,V,y.value),damping:s,stiffness:o,restDelta:f,restSpeed:p}))};return M(0),{calculatedDuration:null,next:V=>{let U=!1;return!N&&T===void 0&&(U=!0,O(V),M(V)),T!==void 0&&V>=T?N.next(V-T):(!U&&O(V),y)}}}const QC=wa(.42,0,1,1),ZC=wa(0,0,.58,1),jb=wa(.42,0,.58,1),e2=e=>Array.isArray(e)&&typeof e[0]!="number",t2={linear:Cn,easeIn:QC,easeInOut:jb,easeOut:ZC,circIn:mp,circInOut:ib,circOut:sb,backIn:pp,backInOut:nb,backOut:tb,anticipate:rb},Sx=e=>{if(cp(e)){w_(e.length===4);const[t,n,r,s]=e;return wa(t,n,r,s)}else if(typeof e=="string")return t2[e];return e};function n2(e,t,n){const r=[],s=n||wb,o=e.length-1;for(let a=0;a<o;a++){let c=s(e[a],e[a+1]);if(t){const u=Array.isArray(t)?t[a]||Cn:t;c=ka(u,c)}r.push(c)}return r}function r2(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const o=e.length;if(w_(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=n2(t,r,s),u=c.length,f=p=>{if(a&&p<e[0])return t[0];let g=0;if(u>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const y=Di(e[g],e[g+1],p);return c[g](y)};return n?p=>f(Er(e[0],e[o-1],p)):f}function s2(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Di(0,t,r);e.push(yt(n,1,s))}}function i2(e){const t=[0];return s2(t,e.length-1),t}function o2(e,t){return e.map(n=>n*t)}function a2(e,t){return e.map(()=>t||jb).splice(0,e.length-1)}function mc({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=e2(r)?r.map(Sx):Sx(r),o={done:!1,value:t[0]},a=o2(n&&n.length===t.length?n:i2(t),e),c=r2(a,t,{ease:Array.isArray(s)?s:a2(t,s)});return{calculatedDuration:e,next:u=>(o.value=c(u),o.done=u>=e,o)}}const l2=e=>{const t=({timestamp:n})=>e(n);return{start:()=>ht.update(t,!0),stop:()=>Zr(t),now:()=>Bt.isProcessing?Bt.timestamp:ur.now()}},c2={decay:kx,inertia:kx,tween:mc,keyframes:mc,spring:Sb},u2=e=>e/100;class bp extends _b{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:u}=this.options;u&&u()};const{name:n,motionValue:r,element:s,keyframes:o}=this.options,a=s?.KeyframeResolver||vp,c=(u,f)=>this.onKeyframesResolved(u,f);this.resolver=new a(o,c,n,r,s),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:s=0,repeatType:o,velocity:a=0}=this.options,c=lp(n)?n:c2[n]||mc;let u,f;c!==mc&&typeof t[0]!="number"&&(u=ka(u2,wb(t[0],t[1])),t=[0,100]);const p=c({...this.options,keyframes:t});o==="mirror"&&(f=c({...this.options,keyframes:[...t].reverse(),velocity:-a})),p.calculatedDuration===null&&(p.calculatedDuration=B_(p));const{calculatedDuration:g}=p,y=g+s,v=y*(r+1)-s;return{generator:p,mirroredGenerator:f,mapPercentToKeyframes:u,calculatedDuration:g,resolvedDuration:y,totalDuration:v}}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:V}=this.options;return{done:!0,value:V[V.length-1]}}const{finalKeyframe:s,generator:o,mirroredGenerator:a,mapPercentToKeyframes:c,keyframes:u,calculatedDuration:f,totalDuration:p,resolvedDuration:g}=r;if(this.startTime===null)return o.next(0);const{delay:y,repeat:v,repeatType:b,repeatDelay:w,onUpdate:k}=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 S=this.currentTime-y*(this.speed>=0?1:-1),C=this.speed>=0?S<0:S>p;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=p);let j=this.currentTime,O=o;if(v){const V=Math.min(this.currentTime,p)/g;let U=Math.floor(V),L=V%1;!L&&V>=1&&(L=1),L===1&&U--,U=Math.min(U,v+1),U%2&&(b==="reverse"?(L=1-L,w&&(L-=w/g)):b==="mirror"&&(O=a)),j=Er(0,1,L)*g}const T=C?{done:!1,value:u[0]}:O.next(j);c&&(T.value=c(T.value));let{done:N}=T;!C&&f!==null&&(N=this.speed>=0?this.currentTime>=p:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return M&&s!==void 0&&(T.value=zc(u,this.options,s)),k&&k(T.value),M&&this.finish(),T}get duration(){const{resolved:t}=this;return t?jr(t.calculatedDuration):0}get time(){return jr(this.currentTime)}set time(t){t=Sr(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=jr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=l2,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):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 d2=new Set(["opacity","clipPath","filter","transform"]);function h2(e,t,n,{delay:r=0,duration:s=300,repeat:o=0,repeatType:a="loop",ease:c="easeInOut",times:u}={}){const f={[t]:n};u&&(f.offset=u);const p=H_(c,s);return Array.isArray(p)&&(f.easing=p),e.animate(f,{delay:r,duration:s,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}const f2=Wf(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),gc=10,p2=2e4;function m2(e){return lp(e.type)||e.type==="spring"||!q_(e.ease)}function g2(e,t){const n=new bp({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let o=0;for(;!r.done&&o<p2;)r=n.sample(o),s.push(r.value),o+=gc;return{times:void 0,keyframes:s,duration:o-gc,ease:"linear"}}const Eb={anticipate:rb,backInOut:nb,circInOut:ib};function y2(e){return e in Eb}class jx extends _b{constructor(t){super(t);const{name:n,motionValue:r,element:s,keyframes:o}=this.options;this.resolver=new vb(o,(a,c)=>this.onKeyframesResolved(a,c),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:o,type:a,motionValue:c,name:u,startTime:f}=this.options;if(!c.owner||!c.owner.current)return!1;if(typeof o=="string"&&fc()&&y2(o)&&(o=Eb[o]),m2(this.options)){const{onComplete:g,onUpdate:y,motionValue:v,element:b,...w}=this.options,k=g2(t,w);t=k.keyframes,t.length===1&&(t[1]=t[0]),r=k.duration,s=k.times,o=k.ease,a="keyframes"}const p=h2(c.owner.current,u,t,{...this.options,duration:r,times:s,ease:o});return p.startTime=f??this.calcStartTime(),this.pendingTimeline?(cx(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:g}=this.options;c.set(zc(t,this.options,n)),g&&g(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:r,times:s,type:a,ease:o,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return jr(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return jr(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Sr(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 Cn;const{animation:r}=n;cx(r,t)}return Cn}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:s,type:o,ease:a,times:c}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:f,onUpdate:p,onComplete:g,element:y,...v}=this.options,b=new bp({...v,keyframes:r,duration:s,type:o,ease:a,times:c,isGenerator:!0}),w=Sr(this.time);f.setWithVelocity(b.sample(w-gc).value,b.sample(w).value,gc)}const{onStop:u}=this.options;u&&u(),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:s,repeatType:o,damping:a,type:c}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:f}=n.owner.getProps();return f2()&&r&&d2.has(r)&&!u&&!f&&!s&&o!=="mirror"&&a!==0&&c!=="inertia"}}const x2={type:"spring",stiffness:500,damping:25,restSpeed:10},v2=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),_2={type:"keyframes",duration:.8},b2={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},w2=(e,{keyframes:t})=>t.length>2?_2:zs.has(e)?e.startsWith("scale")?v2(t[1]):x2:b2;function k2({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:o,repeatType:a,repeatDelay:c,from:u,elapsed:f,...p}){return!!Object.keys(p).length}const wp=(e,t,n,r={},s,o)=>a=>{const c=ap(r,e)||{},u=c.delay||r.delay||0;let{elapsed:f=0}=r;f=f-Sr(u);let p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-f,onUpdate:y=>{t.set(y),c.onUpdate&&c.onUpdate(y)},onComplete:()=>{a(),c.onComplete&&c.onComplete()},name:e,motionValue:t,element:o?void 0:s};k2(c)||(p={...p,...w2(e,p)}),p.duration&&(p.duration=Sr(p.duration)),p.repeatDelay&&(p.repeatDelay=Sr(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(p.duration=0,p.delay===0&&(g=!0)),g&&!o&&t.get()!==void 0){const y=zc(p.keyframes,c);if(y!==void 0)return ht.update(()=>{p.onUpdate(y),p.onComplete()}),new BE([])}return!o&&jx.supports(p)?new jx(p):new bp(p)};function S2({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Cb(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var o;let{transition:a=e.getDefaultTransition(),transitionEnd:c,...u}=t;r&&(a=r);const f=[],p=s&&e.animationState&&e.animationState.getState()[s];for(const g in u){const y=e.getValue(g,(o=e.latestValues[g])!==null&&o!==void 0?o:null),v=u[g];if(v===void 0||p&&S2(p,g))continue;const b={delay:n,...ap(a||{},g)};let w=!1;if(window.MotionHandoffAnimation){const S=Y_(e);if(S){const C=window.MotionHandoffAnimation(S,g,ht);C!==null&&(b.startTime=C,w=!0)}}Gh(e,g),y.start(wp(g,y,v,e.shouldReduceMotion&&J_.has(g)?{type:!1}:b,e,w));const k=y.animation;k&&f.push(k)}return c&&Promise.all(f).then(()=>{ht.update(()=>{c&&nC(e,c)})}),f}function tf(e,t,n={}){var r;const s=Mc(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:o=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(o=n.transitionOverride);const a=s?()=>Promise.all(Cb(e,s,n)):()=>Promise.resolve(),c=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:p=0,staggerChildren:g,staggerDirection:y}=o;return j2(e,t,p+f,g,y,n)}:()=>Promise.resolve(),{when:u}=o;if(u){const[f,p]=u==="beforeChildren"?[a,c]:[c,a];return f().then(()=>p())}else return Promise.all([a(),c(n.delay)])}function j2(e,t,n=0,r=0,s=1,o){const a=[],c=(e.variantChildren.size-1)*r,u=s===1?(f=0)=>f*r:(f=0)=>c-f*r;return Array.from(e.variantChildren).sort(E2).forEach((f,p)=>{f.notify("AnimationStart",t),a.push(tf(f,t,{...o,delay:n+u(p)}).then(()=>f.notify("AnimationComplete",t)))}),Promise.all(a)}function E2(e,t){return e.sortNodePosition(t)}function C2(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(o=>tf(e,o,n));r=Promise.all(s)}else if(typeof t=="string")r=tf(e,t,n);else{const s=typeof t=="function"?Mc(e,t,n.custom):t;r=Promise.all(Cb(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const T2=Jf.length;function Tb(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Tb(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<T2;n++){const r=Jf[n],s=e.props[r];(oa(s)||s===!1)&&(t[r]=s)}return t}const N2=[...Gf].reverse(),A2=Gf.length;function R2(e){return t=>Promise.all(t.map(({animation:n,options:r})=>C2(e,n,r)))}function P2(e){let t=R2(e),n=Ex(),r=!0;const s=u=>(f,p)=>{var g;const y=Mc(e,p,u==="exit"?(g=e.presenceContext)===null||g===void 0?void 0:g.custom:void 0);if(y){const{transition:v,transitionEnd:b,...w}=y;f={...f,...w,...b}}return f};function o(u){t=u(e)}function a(u){const{props:f}=e,p=Tb(e.parent)||{},g=[],y=new Set;let v={},b=1/0;for(let k=0;k<A2;k++){const S=N2[k],C=n[S],j=f[S]!==void 0?f[S]:p[S],O=oa(j),T=S===u?C.isActive:null;T===!1&&(b=k);let N=j===p[S]&&j!==f[S]&&O;if(N&&r&&e.manuallyAnimateOnMount&&(N=!1),C.protectedKeys={...v},!C.isActive&&T===null||!j&&!C.prevProp||Ic(j)||typeof j=="boolean")continue;const M=O2(C.prevProp,j);let V=M||S===u&&C.isActive&&!N&&O||k>b&&O,U=!1;const L=Array.isArray(j)?j:[j];let Q=L.reduce(s(S),{});T===!1&&(Q={});const{prevResolvedValues:Y={}}=C,he={...Y,...Q},K=re=>{V=!0,y.has(re)&&(U=!0,y.delete(re)),C.needsAnimating[re]=!0;const J=e.getValue(re);J&&(J.liveStyle=!1)};for(const re in he){const J=Q[re],ce=Y[re];if(v.hasOwnProperty(re))continue;let A=!1;Hh(J)&&Hh(ce)?A=!U_(J,ce):A=J!==ce,A?J!=null?K(re):y.add(re):J!==void 0&&y.has(re)?K(re):C.protectedKeys[re]=!0}C.prevProp=j,C.prevResolvedValues=Q,C.isActive&&(v={...v,...Q}),r&&e.blockInitialAnimation&&(V=!1),V&&(!(N&&M)||U)&&g.push(...L.map(re=>({animation:re,options:{type:S}})))}if(y.size){const k={};y.forEach(S=>{const C=e.getBaseTarget(S),j=e.getValue(S);j&&(j.liveStyle=!0),k[S]=C??null}),g.push({animation:k})}let w=!!g.length;return r&&(f.initial===!1||f.initial===f.animate)&&!e.manuallyAnimateOnMount&&(w=!1),r=!1,w?t(g):Promise.resolve()}function c(u,f){var p;if(n[u].isActive===f)return Promise.resolve();(p=e.variantChildren)===null||p===void 0||p.forEach(y=>{var v;return(v=y.animationState)===null||v===void 0?void 0:v.setActive(u,f)}),n[u].isActive=f;const g=a(u);for(const y in n)n[y].protectedKeys={};return g}return{animateChanges:a,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Ex(),r=!0}}}function O2(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!U_(t,e):!1}function ys(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ex(){return{animate:ys(!0),whileInView:ys(),whileHover:ys(),whileTap:ys(),whileDrag:ys(),whileFocus:ys(),exit:ys()}}class ts{constructor(t){this.isMounted=!1,this.node=t}update(){}}class L2 extends ts{constructor(t){super(t),t.animationState||(t.animationState=P2(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Ic(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 I2=0;class D2 extends ts{constructor(){super(...arguments),this.id=I2++}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 s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const M2={animation:{Feature:L2},exit:{Feature:D2}};function ua(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Sa(e){return{point:{x:e.pageX,y:e.pageY}}}const z2=e=>t=>up(t)&&e(t,Sa(t));function Wo(e,t,n,r){return ua(e,t,z2(n),r)}const Cx=(e,t)=>Math.abs(e-t);function F2(e,t){const n=Cx(e.x,t.x),r=Cx(e.y,t.y);return Math.sqrt(n**2+r**2)}class Nb{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:o=!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 g=Qd(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,v=F2(g.offset,{x:0,y:0})>=3;if(!y&&!v)return;const{point:b}=g,{timestamp:w}=Bt;this.history.push({...b,timestamp:w});const{onStart:k,onMove:S}=this.handlers;y||(k&&k(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,g)},this.handlePointerMove=(g,y)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Yd(y,this.transformPagePoint),ht.update(this.updatePoint,!0)},this.handlePointerUp=(g,y)=>{this.end();const{onEnd:v,onSessionEnd:b,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Qd(g.type==="pointercancel"?this.lastMoveEventInfo:Yd(y,this.transformPagePoint),this.history);this.startEvent&&v&&v(g,k),b&&b(g,k)},!up(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const a=Sa(t),c=Yd(a,this.transformPagePoint),{point:u}=c,{timestamp:f}=Bt;this.history=[{...u,timestamp:f}];const{onSessionStart:p}=n;p&&p(t,Qd(c,this.history)),this.removeListeners=ka(Wo(this.contextWindow,"pointermove",this.handlePointerMove),Wo(this.contextWindow,"pointerup",this.handlePointerUp),Wo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Zr(this.updatePoint)}}function Yd(e,t){return t?{point:t(e.point)}:e}function Tx(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Qd({point:e},t){return{point:e,delta:Tx(e,Ab(t)),offset:Tx(e,$2(t)),velocity:U2(t,.1)}}function $2(e){return e[0]}function Ab(e){return e[e.length-1]}function U2(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=Ab(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Sr(t)));)n--;if(!r)return{x:0,y:0};const o=jr(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const Rb=1e-4,B2=1-Rb,V2=1+Rb,Pb=.01,q2=0-Pb,H2=0+Pb;function An(e){return e.max-e.min}function K2(e,t,n){return Math.abs(e-t)<=n}function Nx(e,t,n,r=.5){e.origin=r,e.originPoint=yt(t.min,t.max,e.origin),e.scale=An(n)/An(t),e.translate=yt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=B2&&e.scale<=V2||isNaN(e.scale))&&(e.scale=1),(e.translate>=q2&&e.translate<=H2||isNaN(e.translate))&&(e.translate=0)}function Go(e,t,n,r){Nx(e.x,t.x,n.x,r?r.originX:void 0),Nx(e.y,t.y,n.y,r?r.originY:void 0)}function Ax(e,t,n){e.min=n.min+t.min,e.max=e.min+An(t)}function W2(e,t,n){Ax(e.x,t.x,n.x),Ax(e.y,t.y,n.y)}function Rx(e,t,n){e.min=t.min-n.min,e.max=e.min+An(t)}function Jo(e,t,n){Rx(e.x,t.x,n.x),Rx(e.y,t.y,n.y)}function G2(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?yt(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?yt(n,e,r.max):Math.min(e,n)),e}function Px(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 J2(e,{top:t,left:n,bottom:r,right:s}){return{x:Px(e.x,n,s),y:Px(e.y,t,r)}}function Ox(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 X2(e,t){return{x:Ox(e.x,t.x),y:Ox(e.y,t.y)}}function Y2(e,t){let n=.5;const r=An(e),s=An(t);return s>r?n=Di(t.min,t.max-r,e.min):r>s&&(n=Di(e.min,e.max-s,t.min)),Er(0,1,n)}function Q2(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 nf=.35;function Z2(e=nf){return e===!1?e=0:e===!0&&(e=nf),{x:Lx(e,"left","right"),y:Lx(e,"top","bottom")}}function Lx(e,t,n){return{min:Ix(e,t),max:Ix(e,n)}}function Ix(e,t){return typeof e=="number"?e:e[t]||0}const Dx=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ti=()=>({x:Dx(),y:Dx()}),Mx=()=>({min:0,max:0}),kt=()=>({x:Mx(),y:Mx()});function Fn(e){return[e("x"),e("y")]}function Ob({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function eT({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function tT(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 Zd(e){return e===void 0||e===1}function rf({scale:e,scaleX:t,scaleY:n}){return!Zd(e)||!Zd(t)||!Zd(n)}function bs(e){return rf(e)||Lb(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Lb(e){return zx(e.x)||zx(e.y)}function zx(e){return e&&e!=="0%"}function yc(e,t,n){const r=e-n,s=t*r;return n+s}function Fx(e,t,n,r,s){return s!==void 0&&(e=yc(e,s,r)),yc(e,n,r)+t}function sf(e,t=0,n=1,r,s){e.min=Fx(e.min,t,n,r,s),e.max=Fx(e.max,t,n,r,s)}function Ib(e,{x:t,y:n}){sf(e.x,t.translate,t.scale,t.originPoint),sf(e.y,n.translate,n.scale,n.originPoint)}const $x=.999999999999,Ux=1.0000000000001;function nT(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let o,a;for(let c=0;c<s;c++){o=n[c],a=o.projectionDelta;const{visualElement:u}=o.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Ai(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,Ib(e,a)),r&&bs(o.latestValues)&&Ai(e,o.latestValues))}t.x<Ux&&t.x>$x&&(t.x=1),t.y<Ux&&t.y>$x&&(t.y=1)}function Ni(e,t){e.min=e.min+t,e.max=e.max+t}function Bx(e,t,n,r,s=.5){const o=yt(e.min,e.max,s);sf(e,t,n,o,r)}function Ai(e,t){Bx(e.x,t.x,t.scaleX,t.scale,t.originX),Bx(e.y,t.y,t.scaleY,t.scale,t.originY)}function Db(e,t){return Ob(tT(e.getBoundingClientRect(),t))}function rT(e,t,n){const r=Db(e,n),{scroll:s}=t;return s&&(Ni(r.x,s.offset.x),Ni(r.y,s.offset.y)),r}const Mb=({current:e})=>e?e.ownerDocument.defaultView:null,sT=new WeakMap;class iT{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=kt(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=p=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Sa(p).point)},o=(p,g)=>{const{drag:y,dragPropagation:v,onDragStart:b}=this.getProps();if(y&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=YE(y),!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),Fn(k=>{let S=this.getAxisMotionValue(k).get()||0;if(cr.test(S)){const{projection:C}=this.visualElement;if(C&&C.layout){const j=C.layout.layoutBox[k];j&&(S=An(j)*(parseFloat(S)/100))}}this.originPoint[k]=S}),b&&ht.postRender(()=>b(p,g)),Gh(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},a=(p,g)=>{const{dragPropagation:y,dragDirectionLock:v,onDirectionLock:b,onDrag:w}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:k}=g;if(v&&this.currentDirection===null){this.currentDirection=oT(k),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",g.point,k),this.updateAxis("y",g.point,k),this.visualElement.render(),w&&w(p,g)},c=(p,g)=>this.stop(p,g),u=()=>Fn(p=>{var g;return this.getAnimationState(p)==="paused"&&((g=this.getAxisMotionValue(p).animation)===null||g===void 0?void 0:g.play())}),{dragSnapToOrigin:f}=this.getProps();this.panSession=new Nb(t,{onSessionStart:s,onStart:o,onMove:a,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,contextWindow:Mb(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&ht.postRender(()=>o(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:s}=this.getProps();if(!r||!ql(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=G2(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,o=this.constraints;n&&Ei(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=J2(s.layoutBox,n):this.constraints=!1,this.elastic=Z2(r),o!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Fn(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Q2(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Ei(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=rT(r,s.root,this.visualElement.getTransformPagePoint());let a=X2(s.layout.layoutBox,o);if(n){const c=n(eT(a));this.hasMutatedConstraints=!!c,c&&(a=Ob(c))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},f=Fn(p=>{if(!ql(p,n,this.currentDirection))return;let g=u&&u[p]||{};a&&(g={min:0,max:0});const y=s?200:1e6,v=s?40:1e7,b={type:"inertia",velocity:r?t[p]:0,bounceStiffness:y,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...o,...g};return this.startAxisValueAnimation(p,b)});return Promise.all(f).then(c)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Gh(this.visualElement,t),r.start(wp(t,r,0,n,this.visualElement,!1))}stopAnimation(){Fn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Fn(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(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Fn(n=>{const{drag:r}=this.getProps();if(!ql(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:c}=s.layout.layoutBox[n];o.set(t[n]-yt(a,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Ei(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Fn(a=>{const c=this.getAxisMotionValue(a);if(c&&this.constraints!==!1){const u=c.get();s[a]=Y2({min:u,max:u},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Fn(a=>{if(!ql(a,t,null))return;const c=this.getAxisMotionValue(a),{min:u,max:f}=this.constraints[a];c.set(yt(u,f,s[a]))})}addListeners(){if(!this.visualElement.current)return;sT.set(this.visualElement,this);const t=this.visualElement.current,n=Wo(t,"pointerdown",u=>{const{drag:f,dragListener:p=!0}=this.getProps();f&&p&&this.start(u)}),r=()=>{const{dragConstraints:u}=this.getProps();Ei(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,o=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),ht.read(r);const a=ua(window,"resize",()=>this.scalePositionWithinConstraints()),c=s.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:f})=>{this.isDragging&&f&&(Fn(p=>{const g=this.getAxisMotionValue(p);g&&(this.originPoint[p]+=u[p].translate,g.set(g.get()+u[p].translate))}),this.visualElement.render())}));return()=>{a(),n(),o(),c&&c()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:a=nf,dragMomentum:c=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:a,dragMomentum:c}}}function ql(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function oT(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class aT extends ts{constructor(t){super(t),this.removeGroupControls=Cn,this.removeListeners=Cn,this.controls=new iT(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Cn}unmount(){this.removeGroupControls(),this.removeListeners()}}const Vx=e=>(t,n)=>{e&&ht.postRender(()=>e(t,n))};class lT extends ts{constructor(){super(...arguments),this.removePointerDownListener=Cn}onPointerDown(t){this.session=new Nb(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Mb(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Vx(t),onStart:Vx(n),onMove:r,onEnd:(o,a)=>{delete this.session,s&&ht.postRender(()=>s(o,a))}}}mount(){this.removePointerDownListener=Wo(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 sc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function qx(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Lo={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ie.test(e))e=parseFloat(e);else return e;const n=qx(e,t.target.x),r=qx(e,t.target.y);return`${n}% ${r}%`}},cT={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=es.parse(e);if(s.length>5)return r;const o=es.createTransformer(e),a=typeof s[0]!="number"?1:0,c=n.x.scale*t.x,u=n.y.scale*t.y;s[0+a]/=c,s[1+a]/=u;const f=yt(c,u,.5);return typeof s[2+a]=="number"&&(s[2+a]/=f),typeof s[3+a]=="number"&&(s[3+a]/=f),o(s)}};class uT extends R.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;AE(dT),o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),sc.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,s||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||ht.postRender(()=>{const c=a.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Yf.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function zb(e){const[t,n]=__(),r=R.useContext(Vf);return h.jsx(uT,{...e,layoutGroup:r,switchLayoutGroup:R.useContext(T_),isPresent:t,safeToRemove:n})}const dT={borderRadius:{...Lo,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Lo,borderTopRightRadius:Lo,borderBottomLeftRadius:Lo,borderBottomRightRadius:Lo,boxShadow:cT};function hT(e,t,n){const r=Xt(e)?e:la(e);return r.start(wp("",r,t,n)),r.animation}function fT(e){return e instanceof SVGElement&&e.tagName!=="svg"}const pT=(e,t)=>e.depth-t.depth;class mT{constructor(){this.children=[],this.isDirty=!1}add(t){dp(this.children,t),this.isDirty=!0}remove(t){hp(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(pT),this.isDirty=!1,this.children.forEach(t)}}function gT(e,t){const n=ur.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(Zr(r),e(o-t))};return ht.read(r,!0),()=>Zr(r)}const Fb=["TopLeft","TopRight","BottomLeft","BottomRight"],yT=Fb.length,Hx=e=>typeof e=="string"?parseFloat(e):e,Kx=e=>typeof e=="number"||Ie.test(e);function xT(e,t,n,r,s,o){s?(e.opacity=yt(0,n.opacity!==void 0?n.opacity:1,vT(r)),e.opacityExit=yt(t.opacity!==void 0?t.opacity:1,0,_T(r))):o&&(e.opacity=yt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;a<yT;a++){const c=`border${Fb[a]}Radius`;let u=Wx(t,c),f=Wx(n,c);if(u===void 0&&f===void 0)continue;u||(u=0),f||(f=0),u===0||f===0||Kx(u)===Kx(f)?(e[c]=Math.max(yt(Hx(u),Hx(f),r),0),(cr.test(f)||cr.test(u))&&(e[c]+="%")):e[c]=f}(t.rotate||n.rotate)&&(e.rotate=yt(t.rotate||0,n.rotate||0,r))}function Wx(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const vT=$b(0,.5,sb),_T=$b(.5,.95,Cn);function $b(e,t,n){return r=>r<e?0:r>t?1:n(Di(e,t,r))}function Gx(e,t){e.min=t.min,e.max=t.max}function zn(e,t){Gx(e.x,t.x),Gx(e.y,t.y)}function Jx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Xx(e,t,n,r,s){return e-=t,e=yc(e,1/n,r),s!==void 0&&(e=yc(e,1/s,r)),e}function bT(e,t=0,n=1,r=.5,s,o=e,a=e){if(cr.test(t)&&(t=parseFloat(t),t=yt(a.min,a.max,t/100)-a.min),typeof t!="number")return;let c=yt(o.min,o.max,r);e===o&&(c-=t),e.min=Xx(e.min,t,n,c,s),e.max=Xx(e.max,t,n,c,s)}function Yx(e,t,[n,r,s],o,a){bT(e,t[n],t[r],t[s],t.scale,o,a)}const wT=["x","scaleX","originX"],kT=["y","scaleY","originY"];function Qx(e,t,n,r){Yx(e.x,t,wT,n?n.x:void 0,r?r.x:void 0),Yx(e.y,t,kT,n?n.y:void 0,r?r.y:void 0)}function Zx(e){return e.translate===0&&e.scale===1}function Ub(e){return Zx(e.x)&&Zx(e.y)}function ev(e,t){return e.min===t.min&&e.max===t.max}function ST(e,t){return ev(e.x,t.x)&&ev(e.y,t.y)}function tv(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Bb(e,t){return tv(e.x,t.x)&&tv(e.y,t.y)}function nv(e){return An(e.x)/An(e.y)}function rv(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class jT{constructor(){this.members=[]}add(t){dp(this.members,t),t.scheduleRender()}remove(t){if(hp(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(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const o=this.members[s];if(o.isPresent!==!1){r=o;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:s}=t.options;s===!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 ET(e,t,n){let r="";const s=e.x.translate/t.x,o=e.y.translate/t.y,a=n?.z||0;if((s||o||a)&&(r=`translate3d(${s}px, ${o}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:f,rotate:p,rotateX:g,rotateY:y,skewX:v,skewY:b}=n;f&&(r=`perspective(${f}px) ${r}`),p&&(r+=`rotate(${p}deg) `),g&&(r+=`rotateX(${g}deg) `),y&&(r+=`rotateY(${y}deg) `),v&&(r+=`skewX(${v}deg) `),b&&(r+=`skewY(${b}deg) `)}const c=e.x.scale*t.x,u=e.y.scale*t.y;return(c!==1||u!==1)&&(r+=`scale(${c}, ${u})`),r||"none"}const ws={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},qo=typeof window<"u"&&window.MotionDebug!==void 0,eh=["","X","Y","Z"],CT={visibility:"hidden"},sv=1e3;let TT=0;function th(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Vb(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Y_(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ht,!(s||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Vb(r)}function qb({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},c=t?.()){this.id=TT++,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,qo&&(ws.totalNodes=ws.resolvedTargetDeltas=ws.recalculatedProjection=0),this.nodes.forEach(RT),this.nodes.forEach(DT),this.nodes.forEach(MT),this.nodes.forEach(PT),qo&&window.MotionDebug.record(ws)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,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 u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new mT)}addEventListener(a,c){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new fp),this.eventHandlers.get(a).add(c)}notifyListeners(a,...c){const u=this.eventHandlers.get(a);u&&u.notify(...c)}hasListeners(a){return this.eventHandlers.has(a)}mount(a,c=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=fT(a),this.instance=a;const{layoutId:u,layout:f,visualElement:p}=this.options;if(p&&!p.current&&p.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),c&&(f||u)&&(this.isLayoutDirty=!0),e){let g;const y=()=>this.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,g&&g(),g=gT(y,250),sc.hasAnimatedSinceResize&&(sc.hasAnimatedSinceResize=!1,this.nodes.forEach(ov))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&p&&(u||f)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:y,hasRelativeTargetChanged:v,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||p.getDefaultTransition()||BT,{onLayoutAnimationStart:k,onLayoutAnimationComplete:S}=p.getProps(),C=!this.targetLayout||!Bb(this.targetLayout,b)||v,j=!y&&v;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||y&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(g,j);const O={...ap(w,"layout"),onPlay:k,onComplete:S};(p.shouldReduceMotion||this.options.layoutRoot)&&(O.delay=0,O.type=!1),this.startAnimation(O)}else y||ov(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Zr(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(zT),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Vb(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const g=this.path[p];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:c,layout:u}=this.options;if(c===void 0&&!u)return;const f=this.getTransformTemplate();this.prevTransformTemplateValue=f?f(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(iv);return}this.isUpdating||this.nodes.forEach(LT),this.isUpdating=!1,this.nodes.forEach(IT),this.nodes.forEach(NT),this.nodes.forEach(AT),this.clearAllSnapshots();const c=ur.now();Bt.delta=Er(0,1e3/60,c-Bt.timestamp),Bt.timestamp=c,Bt.isProcessing=!0,Hd.update.process(Bt),Hd.preRender.process(Bt),Hd.render.process(Bt),Bt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Yf.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(OT),this.sharedNodes.forEach(FT)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ht.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ht.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 u=0;u<this.path.length;u++)this.path[u].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=kt(),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,a?a.layoutBox:void 0)}updateScroll(a="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(c=!1),c){const u=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:u,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!s)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!Ub(this.projectionDelta),u=this.getTransformTemplate(),f=u?u(this.latestValues,""):void 0,p=f!==this.prevTransformTemplateValue;a&&(c||bs(this.latestValues)||p)&&(s(this.instance,f),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const c=this.measurePageBox();let u=this.removeElementScroll(c);return a&&(u=this.removeTransform(u)),VT(u),{animationId:this.root.animationId,measuredBox:c,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var a;const{visualElement:c}=this.options;if(!c)return kt();const u=c.measureViewportBox();if(!(((a=this.scroll)===null||a===void 0?void 0:a.wasRoot)||this.path.some(qT))){const{scroll:p}=this.root;p&&(Ni(u.x,p.offset.x),Ni(u.y,p.offset.y))}return u}removeElementScroll(a){var c;const u=kt();if(zn(u,a),!((c=this.scroll)===null||c===void 0)&&c.wasRoot)return u;for(let f=0;f<this.path.length;f++){const p=this.path[f],{scroll:g,options:y}=p;p!==this.root&&g&&y.layoutScroll&&(g.wasRoot&&zn(u,a),Ni(u.x,g.offset.x),Ni(u.y,g.offset.y))}return u}applyTransform(a,c=!1){const u=kt();zn(u,a);for(let f=0;f<this.path.length;f++){const p=this.path[f];!c&&p.options.layoutScroll&&p.scroll&&p!==p.root&&Ai(u,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),bs(p.latestValues)&&Ai(u,p.latestValues)}return bs(this.latestValues)&&Ai(u,this.latestValues),u}removeTransform(a){const c=kt();zn(c,a);for(let u=0;u<this.path.length;u++){const f=this.path[u];if(!f.instance||!bs(f.latestValues))continue;rf(f.latestValues)&&f.updateSnapshot();const p=kt(),g=f.measurePageBox();zn(p,g),Qx(c,f.latestValues,f.snapshot?f.snapshot.layoutBox:void 0,p)}return bs(this.latestValues)&&Qx(c,this.latestValues),c}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.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!==Bt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var c;const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const f=!!this.resumingFrom||this!==u;if(!(a||f&&this.isSharedProjectionDirty||this.isProjectionDirty||!((c=this.parent)===null||c===void 0)&&c.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:g,layoutId:y}=this.options;if(!(!this.layout||!(g||y))){if(this.resolvedRelativeTargetAt=Bt.timestamp,!this.targetDelta&&!this.relativeTarget){const v=this.getClosestProjectingParent();v&&v.layout&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=kt(),this.relativeTargetOrigin=kt(),Jo(this.relativeTargetOrigin,this.layout.layoutBox,v.layout.layoutBox),zn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=kt(),this.targetWithTransforms=kt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),W2(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):zn(this.target,this.layout.layoutBox),Ib(this.target,this.targetDelta)):zn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const v=this.getClosestProjectingParent();v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=kt(),this.relativeTargetOrigin=kt(),Jo(this.relativeTargetOrigin,this.target,v.target),zn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}qo&&ws.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||rf(this.parent.latestValues)||Lb(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 a;const c=this.getLead(),u=!!this.resumingFrom||this!==c;let f=!0;if((this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty)&&(f=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(f=!1),this.resolvedRelativeTargetAt===Bt.timestamp&&(f=!1),f)return;const{layout:p,layoutId:g}=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||g))return;zn(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,v=this.treeScale.y;nT(this.layoutCorrected,this.treeScale,this.path,u),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=kt());const{target:b}=c;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Jx(this.prevProjectionDelta.x,this.projectionDelta.x),Jx(this.prevProjectionDelta.y,this.projectionDelta.y)),Go(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==y||this.treeScale.y!==v||!rv(this.projectionDelta.x,this.prevProjectionDelta.x)||!rv(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),qo&&ws.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var c;if((c=this.options.visualElement)===null||c===void 0||c.scheduleRender(),a){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ti(),this.projectionDelta=Ti(),this.projectionDeltaWithTransform=Ti()}setAnimationOrigin(a,c=!1){const u=this.snapshot,f=u?u.latestValues:{},p={...this.latestValues},g=Ti();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const y=kt(),v=u?u.source:void 0,b=this.layout?this.layout.source:void 0,w=v!==b,k=this.getStack(),S=!k||k.members.length<=1,C=!!(w&&!S&&this.options.crossfade===!0&&!this.path.some(UT));this.animationProgress=0;let j;this.mixTargetDelta=O=>{const T=O/1e3;av(g.x,a.x,T),av(g.y,a.y,T),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Jo(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),$T(this.relativeTarget,this.relativeTargetOrigin,y,T),j&&ST(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=kt()),zn(j,this.relativeTarget)),w&&(this.animationValues=p,xT(p,f,this.latestValues,T,C,S)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Zr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ht.update(()=>{sc.hasAnimatedSinceResize=!0,this.currentAnimation=hT(0,sv,{...a,onUpdate:c=>{this.mixTargetDelta(c),a.onUpdate&&a.onUpdate(c)},onComplete:()=>{a.onComplete&&a.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 a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(sv),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:c,target:u,layout:f,latestValues:p}=a;if(!(!c||!u||!f)){if(this!==a&&this.layout&&f&&Hb(this.options.animationType,this.layout.layoutBox,f.layoutBox)){u=this.target||kt();const g=An(this.layout.layoutBox.x);u.x.min=a.target.x.min,u.x.max=u.x.min+g;const y=An(this.layout.layoutBox.y);u.y.min=a.target.y.min,u.y.max=u.y.min+y}zn(c,u),Ai(c,p),Go(this.projectionDeltaWithTransform,this.layoutCorrected,c,p)}}registerSharedNode(a,c){this.sharedNodes.has(a)||this.sharedNodes.set(a,new jT),this.sharedNodes.get(a).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 a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:c}=this.options;return c?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:c}=this.options;return c?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:c,preserveFollowOpacity:u}={}){const f=this.getStack();f&&f.promote(this,u),a&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let c=!1;const{latestValues:u}=a;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(c=!0),!c)return;const f={};u.z&&th("z",a,f,this.animationValues);for(let p=0;p<eh.length;p++)th(`rotate${eh[p]}`,a,f,this.animationValues),th(`skew${eh[p]}`,a,f,this.animationValues);a.render();for(const p in f)a.setStaticValue(p,f[p]),this.animationValues&&(this.animationValues[p]=f[p]);a.scheduleRender()}getProjectionStyles(a){var c,u;if(!this.instance||this.isSVG)return;if(!this.isVisible)return CT;const f={visibility:""},p=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,f.opacity="",f.pointerEvents=nc(a?.pointerEvents)||"",f.transform=p?p(this.latestValues,""):"none",f;const g=this.getLead();if(!this.projectionDelta||!this.layout||!g.target){const w={};return this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=nc(a?.pointerEvents)||""),this.hasProjected&&!bs(this.latestValues)&&(w.transform=p?p({},""):"none",this.hasProjected=!1),w}const y=g.animationValues||g.latestValues;this.applyTransformsToTarget(),f.transform=ET(this.projectionDeltaWithTransform,this.treeScale,y),p&&(f.transform=p(y,f.transform));const{x:v,y:b}=this.projectionDelta;f.transformOrigin=`${v.origin*100}% ${b.origin*100}% 0`,g.animationValues?f.opacity=g===this?(u=(c=y.opacity)!==null&&c!==void 0?c:this.latestValues.opacity)!==null&&u!==void 0?u:1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:f.opacity=g===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const w in hc){if(y[w]===void 0)continue;const{correct:k,applyTo:S}=hc[w],C=f.transform==="none"?y[w]:k(y[w],g);if(S){const j=S.length;for(let O=0;O<j;O++)f[S[O]]=C}else f[w]=C}return this.options.layoutId&&(f.pointerEvents=g===this?nc(a?.pointerEvents)||"":"none"),f}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var c;return(c=a.currentAnimation)===null||c===void 0?void 0:c.stop()}),this.root.nodes.forEach(iv),this.root.sharedNodes.clear()}}}function NT(e){e.updateLayout()}function AT(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:s}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;o==="size"?Fn(g=>{const y=a?n.measuredBox[g]:n.layoutBox[g],v=An(y);y.min=r[g].min,y.max=y.min+v}):Hb(o,n.layoutBox,r)&&Fn(g=>{const y=a?n.measuredBox[g]:n.layoutBox[g],v=An(r[g]);y.max=y.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[g].max=e.relativeTarget[g].min+v)});const c=Ti();Go(c,r,n.layoutBox);const u=Ti();a?Go(u,e.applyTransform(s,!0),n.measuredBox):Go(u,r,n.layoutBox);const f=!Ub(c);let p=!1;if(!e.resumeFrom){const g=e.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:y,layout:v}=g;if(y&&v){const b=kt();Jo(b,n.layoutBox,y.layoutBox);const w=kt();Jo(w,r,v.layoutBox),Bb(b,w)||(p=!0),g.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=b,e.relativeParent=g)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:u,layoutDelta:c,hasLayoutChanged:f,hasRelativeTargetChanged:p})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function RT(e){qo&&ws.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 PT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function OT(e){e.clearSnapshot()}function iv(e){e.clearMeasurements()}function LT(e){e.isLayoutDirty=!1}function IT(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function ov(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function DT(e){e.resolveTargetDelta()}function MT(e){e.calcProjection()}function zT(e){e.resetSkewAndRotation()}function FT(e){e.removeLeadSnapshot()}function av(e,t,n){e.translate=yt(t.translate,0,n),e.scale=yt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function lv(e,t,n,r){e.min=yt(t.min,n.min,r),e.max=yt(t.max,n.max,r)}function $T(e,t,n,r){lv(e.x,t.x,n.x,r),lv(e.y,t.y,n.y,r)}function UT(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const BT={duration:.45,ease:[.4,0,.1,1]},cv=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),uv=cv("applewebkit/")&&!cv("chrome/")?Math.round:Cn;function dv(e){e.min=uv(e.min),e.max=uv(e.max)}function VT(e){dv(e.x),dv(e.y)}function Hb(e,t,n){return e==="position"||e==="preserve-aspect"&&!K2(nv(t),nv(n),.2)}function qT(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const HT=qb({attachResizeListener:(e,t)=>ua(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),nh={current:void 0},Kb=qb({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!nh.current){const e=new HT({});e.mount(window),e.setOptions({layoutScroll:!0}),nh.current=e}return nh.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),KT={pan:{Feature:lT},drag:{Feature:aT,ProjectionNode:Kb,MeasureLayout:zb}};function hv(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,o=r[s];o&&ht.postRender(()=>o(t,Sa(t)))}class WT extends ts{mount(){const{current:t}=this.node;t&&(this.unmount=KE(t,n=>(hv(this.node,n,"Start"),r=>hv(this.node,r,"End"))))}unmount(){}}class GT extends ts{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=ka(ua(this.node.current,"focus",()=>this.onFocus()),ua(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function fv(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),o=r[s];o&&ht.postRender(()=>o(t,Sa(t)))}class JT extends ts{mount(){const{current:t}=this.node;t&&(this.unmount=XE(t,n=>(fv(this.node,n,"Start"),(r,{success:s})=>fv(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const of=new WeakMap,rh=new WeakMap,XT=e=>{const t=of.get(e.target);t&&t(e)},YT=e=>{e.forEach(XT)};function QT({root:e,...t}){const n=e||document;rh.has(n)||rh.set(n,{});const r=rh.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(YT,{root:e,...t})),r[s]}function ZT(e,t,n){const r=QT(t);return of.set(e,n),r.observe(e),()=>{of.delete(e),r.unobserve(e)}}const eN={some:0,all:1};class tN extends ts{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:eN[s]},c=u=>{const{isIntersecting:f}=u;if(this.isInView===f||(this.isInView=f,o&&!f&&this.hasEnteredView))return;f&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",f);const{onViewportEnter:p,onViewportLeave:g}=this.node.getProps(),y=f?p:g;y&&y(u)};return ZT(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(nN(t,n))&&this.startObserver()}unmount(){}}function nN({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const rN={inView:{Feature:tN},tap:{Feature:JT},focus:{Feature:GT},hover:{Feature:WT}},sN={layout:{ProjectionNode:Kb,MeasureLayout:zb}},af={current:null},Wb={current:!1};function iN(){if(Wb.current=!0,!!Kf)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>af.current=e.matches;e.addListener(t),t()}else af.current=!1}const oN=[...xb,Gt,es],aN=e=>oN.find(yb(e)),pv=new WeakMap;function lN(e,t,n){for(const r in t){const s=t[r],o=n[r];if(Xt(s))e.addValue(r,s);else if(Xt(o))e.addValue(r,la(s,{owner:e}));else if(o!==s)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(r);e.addValue(r,la(a!==void 0?a:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const mv=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class cN{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:o,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=vp,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 v=ur.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,ht.render(this.render,!1,!0))};const{latestValues:u,renderState:f,onUpdate:p}=a;this.onUpdate=p,this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=f,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=Dc(n),this.isVariantNode=E_(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...y}=this.scrapeMotionValuesFromProps(n,{},this);for(const v in y){const b=y[v];u[v]!==void 0&&Xt(b)&&b.set(u[v],!1)}}mount(t){this.current=t,pv.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)),Wb.current||iN(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:af.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){pv.delete(this.current),this.projection&&this.projection.unmount(),Zr(this.notifyUpdate),Zr(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=zs.has(t),s=n.on("change",c=>{this.latestValues[t]=c,this.props.onUpdate&&ht.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),o(),a&&a(),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 Mi){const n=Mi[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):kt()}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<mv.length;r++){const s=mv[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const o="on"+s,a=t[o];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=lN(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=la(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=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 s!=null&&(typeof s=="string"&&(mb(s)||ob(s))?s=parseFloat(s):!aN(s)&&es.test(n)&&(s=hb(t,n)),this.setBaseTarget(t,Xt(s)?s.get():s)),Xt(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const a=Zf(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[t])}if(r&&s!==void 0)return s;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Xt(o)?o:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new fp),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class Gb extends cN{constructor(){super(...arguments),this.KeyframeResolver=vb}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;Xt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function uN(e){return window.getComputedStyle(e)}class dN extends Gb{constructor(){super(...arguments),this.type="html",this.renderInstance=I_}readValueFromInstance(t,n){if(zs.has(n)){const r=xp(n);return r&&r.default||0}else{const r=uN(t),s=(P_(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Db(t,n)}build(t,n,r){np(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return op(t,n,r)}}class hN extends Gb{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=kt}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(zs.has(n)){const r=xp(n);return r&&r.default||0}return n=D_.has(n)?n:Xf(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return F_(t,n,r)}build(t,n,r){rp(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){M_(t,n,r,s)}mount(t){this.isSVGTag=ip(t.tagName),super.mount(t)}}const fN=(e,t)=>Qf(e)?new hN(t):new dN(t,{allowProjection:e!==R.Fragment}),pN=FE({...M2,...rN,...KT,...sN},fN),Be=eE(pN);function Jb(e,t){return function(){return e.apply(t,arguments)}}const{toString:mN}=Object.prototype,{getPrototypeOf:kp}=Object,{iterator:Fc,toStringTag:Xb}=Symbol,$c=(e=>t=>{const n=mN.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Zn=e=>(e=e.toLowerCase(),t=>$c(t)===e),Uc=e=>t=>typeof t===e,{isArray:Hi}=Array,Fi=Uc("undefined");function ja(e){return e!==null&&!Fi(e)&&e.constructor!==null&&!Fi(e.constructor)&&gn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Yb=Zn("ArrayBuffer");function gN(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Yb(e.buffer),t}const yN=Uc("string"),gn=Uc("function"),Qb=Uc("number"),Ea=e=>e!==null&&typeof e=="object",xN=e=>e===!0||e===!1,ic=e=>{if($c(e)!=="object")return!1;const t=kp(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Xb in e)&&!(Fc in e)},vN=e=>{if(!Ea(e)||ja(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},_N=Zn("Date"),bN=Zn("File"),wN=Zn("Blob"),kN=Zn("FileList"),SN=e=>Ea(e)&&gn(e.pipe),jN=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||gn(e.append)&&((t=$c(e))==="formdata"||t==="object"&&gn(e.toString)&&e.toString()==="[object FormData]"))},EN=Zn("URLSearchParams"),[CN,TN,NN,AN]=["ReadableStream","Request","Response","Headers"].map(Zn),RN=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ca(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Hi(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(ja(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;let c;for(r=0;r<a;r++)c=o[r],t.call(null,e[c],c,e)}}function Zb(e,t){if(ja(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const Cs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ew=e=>!Fi(e)&&e!==Cs;function lf(){const{caseless:e,skipUndefined:t}=ew(this)&&this||{},n={},r=(s,o)=>{const a=e&&Zb(n,o)||o;ic(n[a])&&ic(s)?n[a]=lf(n[a],s):ic(s)?n[a]=lf({},s):Hi(s)?n[a]=s.slice():(!t||!Fi(s))&&(n[a]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&Ca(arguments[s],r);return n}const PN=(e,t,n,{allOwnKeys:r}={})=>(Ca(t,(s,o)=>{n&&gn(s)?e[o]=Jb(s,n):e[o]=s},{allOwnKeys:r}),e),ON=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),LN=(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)},IN=(e,t,n,r)=>{let s,o,a;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)a=s[o],(!r||r(a,e,t))&&!c[a]&&(t[a]=e[a],c[a]=!0);e=n!==!1&&kp(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},DN=(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},MN=e=>{if(!e)return null;if(Hi(e))return e;let t=e.length;if(!Qb(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},zN=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&kp(Uint8Array)),FN=(e,t)=>{const r=(e&&e[Fc]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},$N=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},UN=Zn("HTMLFormElement"),BN=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),gv=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),VN=Zn("RegExp"),tw=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ca(n,(s,o)=>{let a;(a=t(s,o,e))!==!1&&(r[o]=a||s)}),Object.defineProperties(e,r)},qN=e=>{tw(e,(t,n)=>{if(gn(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(gn(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+"'")})}})},HN=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return Hi(e)?r(e):r(String(e).split(t)),n},KN=()=>{},WN=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function GN(e){return!!(e&&gn(e.append)&&e[Xb]==="FormData"&&e[Fc])}const JN=e=>{const t=new Array(10),n=(r,s)=>{if(Ea(r)){if(t.indexOf(r)>=0)return;if(ja(r))return r;if(!("toJSON"in r)){t[s]=r;const o=Hi(r)?[]:{};return Ca(r,(a,c)=>{const u=n(a,s+1);!Fi(u)&&(o[c]=u)}),t[s]=void 0,o}}return r};return n(e,0)},XN=Zn("AsyncFunction"),YN=e=>e&&(Ea(e)||gn(e))&&gn(e.then)&&gn(e.catch),nw=((e,t)=>e?setImmediate:t?((n,r)=>(Cs.addEventListener("message",({source:s,data:o})=>{s===Cs&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Cs.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",gn(Cs.postMessage)),QN=typeof queueMicrotask<"u"?queueMicrotask.bind(Cs):typeof process<"u"&&process.nextTick||nw,ZN=e=>e!=null&&gn(e[Fc]),H={isArray:Hi,isArrayBuffer:Yb,isBuffer:ja,isFormData:jN,isArrayBufferView:gN,isString:yN,isNumber:Qb,isBoolean:xN,isObject:Ea,isPlainObject:ic,isEmptyObject:vN,isReadableStream:CN,isRequest:TN,isResponse:NN,isHeaders:AN,isUndefined:Fi,isDate:_N,isFile:bN,isBlob:wN,isRegExp:VN,isFunction:gn,isStream:SN,isURLSearchParams:EN,isTypedArray:zN,isFileList:kN,forEach:Ca,merge:lf,extend:PN,trim:RN,stripBOM:ON,inherits:LN,toFlatObject:IN,kindOf:$c,kindOfTest:Zn,endsWith:DN,toArray:MN,forEachEntry:FN,matchAll:$N,isHTMLForm:UN,hasOwnProperty:gv,hasOwnProp:gv,reduceDescriptors:tw,freezeMethods:qN,toObjectSet:HN,toCamelCase:BN,noop:KN,toFiniteNumber:WN,findKey:Zb,global:Cs,isContextDefined:ew,isSpecCompliantForm:GN,toJSONObject:JN,isAsyncFn:XN,isThenable:YN,setImmediate:nw,asap:QN,isIterable:ZN};function Ve(e,t,n,r,s){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),s&&(this.response=s,this.status=s.status?s.status:null)}H.inherits(Ve,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:H.toJSONObject(this.config),code:this.code,status:this.status}}});const rw=Ve.prototype,sw={};["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=>{sw[e]={value:e}});Object.defineProperties(Ve,sw);Object.defineProperty(rw,"isAxiosError",{value:!0});Ve.from=(e,t,n,r,s,o)=>{const a=Object.create(rw);H.toFlatObject(e,a,function(p){return p!==Error.prototype},f=>f!=="isAxiosError");const c=e&&e.message?e.message:"Error",u=t==null&&e?e.code:t;return Ve.call(a,c,u,n,r,s),e&&a.cause==null&&Object.defineProperty(a,"cause",{value:e,configurable:!0}),a.name=e&&e.name||"Error",o&&Object.assign(a,o),a};const eA=null;function cf(e){return H.isPlainObject(e)||H.isArray(e)}function iw(e){return H.endsWith(e,"[]")?e.slice(0,-2):e}function yv(e,t,n){return e?e.concat(t).map(function(s,o){return s=iw(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function tA(e){return H.isArray(e)&&!e.some(cf)}const nA=H.toFlatObject(H,{},null,function(t){return/^is[A-Z]/.test(t)});function Bc(e,t,n){if(!H.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=H.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,k){return!H.isUndefined(k[w])});const r=n.metaTokens,s=n.visitor||p,o=n.dots,a=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&H.isSpecCompliantForm(t);if(!H.isFunction(s))throw new TypeError("visitor must be a function");function f(b){if(b===null)return"";if(H.isDate(b))return b.toISOString();if(H.isBoolean(b))return b.toString();if(!u&&H.isBlob(b))throw new Ve("Blob is not supported. Use a Buffer instead.");return H.isArrayBuffer(b)||H.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function p(b,w,k){let S=b;if(b&&!k&&typeof b=="object"){if(H.endsWith(w,"{}"))w=r?w:w.slice(0,-2),b=JSON.stringify(b);else if(H.isArray(b)&&tA(b)||(H.isFileList(b)||H.endsWith(w,"[]"))&&(S=H.toArray(b)))return w=iw(w),S.forEach(function(j,O){!(H.isUndefined(j)||j===null)&&t.append(a===!0?yv([w],O,o):a===null?w:w+"[]",f(j))}),!1}return cf(b)?!0:(t.append(yv(k,w,o),f(b)),!1)}const g=[],y=Object.assign(nA,{defaultVisitor:p,convertValue:f,isVisitable:cf});function v(b,w){if(!H.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+w.join("."));g.push(b),H.forEach(b,function(S,C){(!(H.isUndefined(S)||S===null)&&s.call(t,S,H.isString(C)?C.trim():C,w,y))===!0&&v(S,w?w.concat(C):[C])}),g.pop()}}if(!H.isObject(e))throw new TypeError("data must be an object");return v(e),t}function xv(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Sp(e,t){this._pairs=[],e&&Bc(e,this,t)}const ow=Sp.prototype;ow.append=function(t,n){this._pairs.push([t,n])};ow.toString=function(t){const n=t?function(r){return t.call(this,r,xv)}:xv;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function rA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function aw(e,t,n){if(!t)return e;const r=n&&n.encode||rA;H.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(t,n):o=H.isURLSearchParams(t)?t.toString():new Sp(t,n).toString(r),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class vv{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){H.forEach(this.handlers,function(r){r!==null&&t(r)})}}const lw={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},sA=typeof URLSearchParams<"u"?URLSearchParams:Sp,iA=typeof FormData<"u"?FormData:null,oA=typeof Blob<"u"?Blob:null,aA={isBrowser:!0,classes:{URLSearchParams:sA,FormData:iA,Blob:oA},protocols:["http","https","file","blob","url","data"]},jp=typeof window<"u"&&typeof document<"u",uf=typeof navigator=="object"&&navigator||void 0,lA=jp&&(!uf||["ReactNative","NativeScript","NS"].indexOf(uf.product)<0),cA=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",uA=jp&&window.location.href||"http://localhost",dA=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:jp,hasStandardBrowserEnv:lA,hasStandardBrowserWebWorkerEnv:cA,navigator:uf,origin:uA},Symbol.toStringTag,{value:"Module"})),Jt={...dA,...aA};function hA(e,t){return Bc(e,new Jt.classes.URLSearchParams,{visitor:function(n,r,s,o){return Jt.isNode&&H.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function fA(e){return H.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function pA(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function cw(e){function t(n,r,s,o){let a=n[o++];if(a==="__proto__")return!0;const c=Number.isFinite(+a),u=o>=n.length;return a=!a&&H.isArray(s)?s.length:a,u?(H.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!c):((!s[a]||!H.isObject(s[a]))&&(s[a]=[]),t(n,r,s[a],o)&&H.isArray(s[a])&&(s[a]=pA(s[a])),!c)}if(H.isFormData(e)&&H.isFunction(e.entries)){const n={};return H.forEachEntry(e,(r,s)=>{t(fA(r),s,n,0)}),n}return null}function mA(e,t,n){if(H.isString(e))try{return(t||JSON.parse)(e),H.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Ta={transitional:lw,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=H.isObject(t);if(o&&H.isHTMLForm(t)&&(t=new FormData(t)),H.isFormData(t))return s?JSON.stringify(cw(t)):t;if(H.isArrayBuffer(t)||H.isBuffer(t)||H.isStream(t)||H.isFile(t)||H.isBlob(t)||H.isReadableStream(t))return t;if(H.isArrayBufferView(t))return t.buffer;if(H.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return hA(t,this.formSerializer).toString();if((c=H.isFileList(t))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Bc(c?{"files[]":t}:t,u&&new u,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),mA(t)):t}],transformResponse:[function(t){const n=this.transitional||Ta.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(H.isResponse(t)||H.isReadableStream(t))return t;if(t&&H.isString(t)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(a)throw c.name==="SyntaxError"?Ve.from(c,Ve.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}}};H.forEach(["delete","get","head","post","put","patch"],e=>{Ta.headers[e]={}});const gA=H.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"]),yA=e=>{const t={};let n,r,s;return e&&e.split(`
17
+ `).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||t[n]&&gA[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},_v=Symbol("internals");function Io(e){return e&&String(e).trim().toLowerCase()}function oc(e){return e===!1||e==null?e:H.isArray(e)?e.map(oc):String(e)}function xA(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 vA=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function sh(e,t,n,r,s){if(H.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!H.isString(t)){if(H.isString(r))return t.indexOf(r)!==-1;if(H.isRegExp(r))return r.test(t)}}function _A(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function bA(e,t){const n=H.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,a){return this[r].call(this,t,s,o,a)},configurable:!0})})}let yn=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,u,f){const p=Io(u);if(!p)throw new Error("header name must be a non-empty string");const g=H.findKey(s,p);(!g||s[g]===void 0||f===!0||f===void 0&&s[g]!==!1)&&(s[g||u]=oc(c))}const a=(c,u)=>H.forEach(c,(f,p)=>o(f,p,u));if(H.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(H.isString(t)&&(t=t.trim())&&!vA(t))a(yA(t),n);else if(H.isObject(t)&&H.isIterable(t)){let c={},u,f;for(const p of t){if(!H.isArray(p))throw TypeError("Object iterator must return a key-value pair");c[f=p[0]]=(u=c[f])?H.isArray(u)?[...u,p[1]]:[u,p[1]]:p[1]}a(c,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=Io(t),t){const r=H.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return xA(s);if(H.isFunction(n))return n.call(this,s,r);if(H.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Io(t),t){const r=H.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||sh(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(a){if(a=Io(a),a){const c=H.findKey(r,a);c&&(!n||sh(r,r[c],c,n))&&(delete r[c],s=!0)}}return H.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||sh(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return H.forEach(this,(s,o)=>{const a=H.findKey(r,o);if(a){n[a]=oc(s),delete n[o];return}const c=t?_A(o):String(o).trim();c!==o&&delete n[o],n[c]=oc(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return H.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&H.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(s=>r.set(s)),r}static accessor(t){const r=(this[_v]=this[_v]={accessors:{}}).accessors,s=this.prototype;function o(a){const c=Io(a);r[c]||(bA(s,a),r[c]=!0)}return H.isArray(t)?t.forEach(o):o(t),this}};yn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);H.reduceDescriptors(yn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});H.freezeMethods(yn);function ih(e,t){const n=this||Ta,r=t||n,s=yn.from(r.headers);let o=r.data;return H.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function uw(e){return!!(e&&e.__CANCEL__)}function Ki(e,t,n){Ve.call(this,e??"canceled",Ve.ERR_CANCELED,t,n),this.name="CanceledError"}H.inherits(Ki,Ve,{__CANCEL__:!0});function dw(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ve("Request failed with status code "+n.status,[Ve.ERR_BAD_REQUEST,Ve.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function wA(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function kA(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,a;return t=t!==void 0?t:1e3,function(u){const f=Date.now(),p=r[o];a||(a=f),n[s]=u,r[s]=f;let g=o,y=0;for(;g!==s;)y+=n[g++],g=g%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),f-a<t)return;const v=p&&f-p;return v?Math.round(y*1e3/v):void 0}}function SA(e,t){let n=0,r=1e3/t,s,o;const a=(f,p=Date.now())=>{n=p,s=null,o&&(clearTimeout(o),o=null),e(...f)};return[(...f)=>{const p=Date.now(),g=p-n;g>=r?a(f,p):(s=f,o||(o=setTimeout(()=>{o=null,a(s)},r-g)))},()=>s&&a(s)]}const xc=(e,t,n=3)=>{let r=0;const s=kA(50,250);return SA(o=>{const a=o.loaded,c=o.lengthComputable?o.total:void 0,u=a-r,f=s(u),p=a<=c;r=a;const g={loaded:a,total:c,progress:c?a/c:void 0,bytes:u,rate:f||void 0,estimated:f&&c&&p?(c-a)/f:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(g)},n)},bv=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},wv=e=>(...t)=>H.asap(()=>e(...t)),jA=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,EA=Jt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,a){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];H.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),H.isString(r)&&c.push(`path=${r}`),H.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),H.isString(a)&&c.push(`SameSite=${a}`),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 CA(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function TA(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function hw(e,t,n){let r=!CA(t);return e&&(r||n==!1)?TA(e,t):t}const kv=e=>e instanceof yn?{...e}:e;function Is(e,t){t=t||{};const n={};function r(f,p,g,y){return H.isPlainObject(f)&&H.isPlainObject(p)?H.merge.call({caseless:y},f,p):H.isPlainObject(p)?H.merge({},p):H.isArray(p)?p.slice():p}function s(f,p,g,y){if(H.isUndefined(p)){if(!H.isUndefined(f))return r(void 0,f,g,y)}else return r(f,p,g,y)}function o(f,p){if(!H.isUndefined(p))return r(void 0,p)}function a(f,p){if(H.isUndefined(p)){if(!H.isUndefined(f))return r(void 0,f)}else return r(void 0,p)}function c(f,p,g){if(g in t)return r(f,p);if(g in e)return r(void 0,f)}const u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c,headers:(f,p,g)=>s(kv(f),kv(p),g,!0)};return H.forEach(Object.keys({...e,...t}),function(p){const g=u[p]||s,y=g(e[p],t[p],p);H.isUndefined(y)&&g!==c||(n[p]=y)}),n}const fw=e=>{const t=Is({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:c}=t;if(t.headers=a=yn.from(a),t.url=aw(hw(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),H.isFormData(n)){if(Jt.hasStandardBrowserEnv||Jt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(H.isFunction(n.getHeaders)){const u=n.getHeaders(),f=["content-type","content-length"];Object.entries(u).forEach(([p,g])=>{f.includes(p.toLowerCase())&&a.set(p,g)})}}if(Jt.hasStandardBrowserEnv&&(r&&H.isFunction(r)&&(r=r(t)),r||r!==!1&&jA(t.url))){const u=s&&o&&EA.read(o);u&&a.set(s,u)}return t},NA=typeof XMLHttpRequest<"u",AA=NA&&function(e){return new Promise(function(n,r){const s=fw(e);let o=s.data;const a=yn.from(s.headers).normalize();let{responseType:c,onUploadProgress:u,onDownloadProgress:f}=s,p,g,y,v,b;function w(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(p),s.signal&&s.signal.removeEventListener("abort",p)}let k=new XMLHttpRequest;k.open(s.method.toUpperCase(),s.url,!0),k.timeout=s.timeout;function S(){if(!k)return;const j=yn.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),T={data:!c||c==="text"||c==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:j,config:e,request:k};dw(function(M){n(M),w()},function(M){r(M),w()},T),k=null}"onloadend"in k?k.onloadend=S:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(S)},k.onabort=function(){k&&(r(new Ve("Request aborted",Ve.ECONNABORTED,e,k)),k=null)},k.onerror=function(O){const T=O&&O.message?O.message:"Network Error",N=new Ve(T,Ve.ERR_NETWORK,e,k);N.event=O||null,r(N),k=null},k.ontimeout=function(){let O=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const T=s.transitional||lw;s.timeoutErrorMessage&&(O=s.timeoutErrorMessage),r(new Ve(O,T.clarifyTimeoutError?Ve.ETIMEDOUT:Ve.ECONNABORTED,e,k)),k=null},o===void 0&&a.setContentType(null),"setRequestHeader"in k&&H.forEach(a.toJSON(),function(O,T){k.setRequestHeader(T,O)}),H.isUndefined(s.withCredentials)||(k.withCredentials=!!s.withCredentials),c&&c!=="json"&&(k.responseType=s.responseType),f&&([y,b]=xc(f,!0),k.addEventListener("progress",y)),u&&k.upload&&([g,v]=xc(u),k.upload.addEventListener("progress",g),k.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(p=j=>{k&&(r(!j||j.type?new Ki(null,e,k):j),k.abort(),k=null)},s.cancelToken&&s.cancelToken.subscribe(p),s.signal&&(s.signal.aborted?p():s.signal.addEventListener("abort",p)));const C=wA(s.url);if(C&&Jt.protocols.indexOf(C)===-1){r(new Ve("Unsupported protocol "+C+":",Ve.ERR_BAD_REQUEST,e));return}k.send(o||null)})},RA=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(f){if(!s){s=!0,c();const p=f instanceof Error?f:this.reason;r.abort(p instanceof Ve?p:new Ki(p instanceof Error?p.message:p))}};let a=t&&setTimeout(()=>{a=null,o(new Ve(`timeout ${t} of ms exceeded`,Ve.ETIMEDOUT))},t);const c=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),e=null)};e.forEach(f=>f.addEventListener("abort",o));const{signal:u}=r;return u.unsubscribe=()=>H.asap(c),u}},PA=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},OA=async function*(e,t){for await(const n of LA(e))yield*PA(n,t)},LA=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()}},Sv=(e,t,n,r)=>{const s=OA(e,t);let o=0,a,c=u=>{a||(a=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:f,value:p}=await s.next();if(f){c(),u.close();return}let g=p.byteLength;if(n){let y=o+=g;n(y)}u.enqueue(new Uint8Array(p))}catch(f){throw c(f),f}},cancel(u){return c(u),s.return()}},{highWaterMark:2})},jv=64*1024,{isFunction:Hl}=H,IA=(({Request:e,Response:t})=>({Request:e,Response:t}))(H.global),{ReadableStream:Ev,TextEncoder:Cv}=H.global,Tv=(e,...t)=>{try{return!!e(...t)}catch{return!1}},DA=e=>{e=H.merge.call({skipUndefined:!0},IA,e);const{fetch:t,Request:n,Response:r}=e,s=t?Hl(t):typeof fetch=="function",o=Hl(n),a=Hl(r);if(!s)return!1;const c=s&&Hl(Ev),u=s&&(typeof Cv=="function"?(b=>w=>b.encode(w))(new Cv):async b=>new Uint8Array(await new n(b).arrayBuffer())),f=o&&c&&Tv(()=>{let b=!1;const w=new n(Jt.origin,{body:new Ev,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!w}),p=a&&c&&Tv(()=>H.isReadableStream(new r("").body)),g={stream:p&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(w,k)=>{let S=w&&w[b];if(S)return S.call(w);throw new Ve(`Response type '${b}' is not supported`,Ve.ERR_NOT_SUPPORT,k)})});const y=async b=>{if(b==null)return 0;if(H.isBlob(b))return b.size;if(H.isSpecCompliantForm(b))return(await new n(Jt.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(H.isArrayBufferView(b)||H.isArrayBuffer(b))return b.byteLength;if(H.isURLSearchParams(b)&&(b=b+""),H.isString(b))return(await u(b)).byteLength},v=async(b,w)=>{const k=H.toFiniteNumber(b.getContentLength());return k??y(w)};return async b=>{let{url:w,method:k,data:S,signal:C,cancelToken:j,timeout:O,onDownloadProgress:T,onUploadProgress:N,responseType:M,headers:V,withCredentials:U="same-origin",fetchOptions:L}=fw(b),Q=t||fetch;M=M?(M+"").toLowerCase():"text";let Y=RA([C,j&&j.toAbortSignal()],O),he=null;const K=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let W;try{if(N&&f&&k!=="get"&&k!=="head"&&(W=await v(V,S))!==0){let D=new n(w,{method:"POST",body:S,duplex:"half"}),G;if(H.isFormData(S)&&(G=D.headers.get("content-type"))&&V.setContentType(G),D.body){const[P,ve]=bv(W,xc(wv(N)));S=Sv(D.body,jv,P,ve)}}H.isString(U)||(U=U?"include":"omit");const ne=o&&"credentials"in n.prototype,re={...L,signal:Y,method:k.toUpperCase(),headers:V.normalize().toJSON(),body:S,duplex:"half",credentials:ne?U:void 0};he=o&&new n(w,re);let J=await(o?Q(he,L):Q(w,re));const ce=p&&(M==="stream"||M==="response");if(p&&(T||ce&&K)){const D={};["status","statusText","headers"].forEach(Ne=>{D[Ne]=J[Ne]});const G=H.toFiniteNumber(J.headers.get("content-length")),[P,ve]=T&&bv(G,xc(wv(T),!0))||[];J=new r(Sv(J.body,jv,P,()=>{ve&&ve(),K&&K()}),D)}M=M||"text";let A=await g[H.findKey(g,M)||"text"](J,b);return!ce&&K&&K(),await new Promise((D,G)=>{dw(D,G,{data:A,headers:yn.from(J.headers),status:J.status,statusText:J.statusText,config:b,request:he})})}catch(ne){throw K&&K(),ne&&ne.name==="TypeError"&&/Load failed|fetch/i.test(ne.message)?Object.assign(new Ve("Network Error",Ve.ERR_NETWORK,b,he),{cause:ne.cause||ne}):Ve.from(ne,ne&&ne.code,b,he)}}},MA=new Map,pw=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let a=o.length,c=a,u,f,p=MA;for(;c--;)u=o[c],f=p.get(u),f===void 0&&p.set(u,f=c?new Map:DA(t)),p=f;return f};pw();const Ep={http:eA,xhr:AA,fetch:{get:pw}};H.forEach(Ep,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Nv=e=>`- ${e}`,zA=e=>H.isFunction(e)||e===null||e===!1;function FA(e,t){e=H.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let a=0;a<n;a++){r=e[a];let c;if(s=r,!zA(r)&&(s=Ep[(c=String(r)).toLowerCase()],s===void 0))throw new Ve(`Unknown adapter '${c}'`);if(s&&(H.isFunction(s)||(s=s.get(t))))break;o[c||"#"+a]=s}if(!s){const a=Object.entries(o).map(([u,f])=>`adapter ${u} `+(f===!1?"is not supported by the environment":"is not available in the build"));let c=n?a.length>1?`since :
19
19
  `+a.map(Nv).join(`
20
- `):" "+Nv(a[0]):"as no adapter specified";throw new Ve("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const mw={getAdapter:FA,adapters:Ep};function oh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ki(null,e)}function Av(e){return oh(e),e.headers=gn.from(e.headers),e.data=ih.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),mw.getAdapter(e.adapter||Ta.adapter,e)(e).then(function(r){return oh(e),r.data=ih.call(e,e.transformResponse,r),r.headers=gn.from(r.headers),r},function(r){return uw(r)||(oh(e),r&&r.response&&(r.response.data=ih.call(e,e.transformResponse,r.response),r.response.headers=gn.from(r.response.headers))),Promise.reject(r)})}const gw="1.13.2",Vc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Vc[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Rv={};Vc.transitional=function(t,n,r){function s(o,a){return"[Axios v"+gw+"] Transitional option '"+o+"'"+a+(r?". "+r:"")}return(o,a,c)=>{if(t===!1)throw new Ve(s(a," has been removed"+(n?" in "+n:"")),Ve.ERR_DEPRECATED);return n&&!Rv[a]&&(Rv[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,a,c):!0}};Vc.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function $A(e,t,n){if(typeof e!="object")throw new Ve("options must be an object",Ve.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],a=t[o];if(a){const c=e[o],u=c===void 0||a(c,o,e);if(u!==!0)throw new Ve("option "+o+" must be "+u,Ve.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ve("Unknown option "+o,Ve.ERR_BAD_OPTION)}}const ac={assertOptions:$A,validators:Vc},or=ac.validators;let Ps=class{constructor(t){this.defaults=t||{},this.interceptors={request:new vv,response:new vv}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
21
- `+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Is(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&ac.assertOptions(r,{silentJSONParsing:or.transitional(or.boolean),forcedJSONParsing:or.transitional(or.boolean),clarifyTimeoutError:or.transitional(or.boolean)},!1),s!=null&&(H.isFunction(s)?n.paramsSerializer={serialize:s}:ac.assertOptions(s,{encode:or.function,serialize:or.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ac.assertOptions(n,{baseUrl:or.spelling("baseURL"),withXsrfToken:or.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=o&&H.merge(o.common,o[n.method]);o&&H.forEach(["delete","get","head","post","put","patch","common"],b=>{delete o[b]}),n.headers=gn.concat(a,o);const c=[];let u=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(u=u&&w.synchronous,c.unshift(w.fulfilled,w.rejected))});const f=[];this.interceptors.response.forEach(function(w){f.push(w.fulfilled,w.rejected)});let p,g=0,y;if(!u){const b=[Av.bind(this),void 0];for(b.unshift(...c),b.push(...f),y=b.length,p=Promise.resolve(n);g<y;)p=p.then(b[g++],b[g++]);return p}y=c.length;let v=n;for(;g<y;){const b=c[g++],w=c[g++];try{v=b(v)}catch(k){w.call(this,k);break}}try{p=Av.call(this,v)}catch(b){return Promise.reject(b)}for(g=0,y=f.length;g<y;)p=p.then(f[g++],f[g++]);return p}getUri(t){t=Is(this.defaults,t);const n=hw(t.baseURL,t.url,t.allowAbsoluteUrls);return aw(n,t.params,t.paramsSerializer)}};H.forEach(["delete","get","head","options"],function(t){Ps.prototype[t]=function(n,r){return this.request(Is(r||{},{method:t,url:n,data:(r||{}).data}))}});H.forEach(["post","put","patch"],function(t){function n(r){return function(o,a,c){return this.request(Is(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}Ps.prototype[t]=n(),Ps.prototype[t+"Form"]=n(!0)});let UA=class yw{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const a=new Promise(c=>{r.subscribe(c),o=c}).then(s);return a.cancel=function(){r.unsubscribe(o)},a},t(function(o,a,c){r.reason||(r.reason=new Ki(o,a,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 yw(function(s){t=s}),cancel:t}}};function BA(e){return function(n){return e.apply(null,n)}}function VA(e){return H.isObject(e)&&e.isAxiosError===!0}const df={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(df).forEach(([e,t])=>{df[t]=e});function xw(e){const t=new Ps(e),n=Jb(Ps.prototype.request,t);return H.extend(n,Ps.prototype,t,{allOwnKeys:!0}),H.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return xw(Is(e,s))},n}const Xe=xw(Ta);Xe.Axios=Ps;Xe.CanceledError=Ki;Xe.CancelToken=UA;Xe.isCancel=uw;Xe.VERSION=gw;Xe.toFormData=Bc;Xe.AxiosError=Ve;Xe.Cancel=Xe.CanceledError;Xe.all=function(t){return Promise.all(t)};Xe.spread=BA;Xe.isAxiosError=VA;Xe.mergeConfig=Is;Xe.AxiosHeaders=gn;Xe.formToJSON=e=>cw(H.isHTMLForm(e)?new FormData(e):e);Xe.getAdapter=mw.getAdapter;Xe.HttpStatusCode=df;Xe.default=Xe;const{Axios:b$,AxiosError:w$,CanceledError:k$,isCancel:S$,CancelToken:j$,VERSION:E$,all:C$,Cancel:T$,isAxiosError:N$,spread:A$,toFormData:R$,AxiosHeaders:P$,HttpStatusCode:O$,formToJSON:L$,getAdapter:I$,mergeConfig:D$}=Xe,ze=e=>typeof e=="string",Do=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},Pv=e=>e==null?"":""+e,qA=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},HA=/###/g,Ov=e=>e&&e.indexOf("###")>-1?e.replace(HA,"."):e,Lv=e=>!e||ze(e),Xo=(e,t,n)=>{const r=ze(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(Lv(e))return{};const o=Ov(r[s]);!e[o]&&n&&(e[o]=new n),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++s}return Lv(e)?{}:{obj:e,k:Ov(r[s])}},Iv=(e,t,n)=>{const{obj:r,k:s}=Xo(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let o=t[t.length-1],a=t.slice(0,t.length-1),c=Xo(e,a,Object);for(;c.obj===void 0&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),c=Xo(e,a,Object),c?.obj&&typeof c.obj[`${c.k}.${o}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${o}`]=n},KA=(e,t,n,r)=>{const{obj:s,k:o}=Xo(e,t,Object);s[o]=s[o]||[],s[o].push(n)},vc=(e,t)=>{const{obj:n,k:r}=Xo(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},WA=(e,t,n)=>{const r=vc(e,n);return r!==void 0?r:vc(t,n)},vw=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?ze(e[r])||e[r]instanceof String||ze(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):vw(e[r],t[r],n):e[r]=t[r]);return e},ui=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var GA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const JA=e=>ze(e)?e.replace(/[&<>"'\/]/g,t=>GA[t]):e;class XA{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const YA=[" ",",","?","!",";"],QA=new XA(20),ZA=(e,t,n)=>{t=t||"",n=n||"";const r=YA.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=QA.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!s.test(e);if(!o){const a=e.indexOf(n);a>0&&!s.test(e.substring(0,a))&&(o=!0)}return o},hf=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let s=e;for(let o=0;o<r.length;){if(!s||typeof s!="object")return;let a,c="";for(let u=o;u<r.length;++u)if(u!==o&&(c+=n),c+=r[u],a=s[c],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&u<r.length-1)continue;o+=u-o+1;break}s=a}return s},da=e=>e?.replace("_","-"),eR={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class _c{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||eR,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,s){return s&&!this.debug?null:(ze(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new _c(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new _c(this.logger,t)}}var lr=new _c;class qc{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([s,o])=>{for(let a=0;a<o;a++)s(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,o])=>{for(let a=0;a<o;a++)s.apply(s,[t,...n])})}}class Dv extends qc{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r,s={}){const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;t.indexOf(".")>-1?c=t.split("."):(c=[t,n],r&&(Array.isArray(r)?c.push(...r):ze(r)&&o?c.push(...r.split(o)):c.push(r)));const u=vc(this.data,c);return!u&&!n&&!r&&t.indexOf(".")>-1&&(t=c[0],n=c[1],r=c.slice(2).join(".")),u||!a||!ze(r)?u:hf(this.data?.[t]?.[n],r,o)}addResource(t,n,r,s,o={silent:!1}){const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let c=[t,n];r&&(c=c.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(c=t.split("."),s=n,n=c[1]),this.addNamespaces(n),Iv(this.data,c,s),o.silent||this.emit("added",t,n,r,s)}addResources(t,n,r,s={silent:!1}){for(const o in r)(ze(r[o])||Array.isArray(r[o]))&&this.addResource(t,n,o,r[o],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,o,a={silent:!1,skipCopy:!1}){let c=[t,n];t.indexOf(".")>-1&&(c=t.split("."),s=r,r=n,n=c[1]),this.addNamespaces(n);let u=vc(this.data,c)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?vw(u,r,o):u={...u,...r},Iv(this.data,c,u),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var _w={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(o=>{t=this.processors[o]?.process(t,n,r,s)??t}),t}};const bw=Symbol("i18next/PATH_KEY");function tR(){const e=[],t=Object.create(null);let n;return t.get=(r,s)=>(n?.revoke?.(),s===bw?e:(e.push(s),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function ff(e,t){const{[bw]:n}=e(tR());return n.join(t?.keySeparator??".")}const Mv={},ah=e=>!ze(e)&&typeof e!="boolean"&&typeof e!="number";class bc extends qc{constructor(t,n={}){super(),qA(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=lr.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const r={...n};if(t==null)return!1;const s=this.resolve(t,r);if(s?.res===void 0)return!1;const o=ah(s.res);return!(r.returnObjects===!1&&o)}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!ZA(t,r,s);if(a&&!c){const u=t.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:t,namespaces:ze(o)?[o]:o};const f=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(f[0])>-1)&&(o=f.shift()),t=f.join(s)}return{key:t,namespaces:ze(o)?[o]:o}}translate(t,n,r){let s=typeof n=="object"?{...n}:n;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),t==null)return"";typeof t=="function"&&(t=ff(t,{...this.options,...s})),Array.isArray(t)||(t=[String(t)]);const o=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:c,namespaces:u}=this.extractFromKey(t[t.length-1],s),f=u[u.length-1];let p=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;p===void 0&&(p=":");const g=s.lng||this.language,y=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(g?.toLowerCase()==="cimode")return y?o?{res:`${f}${p}${c}`,usedKey:c,exactUsedKey:c,usedLng:g,usedNS:f,usedParams:this.getUsedParamsDetails(s)}:`${f}${p}${c}`:o?{res:c,usedKey:c,exactUsedKey:c,usedLng:g,usedNS:f,usedParams:this.getUsedParamsDetails(s)}:c;const v=this.resolve(t,s);let b=v?.res;const w=v?.usedKey||c,k=v?.exactUsedKey||c,S=["[object Number]","[object Function]","[object RegExp]"],C=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,O=s.count!==void 0&&!ze(s.count),T=bc.hasDefaultValue(s),N=O?this.pluralResolver.getSuffix(g,s.count,s):"",M=s.ordinal&&O?this.pluralResolver.getSuffix(g,s.count,{ordinal:!1}):"",V=O&&!s.ordinal&&s.count===0,B=V&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${N}`]||s[`defaultValue${M}`]||s.defaultValue;let L=b;j&&!b&&T&&(L=B);const Q=ah(L),Y=Object.prototype.toString.apply(L);if(j&&L&&Q&&S.indexOf(Y)<0&&!(ze(C)&&Array.isArray(L))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const he=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,L,{...s,ns:u}):`key '${c} (${this.language})' returned an object instead of string.`;return o?(v.res=he,v.usedParams=this.getUsedParamsDetails(s),v):he}if(a){const he=Array.isArray(L),K=he?[]:{},W=he?k:w;for(const ne in L)if(Object.prototype.hasOwnProperty.call(L,ne)){const re=`${W}${a}${ne}`;T&&!b?K[ne]=this.translate(re,{...s,defaultValue:ah(B)?B[ne]:void 0,joinArrays:!1,ns:u}):K[ne]=this.translate(re,{...s,joinArrays:!1,ns:u}),K[ne]===re&&(K[ne]=L[ne])}b=K}}else if(j&&ze(C)&&Array.isArray(b))b=b.join(C),b&&(b=this.extendTranslation(b,t,s,r));else{let he=!1,K=!1;!this.isValidLookup(b)&&T&&(he=!0,b=B),this.isValidLookup(b)||(K=!0,b=c);const ne=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&K?void 0:b,re=T&&B!==b&&this.options.updateMissing;if(K||he||re){if(this.logger.log(re?"updateKey":"missingKey",g,f,c,re?B:b),a){const D=this.resolve(c,{...s,keySeparator:!1});D&&D.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let J=[];const ce=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ce&&ce[0])for(let D=0;D<ce.length;D++)J.push(ce[D]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(s.lng||this.language):J.push(s.lng||this.language);const A=(D,G,P)=>{const _e=T&&P!==b?P:ne;this.options.missingKeyHandler?this.options.missingKeyHandler(D,f,G,_e,re,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(D,f,G,_e,re,s),this.emit("missingKey",D,f,G,b)};this.options.saveMissing&&(this.options.saveMissingPlurals&&O?J.forEach(D=>{const G=this.pluralResolver.getSuffixes(D,s);V&&s[`defaultValue${this.options.pluralSeparator}zero`]&&G.indexOf(`${this.options.pluralSeparator}zero`)<0&&G.push(`${this.options.pluralSeparator}zero`),G.forEach(P=>{A([D],c+P,s[`defaultValue${P}`]||B)})}):A(J,c,B))}b=this.extendTranslation(b,t,s,v,r),K&&b===c&&this.options.appendNamespaceToMissingKey&&(b=`${f}${p}${c}`),(K||he)&&this.options.parseMissingKeyHandler&&(b=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}${p}${c}`:c,he?b:void 0,s))}return o?(v.res=b,v.usedParams=this.getUsedParamsDetails(s),v):b}extendTranslation(t,n,r,s,o){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=ze(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(u){const g=t.match(this.interpolator.nestingRegexp);f=g&&g.length}let p=r.replace&&!ze(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),t=this.interpolator.interpolate(t,p,r.lng||this.language||s.usedLng,r),u){const g=t.match(this.interpolator.nestingRegexp),y=g&&g.length;f<y&&(r.nest=!1)}!r.lng&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...g)=>o?.[0]===g[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${n[0]}`),null):this.translate(...g,n),r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,c=ze(a)?[a]:a;return t!=null&&c?.length&&r.applyPostProcessor!==!1&&(t=_w.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,n={}){let r,s,o,a,c;return ze(t)&&(t=[t]),t.forEach(u=>{if(this.isValidLookup(r))return;const f=this.extractFromKey(u,n),p=f.key;s=p;let g=f.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const y=n.count!==void 0&&!ze(n.count),v=y&&!n.ordinal&&n.count===0,b=n.context!==void 0&&(ze(n.context)||typeof n.context=="number")&&n.context!=="",w=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);g.forEach(k=>{this.isValidLookup(r)||(c=k,!Mv[`${w[0]}-${k}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(Mv[`${w[0]}-${k}`]=!0,this.logger.warn(`key "${s}" for languages "${w.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(S=>{if(this.isValidLookup(r))return;a=S;const C=[p];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(C,p,S,k,n);else{let O;y&&(O=this.pluralResolver.getSuffix(S,n.count,n));const T=`${this.options.pluralSeparator}zero`,N=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(y&&(n.ordinal&&O.indexOf(N)===0&&C.push(p+O.replace(N,this.options.pluralSeparator)),C.push(p+O),v&&C.push(p+T)),b){const M=`${p}${this.options.contextSeparator||"_"}${n.context}`;C.push(M),y&&(n.ordinal&&O.indexOf(N)===0&&C.push(M+O.replace(N,this.options.pluralSeparator)),C.push(M+O),v&&C.push(M+T))}}let j;for(;j=C.pop();)this.isValidLookup(r)||(o=j,r=this.getResource(S,k,j,n))}))})}),{res:r,usedKey:s,exactUsedKey:o,usedLng:a,usedNS:c}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!ze(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const o of n)delete s[o]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}class zv{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=lr.create("languageUtils")}getScriptPartFromCode(t){if(t=da(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=da(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ze(t)&&t.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getScriptPartFromCode(r);if(this.isSupportedCode(s))return n=s;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(a=>{if(a===o)return a;if(!(a.indexOf("-")<0&&o.indexOf("-")<0)&&(a.indexOf("-")>0&&o.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===o||a.indexOf(o)===0&&o.length>1))return a})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),ze(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),s=[],o=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return ze(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):ze(t)&&o(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&o(this.formatLanguageCode(a))}),s}}const Fv={zero:0,one:1,two:2,few:3,many:4,other:5},$v={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class nR{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=lr.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const r=da(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:s});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(r,{type:s})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),$v;if(!t.match(/-|_/))return $v;const u=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(u,n)}return this.pluralRulesCache[o]=a,a}needsPlural(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,n,r={}){return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((s,o)=>Fv[s]-Fv[o]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(t,n,r={}){const s=this.getRule(t,r);return s?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,r))}}const Uv=(e,t,n,r=".",s=!0)=>{let o=WA(e,t,n);return!o&&s&&ze(n)&&(o=hf(e,n,r),o===void 0&&(o=hf(t,n,r))),o},lh=e=>e.replace(/\$/g,"$$$$");class Bv{constructor(t={}){this.logger=lr.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(n=>n),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:o,prefixEscaped:a,suffix:c,suffixEscaped:u,formatSeparator:f,unescapeSuffix:p,unescapePrefix:g,nestingPrefix:y,nestingPrefixEscaped:v,nestingSuffix:b,nestingSuffixEscaped:w,nestingOptionsSeparator:k,maxReplaces:S,alwaysFormat:C}=t.interpolation;this.escape=n!==void 0?n:JA,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?ui(o):a||"{{",this.suffix=c?ui(c):u||"}}",this.formatSeparator=f||",",this.unescapePrefix=p?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=y?ui(y):v||ui("$t("),this.nestingSuffix=b?ui(b):w||ui(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=S||1e3,this.alwaysFormat=C!==void 0?C:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n?.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let o,a,c;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},f=v=>{if(v.indexOf(this.formatSeparator)<0){const S=Uv(n,u,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(S,void 0,r,{...s,...n,interpolationkey:v}):S}const b=v.split(this.formatSeparator),w=b.shift().trim(),k=b.join(this.formatSeparator).trim();return this.format(Uv(n,u,w,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...s,...n,interpolationkey:w})};this.resetRegExp();const p=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,g=s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>lh(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?lh(this.escape(v)):lh(v)}].forEach(v=>{for(c=0;o=v.regex.exec(t);){const b=o[1].trim();if(a=f(b),a===void 0)if(typeof p=="function"){const k=p(t,o,s);a=ze(k)?k:""}else if(s&&Object.prototype.hasOwnProperty.call(s,b))a="";else if(g){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${b} for interpolating ${t}`),a="";else!ze(a)&&!this.useRawValueToEscape&&(a=Pv(a));const w=v.safeValue(a);if(t=t.replace(o[0],w),g?(v.regex.lastIndex+=a.length,v.regex.lastIndex-=o[0].length):v.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),t}nest(t,n,r={}){let s,o,a;const c=(u,f)=>{const p=this.nestingOptionsSeparator;if(u.indexOf(p)<0)return u;const g=u.split(new RegExp(`${p}[ ]*{`));let y=`{${g[1]}`;u=g[0],y=this.interpolate(y,a);const v=y.match(/'/g),b=y.match(/"/g);((v?.length??0)%2===0&&!b||b.length%2!==0)&&(y=y.replace(/'/g,'"'));try{a=JSON.parse(y),f&&(a={...f,...a})}catch(w){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,w),`${u}${p}${y}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,u};for(;s=this.nestingRegexp.exec(t);){let u=[];a={...r},a=a.replace&&!ze(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const f=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(f!==-1&&(u=s[1].slice(f).split(this.formatSeparator).map(p=>p.trim()).filter(Boolean),s[1]=s[1].slice(0,f)),o=n(c.call(this,s[1].trim(),a),a),o&&s[0]===t&&!ze(o))return o;ze(o)||(o=Pv(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),o=""),u.length&&(o=u.reduce((p,g)=>this.format(p,g,r.lng,{...r,interpolationkey:s[1].trim()}),o.trim())),t=t.replace(s[0],o),this.regexp.lastIndex=0}return t}}const rR=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(a=>{if(a){const[c,...u]=a.split(":"),f=u.join(":").trim().replace(/^'+|'+$/g,""),p=c.trim();n[p]||(n[p]=f),f==="false"&&(n[p]=!1),f==="true"&&(n[p]=!0),isNaN(f)||(n[p]=parseInt(f,10))}})}return{formatName:t,formatOptions:n}},Vv=e=>{const t={};return(n,r,s)=>{let o=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(o={...o,[s.interpolationkey]:void 0});const a=r+JSON.stringify(o);let c=t[a];return c||(c=e(da(r),s),t[a]=c),c(n)}},sR=e=>(t,n,r)=>e(da(n),r)(t);class iR{constructor(t={}){this.logger=lr.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?Vv:sR;this.formats={number:r((s,o)=>{const a=new Intl.NumberFormat(s,{...o});return c=>a.format(c)}),currency:r((s,o)=>{const a=new Intl.NumberFormat(s,{...o,style:"currency"});return c=>a.format(c)}),datetime:r((s,o)=>{const a=new Intl.DateTimeFormat(s,{...o});return c=>a.format(c)}),relativetime:r((s,o)=>{const a=new Intl.RelativeTimeFormat(s,{...o});return c=>a.format(c,o.range||"day")}),list:r((s,o)=>{const a=new Intl.ListFormat(s,{...o});return c=>a.format(c)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Vv(n)}format(t,n,r,s={}){const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(c=>c.indexOf(")")>-1)){const c=o.findIndex(u=>u.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,c)].join(this.formatSeparator)}return o.reduce((c,u)=>{const{formatName:f,formatOptions:p}=rR(u);if(this.formats[f]){let g=c;try{const y=s?.formatParams?.[s.interpolationkey]||{},v=y.locale||y.lng||s.locale||s.lng||r;g=this.formats[f](c,v,{...p,...s,...y})}catch(y){this.logger.warn(y)}return g}else this.logger.warn(`there was no format function for ${f}`);return c},t)}}const oR=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class aR extends qc{constructor(t,n,r,s={}){super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=lr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,s.backend,s)}queueLoad(t,n,r,s){const o={},a={},c={},u={};return t.forEach(f=>{let p=!0;n.forEach(g=>{const y=`${f}|${g}`;!r.reload&&this.store.hasResourceBundle(f,g)?this.state[y]=2:this.state[y]<0||(this.state[y]===1?a[y]===void 0&&(a[y]=!0):(this.state[y]=1,p=!1,a[y]===void 0&&(a[y]=!0),o[y]===void 0&&(o[y]=!0),u[g]===void 0&&(u[g]=!0)))}),p||(c[f]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(u)}}loaded(t,n,r){const s=t.split("|"),o=s[0],a=s[1];n&&this.emit("failedLoading",o,a,n),!n&&r&&this.store.addResourceBundle(o,a,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const c={};this.queue.forEach(u=>{KA(u.loaded,[o],a),oR(u,t),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(f=>{c[f]||(c[f]={});const p=u.loaded[f];p.length&&p.forEach(g=>{c[f][g]===void 0&&(c[f][g]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(u=>!u.done)}read(t,n,r,s=0,o=this.retryTimeout,a){if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:o,callback:a});return}this.readingCalls++;const c=(f,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(f&&p&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,o*2,a)},o);return}a(f,p)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const f=u(t,n);f&&typeof f.then=="function"?f.then(p=>c(null,p)).catch(c):c(null,f)}catch(f){c(f)}return}return u(t,n,c)}prepareLoading(t,n,r={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();ze(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ze(n)&&(n=[n]);const o=this.queueLoad(t,n,r,s);if(!o.toLoad.length)return o.pending.length||s(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t,n=""){const r=t.split("|"),s=r[0],o=r[1];this.read(s,o,"read",void 0,void 0,(a,c)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${s} failed`,a),!a&&c&&this.logger.log(`${n}loaded namespace ${o} for language ${s}`,c),this.loaded(t,a,c)})}saveMissing(t,n,r,s,o,a={},c=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const u={...a,isUpdate:o},f=this.backend.create.bind(this.backend);if(f.length<6)try{let p;f.length===5?p=f(t,n,r,s,u):p=f(t,n,r,s),p&&typeof p.then=="function"?p.then(g=>c(null,g)).catch(c):c(null,p)}catch(p){c(p)}else f(t,n,r,s,c,u)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const ch=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),ze(e[1])&&(t.defaultValue=e[1]),ze(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),qv=e=>(ze(e.ns)&&(e.ns=[e.ns]),ze(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ze(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),Kl=()=>{},lR=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Yo extends qc{constructor(t={},n){if(super(),this.options=qv(t),this.services={},this.logger=lr,this.modules={external:[]},lR(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(ze(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=ch();this.options={...r,...this.options,...qv(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler),this.options.debug===!0&&typeof console<"u"&&console.warn("i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com");const s=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?lr.init(s(this.modules.logger),this.options):lr.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:f=iR;const p=new zv(this.options);this.store=new Dv(this.options.resources,this.options);const g=this.services;g.logger=lr,g.resourceStore=this.store,g.languageUtils=p,g.pluralResolver=new nR(p,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),f&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(g.formatter=s(f),g.formatter.init&&g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new Bv(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new aR(s(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",(v,...b)=>{this.emit(v,...b)}),this.modules.languageDetector&&(g.languageDetector=s(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=s(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new bc(this.services,this.options),this.translator.on("*",(v,...b)=>{this.emit(v,...b)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Kl),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=(...p)=>this.store[f](...p)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=(...p)=>(this.store[f](...p),this)});const c=Do(),u=()=>{const f=(p,g)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(g),n(p,g)};if(this.languages&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initAsync?u():setTimeout(u,0),c}loadResources(t,n=Kl){let r=n;const s=ze(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const o=[],a=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(f=>{f!=="cimode"&&o.indexOf(f)<0&&o.push(f)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>a(u)),this.options.preload?.forEach?.(c=>a(c)),this.services.backendConnector.load(o,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(c)})}else r(null)}reloadResources(t,n,r){const s=Do();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=Kl),this.services.backendConnector.reload(t,n,o=>{s.resolve(),r(o)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&_w.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const r=Do();this.emit("languageChanging",t);const s=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},o=(c,u)=>{u?this.isLanguageChangingTo===t&&(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,r.resolve((...f)=>this.t(...f)),n&&n(c,(...f)=>this.t(...f))},a=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=ze(c)?c:c&&c[0],f=this.store.hasLanguageSomeTranslations(u)?u:this.services.languageUtils.getBestMatchFromCodes(ze(c)?[c]:c);f&&(this.language||s(f),this.translator.language||this.translator.changeLanguage(f),this.services.languageDetector?.cacheUserLanguage?.(f)),this.loadResources(f,p=>{o(p,f)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),r}getFixedT(t,n,r){const s=(o,a,...c)=>{let u;typeof a!="object"?u=this.options.overloadTranslationOptionHandler([o,a].concat(c)):u={...a},u.lng=u.lng||s.lng,u.lngs=u.lngs||s.lngs,u.ns=u.ns||s.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||r||s.keyPrefix);const f=this.options.keySeparator||".";let p;return u.keyPrefix&&Array.isArray(o)?p=o.map(g=>(typeof g=="function"&&(g=ff(g,{...this.options,...a})),`${u.keyPrefix}${f}${g}`)):(typeof o=="function"&&(o=ff(o,{...this.options,...a})),p=u.keyPrefix?`${u.keyPrefix}${f}${o}`:o),this.t(p,u)};return ze(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(c,u)=>{const f=this.services.backendConnector.state[`${c}|${u}`];return f===-1||f===0||f===2};if(n.precheck){const c=n.precheck(this,a);if(c!==void 0)return c}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!s||a(o,t)))}loadNamespaces(t,n){const r=Do();return this.options.ns?(ze(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Do();ze(t)&&(t=[t]);const s=this.options.preload||[],o=t.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return o.length?(this.options.preload=s.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const s=new Intl.Locale(t);if(s&&s.getTextInfo){const o=s.getTextInfo();if(o&&o.direction)return o.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new zv(ch());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const r=new Yo(t,n);return r.createInstance=Yo.createInstance,r}cloneInstance(t={},n=Kl){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},o=new Yo(s);if((t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(c=>{o[c]=this[c]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const c=Object.keys(this.store.data).reduce((u,f)=>(u[f]={...this.store.data[f]},u[f]=Object.keys(u[f]).reduce((p,g)=>(p[g]={...u[f][g]},p),u[f]),u),{});o.store=new Dv(c,s),o.services.resourceStore=o.store}if(t.interpolation){const u={...ch().interpolation,...this.options.interpolation,...t.interpolation},f={...s,interpolation:u};o.services.interpolator=new Bv(f)}return o.translator=new bc(o.services,s),o.translator.on("*",(c,...u)=>{o.emit(c,...u)}),o.init(s,n),o.translator.options=s,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const sn=Yo.createInstance();sn.createInstance;sn.dir;sn.init;sn.loadResources;sn.reloadResources;sn.use;sn.changeLanguage;sn.getFixedT;sn.t;sn.exists;sn.setDefaultNamespace;sn.hasLoadedNamespace;sn.loadNamespaces;sn.loadLanguages;const cR=(e,t,n,r)=>{const s=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(s,"warn","react-i18next::",!0);Ds(s[0])&&(s[0]=`react-i18next:: ${s[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...s):console?.warn&&console.warn(...s)},Hv={},ww=(e,t,n,r)=>{Ds(n)&&Hv[n]||(Ds(n)&&(Hv[n]=new Date),cR(e,t,n,r))},kw=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},pf=(e,t,n)=>{e.loadNamespaces(t,kw(e,n))},Kv=(e,t,n,r)=>{if(Ds(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return pf(e,n,r);n.forEach(s=>{e.options.ns.indexOf(s)<0&&e.options.ns.push(s)}),e.loadLanguages(t,kw(e,r))},uR=(e,t,n={})=>!t.languages||!t.languages.length?(ww(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!s(r.isLanguageChangingTo,e))return!1}}),Ds=e=>typeof e=="string",dR=e=>typeof e=="object"&&e!==null,hR=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,fR={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},pR=e=>fR[e],mR=e=>e.replace(hR,pR);let mf={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:mR,transDefaultProps:void 0};const gR=(e={})=>{mf={...mf,...e}},yR=()=>mf;let Sw;const xR=e=>{Sw=e},vR=()=>Sw,_R={type:"3rdParty",init(e){gR(e.options.react),xR(e)}},bR=R.createContext();class wR{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var uh={exports:{}},dh={};var Wv;function kR(){if(Wv)return dh;Wv=1;var e=Rc();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function c(g,y){var v=y(),b=r({inst:{value:v,getSnapshot:y}}),w=b[0].inst,k=b[1];return o(function(){w.value=v,w.getSnapshot=y,u(w)&&k({inst:w})},[g,v,y]),s(function(){return u(w)&&k({inst:w}),g(function(){u(w)&&k({inst:w})})},[g]),a(v),v}function u(g){var y=g.getSnapshot;g=g.value;try{var v=y();return!n(g,v)}catch{return!0}}function f(g,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return dh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,dh}var Gv;function SR(){return Gv||(Gv=1,uh.exports=kR()),uh.exports}var jR=SR();const ER=(e,t)=>Ds(t)?t:dR(t)&&Ds(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,CR={t:ER,ready:!1},TR=()=>()=>{},et=(e,t={})=>{const{i18n:n}=t,{i18n:r,defaultNS:s}=R.useContext(bR)||{},o=n||r||vR();o&&!o.reportNamespaces&&(o.reportNamespaces=new wR),o||ww(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const a=R.useMemo(()=>({...yR(),...o?.options?.react,...t}),[o,t]),{useSuspense:c,keyPrefix:u}=a,f=s||o?.options?.defaultNS,p=Ds(f)?[f]:f||["translation"],g=R.useMemo(()=>p,p);o?.reportNamespaces?.addUsedNamespaces?.(g);const y=R.useRef(0),v=R.useCallback(B=>{if(!o)return TR;const{bindI18n:L,bindI18nStore:Q}=a,Y=()=>{y.current+=1,B()};return L&&o.on(L,Y),Q&&o.store.on(Q,Y),()=>{L&&L.split(" ").forEach(he=>o.off(he,Y)),Q&&Q.split(" ").forEach(he=>o.store.off(he,Y))}},[o,a]),b=R.useRef(),w=R.useCallback(()=>{if(!o)return CR;const B=!!(o.isInitialized||o.initializedStoreOnce)&&g.every(W=>uR(W,o,a)),L=t.lng||o.language,Q=y.current,Y=b.current;if(Y&&Y.ready===B&&Y.lng===L&&Y.keyPrefix===u&&Y.revision===Q)return Y;const K={t:o.getFixedT(L,a.nsMode==="fallback"?g:g[0],u),ready:B,lng:L,keyPrefix:u,revision:Q};return b.current=K,K},[o,g,u,a,t.lng]),[k,S]=R.useState(0),{t:C,ready:j}=jR.useSyncExternalStore(v,w,w);R.useEffect(()=>{if(o&&!j&&!c){const B=()=>S(L=>L+1);t.lng?Kv(o,t.lng,g,B):pf(o,g,B)}},[o,t.lng,g,j,c,k]);const O=o||{},T=R.useRef(null),N=R.useRef(),M=B=>{const L=Object.getOwnPropertyDescriptors(B);L.__original&&delete L.__original;const Q=Object.create(Object.getPrototypeOf(B),L);if(!Object.prototype.hasOwnProperty.call(Q,"__original"))try{Object.defineProperty(Q,"__original",{value:B,writable:!1,enumerable:!1,configurable:!1})}catch{}return Q},V=R.useMemo(()=>{const B=O,L=B?.language;let Q=B;B&&(T.current&&T.current.__original===B?N.current!==L?(Q=M(B),T.current=Q,N.current=L):Q=T.current:(Q=M(B),T.current=Q,N.current=L));const Y=[C,Q,j];return Y.t=C,Y.i18n=Q,Y.ready=j,Y},[C,O,j,O.resolvedLanguage,O.language,O.languages]);if(o&&c&&!j)throw new Promise(B=>{const L=()=>B();t.lng?Kv(o,t.lng,g,L):pf(o,g,L)});return V};function Hc(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function NR(e,t,n,r){function s(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function c(p){try{f(r.next(p))}catch(g){a(g)}}function u(p){try{f(r.throw(p))}catch(g){a(g)}}function f(p){p.done?o(p.value):s(p.value).then(c,u)}f((r=r.apply(e,t||[])).next())})}const AR=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Cp extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class RR extends Cp{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Jv extends Cp{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Xv extends Cp{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var gf;(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"})(gf||(gf={}));class PR{constructor(t,{headers:n={},customFetch:r,region:s=gf.Any}={}){this.url=t,this.headers=n,this.region=s,this.fetch=AR(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return NR(this,arguments,void 0,function*(n,r={}){var s;let o,a;try{const{headers:c,method:u,body:f,signal:p,timeout:g}=r;let y={},{region:v}=r;v||(v=this.region);const b=new URL(`${this.url}/${n}`);v&&v!=="any"&&(y["x-region"]=v,b.searchParams.set("forceFunctionRegion",v));let w;f&&(c&&!Object.prototype.hasOwnProperty.call(c,"Content-Type")||!c)?typeof Blob<"u"&&f instanceof Blob||f instanceof ArrayBuffer?(y["Content-Type"]="application/octet-stream",w=f):typeof f=="string"?(y["Content-Type"]="text/plain",w=f):typeof FormData<"u"&&f instanceof FormData?w=f:(y["Content-Type"]="application/json",w=JSON.stringify(f)):f&&typeof f!="string"&&!(typeof Blob<"u"&&f instanceof Blob)&&!(f instanceof ArrayBuffer)&&!(typeof FormData<"u"&&f instanceof FormData)?w=JSON.stringify(f):w=f;let k=p;g&&(a=new AbortController,o=setTimeout(()=>a.abort(),g),p?(k=a.signal,p.addEventListener("abort",()=>a.abort())):k=a.signal);const S=yield this.fetch(b.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},y),this.headers),c),body:w,signal:k}).catch(T=>{throw new RR(T)}),C=S.headers.get("x-relay-error");if(C&&C==="true")throw new Jv(S);if(!S.ok)throw new Xv(S);let j=((s=S.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),O;return j==="application/json"?O=yield S.json():j==="application/octet-stream"||j==="application/pdf"?O=yield S.blob():j==="text/event-stream"?O=S:j==="multipart/form-data"?O=yield S.formData():O=yield S.text(),{data:O,error:null,response:S}}catch(c){return{data:null,error:c,response:c instanceof Xv||c instanceof Jv?c.context:void 0}}finally{o&&clearTimeout(o)}})}}var OR=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}},LR=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 s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{let a=null,c=null,u=null,f=o.status,p=o.statusText;if(o.ok){var g,y;if(n.method!=="HEAD"){var v;const S=await o.text();S===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((v=n.headers.get("Accept"))===null||v===void 0)&&v.includes("application/vnd.pgrst.plan+text"))?c=S:c=JSON.parse(S))}const w=(g=n.headers.get("Prefer"))===null||g===void 0?void 0:g.match(/count=(exact|planned|estimated)/),k=(y=o.headers.get("content-range"))===null||y===void 0?void 0:y.split("/");w&&k&&k.length>1&&(u=parseInt(k[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(c)&&(c.length>1?(a={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,u=null,f=406,p="Not Acceptable"):c.length===1?c=c[0]:c=null)}else{var b;const w=await o.text();try{a=JSON.parse(w),Array.isArray(a)&&o.status===404&&(c=[],a=null,f=200,p="OK")}catch{o.status===404&&w===""?(f=204,p="No Content"):a={message:w}}if(a&&n.isMaybeSingle&&(!(a==null||(b=a.details)===null||b===void 0)&&b.includes("0 rows"))&&(a=null,f=200,p="OK"),a&&n.shouldThrowOnError)throw new OR(a)}return{error:a,data:c,count:u,status:f,statusText:p}});return this.shouldThrowOnError||(s=s.catch(o=>{var a;let c="";const u=o?.cause;if(u){var f,p,g,y;const b=(f=u?.message)!==null&&f!==void 0?f:"",w=(p=u?.code)!==null&&p!==void 0?p:"";c=`${(g=o?.name)!==null&&g!==void 0?g:"FetchError"}: ${o?.message}`,c+=`
20
+ `):" "+Nv(a[0]):"as no adapter specified";throw new Ve("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const mw={getAdapter:FA,adapters:Ep};function oh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ki(null,e)}function Av(e){return oh(e),e.headers=yn.from(e.headers),e.data=ih.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),mw.getAdapter(e.adapter||Ta.adapter,e)(e).then(function(r){return oh(e),r.data=ih.call(e,e.transformResponse,r),r.headers=yn.from(r.headers),r},function(r){return uw(r)||(oh(e),r&&r.response&&(r.response.data=ih.call(e,e.transformResponse,r.response),r.response.headers=yn.from(r.response.headers))),Promise.reject(r)})}const gw="1.13.2",Vc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Vc[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Rv={};Vc.transitional=function(t,n,r){function s(o,a){return"[Axios v"+gw+"] Transitional option '"+o+"'"+a+(r?". "+r:"")}return(o,a,c)=>{if(t===!1)throw new Ve(s(a," has been removed"+(n?" in "+n:"")),Ve.ERR_DEPRECATED);return n&&!Rv[a]&&(Rv[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,a,c):!0}};Vc.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function $A(e,t,n){if(typeof e!="object")throw new Ve("options must be an object",Ve.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],a=t[o];if(a){const c=e[o],u=c===void 0||a(c,o,e);if(u!==!0)throw new Ve("option "+o+" must be "+u,Ve.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ve("Unknown option "+o,Ve.ERR_BAD_OPTION)}}const ac={assertOptions:$A,validators:Vc},or=ac.validators;let Ps=class{constructor(t){this.defaults=t||{},this.interceptors={request:new vv,response:new vv}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
21
+ `+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Is(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&ac.assertOptions(r,{silentJSONParsing:or.transitional(or.boolean),forcedJSONParsing:or.transitional(or.boolean),clarifyTimeoutError:or.transitional(or.boolean)},!1),s!=null&&(H.isFunction(s)?n.paramsSerializer={serialize:s}:ac.assertOptions(s,{encode:or.function,serialize:or.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ac.assertOptions(n,{baseUrl:or.spelling("baseURL"),withXsrfToken:or.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=o&&H.merge(o.common,o[n.method]);o&&H.forEach(["delete","get","head","post","put","patch","common"],b=>{delete o[b]}),n.headers=yn.concat(a,o);const c=[];let u=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(u=u&&w.synchronous,c.unshift(w.fulfilled,w.rejected))});const f=[];this.interceptors.response.forEach(function(w){f.push(w.fulfilled,w.rejected)});let p,g=0,y;if(!u){const b=[Av.bind(this),void 0];for(b.unshift(...c),b.push(...f),y=b.length,p=Promise.resolve(n);g<y;)p=p.then(b[g++],b[g++]);return p}y=c.length;let v=n;for(;g<y;){const b=c[g++],w=c[g++];try{v=b(v)}catch(k){w.call(this,k);break}}try{p=Av.call(this,v)}catch(b){return Promise.reject(b)}for(g=0,y=f.length;g<y;)p=p.then(f[g++],f[g++]);return p}getUri(t){t=Is(this.defaults,t);const n=hw(t.baseURL,t.url,t.allowAbsoluteUrls);return aw(n,t.params,t.paramsSerializer)}};H.forEach(["delete","get","head","options"],function(t){Ps.prototype[t]=function(n,r){return this.request(Is(r||{},{method:t,url:n,data:(r||{}).data}))}});H.forEach(["post","put","patch"],function(t){function n(r){return function(o,a,c){return this.request(Is(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}Ps.prototype[t]=n(),Ps.prototype[t+"Form"]=n(!0)});let UA=class yw{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const a=new Promise(c=>{r.subscribe(c),o=c}).then(s);return a.cancel=function(){r.unsubscribe(o)},a},t(function(o,a,c){r.reason||(r.reason=new Ki(o,a,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 yw(function(s){t=s}),cancel:t}}};function BA(e){return function(n){return e.apply(null,n)}}function VA(e){return H.isObject(e)&&e.isAxiosError===!0}const df={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(df).forEach(([e,t])=>{df[t]=e});function xw(e){const t=new Ps(e),n=Jb(Ps.prototype.request,t);return H.extend(n,Ps.prototype,t,{allOwnKeys:!0}),H.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return xw(Is(e,s))},n}const Je=xw(Ta);Je.Axios=Ps;Je.CanceledError=Ki;Je.CancelToken=UA;Je.isCancel=uw;Je.VERSION=gw;Je.toFormData=Bc;Je.AxiosError=Ve;Je.Cancel=Je.CanceledError;Je.all=function(t){return Promise.all(t)};Je.spread=BA;Je.isAxiosError=VA;Je.mergeConfig=Is;Je.AxiosHeaders=yn;Je.formToJSON=e=>cw(H.isHTMLForm(e)?new FormData(e):e);Je.getAdapter=mw.getAdapter;Je.HttpStatusCode=df;Je.default=Je;const{Axios:b$,AxiosError:w$,CanceledError:k$,isCancel:S$,CancelToken:j$,VERSION:E$,all:C$,Cancel:T$,isAxiosError:N$,spread:A$,toFormData:R$,AxiosHeaders:P$,HttpStatusCode:O$,formToJSON:L$,getAdapter:I$,mergeConfig:D$}=Je,Fe=e=>typeof e=="string",Do=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},Pv=e=>e==null?"":""+e,qA=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},HA=/###/g,Ov=e=>e&&e.indexOf("###")>-1?e.replace(HA,"."):e,Lv=e=>!e||Fe(e),Xo=(e,t,n)=>{const r=Fe(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(Lv(e))return{};const o=Ov(r[s]);!e[o]&&n&&(e[o]=new n),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++s}return Lv(e)?{}:{obj:e,k:Ov(r[s])}},Iv=(e,t,n)=>{const{obj:r,k:s}=Xo(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let o=t[t.length-1],a=t.slice(0,t.length-1),c=Xo(e,a,Object);for(;c.obj===void 0&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),c=Xo(e,a,Object),c?.obj&&typeof c.obj[`${c.k}.${o}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${o}`]=n},KA=(e,t,n,r)=>{const{obj:s,k:o}=Xo(e,t,Object);s[o]=s[o]||[],s[o].push(n)},vc=(e,t)=>{const{obj:n,k:r}=Xo(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},WA=(e,t,n)=>{const r=vc(e,n);return r!==void 0?r:vc(t,n)},vw=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?Fe(e[r])||e[r]instanceof String||Fe(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):vw(e[r],t[r],n):e[r]=t[r]);return e},ui=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var GA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const JA=e=>Fe(e)?e.replace(/[&<>"'\/]/g,t=>GA[t]):e;class XA{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const YA=[" ",",","?","!",";"],QA=new XA(20),ZA=(e,t,n)=>{t=t||"",n=n||"";const r=YA.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=QA.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!s.test(e);if(!o){const a=e.indexOf(n);a>0&&!s.test(e.substring(0,a))&&(o=!0)}return o},hf=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let s=e;for(let o=0;o<r.length;){if(!s||typeof s!="object")return;let a,c="";for(let u=o;u<r.length;++u)if(u!==o&&(c+=n),c+=r[u],a=s[c],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&u<r.length-1)continue;o+=u-o+1;break}s=a}return s},da=e=>e?.replace("_","-"),eR={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class _c{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||eR,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,s){return s&&!this.debug?null:(Fe(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new _c(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new _c(this.logger,t)}}var lr=new _c;class qc{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([s,o])=>{for(let a=0;a<o;a++)s(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,o])=>{for(let a=0;a<o;a++)s.apply(s,[t,...n])})}}class Dv extends qc{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r,s={}){const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;t.indexOf(".")>-1?c=t.split("."):(c=[t,n],r&&(Array.isArray(r)?c.push(...r):Fe(r)&&o?c.push(...r.split(o)):c.push(r)));const u=vc(this.data,c);return!u&&!n&&!r&&t.indexOf(".")>-1&&(t=c[0],n=c[1],r=c.slice(2).join(".")),u||!a||!Fe(r)?u:hf(this.data?.[t]?.[n],r,o)}addResource(t,n,r,s,o={silent:!1}){const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let c=[t,n];r&&(c=c.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(c=t.split("."),s=n,n=c[1]),this.addNamespaces(n),Iv(this.data,c,s),o.silent||this.emit("added",t,n,r,s)}addResources(t,n,r,s={silent:!1}){for(const o in r)(Fe(r[o])||Array.isArray(r[o]))&&this.addResource(t,n,o,r[o],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,o,a={silent:!1,skipCopy:!1}){let c=[t,n];t.indexOf(".")>-1&&(c=t.split("."),s=r,r=n,n=c[1]),this.addNamespaces(n);let u=vc(this.data,c)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?vw(u,r,o):u={...u,...r},Iv(this.data,c,u),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var _w={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(o=>{t=this.processors[o]?.process(t,n,r,s)??t}),t}};const bw=Symbol("i18next/PATH_KEY");function tR(){const e=[],t=Object.create(null);let n;return t.get=(r,s)=>(n?.revoke?.(),s===bw?e:(e.push(s),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function ff(e,t){const{[bw]:n}=e(tR());return n.join(t?.keySeparator??".")}const Mv={},ah=e=>!Fe(e)&&typeof e!="boolean"&&typeof e!="number";class bc extends qc{constructor(t,n={}){super(),qA(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=lr.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const r={...n};if(t==null)return!1;const s=this.resolve(t,r);if(s?.res===void 0)return!1;const o=ah(s.res);return!(r.returnObjects===!1&&o)}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!ZA(t,r,s);if(a&&!c){const u=t.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:t,namespaces:Fe(o)?[o]:o};const f=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(f[0])>-1)&&(o=f.shift()),t=f.join(s)}return{key:t,namespaces:Fe(o)?[o]:o}}translate(t,n,r){let s=typeof n=="object"?{...n}:n;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),t==null)return"";typeof t=="function"&&(t=ff(t,{...this.options,...s})),Array.isArray(t)||(t=[String(t)]);const o=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:c,namespaces:u}=this.extractFromKey(t[t.length-1],s),f=u[u.length-1];let p=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;p===void 0&&(p=":");const g=s.lng||this.language,y=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(g?.toLowerCase()==="cimode")return y?o?{res:`${f}${p}${c}`,usedKey:c,exactUsedKey:c,usedLng:g,usedNS:f,usedParams:this.getUsedParamsDetails(s)}:`${f}${p}${c}`:o?{res:c,usedKey:c,exactUsedKey:c,usedLng:g,usedNS:f,usedParams:this.getUsedParamsDetails(s)}:c;const v=this.resolve(t,s);let b=v?.res;const w=v?.usedKey||c,k=v?.exactUsedKey||c,S=["[object Number]","[object Function]","[object RegExp]"],C=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,O=s.count!==void 0&&!Fe(s.count),T=bc.hasDefaultValue(s),N=O?this.pluralResolver.getSuffix(g,s.count,s):"",M=s.ordinal&&O?this.pluralResolver.getSuffix(g,s.count,{ordinal:!1}):"",V=O&&!s.ordinal&&s.count===0,U=V&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${N}`]||s[`defaultValue${M}`]||s.defaultValue;let L=b;j&&!b&&T&&(L=U);const Q=ah(L),Y=Object.prototype.toString.apply(L);if(j&&L&&Q&&S.indexOf(Y)<0&&!(Fe(C)&&Array.isArray(L))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const he=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,L,{...s,ns:u}):`key '${c} (${this.language})' returned an object instead of string.`;return o?(v.res=he,v.usedParams=this.getUsedParamsDetails(s),v):he}if(a){const he=Array.isArray(L),K=he?[]:{},W=he?k:w;for(const ne in L)if(Object.prototype.hasOwnProperty.call(L,ne)){const re=`${W}${a}${ne}`;T&&!b?K[ne]=this.translate(re,{...s,defaultValue:ah(U)?U[ne]:void 0,joinArrays:!1,ns:u}):K[ne]=this.translate(re,{...s,joinArrays:!1,ns:u}),K[ne]===re&&(K[ne]=L[ne])}b=K}}else if(j&&Fe(C)&&Array.isArray(b))b=b.join(C),b&&(b=this.extendTranslation(b,t,s,r));else{let he=!1,K=!1;!this.isValidLookup(b)&&T&&(he=!0,b=U),this.isValidLookup(b)||(K=!0,b=c);const ne=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&K?void 0:b,re=T&&U!==b&&this.options.updateMissing;if(K||he||re){if(this.logger.log(re?"updateKey":"missingKey",g,f,c,re?U:b),a){const D=this.resolve(c,{...s,keySeparator:!1});D&&D.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let J=[];const ce=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ce&&ce[0])for(let D=0;D<ce.length;D++)J.push(ce[D]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(s.lng||this.language):J.push(s.lng||this.language);const A=(D,G,P)=>{const ve=T&&P!==b?P:ne;this.options.missingKeyHandler?this.options.missingKeyHandler(D,f,G,ve,re,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(D,f,G,ve,re,s),this.emit("missingKey",D,f,G,b)};this.options.saveMissing&&(this.options.saveMissingPlurals&&O?J.forEach(D=>{const G=this.pluralResolver.getSuffixes(D,s);V&&s[`defaultValue${this.options.pluralSeparator}zero`]&&G.indexOf(`${this.options.pluralSeparator}zero`)<0&&G.push(`${this.options.pluralSeparator}zero`),G.forEach(P=>{A([D],c+P,s[`defaultValue${P}`]||U)})}):A(J,c,U))}b=this.extendTranslation(b,t,s,v,r),K&&b===c&&this.options.appendNamespaceToMissingKey&&(b=`${f}${p}${c}`),(K||he)&&this.options.parseMissingKeyHandler&&(b=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}${p}${c}`:c,he?b:void 0,s))}return o?(v.res=b,v.usedParams=this.getUsedParamsDetails(s),v):b}extendTranslation(t,n,r,s,o){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=Fe(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(u){const g=t.match(this.interpolator.nestingRegexp);f=g&&g.length}let p=r.replace&&!Fe(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),t=this.interpolator.interpolate(t,p,r.lng||this.language||s.usedLng,r),u){const g=t.match(this.interpolator.nestingRegexp),y=g&&g.length;f<y&&(r.nest=!1)}!r.lng&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...g)=>o?.[0]===g[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${n[0]}`),null):this.translate(...g,n),r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,c=Fe(a)?[a]:a;return t!=null&&c?.length&&r.applyPostProcessor!==!1&&(t=_w.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,n={}){let r,s,o,a,c;return Fe(t)&&(t=[t]),t.forEach(u=>{if(this.isValidLookup(r))return;const f=this.extractFromKey(u,n),p=f.key;s=p;let g=f.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const y=n.count!==void 0&&!Fe(n.count),v=y&&!n.ordinal&&n.count===0,b=n.context!==void 0&&(Fe(n.context)||typeof n.context=="number")&&n.context!=="",w=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);g.forEach(k=>{this.isValidLookup(r)||(c=k,!Mv[`${w[0]}-${k}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(Mv[`${w[0]}-${k}`]=!0,this.logger.warn(`key "${s}" for languages "${w.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(S=>{if(this.isValidLookup(r))return;a=S;const C=[p];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(C,p,S,k,n);else{let O;y&&(O=this.pluralResolver.getSuffix(S,n.count,n));const T=`${this.options.pluralSeparator}zero`,N=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(y&&(n.ordinal&&O.indexOf(N)===0&&C.push(p+O.replace(N,this.options.pluralSeparator)),C.push(p+O),v&&C.push(p+T)),b){const M=`${p}${this.options.contextSeparator||"_"}${n.context}`;C.push(M),y&&(n.ordinal&&O.indexOf(N)===0&&C.push(M+O.replace(N,this.options.pluralSeparator)),C.push(M+O),v&&C.push(M+T))}}let j;for(;j=C.pop();)this.isValidLookup(r)||(o=j,r=this.getResource(S,k,j,n))}))})}),{res:r,usedKey:s,exactUsedKey:o,usedLng:a,usedNS:c}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!Fe(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const o of n)delete s[o]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}class zv{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=lr.create("languageUtils")}getScriptPartFromCode(t){if(t=da(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=da(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(Fe(t)&&t.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getScriptPartFromCode(r);if(this.isSupportedCode(s))return n=s;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(a=>{if(a===o)return a;if(!(a.indexOf("-")<0&&o.indexOf("-")<0)&&(a.indexOf("-")>0&&o.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===o||a.indexOf(o)===0&&o.length>1))return a})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),Fe(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),s=[],o=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return Fe(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):Fe(t)&&o(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&o(this.formatLanguageCode(a))}),s}}const Fv={zero:0,one:1,two:2,few:3,many:4,other:5},$v={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class nR{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=lr.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const r=da(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:s});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(r,{type:s})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),$v;if(!t.match(/-|_/))return $v;const u=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(u,n)}return this.pluralRulesCache[o]=a,a}needsPlural(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,n,r={}){return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((s,o)=>Fv[s]-Fv[o]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(t,n,r={}){const s=this.getRule(t,r);return s?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,r))}}const Uv=(e,t,n,r=".",s=!0)=>{let o=WA(e,t,n);return!o&&s&&Fe(n)&&(o=hf(e,n,r),o===void 0&&(o=hf(t,n,r))),o},lh=e=>e.replace(/\$/g,"$$$$");class Bv{constructor(t={}){this.logger=lr.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(n=>n),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:o,prefixEscaped:a,suffix:c,suffixEscaped:u,formatSeparator:f,unescapeSuffix:p,unescapePrefix:g,nestingPrefix:y,nestingPrefixEscaped:v,nestingSuffix:b,nestingSuffixEscaped:w,nestingOptionsSeparator:k,maxReplaces:S,alwaysFormat:C}=t.interpolation;this.escape=n!==void 0?n:JA,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?ui(o):a||"{{",this.suffix=c?ui(c):u||"}}",this.formatSeparator=f||",",this.unescapePrefix=p?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=y?ui(y):v||ui("$t("),this.nestingSuffix=b?ui(b):w||ui(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=S||1e3,this.alwaysFormat=C!==void 0?C:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n?.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let o,a,c;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},f=v=>{if(v.indexOf(this.formatSeparator)<0){const S=Uv(n,u,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(S,void 0,r,{...s,...n,interpolationkey:v}):S}const b=v.split(this.formatSeparator),w=b.shift().trim(),k=b.join(this.formatSeparator).trim();return this.format(Uv(n,u,w,this.options.keySeparator,this.options.ignoreJSONStructure),k,r,{...s,...n,interpolationkey:w})};this.resetRegExp();const p=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,g=s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>lh(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?lh(this.escape(v)):lh(v)}].forEach(v=>{for(c=0;o=v.regex.exec(t);){const b=o[1].trim();if(a=f(b),a===void 0)if(typeof p=="function"){const k=p(t,o,s);a=Fe(k)?k:""}else if(s&&Object.prototype.hasOwnProperty.call(s,b))a="";else if(g){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${b} for interpolating ${t}`),a="";else!Fe(a)&&!this.useRawValueToEscape&&(a=Pv(a));const w=v.safeValue(a);if(t=t.replace(o[0],w),g?(v.regex.lastIndex+=a.length,v.regex.lastIndex-=o[0].length):v.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),t}nest(t,n,r={}){let s,o,a;const c=(u,f)=>{const p=this.nestingOptionsSeparator;if(u.indexOf(p)<0)return u;const g=u.split(new RegExp(`${p}[ ]*{`));let y=`{${g[1]}`;u=g[0],y=this.interpolate(y,a);const v=y.match(/'/g),b=y.match(/"/g);((v?.length??0)%2===0&&!b||b.length%2!==0)&&(y=y.replace(/'/g,'"'));try{a=JSON.parse(y),f&&(a={...f,...a})}catch(w){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,w),`${u}${p}${y}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,u};for(;s=this.nestingRegexp.exec(t);){let u=[];a={...r},a=a.replace&&!Fe(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const f=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(f!==-1&&(u=s[1].slice(f).split(this.formatSeparator).map(p=>p.trim()).filter(Boolean),s[1]=s[1].slice(0,f)),o=n(c.call(this,s[1].trim(),a),a),o&&s[0]===t&&!Fe(o))return o;Fe(o)||(o=Pv(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),o=""),u.length&&(o=u.reduce((p,g)=>this.format(p,g,r.lng,{...r,interpolationkey:s[1].trim()}),o.trim())),t=t.replace(s[0],o),this.regexp.lastIndex=0}return t}}const rR=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(a=>{if(a){const[c,...u]=a.split(":"),f=u.join(":").trim().replace(/^'+|'+$/g,""),p=c.trim();n[p]||(n[p]=f),f==="false"&&(n[p]=!1),f==="true"&&(n[p]=!0),isNaN(f)||(n[p]=parseInt(f,10))}})}return{formatName:t,formatOptions:n}},Vv=e=>{const t={};return(n,r,s)=>{let o=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(o={...o,[s.interpolationkey]:void 0});const a=r+JSON.stringify(o);let c=t[a];return c||(c=e(da(r),s),t[a]=c),c(n)}},sR=e=>(t,n,r)=>e(da(n),r)(t);class iR{constructor(t={}){this.logger=lr.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?Vv:sR;this.formats={number:r((s,o)=>{const a=new Intl.NumberFormat(s,{...o});return c=>a.format(c)}),currency:r((s,o)=>{const a=new Intl.NumberFormat(s,{...o,style:"currency"});return c=>a.format(c)}),datetime:r((s,o)=>{const a=new Intl.DateTimeFormat(s,{...o});return c=>a.format(c)}),relativetime:r((s,o)=>{const a=new Intl.RelativeTimeFormat(s,{...o});return c=>a.format(c,o.range||"day")}),list:r((s,o)=>{const a=new Intl.ListFormat(s,{...o});return c=>a.format(c)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Vv(n)}format(t,n,r,s={}){const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(c=>c.indexOf(")")>-1)){const c=o.findIndex(u=>u.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,c)].join(this.formatSeparator)}return o.reduce((c,u)=>{const{formatName:f,formatOptions:p}=rR(u);if(this.formats[f]){let g=c;try{const y=s?.formatParams?.[s.interpolationkey]||{},v=y.locale||y.lng||s.locale||s.lng||r;g=this.formats[f](c,v,{...p,...s,...y})}catch(y){this.logger.warn(y)}return g}else this.logger.warn(`there was no format function for ${f}`);return c},t)}}const oR=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class aR extends qc{constructor(t,n,r,s={}){super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=lr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,s.backend,s)}queueLoad(t,n,r,s){const o={},a={},c={},u={};return t.forEach(f=>{let p=!0;n.forEach(g=>{const y=`${f}|${g}`;!r.reload&&this.store.hasResourceBundle(f,g)?this.state[y]=2:this.state[y]<0||(this.state[y]===1?a[y]===void 0&&(a[y]=!0):(this.state[y]=1,p=!1,a[y]===void 0&&(a[y]=!0),o[y]===void 0&&(o[y]=!0),u[g]===void 0&&(u[g]=!0)))}),p||(c[f]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(u)}}loaded(t,n,r){const s=t.split("|"),o=s[0],a=s[1];n&&this.emit("failedLoading",o,a,n),!n&&r&&this.store.addResourceBundle(o,a,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const c={};this.queue.forEach(u=>{KA(u.loaded,[o],a),oR(u,t),n&&u.errors.push(n),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(f=>{c[f]||(c[f]={});const p=u.loaded[f];p.length&&p.forEach(g=>{c[f][g]===void 0&&(c[f][g]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(u=>!u.done)}read(t,n,r,s=0,o=this.retryTimeout,a){if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:o,callback:a});return}this.readingCalls++;const c=(f,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(f&&p&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,o*2,a)},o);return}a(f,p)},u=this.backend[r].bind(this.backend);if(u.length===2){try{const f=u(t,n);f&&typeof f.then=="function"?f.then(p=>c(null,p)).catch(c):c(null,f)}catch(f){c(f)}return}return u(t,n,c)}prepareLoading(t,n,r={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();Fe(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Fe(n)&&(n=[n]);const o=this.queueLoad(t,n,r,s);if(!o.toLoad.length)return o.pending.length||s(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t,n=""){const r=t.split("|"),s=r[0],o=r[1];this.read(s,o,"read",void 0,void 0,(a,c)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${s} failed`,a),!a&&c&&this.logger.log(`${n}loaded namespace ${o} for language ${s}`,c),this.loaded(t,a,c)})}saveMissing(t,n,r,s,o,a={},c=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const u={...a,isUpdate:o},f=this.backend.create.bind(this.backend);if(f.length<6)try{let p;f.length===5?p=f(t,n,r,s,u):p=f(t,n,r,s),p&&typeof p.then=="function"?p.then(g=>c(null,g)).catch(c):c(null,p)}catch(p){c(p)}else f(t,n,r,s,c,u)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const ch=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),Fe(e[1])&&(t.defaultValue=e[1]),Fe(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),qv=e=>(Fe(e.ns)&&(e.ns=[e.ns]),Fe(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Fe(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),Kl=()=>{},lR=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Yo extends qc{constructor(t={},n){if(super(),this.options=qv(t),this.services={},this.logger=lr,this.modules={external:[]},lR(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(Fe(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=ch();this.options={...r,...this.options,...qv(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler),this.options.debug===!0&&typeof console<"u"&&console.warn("i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com");const s=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?lr.init(s(this.modules.logger),this.options):lr.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:f=iR;const p=new zv(this.options);this.store=new Dv(this.options.resources,this.options);const g=this.services;g.logger=lr,g.resourceStore=this.store,g.languageUtils=p,g.pluralResolver=new nR(p,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),f&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(g.formatter=s(f),g.formatter.init&&g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new Bv(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new aR(s(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",(v,...b)=>{this.emit(v,...b)}),this.modules.languageDetector&&(g.languageDetector=s(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=s(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new bc(this.services,this.options),this.translator.on("*",(v,...b)=>{this.emit(v,...b)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Kl),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=(...p)=>this.store[f](...p)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=(...p)=>(this.store[f](...p),this)});const c=Do(),u=()=>{const f=(p,g)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(g),n(p,g)};if(this.languages&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initAsync?u():setTimeout(u,0),c}loadResources(t,n=Kl){let r=n;const s=Fe(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const o=[],a=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(f=>{f!=="cimode"&&o.indexOf(f)<0&&o.push(f)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>a(u)),this.options.preload?.forEach?.(c=>a(c)),this.services.backendConnector.load(o,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(c)})}else r(null)}reloadResources(t,n,r){const s=Do();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=Kl),this.services.backendConnector.reload(t,n,o=>{s.resolve(),r(o)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&_w.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const r=Do();this.emit("languageChanging",t);const s=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},o=(c,u)=>{u?this.isLanguageChangingTo===t&&(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,r.resolve((...f)=>this.t(...f)),n&&n(c,(...f)=>this.t(...f))},a=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=Fe(c)?c:c&&c[0],f=this.store.hasLanguageSomeTranslations(u)?u:this.services.languageUtils.getBestMatchFromCodes(Fe(c)?[c]:c);f&&(this.language||s(f),this.translator.language||this.translator.changeLanguage(f),this.services.languageDetector?.cacheUserLanguage?.(f)),this.loadResources(f,p=>{o(p,f)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),r}getFixedT(t,n,r){const s=(o,a,...c)=>{let u;typeof a!="object"?u=this.options.overloadTranslationOptionHandler([o,a].concat(c)):u={...a},u.lng=u.lng||s.lng,u.lngs=u.lngs||s.lngs,u.ns=u.ns||s.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||r||s.keyPrefix);const f=this.options.keySeparator||".";let p;return u.keyPrefix&&Array.isArray(o)?p=o.map(g=>(typeof g=="function"&&(g=ff(g,{...this.options,...a})),`${u.keyPrefix}${f}${g}`)):(typeof o=="function"&&(o=ff(o,{...this.options,...a})),p=u.keyPrefix?`${u.keyPrefix}${f}${o}`:o),this.t(p,u)};return Fe(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(c,u)=>{const f=this.services.backendConnector.state[`${c}|${u}`];return f===-1||f===0||f===2};if(n.precheck){const c=n.precheck(this,a);if(c!==void 0)return c}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!s||a(o,t)))}loadNamespaces(t,n){const r=Do();return this.options.ns?(Fe(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Do();Fe(t)&&(t=[t]);const s=this.options.preload||[],o=t.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return o.length?(this.options.preload=s.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const s=new Intl.Locale(t);if(s&&s.getTextInfo){const o=s.getTextInfo();if(o&&o.direction)return o.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new zv(ch());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const r=new Yo(t,n);return r.createInstance=Yo.createInstance,r}cloneInstance(t={},n=Kl){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},o=new Yo(s);if((t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(c=>{o[c]=this[c]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const c=Object.keys(this.store.data).reduce((u,f)=>(u[f]={...this.store.data[f]},u[f]=Object.keys(u[f]).reduce((p,g)=>(p[g]={...u[f][g]},p),u[f]),u),{});o.store=new Dv(c,s),o.services.resourceStore=o.store}if(t.interpolation){const u={...ch().interpolation,...this.options.interpolation,...t.interpolation},f={...s,interpolation:u};o.services.interpolator=new Bv(f)}return o.translator=new bc(o.services,s),o.translator.on("*",(c,...u)=>{o.emit(c,...u)}),o.init(s,n),o.translator.options=s,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const on=Yo.createInstance();on.createInstance;on.dir;on.init;on.loadResources;on.reloadResources;on.use;on.changeLanguage;on.getFixedT;on.t;on.exists;on.setDefaultNamespace;on.hasLoadedNamespace;on.loadNamespaces;on.loadLanguages;const cR=(e,t,n,r)=>{const s=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(s,"warn","react-i18next::",!0);Ds(s[0])&&(s[0]=`react-i18next:: ${s[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...s):console?.warn&&console.warn(...s)},Hv={},ww=(e,t,n,r)=>{Ds(n)&&Hv[n]||(Ds(n)&&(Hv[n]=new Date),cR(e,t,n,r))},kw=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},pf=(e,t,n)=>{e.loadNamespaces(t,kw(e,n))},Kv=(e,t,n,r)=>{if(Ds(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return pf(e,n,r);n.forEach(s=>{e.options.ns.indexOf(s)<0&&e.options.ns.push(s)}),e.loadLanguages(t,kw(e,r))},uR=(e,t,n={})=>!t.languages||!t.languages.length?(ww(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!s(r.isLanguageChangingTo,e))return!1}}),Ds=e=>typeof e=="string",dR=e=>typeof e=="object"&&e!==null,hR=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,fR={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},pR=e=>fR[e],mR=e=>e.replace(hR,pR);let mf={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:mR,transDefaultProps:void 0};const gR=(e={})=>{mf={...mf,...e}},yR=()=>mf;let Sw;const xR=e=>{Sw=e},vR=()=>Sw,_R={type:"3rdParty",init(e){gR(e.options.react),xR(e)}},bR=R.createContext();class wR{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var uh={exports:{}},dh={};var Wv;function kR(){if(Wv)return dh;Wv=1;var e=Rc();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function c(g,y){var v=y(),b=r({inst:{value:v,getSnapshot:y}}),w=b[0].inst,k=b[1];return o(function(){w.value=v,w.getSnapshot=y,u(w)&&k({inst:w})},[g,v,y]),s(function(){return u(w)&&k({inst:w}),g(function(){u(w)&&k({inst:w})})},[g]),a(v),v}function u(g){var y=g.getSnapshot;g=g.value;try{var v=y();return!n(g,v)}catch{return!0}}function f(g,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return dh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,dh}var Gv;function SR(){return Gv||(Gv=1,uh.exports=kR()),uh.exports}var jR=SR();const ER=(e,t)=>Ds(t)?t:dR(t)&&Ds(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,CR={t:ER,ready:!1},TR=()=>()=>{},et=(e,t={})=>{const{i18n:n}=t,{i18n:r,defaultNS:s}=R.useContext(bR)||{},o=n||r||vR();o&&!o.reportNamespaces&&(o.reportNamespaces=new wR),o||ww(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const a=R.useMemo(()=>({...yR(),...o?.options?.react,...t}),[o,t]),{useSuspense:c,keyPrefix:u}=a,f=s||o?.options?.defaultNS,p=Ds(f)?[f]:f||["translation"],g=R.useMemo(()=>p,p);o?.reportNamespaces?.addUsedNamespaces?.(g);const y=R.useRef(0),v=R.useCallback(U=>{if(!o)return TR;const{bindI18n:L,bindI18nStore:Q}=a,Y=()=>{y.current+=1,U()};return L&&o.on(L,Y),Q&&o.store.on(Q,Y),()=>{L&&L.split(" ").forEach(he=>o.off(he,Y)),Q&&Q.split(" ").forEach(he=>o.store.off(he,Y))}},[o,a]),b=R.useRef(),w=R.useCallback(()=>{if(!o)return CR;const U=!!(o.isInitialized||o.initializedStoreOnce)&&g.every(W=>uR(W,o,a)),L=t.lng||o.language,Q=y.current,Y=b.current;if(Y&&Y.ready===U&&Y.lng===L&&Y.keyPrefix===u&&Y.revision===Q)return Y;const K={t:o.getFixedT(L,a.nsMode==="fallback"?g:g[0],u),ready:U,lng:L,keyPrefix:u,revision:Q};return b.current=K,K},[o,g,u,a,t.lng]),[k,S]=R.useState(0),{t:C,ready:j}=jR.useSyncExternalStore(v,w,w);R.useEffect(()=>{if(o&&!j&&!c){const U=()=>S(L=>L+1);t.lng?Kv(o,t.lng,g,U):pf(o,g,U)}},[o,t.lng,g,j,c,k]);const O=o||{},T=R.useRef(null),N=R.useRef(),M=U=>{const L=Object.getOwnPropertyDescriptors(U);L.__original&&delete L.__original;const Q=Object.create(Object.getPrototypeOf(U),L);if(!Object.prototype.hasOwnProperty.call(Q,"__original"))try{Object.defineProperty(Q,"__original",{value:U,writable:!1,enumerable:!1,configurable:!1})}catch{}return Q},V=R.useMemo(()=>{const U=O,L=U?.language;let Q=U;U&&(T.current&&T.current.__original===U?N.current!==L?(Q=M(U),T.current=Q,N.current=L):Q=T.current:(Q=M(U),T.current=Q,N.current=L));const Y=[C,Q,j];return Y.t=C,Y.i18n=Q,Y.ready=j,Y},[C,O,j,O.resolvedLanguage,O.language,O.languages]);if(o&&c&&!j)throw new Promise(U=>{const L=()=>U();t.lng?Kv(o,t.lng,g,L):pf(o,g,L)});return V};function Hc(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function NR(e,t,n,r){function s(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function c(p){try{f(r.next(p))}catch(g){a(g)}}function u(p){try{f(r.throw(p))}catch(g){a(g)}}function f(p){p.done?o(p.value):s(p.value).then(c,u)}f((r=r.apply(e,t||[])).next())})}const AR=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Cp extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class RR extends Cp{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Jv extends Cp{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Xv extends Cp{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var gf;(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"})(gf||(gf={}));class PR{constructor(t,{headers:n={},customFetch:r,region:s=gf.Any}={}){this.url=t,this.headers=n,this.region=s,this.fetch=AR(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return NR(this,arguments,void 0,function*(n,r={}){var s;let o,a;try{const{headers:c,method:u,body:f,signal:p,timeout:g}=r;let y={},{region:v}=r;v||(v=this.region);const b=new URL(`${this.url}/${n}`);v&&v!=="any"&&(y["x-region"]=v,b.searchParams.set("forceFunctionRegion",v));let w;f&&(c&&!Object.prototype.hasOwnProperty.call(c,"Content-Type")||!c)?typeof Blob<"u"&&f instanceof Blob||f instanceof ArrayBuffer?(y["Content-Type"]="application/octet-stream",w=f):typeof f=="string"?(y["Content-Type"]="text/plain",w=f):typeof FormData<"u"&&f instanceof FormData?w=f:(y["Content-Type"]="application/json",w=JSON.stringify(f)):f&&typeof f!="string"&&!(typeof Blob<"u"&&f instanceof Blob)&&!(f instanceof ArrayBuffer)&&!(typeof FormData<"u"&&f instanceof FormData)?w=JSON.stringify(f):w=f;let k=p;g&&(a=new AbortController,o=setTimeout(()=>a.abort(),g),p?(k=a.signal,p.addEventListener("abort",()=>a.abort())):k=a.signal);const S=yield this.fetch(b.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},y),this.headers),c),body:w,signal:k}).catch(T=>{throw new RR(T)}),C=S.headers.get("x-relay-error");if(C&&C==="true")throw new Jv(S);if(!S.ok)throw new Xv(S);let j=((s=S.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),O;return j==="application/json"?O=yield S.json():j==="application/octet-stream"||j==="application/pdf"?O=yield S.blob():j==="text/event-stream"?O=S:j==="multipart/form-data"?O=yield S.formData():O=yield S.text(),{data:O,error:null,response:S}}catch(c){return{data:null,error:c,response:c instanceof Xv||c instanceof Jv?c.context:void 0}}finally{o&&clearTimeout(o)}})}}var OR=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}},LR=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 s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{let a=null,c=null,u=null,f=o.status,p=o.statusText;if(o.ok){var g,y;if(n.method!=="HEAD"){var v;const S=await o.text();S===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((v=n.headers.get("Accept"))===null||v===void 0)&&v.includes("application/vnd.pgrst.plan+text"))?c=S:c=JSON.parse(S))}const w=(g=n.headers.get("Prefer"))===null||g===void 0?void 0:g.match(/count=(exact|planned|estimated)/),k=(y=o.headers.get("content-range"))===null||y===void 0?void 0:y.split("/");w&&k&&k.length>1&&(u=parseInt(k[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(c)&&(c.length>1?(a={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,u=null,f=406,p="Not Acceptable"):c.length===1?c=c[0]:c=null)}else{var b;const w=await o.text();try{a=JSON.parse(w),Array.isArray(a)&&o.status===404&&(c=[],a=null,f=200,p="OK")}catch{o.status===404&&w===""?(f=204,p="No Content"):a={message:w}}if(a&&n.isMaybeSingle&&(!(a==null||(b=a.details)===null||b===void 0)&&b.includes("0 rows"))&&(a=null,f=200,p="OK"),a&&n.shouldThrowOnError)throw new OR(a)}return{error:a,data:c,count:u,status:f,statusText:p}});return this.shouldThrowOnError||(s=s.catch(o=>{var a;let c="";const u=o?.cause;if(u){var f,p,g,y;const b=(f=u?.message)!==null&&f!==void 0?f:"",w=(p=u?.code)!==null&&p!==void 0?p:"";c=`${(g=o?.name)!==null&&g!==void 0?g:"FetchError"}: ${o?.message}`,c+=`
22
22
 
23
23
  Caused by: ${(y=u?.name)!==null&&y!==void 0?y:"Error"}: ${b}`,w&&(c+=` (${w})`),u?.stack&&(c+=`
24
24
  ${u.stack}`)}else{var v;c=(v=o?.stack)!==null&&v!==void 0?v:""}return{error:{message:`${(a=o?.name)!==null&&a!==void 0?a:"FetchError"}: ${o?.message}`,details:c,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),s.then(e,t)}returns(){return this}overrideTypes(){return this}},IR=class extends LR{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:s=r}={}){const o=s?`${s}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const s=typeof r>"u"?"offset":`${r}.offset`,o=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(o,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:s=!1,format:o="text"}={}){var a;const c=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),u=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${u}"; options=${c};`),o==="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 Yv=new RegExp("[,()]");var wi=class extends IR{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"&&Yv.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"&&Yv.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const o=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${o}.${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}},DR=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??{},s=n?"HEAD":"GET";let o=!1;const a=(e??"*").split("").map(f=>/\s/.test(f)&&!o?"":(f==='"'&&(o=!o),f)).join(""),{url:c,headers:u}=this.cloneRequestState();return c.searchParams.set("select",a),r&&u.append("Prefer",`count=${r}`),new wi({method:s,url:c,headers:u,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const s="POST",{url:o,headers:a}=this.cloneRequestState();if(t&&a.append("Prefer",`count=${t}`),n||a.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((u,f)=>u.concat(Object.keys(f)),[]);if(c.length>0){const u=[...new Set(c)].map(f=>`"${f}"`);o.searchParams.set("columns",u.join(","))}}return new wi({method:s,url:o,headers:a,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:s=!0}={}){var o;const a="POST",{url:c,headers:u}=this.cloneRequestState();if(u.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&c.searchParams.set("on_conflict",t),r&&u.append("Prefer",`count=${r}`),s||u.append("Prefer","missing=default"),Array.isArray(e)){const f=e.reduce((p,g)=>p.concat(Object.keys(g)),[]);if(f.length>0){const p=[...new Set(f)].map(g=>`"${g}"`);c.searchParams.set("columns",p.join(","))}}return new wi({method:a,url:c,headers:u,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(e,{count:t}={}){var n;const r="PATCH",{url:s,headers:o}=this.cloneRequestState();return t&&o.append("Prefer",`count=${t}`),new wi({method:r,url:s,headers:o,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:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new wi({method:n,url:r,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}},MR=class jw{constructor(t,{headers:n={},schema:r,fetch:s}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.fetch=s}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new DR(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new jw(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,n={},{head:r=!1,get:s=!1,count:o}={}){var a;let c;const u=new URL(`${this.url}/rpc/${t}`);let f;const p=v=>v!==null&&typeof v=="object"&&(!Array.isArray(v)||v.some(p)),g=r&&Object.values(n).some(p);g?(c="POST",f=n):r||s?(c=r?"HEAD":"GET",Object.entries(n).filter(([v,b])=>b!==void 0).map(([v,b])=>[v,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([v,b])=>{u.searchParams.append(v,b)})):(c="POST",f=n);const y=new Headers(this.headers);return g?y.set("Prefer",o?`count=${o},return=minimal`:"return=minimal"):o&&y.set("Prefer",`count=${o}`),new wi({method:c,url:u,headers:y,schema:this.schemaName,body:f,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};class zR{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const s=r.node,o=parseInt(s.replace(/^v/,"").split(".")[0]);return o>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${o} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${o} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
25
25
  import ws from "ws"
26
26
  new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
27
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 FR="2.91.0",$R=`realtime-js/${FR}`,UR="1.0.0",Ew="2.0.0",Qv=Ew,yf=1e4,BR=1e3,VR=100;var Yr;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Yr||(Yr={}));var Rt;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(Rt||(Rt={}));var Jn;(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"})(Jn||(Jn={}));var xf;(function(e){e.websocket="websocket"})(xf||(xf={}));var Ss;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Ss||(Ss={}));class qR{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},a=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(t,n,r){var s,o;const a=t.topic,c=(s=t.ref)!==null&&s!==void 0?s:"",u=(o=t.join_ref)!==null&&o!==void 0?o:"",f=t.payload.event,p=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},g=Object.keys(p).length===0?"":JSON.stringify(p);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`ref length ${c.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`metadata length ${g.length} exceeds maximum of 255`);const y=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+c.length+a.length+f.length+g.length,v=new ArrayBuffer(this.HEADER_LENGTH+y);let b=new DataView(v),w=0;b.setUint8(w++,this.KINDS.userBroadcastPush),b.setUint8(w++,u.length),b.setUint8(w++,c.length),b.setUint8(w++,a.length),b.setUint8(w++,f.length),b.setUint8(w++,g.length),b.setUint8(w++,n),Array.from(u,S=>b.setUint8(w++,S.charCodeAt(0))),Array.from(c,S=>b.setUint8(w++,S.charCodeAt(0))),Array.from(a,S=>b.setUint8(w++,S.charCodeAt(0))),Array.from(f,S=>b.setUint8(w++,S.charCodeAt(0))),Array.from(g,S=>b.setUint8(w++,S.charCodeAt(0)));var k=new Uint8Array(v.byteLength+r.byteLength);return k.set(new Uint8Array(v),0),k.set(new Uint8Array(r),v.byteLength),k.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[s,o,a,c,u]=r;return n({join_ref:s,ref:o,topic:a,event:c,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),s=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,s)}_decodeUserBroadcast(t,n,r){const s=n.getUint8(1),o=n.getUint8(2),a=n.getUint8(3),c=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=r.decode(t.slice(u,u+s));u=u+s;const p=r.decode(t.slice(u,u+o));u=u+o;const g=r.decode(t.slice(u,u+a));u=u+a;const y=t.slice(u,t.byteLength),v=c===this.JSON_ENCODING?JSON.parse(r.decode(y)):y,b={type:this.BROADCAST_EVENT,event:p,payload:v};return a>0&&(b.meta=JSON.parse(g)),{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 Cw{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 lt;(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"})(lt||(lt={}));const Zv=(e,t,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((o,a)=>(o[a]=HR(a,e,t,s),o),{}):{}},HR=(e,t,n,r)=>{const s=t.find(c=>c.name===e),o=s?.type,a=n[e];return o&&!r.includes(o)?Tw(o,a):vf(a)},Tw=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return JR(t,n)}switch(e){case lt.bool:return KR(t);case lt.float4:case lt.float8:case lt.int2:case lt.int4:case lt.int8:case lt.numeric:case lt.oid:return WR(t);case lt.json:case lt.jsonb:return GR(t);case lt.timestamp:return XR(t);case lt.abstime:case lt.date:case lt.daterange:case lt.int4range:case lt.int8range:case lt.money:case lt.reltime:case lt.text:case lt.time:case lt.timestamptz:case lt.timetz:case lt.tsrange:case lt.tstzrange:return vf(t);default:return vf(t)}},vf=e=>e,KR=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},WR=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},GR=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},JR=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let o;const a=e.slice(1,n);try{o=JSON.parse("["+a+"]")}catch{o=a?a.split(","):[]}return o.map(c=>Tw(t,c))}return e},XR=e=>typeof e=="string"?e.replace(" ","T"):e,Nw=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 hh{constructor(t,n,r={},s=yf){this.channel=t,this.event=n,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var r;return this._hasReceived(t)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var e0;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(e0||(e0={}));class Qo{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,{},s=>{const{onJoin:o,onLeave:a,onSync:c}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Qo.syncState(this.state,s,o,a),this.pendingDiffs.forEach(u=>{this.state=Qo.syncDiff(this.state,u,o,a)}),this.pendingDiffs=[],c()}),this.channel._on(r.diff,{},s=>{const{onJoin:o,onLeave:a,onSync:c}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=Qo.syncDiff(this.state,s,o,a),c())}),this.onJoin((s,o,a)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:o,newPresences:a})}),this.onLeave((s,o,a)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:o,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,s){const o=this.cloneDeep(t),a=this.transformState(n),c={},u={};return this.map(o,(f,p)=>{a[f]||(u[f]=p)}),this.map(a,(f,p)=>{const g=o[f];if(g){const y=p.map(k=>k.presence_ref),v=g.map(k=>k.presence_ref),b=p.filter(k=>v.indexOf(k.presence_ref)<0),w=g.filter(k=>y.indexOf(k.presence_ref)<0);b.length>0&&(c[f]=b),w.length>0&&(u[f]=w)}else c[f]=p}),this.syncDiff(o,{joins:c,leaves:u},r,s)}static syncDiff(t,n,r,s){const{joins:o,leaves:a}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(o,(c,u)=>{var f;const p=(f=t[c])!==null&&f!==void 0?f:[];if(t[c]=this.cloneDeep(u),p.length>0){const g=t[c].map(v=>v.presence_ref),y=p.filter(v=>g.indexOf(v.presence_ref)<0);t[c].unshift(...y)}r(c,p,u)}),this.map(a,(c,u)=>{let f=t[c];if(!f)return;const p=u.map(g=>g.presence_ref);f=f.filter(g=>p.indexOf(g.presence_ref)<0),t[c]=f,s(c,f,u),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 s=t[r];return"metas"in s?n[r]=s.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[r]=s,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var t0;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t0||(t0={}));var Zo;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Zo||(Zo={}));var br;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(br||(br={}));class Ri{constructor(t,n={config:{}},r){var s,o;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=Rt.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 hh(this,Jn.join,this.params,this.timeout),this.rejoinTimer=new Cw(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Rt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Rt.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Rt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Rt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Rt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Jn.reply,{},(a,c)=>{this._trigger(this._replyEventName(c),a)}),this.presence=new Qo(this),this.broadcastEndpointURL=Nw(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var r,s,o;if(this.socket.isConnected()||this.socket.connect(),this.state==Rt.closed){const{config:{broadcast:a,presence:c,private:u}}=this.params,f=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(v=>v.filter))!==null&&s!==void 0?s:[],p=!!this.bindings[Zo.PRESENCE]&&this.bindings[Zo.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,g={},y={broadcast:a,presence:Object.assign(Object.assign({},c),{enabled:p}),postgres_changes:f,private:u};this.socket.accessTokenValue&&(g.access_token=this.socket.accessTokenValue),this._onError(v=>t?.(br.CHANNEL_ERROR,v)),this._onClose(()=>t?.(br.CLOSED)),this.updateJoinPayload(Object.assign({config:y},g)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:v})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),v===void 0){t?.(br.SUBSCRIBED);return}else{const w=this.bindings.postgres_changes,k=(b=w?.length)!==null&&b!==void 0?b:0,S=[];for(let C=0;C<k;C++){const j=w[C],{filter:{event:O,schema:T,table:N,filter:M}}=j,V=v&&v[C];if(V&&V.event===O&&Ri.isFilterValueEqual(V.schema,T)&&Ri.isFilterValueEqual(V.table,N)&&Ri.isFilterValueEqual(V.filter,M))S.push(Object.assign(Object.assign({},j),{id:V.id}));else{this.unsubscribe(),this.state=Rt.errored,t?.(br.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=S,t&&t(br.SUBSCRIBED);return}}).receive("error",v=>{this.state=Rt.errored,t?.(br.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(v).join(", ")||"error")))}).receive("timeout",()=>{t?.(br.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===Rt.joined&&t===Zo.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(t,n,r)}async httpSend(t,n,r={}){var s;if(n==null)return Promise.reject("Payload is required for httpSend()");const o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},c=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);if(c.status===202)return{success:!0};let u=c.statusText;try{const f=await c.json();u=f.error||f.message||u}catch{}return Promise.reject(new Error(u))}async send(t,n={}){var r,s;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:a}=t,c={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(c.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:c,body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:a,private:this.private}]})};try{const f=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=f.body)===null||s===void 0?void 0:s.cancel()),f.ok?"ok":"error"}catch(f){return f.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var a,c,u;const f=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((u=(c=(a=this.params)===null||a===void 0?void 0:a.config)===null||c===void 0?void 0:c.broadcast)===null||u===void 0)&&u.ack)&&o("ok"),f.receive("ok",()=>o("ok")),f.receive("error",()=>o("error")),f.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=Rt.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Jn.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{r=new hh(this,Jn.leave,{},t),r.receive("ok",()=>{n(),s("ok")}).receive("timeout",()=>{n(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Rt.closed,this.bindings={}}async _fetchWithTimeout(t,n,r){const s=new AbortController,o=setTimeout(()=>s.abort(),r),a=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(o),a}_push(t,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new hh(this,t,n,r);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>VR){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,r){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,r){var s,o;const a=t.toLocaleLowerCase(),{close:c,error:u,leave:f,join:p}=Jn;if(r&&[c,u,f,p].indexOf(a)>=0&&r!==this._joinRef())return;let y=this._onMessage(a,n,r);if(n&&!y)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(v=>{var b,w,k;return((b=v.filter)===null||b===void 0?void 0:b.event)==="*"||((k=(w=v.filter)===null||w===void 0?void 0:w.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===a}).map(v=>v.callback(y,r)):(o=this.bindings[a])===null||o===void 0||o.filter(v=>{var b,w,k,S,C,j,O,T;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in v){const N=v.id,M=(b=v.filter)===null||b===void 0?void 0:b.event;return N&&((w=n.ids)===null||w===void 0?void 0:w.includes(N))&&(M==="*"||M?.toLocaleLowerCase()===((k=n.data)===null||k===void 0?void 0:k.type.toLocaleLowerCase()))&&(!(!((S=v.filter)===null||S===void 0)&&S.table)||v.filter.table===((C=n.data)===null||C===void 0?void 0:C.table))}else{const N=(O=(j=v?.filter)===null||j===void 0?void 0:j.event)===null||O===void 0?void 0:O.toLocaleLowerCase();return N==="*"||N===((T=n?.event)===null||T===void 0?void 0:T.toLocaleLowerCase())}else return v.type.toLocaleLowerCase()===a}).map(v=>{if(typeof y=="object"&&"ids"in y){const b=y.data,{schema:w,table:k,commit_timestamp:S,type:C,errors:j}=b;y=Object.assign(Object.assign({},{schema:w,table:k,commit_timestamp:S,eventType:C,new:{},old:{},errors:j}),this._getPayloadRecords(b))}v.callback(y,r)})}_isClosed(){return this.state===Rt.closed}_isJoined(){return this.state===Rt.joined}_isJoining(){return this.state===Rt.joining}_isLeaving(){return this.state===Rt.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const s=t.toLocaleLowerCase(),o={type:s,filter:n,callback:r};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(s=>{var o;return!(((o=s.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===r&&Ri.isEqual(s.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const r in t)if(t[r]!==n[r])return!1;return!0}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(Jn.close,{},t)}_onError(t){this._on(Jn.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Rt.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=Zv(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=Zv(t.columns,t.old_record)),n}}const fh=()=>{},Wl={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},YR=[1e3,2e3,5e3,1e4],QR=1e4,ZR=`
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 FR="2.91.0",$R=`realtime-js/${FR}`,UR="1.0.0",Ew="2.0.0",Qv=Ew,yf=1e4,BR=1e3,VR=100;var Yr;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Yr||(Yr={}));var At;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(At||(At={}));var Yn;(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"})(Yn||(Yn={}));var xf;(function(e){e.websocket="websocket"})(xf||(xf={}));var Ss;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Ss||(Ss={}));class qR{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},a=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(t,n,r){var s,o;const a=t.topic,c=(s=t.ref)!==null&&s!==void 0?s:"",u=(o=t.join_ref)!==null&&o!==void 0?o:"",f=t.payload.event,p=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},g=Object.keys(p).length===0?"":JSON.stringify(p);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`ref length ${c.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`metadata length ${g.length} exceeds maximum of 255`);const y=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+c.length+a.length+f.length+g.length,v=new ArrayBuffer(this.HEADER_LENGTH+y);let b=new DataView(v),w=0;b.setUint8(w++,this.KINDS.userBroadcastPush),b.setUint8(w++,u.length),b.setUint8(w++,c.length),b.setUint8(w++,a.length),b.setUint8(w++,f.length),b.setUint8(w++,g.length),b.setUint8(w++,n),Array.from(u,S=>b.setUint8(w++,S.charCodeAt(0))),Array.from(c,S=>b.setUint8(w++,S.charCodeAt(0))),Array.from(a,S=>b.setUint8(w++,S.charCodeAt(0))),Array.from(f,S=>b.setUint8(w++,S.charCodeAt(0))),Array.from(g,S=>b.setUint8(w++,S.charCodeAt(0)));var k=new Uint8Array(v.byteLength+r.byteLength);return k.set(new Uint8Array(v),0),k.set(new Uint8Array(r),v.byteLength),k.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[s,o,a,c,u]=r;return n({join_ref:s,ref:o,topic:a,event:c,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),s=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,s)}_decodeUserBroadcast(t,n,r){const s=n.getUint8(1),o=n.getUint8(2),a=n.getUint8(3),c=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=r.decode(t.slice(u,u+s));u=u+s;const p=r.decode(t.slice(u,u+o));u=u+o;const g=r.decode(t.slice(u,u+a));u=u+a;const y=t.slice(u,t.byteLength),v=c===this.JSON_ENCODING?JSON.parse(r.decode(y)):y,b={type:this.BROADCAST_EVENT,event:p,payload:v};return a>0&&(b.meta=JSON.parse(g)),{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 Cw{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 lt;(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"})(lt||(lt={}));const Zv=(e,t,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((o,a)=>(o[a]=HR(a,e,t,s),o),{}):{}},HR=(e,t,n,r)=>{const s=t.find(c=>c.name===e),o=s?.type,a=n[e];return o&&!r.includes(o)?Tw(o,a):vf(a)},Tw=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return JR(t,n)}switch(e){case lt.bool:return KR(t);case lt.float4:case lt.float8:case lt.int2:case lt.int4:case lt.int8:case lt.numeric:case lt.oid:return WR(t);case lt.json:case lt.jsonb:return GR(t);case lt.timestamp:return XR(t);case lt.abstime:case lt.date:case lt.daterange:case lt.int4range:case lt.int8range:case lt.money:case lt.reltime:case lt.text:case lt.time:case lt.timestamptz:case lt.timetz:case lt.tsrange:case lt.tstzrange:return vf(t);default:return vf(t)}},vf=e=>e,KR=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},WR=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},GR=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},JR=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let o;const a=e.slice(1,n);try{o=JSON.parse("["+a+"]")}catch{o=a?a.split(","):[]}return o.map(c=>Tw(t,c))}return e},XR=e=>typeof e=="string"?e.replace(" ","T"):e,Nw=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 hh{constructor(t,n,r={},s=yf){this.channel=t,this.event=n,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var r;return this._hasReceived(t)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var e0;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(e0||(e0={}));class Qo{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,{},s=>{const{onJoin:o,onLeave:a,onSync:c}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Qo.syncState(this.state,s,o,a),this.pendingDiffs.forEach(u=>{this.state=Qo.syncDiff(this.state,u,o,a)}),this.pendingDiffs=[],c()}),this.channel._on(r.diff,{},s=>{const{onJoin:o,onLeave:a,onSync:c}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=Qo.syncDiff(this.state,s,o,a),c())}),this.onJoin((s,o,a)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:o,newPresences:a})}),this.onLeave((s,o,a)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:o,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,s){const o=this.cloneDeep(t),a=this.transformState(n),c={},u={};return this.map(o,(f,p)=>{a[f]||(u[f]=p)}),this.map(a,(f,p)=>{const g=o[f];if(g){const y=p.map(k=>k.presence_ref),v=g.map(k=>k.presence_ref),b=p.filter(k=>v.indexOf(k.presence_ref)<0),w=g.filter(k=>y.indexOf(k.presence_ref)<0);b.length>0&&(c[f]=b),w.length>0&&(u[f]=w)}else c[f]=p}),this.syncDiff(o,{joins:c,leaves:u},r,s)}static syncDiff(t,n,r,s){const{joins:o,leaves:a}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(o,(c,u)=>{var f;const p=(f=t[c])!==null&&f!==void 0?f:[];if(t[c]=this.cloneDeep(u),p.length>0){const g=t[c].map(v=>v.presence_ref),y=p.filter(v=>g.indexOf(v.presence_ref)<0);t[c].unshift(...y)}r(c,p,u)}),this.map(a,(c,u)=>{let f=t[c];if(!f)return;const p=u.map(g=>g.presence_ref);f=f.filter(g=>p.indexOf(g.presence_ref)<0),t[c]=f,s(c,f,u),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 s=t[r];return"metas"in s?n[r]=s.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[r]=s,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var t0;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t0||(t0={}));var Zo;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Zo||(Zo={}));var br;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(br||(br={}));class Ri{constructor(t,n={config:{}},r){var s,o;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=At.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 hh(this,Yn.join,this.params,this.timeout),this.rejoinTimer=new Cw(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=At.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=At.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=At.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=At.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=At.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Yn.reply,{},(a,c)=>{this._trigger(this._replyEventName(c),a)}),this.presence=new Qo(this),this.broadcastEndpointURL=Nw(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var r,s,o;if(this.socket.isConnected()||this.socket.connect(),this.state==At.closed){const{config:{broadcast:a,presence:c,private:u}}=this.params,f=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(v=>v.filter))!==null&&s!==void 0?s:[],p=!!this.bindings[Zo.PRESENCE]&&this.bindings[Zo.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,g={},y={broadcast:a,presence:Object.assign(Object.assign({},c),{enabled:p}),postgres_changes:f,private:u};this.socket.accessTokenValue&&(g.access_token=this.socket.accessTokenValue),this._onError(v=>t?.(br.CHANNEL_ERROR,v)),this._onClose(()=>t?.(br.CLOSED)),this.updateJoinPayload(Object.assign({config:y},g)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:v})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),v===void 0){t?.(br.SUBSCRIBED);return}else{const w=this.bindings.postgres_changes,k=(b=w?.length)!==null&&b!==void 0?b:0,S=[];for(let C=0;C<k;C++){const j=w[C],{filter:{event:O,schema:T,table:N,filter:M}}=j,V=v&&v[C];if(V&&V.event===O&&Ri.isFilterValueEqual(V.schema,T)&&Ri.isFilterValueEqual(V.table,N)&&Ri.isFilterValueEqual(V.filter,M))S.push(Object.assign(Object.assign({},j),{id:V.id}));else{this.unsubscribe(),this.state=At.errored,t?.(br.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=S,t&&t(br.SUBSCRIBED);return}}).receive("error",v=>{this.state=At.errored,t?.(br.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(v).join(", ")||"error")))}).receive("timeout",()=>{t?.(br.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===At.joined&&t===Zo.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(t,n,r)}async httpSend(t,n,r={}){var s;if(n==null)return Promise.reject("Payload is required for httpSend()");const o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},c=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);if(c.status===202)return{success:!0};let u=c.statusText;try{const f=await c.json();u=f.error||f.message||u}catch{}return Promise.reject(new Error(u))}async send(t,n={}){var r,s;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:a}=t,c={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(c.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:c,body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:a,private:this.private}]})};try{const f=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=f.body)===null||s===void 0?void 0:s.cancel()),f.ok?"ok":"error"}catch(f){return f.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var a,c,u;const f=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((u=(c=(a=this.params)===null||a===void 0?void 0:a.config)===null||c===void 0?void 0:c.broadcast)===null||u===void 0)&&u.ack)&&o("ok"),f.receive("ok",()=>o("ok")),f.receive("error",()=>o("error")),f.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=At.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Yn.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{r=new hh(this,Yn.leave,{},t),r.receive("ok",()=>{n(),s("ok")}).receive("timeout",()=>{n(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=At.closed,this.bindings={}}async _fetchWithTimeout(t,n,r){const s=new AbortController,o=setTimeout(()=>s.abort(),r),a=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(o),a}_push(t,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new hh(this,t,n,r);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>VR){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,r){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,r){var s,o;const a=t.toLocaleLowerCase(),{close:c,error:u,leave:f,join:p}=Yn;if(r&&[c,u,f,p].indexOf(a)>=0&&r!==this._joinRef())return;let y=this._onMessage(a,n,r);if(n&&!y)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(v=>{var b,w,k;return((b=v.filter)===null||b===void 0?void 0:b.event)==="*"||((k=(w=v.filter)===null||w===void 0?void 0:w.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===a}).map(v=>v.callback(y,r)):(o=this.bindings[a])===null||o===void 0||o.filter(v=>{var b,w,k,S,C,j,O,T;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in v){const N=v.id,M=(b=v.filter)===null||b===void 0?void 0:b.event;return N&&((w=n.ids)===null||w===void 0?void 0:w.includes(N))&&(M==="*"||M?.toLocaleLowerCase()===((k=n.data)===null||k===void 0?void 0:k.type.toLocaleLowerCase()))&&(!(!((S=v.filter)===null||S===void 0)&&S.table)||v.filter.table===((C=n.data)===null||C===void 0?void 0:C.table))}else{const N=(O=(j=v?.filter)===null||j===void 0?void 0:j.event)===null||O===void 0?void 0:O.toLocaleLowerCase();return N==="*"||N===((T=n?.event)===null||T===void 0?void 0:T.toLocaleLowerCase())}else return v.type.toLocaleLowerCase()===a}).map(v=>{if(typeof y=="object"&&"ids"in y){const b=y.data,{schema:w,table:k,commit_timestamp:S,type:C,errors:j}=b;y=Object.assign(Object.assign({},{schema:w,table:k,commit_timestamp:S,eventType:C,new:{},old:{},errors:j}),this._getPayloadRecords(b))}v.callback(y,r)})}_isClosed(){return this.state===At.closed}_isJoined(){return this.state===At.joined}_isJoining(){return this.state===At.joining}_isLeaving(){return this.state===At.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const s=t.toLocaleLowerCase(),o={type:s,filter:n,callback:r};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(s=>{var o;return!(((o=s.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===r&&Ri.isEqual(s.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const r in t)if(t[r]!==n[r])return!1;return!0}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(Yn.close,{},t)}_onError(t){this._on(Yn.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=At.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=Zv(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=Zv(t.columns,t.old_record)),n}}const fh=()=>{},Wl={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},YR=[1e3,2e3,5e3,1e4],QR=1e4,ZR=`
29
29
  addEventListener("message", (e) => {
30
30
  if (e.data.event === "start") {
31
31
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
@@ -43,8 +43,8 @@ Option 2: Install and provide the "ws" package:
43
43
  const client = new RealtimeClient(url, {
44
44
  ...options,
45
45
  transport: ws
46
- })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(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 Yr.connecting:return Ss.Connecting;case Yr.open:return Ss.Open;case Yr.closing:return Ss.Closing;default:return Ss.Closed}}isConnected(){return this.connectionState()===Ss.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const r=`realtime:${t}`,s=this.getChannels().find(o=>o.topic===r);if(s)return s;{const o=new Ri(`realtime:${t}`,n,this);return this.channels.push(o),o}}push(t){const{topic:n,event:r,payload:s,ref:o}=t,a=()=>{this.encode(t,c=>{var u;(u=this.conn)===null||u===void 0||u.send(c)})};this.log("push",`${n} ${r} (${o})`,s),this.isConnected()?a():this.sendBuffer.push(a)}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(BR,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},Wl.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:s,payload:o,ref:a}=n,c=a?`(${a})`:"",u=o.status||"";this.log("receive",`${u} ${r} ${s} ${c}`.trim(),o),this.channels.filter(f=>f._isMember(r)).forEach(f=>f._trigger(s,o,a)),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===Yr.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Yr.open||this.conn.readyState===Yr.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(Jn.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const r=t.match(/\?/)?"&":"?",s=new URLSearchParams(n);return`${t}${r}${s}`}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([ZR],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const o={access_token:n,version:$R};n&&s.updateJoinPayload(o),s.joinedOnce&&s._isJoined()&&s._push(Jn.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(r=>{try{r(n)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Cw(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Wl.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,r,s,o,a,c,u,f,p,g,y,v;switch(this.transport=(n=t?.transport)!==null&&n!==void 0?n:null,this.timeout=(r=t?.timeout)!==null&&r!==void 0?r:yf,this.heartbeatIntervalMs=(s=t?.heartbeatIntervalMs)!==null&&s!==void 0?s:Wl.HEARTBEAT_INTERVAL,this.worker=(o=t?.worker)!==null&&o!==void 0?o:!1,this.accessToken=(a=t?.accessToken)!==null&&a!==void 0?a:null,this.heartbeatCallback=(c=t?.heartbeatCallback)!==null&&c!==void 0?c:fh,this.vsn=(u=t?.vsn)!==null&&u!==void 0?u:Qv,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=>YR[b-1]||QR),this.vsn){case UR:this.encode=(p=t?.encode)!==null&&p!==void 0?p:((b,w)=>w(JSON.stringify(b))),this.decode=(g=t?.decode)!==null&&g!==void 0?g:((b,w)=>w(JSON.parse(b)));break;case Ew:this.encode=(y=t?.encode)!==null&&y!==void 0?y:this.serializer.encode.bind(this.serializer),this.decode=(v=t?.decode)!==null&&v!==void 0?v: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 ha=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 tP(e,t,n){const r=new URL(t,e);if(n)for(const[s,o]of Object.entries(n))o!==void 0&&r.searchParams.set(s,o);return r.toString()}async function nP(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 rP(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:o,headers:a}){const c=tP(e.baseUrl,r,s),u=await nP(e.auth),f=await t(c,{method:n,headers:{...o?{"Content-Type":"application/json"}:{},...u,...a},body:o?JSON.stringify(o):void 0}),p=await f.text(),g=(f.headers.get("content-type")||"").includes("application/json"),y=g&&p?JSON.parse(p):p;if(!f.ok){const v=g?y:void 0,b=v?.error;throw new ha(b?.message??`Request failed with status ${f.status}`,{status:f.status,icebergType:b?.type,icebergCode:b?.code,details:v})}return{status:f.status,headers:f.headers,data:y}}}}function Gl(e){return e.join("")}var sP=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Gl(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/${Gl(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Gl(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Gl(e.namespace)}`}),!0}catch(t){if(t instanceof ha&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof ha&&n.status===409)return;throw n}}};function di(e){return e.join("")}var iP=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/${di(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/${di(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/${di(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/${di(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/${di(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/${di(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof ha&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof ha&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},oP=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=rP({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new sP(this.client,t),this.tableOps=new iP(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)}},Kc=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function gt(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var aP=class extends Kc{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}}},_f=class extends Kc{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};const Tp=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),lP=()=>Response,bf=e=>{if(Array.isArray(e))return e.map(n=>bf(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));t[s]=bf(r)}),t},cP=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)},uP=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function fa(e){"@babel/helpers - typeof";return fa=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},fa(e)}function dP(e,t){if(fa(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hP(e){var t=dP(e,"string");return fa(t)=="symbol"?t:t+""}function fP(e,t,n){return(t=hP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ie(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?n0(Object(n),!0).forEach(function(r){fP(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):n0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const ph=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)},pP=async(e,t,n)=>{e instanceof await lP()&&!n?.noResolveJson?e.json().then(r=>{const s=e.status||500,o=r?.statusCode||s+"";t(new aP(ph(r),s,o))}).catch(r=>{t(new _f(ph(r),r))}):t(new _f(ph(e),e))},mP=(e,t,n,r)=>{const s={method:e,headers:t?.headers||{}};return e==="GET"||!r?s:(cP(r)?(s.headers=Ie({"Content-Type":"application/json"},t?.headers),s.body=JSON.stringify(r)):s.body=r,t?.duplex&&(s.duplex=t.duplex),Ie(Ie({},s),n))};async function Na(e,t,n,r,s,o){return new Promise((a,c)=>{e(n,mP(t,r,s,o)).then(u=>{if(!u.ok)throw u;return r?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>pP(u,c,r))})}async function pa(e,t,n,r){return Na(e,"GET",t,n,r)}async function Gn(e,t,n,r,s){return Na(e,"POST",t,r,s,n)}async function wf(e,t,n,r,s){return Na(e,"PUT",t,r,s,n)}async function gP(e,t,n,r){return Na(e,"HEAD",t,Ie(Ie({},n),{},{noResolveJson:!0}),r)}async function Np(e,t,n,r,s){return Na(e,"DELETE",t,r,s,n)}var yP=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(gt(t))return{data:null,error:t};throw t}}};let Aw;Aw=Symbol.toStringTag;var xP=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Aw]="BlobDownloadBuilder",this.promise=null}asStream(){return new yP(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(gt(t))return{data:null,error:t};throw t}}};const vP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},r0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var _P=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=n,this.fetch=Tp(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(e,t,n,r){var s=this;try{let o;const a=Ie(Ie({},r0),r);let c=Ie(Ie({},s.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const u=a.metadata;typeof Blob<"u"&&n instanceof Blob?(o=new FormData,o.append("cacheControl",a.cacheControl),u&&o.append("metadata",s.encodeMetadata(u)),o.append("",n)):typeof FormData<"u"&&n instanceof FormData?(o=n,o.has("cacheControl")||o.append("cacheControl",a.cacheControl),u&&!o.has("metadata")&&o.append("metadata",s.encodeMetadata(u))):(o=n,c["cache-control"]=`max-age=${a.cacheControl}`,c["content-type"]=a.contentType,u&&(c["x-metadata"]=s.toBase64(s.encodeMetadata(u))),(typeof ReadableStream<"u"&&o instanceof ReadableStream||o&&typeof o=="object"&&"pipe"in o&&typeof o.pipe=="function")&&!a.duplex&&(a.duplex="half")),r?.headers&&(c=Ie(Ie({},c),r.headers));const f=s._removeEmptyFolders(t),p=s._getFinalPath(f),g=await(e=="PUT"?wf:Gn)(s.fetch,`${s.url}/object/${p}`,o,Ie({headers:c},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:f,id:g.Id,fullPath:g.Key},error:null}}catch(o){if(s.shouldThrowOnError)throw o;if(gt(o))return{data:null,error:o};throw o}}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var s=this;const o=s._removeEmptyFolders(e),a=s._getFinalPath(o),c=new URL(s.url+`/object/upload/sign/${a}`);c.searchParams.set("token",t);try{let u;const f=Ie({upsert:r0.upsert},r),p=Ie(Ie({},s.headers),{"x-upsert":String(f.upsert)});return typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",f.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",f.cacheControl)):(u=n,p["cache-control"]=`max-age=${f.cacheControl}`,p["content-type"]=f.contentType),{data:{path:o,fullPath:(await wf(s.fetch,c.toString(),u,{headers:p})).Key},error:null}}catch(u){if(s.shouldThrowOnError)throw u;if(gt(u))return{data:null,error:u};throw u}}async createSignedUploadUrl(e,t){var n=this;try{let r=n._getFinalPath(e);const s=Ie({},n.headers);t?.upsert&&(s["x-upsert"]="true");const o=await Gn(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),a=new URL(n.url+o.url),c=a.searchParams.get("token");if(!c)throw new Kc("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:c},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(gt(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 Gn(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers}),error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}async copy(e,t,n){var r=this;try{return{data:{path:(await Gn(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers})).Key},error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}async createSignedUrl(e,t,n){var r=this;try{let s=r._getFinalPath(e),o=await Gn(r.fetch,`${r.url}/object/sign/${s}`,Ie({expiresIn:t},n?.transform?{transform:n.transform}:{}),{headers:r.headers});const a=n?.download?`&download=${n.download===!0?"":n.download}`:"";return o={signedUrl:encodeURI(`${r.url}${o.signedURL}${a}`)},{data:o,error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}async createSignedUrls(e,t,n){var r=this;try{const s=await Gn(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),o=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:s.map(a=>Ie(Ie({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${o}`):null})),error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}download(e,t){const n=typeof t?.transform<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString(t?.transform||{}),s=r?`?${r}`:"",o=this._getFinalPath(e),a=()=>pa(this.fetch,`${this.url}/${n}/${o}${s}`,{headers:this.headers,noResolveJson:!0});return new xP(a,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);try{return{data:bf(await pa(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(gt(r))return{data:null,error:r};throw r}}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await gP(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(gt(r)&&r instanceof _f){const s=r.originalError;if([400,404].includes(s?.status))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=[],s=t?.download?`download=${t.download===!0?"":t.download}`:"";s!==""&&r.push(s);const o=typeof t?.transform<"u"?"render/image":"object",a=this.transformOptsToQueryString(t?.transform||{});a!==""&&r.push(a);let c=r.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${n}${c}`)}}}async remove(e){var t=this;try{return{data:await Np(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async list(e,t,n){var r=this;try{const s=Ie(Ie(Ie({},vP),t),{},{prefix:e||""});return{data:await Gn(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n),error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}async listV2(e,t){var n=this;try{const r=Ie({},e);return{data:await Gn(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(gt(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 Rw="2.91.0",Pw={"X-Client-Info":`storage-js/${Rw}`};var bP=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1;const s=new URL(e);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Ie(Ie({},Pw),t),this.fetch=Tp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(e){var t=this;try{const n=t.listBucketOptionsToQueryString(e);return{data:await pa(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await pa(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async createBucket(e,t={public:!1}){var n=this;try{return{data:await Gn(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(gt(r))return{data:null,error:r};throw r}}async updateBucket(e,t){var n=this;try{return{data:await wf(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(gt(r))return{data:null,error:r};throw r}}async emptyBucket(e){var t=this;try{return{data:await Gn(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Np(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(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():""}},wP=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Ie(Ie({},Pw),t),this.fetch=Tp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await Gn(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(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(),s=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return{data:await pa(t.fetch,s,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Np(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}from(e){var t=this;if(!uP(e))throw new Kc("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 oP({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(s,o){const a=s[o];return typeof a!="function"?a:async(...c)=>{try{return{data:await a.apply(s,c),error:null}}catch(u){if(r)throw u;return{data:null,error:u}}}}})}};const Ap={"X-Client-Info":`storage-js/${Rw}`,"Content-Type":"application/json"};var Ow=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Sn(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}var mh=class extends Ow{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}}},kP=class extends Ow{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}};const Rp=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),SP=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)},s0=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),jP=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,s=e;if(typeof s.json=="function")s.json().then(o=>{const a=o?.statusCode||o?.code||r+"";t(new mh(s0(o),r,a))}).catch(()=>{const o=r+"";t(new mh(s.statusText||`HTTP ${r} error`,r,o))});else{const o=r+"";t(new mh(s.statusText||`HTTP ${r} error`,r,o))}}else t(new kP(s0(e),e))},EP=(e,t,n,r)=>{const s={method:e,headers:t?.headers||{}};return r?(SP(r)?(s.headers=Ie({"Content-Type":"application/json"},t?.headers),s.body=JSON.stringify(r)):s.body=r,Ie(Ie({},s),n)):s};async function CP(e,t,n,r,s,o){return new Promise((a,c)=>{e(n,EP(t,r,s,o)).then(u=>{if(!u.ok)throw u;if(r?.noResolveJson)return u;const f=u.headers.get("content-type");return!f||!f.includes("application/json")?{}:u.json()}).then(u=>a(u)).catch(u=>jP(u,c,r))})}async function jn(e,t,n,r,s){return CP(e,"POST",t,r,s,n)}var TP=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Ie(Ie({},Ap),t),this.fetch=Rp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(e){var t=this;try{return{data:await jn(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(n))return{data:null,error:n};throw n}}async getIndex(e,t){var n=this;try{return{data:await jn(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Sn(r))return{data:null,error:r};throw r}}async listIndexes(e){var t=this;try{return{data:await jn(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(n))return{data:null,error:n};throw n}}async deleteIndex(e,t){var n=this;try{return{data:await jn(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Sn(r))return{data:null,error:r};throw r}}},NP=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Ie(Ie({},Ap),t),this.fetch=Rp(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 jn(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(n))return{data:null,error:n};throw n}}async getVectors(e){var t=this;try{return{data:await jn(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(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 jn(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(n))return{data:null,error:n};throw n}}async queryVectors(e){var t=this;try{return{data:await jn(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(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 jn(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(n))return{data:null,error:n};throw n}}},AP=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Ie(Ie({},Ap),t),this.fetch=Rp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await jn(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await jn(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(n))return{data:null,error:n};throw n}}async listBuckets(e={}){var t=this;try{return{data:await jn(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await jn(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Sn(n))return{data:null,error:n};throw n}}},RP=class extends AP{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new PP(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)}},PP=class extends TP{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,Ie(Ie({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,Ie(Ie({},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 OP(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},OP=class extends NP{constructor(e,t,n,r,s){super(e,t,s),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,Ie(Ie({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,Ie(Ie({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,Ie(Ie({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,Ie(Ie({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,Ie(Ie({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},LP=class extends bP{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new _P(this.url,this.headers,e,this.fetch)}get vectors(){return new RP(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new wP(this.url+"/iceberg",this.headers,this.fetch)}};const Lw="2.91.0",ki=30*1e3,kf=3,gh=kf*ki,IP="http://localhost:9999",DP="supabase.auth.token",MP={"X-Client-Info":`gotrue-js/${Lw}`},Sf="X-Supabase-Api-Version",Iw={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},zP=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,FP=600*1e3;class ma extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function Te(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class $P extends ma{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function UP(e){return Te(e)&&e.name==="AuthApiError"}class js extends ma{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Cr extends ma{constructor(t,n,r,s){super(t,r,s),this.name=n,this.status=r}}class wn extends Cr{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function BP(e){return Te(e)&&e.name==="AuthSessionMissingError"}class hi extends Cr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Jl extends Cr{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Xl extends Cr{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 VP(e){return Te(e)&&e.name==="AuthImplicitGrantRedirectError"}class i0 extends Cr{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 qP extends Cr{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 jf extends Cr{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function yh(e){return Te(e)&&e.name==="AuthRetryableFetchError"}class o0 extends Cr{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class Ef extends Cr{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const wc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),a0=`
47
- \r=`.split(""),HP=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<a0.length;t+=1)e[a0[t].charCodeAt(0)]=-2;for(let t=0;t<wc.length;t+=1)e[wc[t].charCodeAt(0)]=t;return e})();function l0(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(wc[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(wc[r]),t.queuedBits-=6}}function Dw(e,t,n){const r=HP[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 c0(e){const t=[],n=a=>{t.push(String.fromCodePoint(a))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},o=a=>{GP(a,r,n)};for(let a=0;a<e.length;a+=1)Dw(e.charCodeAt(a),s,o);return t.join("")}function KP(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 WP(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}KP(r,t)}}function GP(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 Pi(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)Dw(e.charCodeAt(s),n,r);return new Uint8Array(t)}function JP(e){const t=[];return WP(e,n=>t.push(n)),new Uint8Array(t)}function Ts(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};return e.forEach(s=>l0(s,n,r)),l0(null,n,r),t.join("")}function XP(e){return Math.round(Date.now()/1e3)+e}function YP(){return Symbol("auth-callback")}const Ut=()=>typeof window<"u"&&typeof document<"u",xs={tested:!1,writable:!1},Mw=()=>{if(!Ut())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(xs.tested)return xs.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),xs.tested=!0,xs.writable=!0}catch{xs.tested=!0,xs.writable=!1}return xs.writable};function QP(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,o)=>{t[o]=s})}catch{}return n.searchParams.forEach((r,s)=>{t[s]=r}),t}const zw=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),ZP=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Si=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},vs=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},$t=async(e,t)=>{await e.removeItem(t)};class Wc{constructor(){this.promise=new Wc.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}Wc.promiseConstructor=Promise;function xh(e){const t=e.split(".");if(t.length!==3)throw new Ef("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!zP.test(t[r]))throw new Ef("JWT not in base64url format");return{header:JSON.parse(c0(t[0])),payload:JSON.parse(c0(t[1])),signature:Pi(t[2]),raw:{header:t[0],payload:t[1]}}}async function eO(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function tO(e,t){return new Promise((r,s)=>{(async()=>{for(let o=0;o<1/0;o++)try{const a=await e(o);if(!t(o,null,a)){r(a);return}}catch(a){if(!t(o,a)){s(a);return}}})()})}function nO(e){return("0"+e.toString(16)).substr(-2)}function rO(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let o=0;o<56;o++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(t),Array.from(t,nO).join("")}async function sO(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(o=>String.fromCharCode(o)).join("")}async function iO(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 sO(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function fi(e,t,n=!1){const r=rO();let s=r;n&&(s+="/PASSWORD_RECOVERY"),await Si(e,`${t}-code-verifier`,s);const o=await iO(r);return[o,r===o?"plain":"s256"]}const oO=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function aO(e){const t=e.headers.get(Sf);if(!t||!t.match(oO))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function lO(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 cO(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 uO=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function pi(e){if(!uO.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function vh(){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 dO(e,t){return new Proxy(e,{get:(n,r,s)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const o=r.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,s)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,r,s)}})}function u0(e){return JSON.parse(JSON.stringify(e))}const ks=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),hO=[502,503,504];async function d0(e){var t;if(!ZP(e))throw new jf(ks(e),0);if(hO.includes(e.status))throw new jf(ks(e),e.status);let n;try{n=await e.json()}catch(o){throw new js(ks(o),o)}let r;const s=aO(e);if(s&&s.getTime()>=Iw["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 o0(ks(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new wn}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((o,a)=>o&&typeof a=="string",!0))throw new o0(ks(n),e.status,n.weak_password.reasons);throw new $P(ks(n),e.status||500,r)}const fO=(e,t,n,r)=>{const s={method:e,headers:t?.headers||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function Oe(e,t,n,r){var s;const o=Object.assign({},r?.headers);o[Sf]||(o[Sf]=Iw["2024-01-01"].name),r?.jwt&&(o.Authorization=`Bearer ${r.jwt}`);const a=(s=r?.query)!==null&&s!==void 0?s:{};r?.redirectTo&&(a.redirect_to=r.redirectTo);const c=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",u=await pO(e,t,n+c,{headers:o,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(u):{data:Object.assign({},u),error:null}}async function pO(e,t,n,r,s,o){const a=fO(t,r,s,o);let c;try{c=await e(n,Object.assign({},a))}catch(u){throw console.error(u),new jf(ks(u),0)}if(c.ok||await d0(c),r?.noResolveJson)return c;try{return await c.json()}catch(u){await d0(u)}}function Kn(e){var t;let n=null;yO(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=XP(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function h0(e){const t=Kn(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 Qr(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function mO(e){return{data:e,error:null}}function gO(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:o}=e,a=Hc(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:o},u=Object.assign({},a);return{data:{properties:c,user:u},error:null}}function f0(e){return e}function yO(e){return e.access_token&&e.refresh_token&&e.expires_in}const _h=["global","local","others"];class xO{constructor({url:t="",headers:n={},fetch:r}){this.url=t,this.headers=n,this.fetch=zw(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=_h[0]){if(_h.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${_h.join(", ")}`);try{return await Oe(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Te(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await Oe(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Qr})}catch(r){if(Te(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=Hc(t,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r?.newEmail,delete s.newEmail),await Oe(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:gO,redirectTo:n?.redirectTo})}catch(n){if(Te(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Oe(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Qr})}catch(n){if(Te(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,s,o,a,c,u;try{const f={nextPage:null,lastPage:0,total:0},p=await Oe(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:(o=(s=t?.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:f0});if(p.error)throw p.error;const g=await p.json(),y=(a=p.headers.get("x-total-count"))!==null&&a!==void 0?a:0,v=(u=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(b=>{const w=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);f[`${k}Page`]=w}),f.total=parseInt(y)),{data:Object.assign(Object.assign({},g),f),error:null}}catch(f){if(Te(f))return{data:{users:[]},error:f};throw f}}async getUserById(t){pi(t);try{return await Oe(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Qr})}catch(n){if(Te(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){pi(t);try{return await Oe(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:Qr})}catch(r){if(Te(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){pi(t);try{return await Oe(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:Qr})}catch(r){if(Te(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){pi(t.userId);try{const{data:n,error:r}=await Oe(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _deleteFactor(t){pi(t.userId),pi(t.id);try{return{data:await Oe(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,s,o,a,c,u;try{const f={nextPage:null,lastPage:0,total:0},p=await Oe(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:(o=(s=t?.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:f0});if(p.error)throw p.error;const g=await p.json(),y=(a=p.headers.get("x-total-count"))!==null&&a!==void 0?a:0,v=(u=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(b=>{const w=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);f[`${k}Page`]=w}),f.total=parseInt(y)),{data:Object.assign(Object.assign({},g),f),error:null}}catch(f){if(Te(f))return{data:{clients:[]},error:f};throw f}}async _createOAuthClient(t){try{return await Oe(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Oe(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Oe(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Te(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await Oe(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Oe(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Te(n))return{data:null,error:n};throw n}}}function p0(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const mi={debug:!!(globalThis&&Mw()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Fw extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class vO extends Fw{}async function _O(e,t,n){mi.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout(()=>{r.abort(),mi.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){mi.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await n()}finally{mi.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}else{if(t===0)throw mi.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new vO(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(mi.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function bO(){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 $w(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function wO(e){return parseInt(e,16)}function kO(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function SO(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:o=new Date,nonce:a,notBefore:c,requestId:u,resources:f,scheme:p,uri:g,version:y}=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(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!g)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(y!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${y}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
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 Yr.connecting:return Ss.Connecting;case Yr.open:return Ss.Open;case Yr.closing:return Ss.Closing;default:return Ss.Closed}}isConnected(){return this.connectionState()===Ss.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const r=`realtime:${t}`,s=this.getChannels().find(o=>o.topic===r);if(s)return s;{const o=new Ri(`realtime:${t}`,n,this);return this.channels.push(o),o}}push(t){const{topic:n,event:r,payload:s,ref:o}=t,a=()=>{this.encode(t,c=>{var u;(u=this.conn)===null||u===void 0||u.send(c)})};this.log("push",`${n} ${r} (${o})`,s),this.isConnected()?a():this.sendBuffer.push(a)}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(BR,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},Wl.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:s,payload:o,ref:a}=n,c=a?`(${a})`:"",u=o.status||"";this.log("receive",`${u} ${r} ${s} ${c}`.trim(),o),this.channels.filter(f=>f._isMember(r)).forEach(f=>f._trigger(s,o,a)),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===Yr.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Yr.open||this.conn.readyState===Yr.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(Yn.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const r=t.match(/\?/)?"&":"?",s=new URLSearchParams(n);return`${t}${r}${s}`}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([ZR],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const o={access_token:n,version:$R};n&&s.updateJoinPayload(o),s.joinedOnce&&s._isJoined()&&s._push(Yn.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(r=>{try{r(n)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Cw(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Wl.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,r,s,o,a,c,u,f,p,g,y,v;switch(this.transport=(n=t?.transport)!==null&&n!==void 0?n:null,this.timeout=(r=t?.timeout)!==null&&r!==void 0?r:yf,this.heartbeatIntervalMs=(s=t?.heartbeatIntervalMs)!==null&&s!==void 0?s:Wl.HEARTBEAT_INTERVAL,this.worker=(o=t?.worker)!==null&&o!==void 0?o:!1,this.accessToken=(a=t?.accessToken)!==null&&a!==void 0?a:null,this.heartbeatCallback=(c=t?.heartbeatCallback)!==null&&c!==void 0?c:fh,this.vsn=(u=t?.vsn)!==null&&u!==void 0?u:Qv,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=>YR[b-1]||QR),this.vsn){case UR:this.encode=(p=t?.encode)!==null&&p!==void 0?p:((b,w)=>w(JSON.stringify(b))),this.decode=(g=t?.decode)!==null&&g!==void 0?g:((b,w)=>w(JSON.parse(b)));break;case Ew:this.encode=(y=t?.encode)!==null&&y!==void 0?y:this.serializer.encode.bind(this.serializer),this.decode=(v=t?.decode)!==null&&v!==void 0?v: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 ha=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 tP(e,t,n){const r=new URL(t,e);if(n)for(const[s,o]of Object.entries(n))o!==void 0&&r.searchParams.set(s,o);return r.toString()}async function nP(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 rP(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:o,headers:a}){const c=tP(e.baseUrl,r,s),u=await nP(e.auth),f=await t(c,{method:n,headers:{...o?{"Content-Type":"application/json"}:{},...u,...a},body:o?JSON.stringify(o):void 0}),p=await f.text(),g=(f.headers.get("content-type")||"").includes("application/json"),y=g&&p?JSON.parse(p):p;if(!f.ok){const v=g?y:void 0,b=v?.error;throw new ha(b?.message??`Request failed with status ${f.status}`,{status:f.status,icebergType:b?.type,icebergCode:b?.code,details:v})}return{status:f.status,headers:f.headers,data:y}}}}function Gl(e){return e.join("")}var sP=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Gl(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/${Gl(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Gl(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Gl(e.namespace)}`}),!0}catch(t){if(t instanceof ha&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof ha&&n.status===409)return;throw n}}};function di(e){return e.join("")}var iP=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/${di(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/${di(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/${di(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/${di(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/${di(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/${di(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof ha&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof ha&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},oP=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=rP({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new sP(this.client,t),this.tableOps=new iP(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)}},Kc=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function gt(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var aP=class extends Kc{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}}},_f=class extends Kc{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};const Tp=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),lP=()=>Response,bf=e=>{if(Array.isArray(e))return e.map(n=>bf(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));t[s]=bf(r)}),t},cP=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)},uP=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function fa(e){"@babel/helpers - typeof";return fa=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},fa(e)}function dP(e,t){if(fa(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hP(e){var t=dP(e,"string");return fa(t)=="symbol"?t:t+""}function fP(e,t,n){return(t=hP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function De(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?n0(Object(n),!0).forEach(function(r){fP(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):n0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const ph=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)},pP=async(e,t,n)=>{e instanceof await lP()&&!n?.noResolveJson?e.json().then(r=>{const s=e.status||500,o=r?.statusCode||s+"";t(new aP(ph(r),s,o))}).catch(r=>{t(new _f(ph(r),r))}):t(new _f(ph(e),e))},mP=(e,t,n,r)=>{const s={method:e,headers:t?.headers||{}};return e==="GET"||!r?s:(cP(r)?(s.headers=De({"Content-Type":"application/json"},t?.headers),s.body=JSON.stringify(r)):s.body=r,t?.duplex&&(s.duplex=t.duplex),De(De({},s),n))};async function Na(e,t,n,r,s,o){return new Promise((a,c)=>{e(n,mP(t,r,s,o)).then(u=>{if(!u.ok)throw u;return r?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>pP(u,c,r))})}async function pa(e,t,n,r){return Na(e,"GET",t,n,r)}async function Xn(e,t,n,r,s){return Na(e,"POST",t,r,s,n)}async function wf(e,t,n,r,s){return Na(e,"PUT",t,r,s,n)}async function gP(e,t,n,r){return Na(e,"HEAD",t,De(De({},n),{},{noResolveJson:!0}),r)}async function Np(e,t,n,r,s){return Na(e,"DELETE",t,r,s,n)}var yP=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(gt(t))return{data:null,error:t};throw t}}};let Aw;Aw=Symbol.toStringTag;var xP=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Aw]="BlobDownloadBuilder",this.promise=null}asStream(){return new yP(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(gt(t))return{data:null,error:t};throw t}}};const vP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},r0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var _P=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=n,this.fetch=Tp(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(e,t,n,r){var s=this;try{let o;const a=De(De({},r0),r);let c=De(De({},s.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const u=a.metadata;typeof Blob<"u"&&n instanceof Blob?(o=new FormData,o.append("cacheControl",a.cacheControl),u&&o.append("metadata",s.encodeMetadata(u)),o.append("",n)):typeof FormData<"u"&&n instanceof FormData?(o=n,o.has("cacheControl")||o.append("cacheControl",a.cacheControl),u&&!o.has("metadata")&&o.append("metadata",s.encodeMetadata(u))):(o=n,c["cache-control"]=`max-age=${a.cacheControl}`,c["content-type"]=a.contentType,u&&(c["x-metadata"]=s.toBase64(s.encodeMetadata(u))),(typeof ReadableStream<"u"&&o instanceof ReadableStream||o&&typeof o=="object"&&"pipe"in o&&typeof o.pipe=="function")&&!a.duplex&&(a.duplex="half")),r?.headers&&(c=De(De({},c),r.headers));const f=s._removeEmptyFolders(t),p=s._getFinalPath(f),g=await(e=="PUT"?wf:Xn)(s.fetch,`${s.url}/object/${p}`,o,De({headers:c},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:f,id:g.Id,fullPath:g.Key},error:null}}catch(o){if(s.shouldThrowOnError)throw o;if(gt(o))return{data:null,error:o};throw o}}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var s=this;const o=s._removeEmptyFolders(e),a=s._getFinalPath(o),c=new URL(s.url+`/object/upload/sign/${a}`);c.searchParams.set("token",t);try{let u;const f=De({upsert:r0.upsert},r),p=De(De({},s.headers),{"x-upsert":String(f.upsert)});return typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",f.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",f.cacheControl)):(u=n,p["cache-control"]=`max-age=${f.cacheControl}`,p["content-type"]=f.contentType),{data:{path:o,fullPath:(await wf(s.fetch,c.toString(),u,{headers:p})).Key},error:null}}catch(u){if(s.shouldThrowOnError)throw u;if(gt(u))return{data:null,error:u};throw u}}async createSignedUploadUrl(e,t){var n=this;try{let r=n._getFinalPath(e);const s=De({},n.headers);t?.upsert&&(s["x-upsert"]="true");const o=await Xn(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),a=new URL(n.url+o.url),c=a.searchParams.get("token");if(!c)throw new Kc("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:c},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(gt(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 Xn(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers}),error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}async copy(e,t,n){var r=this;try{return{data:{path:(await Xn(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers})).Key},error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}async createSignedUrl(e,t,n){var r=this;try{let s=r._getFinalPath(e),o=await Xn(r.fetch,`${r.url}/object/sign/${s}`,De({expiresIn:t},n?.transform?{transform:n.transform}:{}),{headers:r.headers});const a=n?.download?`&download=${n.download===!0?"":n.download}`:"";return o={signedUrl:encodeURI(`${r.url}${o.signedURL}${a}`)},{data:o,error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}async createSignedUrls(e,t,n){var r=this;try{const s=await Xn(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),o=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:s.map(a=>De(De({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${o}`):null})),error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}download(e,t){const n=typeof t?.transform<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString(t?.transform||{}),s=r?`?${r}`:"",o=this._getFinalPath(e),a=()=>pa(this.fetch,`${this.url}/${n}/${o}${s}`,{headers:this.headers,noResolveJson:!0});return new xP(a,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);try{return{data:bf(await pa(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(gt(r))return{data:null,error:r};throw r}}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await gP(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(gt(r)&&r instanceof _f){const s=r.originalError;if([400,404].includes(s?.status))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=[],s=t?.download?`download=${t.download===!0?"":t.download}`:"";s!==""&&r.push(s);const o=typeof t?.transform<"u"?"render/image":"object",a=this.transformOptsToQueryString(t?.transform||{});a!==""&&r.push(a);let c=r.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${n}${c}`)}}}async remove(e){var t=this;try{return{data:await Np(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async list(e,t,n){var r=this;try{const s=De(De(De({},vP),t),{},{prefix:e||""});return{data:await Xn(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n),error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(gt(s))return{data:null,error:s};throw s}}async listV2(e,t){var n=this;try{const r=De({},e);return{data:await Xn(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(gt(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 Rw="2.91.0",Pw={"X-Client-Info":`storage-js/${Rw}`};var bP=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1;const s=new URL(e);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=De(De({},Pw),t),this.fetch=Tp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(e){var t=this;try{const n=t.listBucketOptionsToQueryString(e);return{data:await pa(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await pa(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async createBucket(e,t={public:!1}){var n=this;try{return{data:await Xn(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(gt(r))return{data:null,error:r};throw r}}async updateBucket(e,t){var n=this;try{return{data:await wf(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(gt(r))return{data:null,error:r};throw r}}async emptyBucket(e){var t=this;try{return{data:await Xn(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Np(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(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():""}},wP=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=De(De({},Pw),t),this.fetch=Tp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await Xn(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(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(),s=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return{data:await pa(t.fetch,s,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Np(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(gt(n))return{data:null,error:n};throw n}}from(e){var t=this;if(!uP(e))throw new Kc("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 oP({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(s,o){const a=s[o];return typeof a!="function"?a:async(...c)=>{try{return{data:await a.apply(s,c),error:null}}catch(u){if(r)throw u;return{data:null,error:u}}}}})}};const Ap={"X-Client-Info":`storage-js/${Rw}`,"Content-Type":"application/json"};var Ow=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function jn(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}var mh=class extends Ow{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}}},kP=class extends Ow{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}};const Rp=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),SP=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)},s0=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),jP=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,s=e;if(typeof s.json=="function")s.json().then(o=>{const a=o?.statusCode||o?.code||r+"";t(new mh(s0(o),r,a))}).catch(()=>{const o=r+"";t(new mh(s.statusText||`HTTP ${r} error`,r,o))});else{const o=r+"";t(new mh(s.statusText||`HTTP ${r} error`,r,o))}}else t(new kP(s0(e),e))},EP=(e,t,n,r)=>{const s={method:e,headers:t?.headers||{}};return r?(SP(r)?(s.headers=De({"Content-Type":"application/json"},t?.headers),s.body=JSON.stringify(r)):s.body=r,De(De({},s),n)):s};async function CP(e,t,n,r,s,o){return new Promise((a,c)=>{e(n,EP(t,r,s,o)).then(u=>{if(!u.ok)throw u;if(r?.noResolveJson)return u;const f=u.headers.get("content-type");return!f||!f.includes("application/json")?{}:u.json()}).then(u=>a(u)).catch(u=>jP(u,c,r))})}async function En(e,t,n,r,s){return CP(e,"POST",t,r,s,n)}var TP=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=De(De({},Ap),t),this.fetch=Rp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(e){var t=this;try{return{data:await En(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(n))return{data:null,error:n};throw n}}async getIndex(e,t){var n=this;try{return{data:await En(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(jn(r))return{data:null,error:r};throw r}}async listIndexes(e){var t=this;try{return{data:await En(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(n))return{data:null,error:n};throw n}}async deleteIndex(e,t){var n=this;try{return{data:await En(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(jn(r))return{data:null,error:r};throw r}}},NP=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=De(De({},Ap),t),this.fetch=Rp(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 En(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(n))return{data:null,error:n};throw n}}async getVectors(e){var t=this;try{return{data:await En(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(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 En(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(n))return{data:null,error:n};throw n}}async queryVectors(e){var t=this;try{return{data:await En(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(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 En(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(n))return{data:null,error:n};throw n}}},AP=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=De(De({},Ap),t),this.fetch=Rp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await En(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await En(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(n))return{data:null,error:n};throw n}}async listBuckets(e={}){var t=this;try{return{data:await En(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await En(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(jn(n))return{data:null,error:n};throw n}}},RP=class extends AP{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new PP(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)}},PP=class extends TP{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,De(De({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,De(De({},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 OP(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},OP=class extends NP{constructor(e,t,n,r,s){super(e,t,s),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,De(De({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,De(De({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,De(De({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,De(De({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,De(De({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},LP=class extends bP{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new _P(this.url,this.headers,e,this.fetch)}get vectors(){return new RP(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new wP(this.url+"/iceberg",this.headers,this.fetch)}};const Lw="2.91.0",ki=30*1e3,kf=3,gh=kf*ki,IP="http://localhost:9999",DP="supabase.auth.token",MP={"X-Client-Info":`gotrue-js/${Lw}`},Sf="X-Supabase-Api-Version",Iw={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},zP=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,FP=600*1e3;class ma extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function Te(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class $P extends ma{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function UP(e){return Te(e)&&e.name==="AuthApiError"}class js extends ma{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Cr extends ma{constructor(t,n,r,s){super(t,r,s),this.name=n,this.status=r}}class kn extends Cr{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function BP(e){return Te(e)&&e.name==="AuthSessionMissingError"}class hi extends Cr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Jl extends Cr{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Xl extends Cr{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 VP(e){return Te(e)&&e.name==="AuthImplicitGrantRedirectError"}class i0 extends Cr{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 qP extends Cr{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 jf extends Cr{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function yh(e){return Te(e)&&e.name==="AuthRetryableFetchError"}class o0 extends Cr{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class Ef extends Cr{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const wc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),a0=`
47
+ \r=`.split(""),HP=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<a0.length;t+=1)e[a0[t].charCodeAt(0)]=-2;for(let t=0;t<wc.length;t+=1)e[wc[t].charCodeAt(0)]=t;return e})();function l0(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(wc[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(wc[r]),t.queuedBits-=6}}function Dw(e,t,n){const r=HP[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 c0(e){const t=[],n=a=>{t.push(String.fromCodePoint(a))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},o=a=>{GP(a,r,n)};for(let a=0;a<e.length;a+=1)Dw(e.charCodeAt(a),s,o);return t.join("")}function KP(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 WP(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}KP(r,t)}}function GP(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 Pi(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)Dw(e.charCodeAt(s),n,r);return new Uint8Array(t)}function JP(e){const t=[];return WP(e,n=>t.push(n)),new Uint8Array(t)}function Ts(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};return e.forEach(s=>l0(s,n,r)),l0(null,n,r),t.join("")}function XP(e){return Math.round(Date.now()/1e3)+e}function YP(){return Symbol("auth-callback")}const Ut=()=>typeof window<"u"&&typeof document<"u",xs={tested:!1,writable:!1},Mw=()=>{if(!Ut())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(xs.tested)return xs.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),xs.tested=!0,xs.writable=!0}catch{xs.tested=!0,xs.writable=!1}return xs.writable};function QP(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,o)=>{t[o]=s})}catch{}return n.searchParams.forEach((r,s)=>{t[s]=r}),t}const zw=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),ZP=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Si=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},vs=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},$t=async(e,t)=>{await e.removeItem(t)};class Wc{constructor(){this.promise=new Wc.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}Wc.promiseConstructor=Promise;function xh(e){const t=e.split(".");if(t.length!==3)throw new Ef("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!zP.test(t[r]))throw new Ef("JWT not in base64url format");return{header:JSON.parse(c0(t[0])),payload:JSON.parse(c0(t[1])),signature:Pi(t[2]),raw:{header:t[0],payload:t[1]}}}async function eO(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function tO(e,t){return new Promise((r,s)=>{(async()=>{for(let o=0;o<1/0;o++)try{const a=await e(o);if(!t(o,null,a)){r(a);return}}catch(a){if(!t(o,a)){s(a);return}}})()})}function nO(e){return("0"+e.toString(16)).substr(-2)}function rO(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let o=0;o<56;o++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(t),Array.from(t,nO).join("")}async function sO(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(o=>String.fromCharCode(o)).join("")}async function iO(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 sO(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function fi(e,t,n=!1){const r=rO();let s=r;n&&(s+="/PASSWORD_RECOVERY"),await Si(e,`${t}-code-verifier`,s);const o=await iO(r);return[o,r===o?"plain":"s256"]}const oO=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function aO(e){const t=e.headers.get(Sf);if(!t||!t.match(oO))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function lO(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 cO(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 uO=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function pi(e){if(!uO.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function vh(){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 dO(e,t){return new Proxy(e,{get:(n,r,s)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const o=r.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,s)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,r,s)}})}function u0(e){return JSON.parse(JSON.stringify(e))}const ks=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),hO=[502,503,504];async function d0(e){var t;if(!ZP(e))throw new jf(ks(e),0);if(hO.includes(e.status))throw new jf(ks(e),e.status);let n;try{n=await e.json()}catch(o){throw new js(ks(o),o)}let r;const s=aO(e);if(s&&s.getTime()>=Iw["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 o0(ks(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new kn}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((o,a)=>o&&typeof a=="string",!0))throw new o0(ks(n),e.status,n.weak_password.reasons);throw new $P(ks(n),e.status||500,r)}const fO=(e,t,n,r)=>{const s={method:e,headers:t?.headers||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function Le(e,t,n,r){var s;const o=Object.assign({},r?.headers);o[Sf]||(o[Sf]=Iw["2024-01-01"].name),r?.jwt&&(o.Authorization=`Bearer ${r.jwt}`);const a=(s=r?.query)!==null&&s!==void 0?s:{};r?.redirectTo&&(a.redirect_to=r.redirectTo);const c=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",u=await pO(e,t,n+c,{headers:o,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(u):{data:Object.assign({},u),error:null}}async function pO(e,t,n,r,s,o){const a=fO(t,r,s,o);let c;try{c=await e(n,Object.assign({},a))}catch(u){throw console.error(u),new jf(ks(u),0)}if(c.ok||await d0(c),r?.noResolveJson)return c;try{return await c.json()}catch(u){await d0(u)}}function Gn(e){var t;let n=null;yO(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=XP(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function h0(e){const t=Gn(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 Qr(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function mO(e){return{data:e,error:null}}function gO(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:o}=e,a=Hc(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:o},u=Object.assign({},a);return{data:{properties:c,user:u},error:null}}function f0(e){return e}function yO(e){return e.access_token&&e.refresh_token&&e.expires_in}const _h=["global","local","others"];class xO{constructor({url:t="",headers:n={},fetch:r}){this.url=t,this.headers=n,this.fetch=zw(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=_h[0]){if(_h.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${_h.join(", ")}`);try{return await Le(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Te(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await Le(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Qr})}catch(r){if(Te(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=Hc(t,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r?.newEmail,delete s.newEmail),await Le(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:gO,redirectTo:n?.redirectTo})}catch(n){if(Te(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Le(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Qr})}catch(n){if(Te(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,s,o,a,c,u;try{const f={nextPage:null,lastPage:0,total:0},p=await Le(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:(o=(s=t?.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:f0});if(p.error)throw p.error;const g=await p.json(),y=(a=p.headers.get("x-total-count"))!==null&&a!==void 0?a:0,v=(u=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(b=>{const w=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);f[`${k}Page`]=w}),f.total=parseInt(y)),{data:Object.assign(Object.assign({},g),f),error:null}}catch(f){if(Te(f))return{data:{users:[]},error:f};throw f}}async getUserById(t){pi(t);try{return await Le(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Qr})}catch(n){if(Te(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){pi(t);try{return await Le(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:Qr})}catch(r){if(Te(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){pi(t);try{return await Le(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:Qr})}catch(r){if(Te(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){pi(t.userId);try{const{data:n,error:r}=await Le(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _deleteFactor(t){pi(t.userId),pi(t.id);try{return{data:await Le(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,s,o,a,c,u;try{const f={nextPage:null,lastPage:0,total:0},p=await Le(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:(o=(s=t?.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:f0});if(p.error)throw p.error;const g=await p.json(),y=(a=p.headers.get("x-total-count"))!==null&&a!==void 0?a:0,v=(u=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(b=>{const w=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);f[`${k}Page`]=w}),f.total=parseInt(y)),{data:Object.assign(Object.assign({},g),f),error:null}}catch(f){if(Te(f))return{data:{clients:[]},error:f};throw f}}async _createOAuthClient(t){try{return await Le(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Le(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Le(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Te(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await Le(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Le(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Te(n))return{data:null,error:n};throw n}}}function p0(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const mi={debug:!!(globalThis&&Mw()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Fw extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class vO extends Fw{}async function _O(e,t,n){mi.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout(()=>{r.abort(),mi.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){mi.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await n()}finally{mi.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}else{if(t===0)throw mi.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new vO(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(mi.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function bO(){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 $w(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function wO(e){return parseInt(e,16)}function kO(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function SO(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:o=new Date,nonce:a,notBefore:c,requestId:u,resources:f,scheme:p,uri:g,version:y}=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(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!g)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(y!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${y}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
48
48
  `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const v=$w(e.address),b=p?`${p}://${r}`:r,w=e.statement?`${e.statement}
49
49
  `:"",k=`${b} wants you to sign in with your Ethereum account:
50
50
  ${v}
@@ -59,17 +59,17 @@ Not Before: ${c.toISOString()}`),u&&(S+=`
59
59
  Request ID: ${u}`),f){let C=`
60
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}`);C+=`
61
61
  - ${j}`}S+=C}return`${k}
62
- ${S}`}class Tt extends Error{constructor({message:t,code:n,cause:r,name:s}){var o;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(o=s??(r instanceof Error?r.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=n}}class kc extends Tt{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function jO({error:e,options:t}){var n,r,s;const{publicKey:o}=t;if(!o)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Tt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=o.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Tt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=o.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Tt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Tt({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 Tt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Tt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return o.pubKeyCredParams.filter(c=>c.type==="public-key").length===0?new Tt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Tt({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 a=window.location.hostname;if(Uw(a)){if(o.rp.id!==a)return new Tt({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Tt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new Tt({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 Tt({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 Tt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function EO({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 Tt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Tt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(Uw(r)){if(n.rpId!==r)return new Tt({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Tt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Tt({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 Tt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class CO{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const TO=new CO;function NO(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,s=Hc(e,["challenge","user","excludeCredentials"]),o=Pi(t).buffer,a=Object.assign(Object.assign({},n),{id:Pi(n.id).buffer}),c=Object.assign(Object.assign({},s),{challenge:o,user:a});if(r&&r.length>0){c.excludeCredentials=new Array(r.length);for(let u=0;u<r.length;u++){const f=r[u];c.excludeCredentials[u]=Object.assign(Object.assign({},f),{id:Pi(f.id).buffer,type:f.type||"public-key",transports:f.transports})}}return c}function AO(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=Hc(e,["challenge","allowCredentials"]),s=Pi(t).buffer,o=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){o.allowCredentials=new Array(n.length);for(let a=0;a<n.length;a++){const c=n[a];o.allowCredentials[a]=Object.assign(Object.assign({},c),{id:Pi(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function RO(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:Ts(new Uint8Array(e.response.attestationObject)),clientDataJSON:Ts(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function PO(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Ts(new Uint8Array(s.authenticatorData)),clientDataJSON:Ts(new Uint8Array(s.clientDataJSON)),signature:Ts(new Uint8Array(s.signature)),userHandle:s.userHandle?Ts(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Uw(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function m0(){var e,t;return!!(Ut()&&"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 OO(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new kc("Browser returned unexpected credential type",t)}:{data:null,error:new kc("Empty credential response",t)}}catch(t){return{data:null,error:jO({error:t,options:e})}}}async function LO(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new kc("Browser returned unexpected credential type",t)}:{data:null,error:new kc("Empty credential response",t)}}catch(t){return{data:null,error:EO({error:t,options:e})}}}const IO={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},DO={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Sc(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of e)if(s)for(const o in s){const a=s[o];if(a!==void 0)if(Array.isArray(a))r[o]=a;else if(n(a))r[o]=a;else if(t(a)){const c=r[o];t(c)?r[o]=Sc(c,a):r[o]=Sc(a)}else r[o]=a}return r}function MO(e,t){return Sc(IO,e,t||{})}function zO(e,t){return Sc(DO,e,t||{})}class FO{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:s},o){try{const{data:a,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!a)return{data:null,error:c};const u=s??TO.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:f}=a.webauthn.credential_options.publicKey;f.name||(f.name=`${f.id}:${r}`),f.displayName||(f.displayName=f.name)}switch(a.webauthn.type){case"create":{const f=MO(a.webauthn.credential_options.publicKey,o?.create),{data:p,error:g}=await OO({publicKey:f,signal:u});return p?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:p}},error:null}:{data:null,error:g}}case"request":{const f=zO(a.webauthn.credential_options.publicKey,o?.request),{data:p,error:g}=await LO(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:f,signal:u}));return p?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:p}},error:null}:{data:null,error:g}}}}catch(a){return Te(a)?{data:null,error:a}:{data:null,error:new js("Unexpected error in challenge",a)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},o){if(!n)return{data:null,error:new ma("rpId is required for WebAuthn authentication")};try{if(!m0())return{data:null,error:new js("Browser does not support WebAuthn",null)};const{data:a,error:c}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:o});if(!a)return{data:null,error:c};const{webauthn:u}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:u.type,rpId:n,rpOrigins:r,credential_response:u.credential_response}})}catch(a){return Te(a)?{data:null,error:a}:{data:null,error:new js("Unexpected error in authenticate",a)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},o){if(!n)return{data:null,error:new ma("rpId is required for WebAuthn registration")};try{if(!m0())return{data:null,error:new js("Browser does not support WebAuthn",null)};const{data:a,error:c}=await this._enroll({friendlyName:t});if(!a)return await this.client.mfa.listFactors().then(p=>{var g;return(g=p.data)===null||g===void 0?void 0:g.all.find(y=>y.factor_type==="webauthn"&&y.friendly_name===t&&y.status!=="unverified")}).then(p=>p?this.client.mfa.unenroll({factorId:p?.id}):void 0),{data:null,error:c};const{data:u,error:f}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:s},{create:o});return u?this._verify({factorId:a.id,challengeId:u.challengeId,webauthn:{rpId:n,rpOrigins:r,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:f}}catch(a){return Te(a)?{data:null,error:a}:{data:null,error:new js("Unexpected error in register",a)}}}}bO();const $O={url:IP,storageKey:DP,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:MP,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function g0(e,t,n){return await n()}const gi={};class ga{get jwks(){var t,n;return(n=(t=gi[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){gi[this.storageKey]=Object.assign(Object.assign({},gi[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=gi[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){gi[this.storageKey]=Object.assign(Object.assign({},gi[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},$O),t);if(this.storageKey=o.storageKey,this.instanceID=(n=ga.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,ga.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Ut()){const a=`${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(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.admin=new xO({url:o.url,headers:o.headers,fetch:o.fetch}),this.url=o.url,this.headers=o.headers,this.fetch=zw(o.fetch),this.lock=o.lock||g0,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&Ut()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=_O:this.lock=g0,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 FO(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?(o.storage?this.storage=o.storage:Mw()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=p0(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=p0(this.memoryStorage)),Ut()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),await this._notifyAllSubscribers(a.data.event,a.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} (${Lw}) ${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(Ut()&&(n=QP(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Ut()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:o}=await this._getSessionFromURL(n,r);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),VP(o)){const u=(t=o.details)===null||t===void 0?void 0:t.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:o}}return{error:o}}const{session:a,redirectType:c}=s;return this._debug("#_initialize()","detected session in URL",a,"redirect type",c),await this._saveSession(a),setTimeout(async()=>{c==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Te(n)?this._returnResult({error:n}):this._returnResult({error:new js("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,s;try{const o=await Oe(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:(s=t?.options)===null||s===void 0?void 0:s.captchaToken}},xform:Kn}),{data:a,error:c}=o;if(c||!a)return this._returnResult({data:{user:null,session:null},error:c});const u=a.session,f=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:f,session:u},error:null})}catch(o){if(Te(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signUp(t){var n,r,s;try{let o;if("email"in t){const{email:p,password:g,options:y}=t;let v=null,b=null;this.flowType==="pkce"&&([v,b]=await fi(this.storage,this.storageKey)),o=await Oe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:y?.emailRedirectTo,body:{email:p,password:g,data:(n=y?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:y?.captchaToken},code_challenge:v,code_challenge_method:b},xform:Kn})}else if("phone"in t){const{phone:p,password:g,options:y}=t;o=await Oe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:p,password:g,data:(r=y?.data)!==null&&r!==void 0?r:{},channel:(s=y?.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:y?.captchaToken}},xform:Kn})}else throw new Jl("You must provide either an email or phone number and a password");const{data:a,error:c}=o;if(c||!a)return await $t(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:c});const u=a.session,f=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:f,session:u},error:null})}catch(o){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithPassword(t){try{let n;if("email"in t){const{email:o,password:a,options:c}=t;n=await Oe(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:a,gotrue_meta_security:{captcha_token:c?.captchaToken}},xform:h0})}else if("phone"in t){const{phone:o,password:a,options:c}=t;n=await Oe(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:a,gotrue_meta_security:{captcha_token:c?.captchaToken}},xform:h0})}else throw new Jl("You must provide either an email or phone number and a password");const{data:r,error:s}=n;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){const o=new hi;return this._returnResult({data:{user:null,session:null},error:o})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,s,o;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(o=t.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,s,o,a,c,u,f,p,g,y;let v,b;if("message"in t)v=t.message,b=t.signature;else{const{chain:w,wallet:k,statement:S,options:C}=t;let j;if(Ut())if(typeof k=="object")j=k;else{const B=window;if("ethereum"in B&&typeof B.ethereum=="object"&&"request"in B.ethereum&&typeof B.ethereum.request=="function")j=B.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!C?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=k}const O=new URL((n=C?.url)!==null&&n!==void 0?n:window.location.href),T=await j.request({method:"eth_requestAccounts"}).then(B=>B).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!T||T.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const N=$w(T[0]);let M=(r=C?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!M){const B=await j.request({method:"eth_chainId"});M=wO(B)}const V={domain:O.host,address:N,statement:S,uri:O.href,version:"1",chainId:M,nonce:(s=C?.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(a=(o=C?.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(c=C?.signInWithEthereum)===null||c===void 0?void 0:c.expirationTime,notBefore:(u=C?.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(f=C?.signInWithEthereum)===null||f===void 0?void 0:f.requestId,resources:(p=C?.signInWithEthereum)===null||p===void 0?void 0:p.resources};v=SO(V),b=await j.request({method:"personal_sign",params:[kO(v),N]})}try{const{data:w,error:k}=await Oe(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:v,signature:b},!((g=t.options)===null||g===void 0)&&g.captchaToken?{gotrue_meta_security:{captcha_token:(y=t.options)===null||y===void 0?void 0:y.captchaToken}}:null),xform:Kn});if(k)throw k;if(!w||!w.session||!w.user){const S=new hi;return this._returnResult({data:{user:null,session:null},error:S})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:k})}catch(w){if(Te(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async signInWithSolana(t){var n,r,s,o,a,c,u,f,p,g,y,v;let b,w;if("message"in t)b=t.message,w=t.signature;else{const{chain:k,wallet:S,statement:C,options:j}=t;let O;if(Ut())if(typeof S=="object")O=S;else{const N=window;if("solana"in N&&typeof N.solana=="object"&&("signIn"in N.solana&&typeof N.solana.signIn=="function"||"signMessage"in N.solana&&typeof N.solana.signMessage=="function"))O=N.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 S!="object"||!j?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");O=S}const T=new URL((n=j?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in O&&O.signIn){const N=await O.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},j?.signInWithSolana),{version:"1",domain:T.host,uri:T.href}),C?{statement:C}:null));let M;if(Array.isArray(N)&&N[0]&&typeof N[0]=="object")M=N[0];else if(N&&typeof N=="object"&&"signedMessage"in N&&"signature"in N)M=N;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in M&&"signature"in M&&(typeof M.signedMessage=="string"||M.signedMessage instanceof Uint8Array)&&M.signature instanceof Uint8Array)b=typeof M.signedMessage=="string"?M.signedMessage:new TextDecoder().decode(M.signedMessage),w=M.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in O)||typeof O.signMessage!="function"||!("publicKey"in O)||typeof O!="object"||!O.publicKey||!("toBase58"in O.publicKey)||typeof O.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${T.host} wants you to sign in with your Solana account:`,O.publicKey.toBase58(),...C?["",C,""]:[""],"Version: 1",`URI: ${T.href}`,`Issued At: ${(s=(r=j?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((o=j?.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${j.signInWithSolana.notBefore}`]:[],...!((a=j?.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${j.signInWithSolana.expirationTime}`]:[],...!((c=j?.signInWithSolana)===null||c===void 0)&&c.chainId?[`Chain ID: ${j.signInWithSolana.chainId}`]:[],...!((u=j?.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${j.signInWithSolana.nonce}`]:[],...!((f=j?.signInWithSolana)===null||f===void 0)&&f.requestId?[`Request ID: ${j.signInWithSolana.requestId}`]:[],...!((g=(p=j?.signInWithSolana)===null||p===void 0?void 0:p.resources)===null||g===void 0)&&g.length?["Resources",...j.signInWithSolana.resources.map(M=>`- ${M}`)]:[]].join(`
63
- `);const N=await O.signMessage(new TextEncoder().encode(b),"utf8");if(!N||!(N instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");w=N}}try{const{data:k,error:S}=await Oe(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:Ts(w)},!((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:Kn});if(S)throw S;if(!k||!k.session||!k.user){const C=new hi;return this._returnResult({data:{user:null,session:null},error:C})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:S})}catch(k){if(Te(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(t){const n=await vs(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new qP;const{data:o,error:a}=await Oe(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:Kn});if(await $t(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!o||!o.session||!o.user){const c=new hi;return this._returnResult({data:{user:null,session:null,redirectType:null},error:c})}return o.session&&(await this._saveSession(o.session),setTimeout(async()=>{await this._notifyAllSubscribers("SIGNED_IN",o.session)},0)),this._returnResult({data:Object.assign(Object.assign({},o),{redirectType:s??null}),error:a})}catch(o){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(o))return this._returnResult({data:{user:null,session:null,redirectType:null},error:o});throw o}}async signInWithIdToken(t){try{const{options:n,provider:r,token:s,access_token:o,nonce:a}=t,c=await Oe(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:o,nonce:a,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Kn}),{data:u,error:f}=c;if(f)return this._returnResult({data:{user:null,session:null},error:f});if(!u||!u.session||!u.user){const p=new hi;return this._returnResult({data:{user:null,session:null},error:p})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:f})}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,s,o,a;try{if("email"in t){const{email:c,options:u}=t;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await fi(this.storage,this.storageKey));const{error:g}=await Oe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:c,data:(n=u?.data)!==null&&n!==void 0?n:{},create_user:(r=u?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:f,code_challenge_method:p},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:g})}if("phone"in t){const{phone:c,options:u}=t,{data:f,error:p}=await Oe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:c,data:(s=u?.data)!==null&&s!==void 0?s:{},create_user:(o=u?.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(a=u?.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:f?.message_id},error:p})}throw new Jl("You must provide either an email or phone number.")}catch(c){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async verifyOtp(t){var n,r;try{let s,o;"options"in t&&(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo,o=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:a,error:c}=await Oe(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:s,xform:Kn});if(c)throw c;if(!a)throw new Error("An error occurred on token verification.");const u=a.session,f=a.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:f,session:u},error:null})}catch(s){if(Te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var n,r,s,o,a;try{let c=null,u=null;this.flowType==="pkce"&&([c,u]=await fi(this.storage,this.storageKey));const f=await Oe(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=t?.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:c,code_challenge_method:u}),headers:this.headers,xform:mO});return!((o=f.data)===null||o===void 0)&&o.url&&Ut()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(f.data.url),this._returnResult(f)}catch(c){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(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 wn;const{error:s}=await Oe(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(Te(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:s,options:o}=t,{error:a}=await Oe(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:o?.captchaToken}},redirectTo:o?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in t){const{phone:r,type:s,options:o}=t,{data:a,error:c}=await Oe(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:o?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a?.message_id},error:c})}throw new Jl("You must provide either an email or phone number and a type")}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await vs(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()<gh:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const a=await vs(this.userStorage,this.storageKey+"-user");a?.user?t.user=a.user:t.user=vh()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=dO(t.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:o}=await this._callRefreshToken(t.refresh_token);return o?this._returnResult({data:{session:null},error:o}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Oe(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Qr}):await this._useSession(async n=>{var r,s,o;const{data:a,error:c}=n;if(c)throw c;return!(!((r=a.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new wn}:await Oe(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&o!==void 0?o:void 0,xform:Qr})})}catch(n){if(Te(n))return BP(n)&&(await this._removeSession(),await $t(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:s,error:o}=r;if(o)throw o;if(!s.session)throw new wn;const a=s.session;let c=null,u=null;this.flowType==="pkce"&&t.email!=null&&([c,u]=await fi(this.storage,this.storageKey));const{data:f,error:p}=await Oe(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:c,code_challenge_method:u}),jwt:a.access_token,xform:Qr});if(p)throw p;return a.user=f.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(r){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(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 wn;const n=Date.now()/1e3;let r=n,s=!0,o=null;const{payload:a}=xh(t.access_token);if(a.exp&&(r=a.exp,s=r<=n),s){const{data:c,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c)return{data:{user:null,session:null},error:null};o=c}else{const{data:c,error:u}=await this._getUser(t.access_token);if(u)throw u;o={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(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return this._returnResult({data:{user:o.user,session:o},error:null})}catch(n){if(Te(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:a,error:c}=n;if(c)throw c;t=(r=a.session)!==null&&r!==void 0?r:void 0}if(!t?.refresh_token)throw new wn;const{data:s,error:o}=await this._callRefreshToken(t.refresh_token);return o?this._returnResult({data:{user:null,session:null},error:o}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){try{if(!Ut())throw new Xl("No browser detected.");if(t.error||t.error_description||t.error_code)throw new Xl(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 i0("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Xl("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 i0("No code detected.");const{data:C,error:j}=await this._exchangeCodeForSession(t.code);if(j)throw j;const O=new URL(window.location.href);return O.searchParams.delete("code"),window.history.replaceState(window.history.state,"",O.toString()),{data:{session:C.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:s,access_token:o,refresh_token:a,expires_in:c,expires_at:u,token_type:f}=t;if(!o||!c||!a||!f)throw new Xl("No session defined in URL");const p=Math.round(Date.now()/1e3),g=parseInt(c);let y=p+g;u&&(y=parseInt(u));const v=y-p;v*1e3<=ki&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${v}s, should have been closer to ${g}s`);const b=y-g;p-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,y,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,y,p);const{data:w,error:k}=await this._getUser(o);if(k)throw k;const S={provider_token:r,provider_refresh_token:s,access_token:o,expires_in:g,expires_at:y,refresh_token:a,token_type:f,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:S,redirectType:t.type},error:null})}catch(r){if(Te(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 vs(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:o}=n;if(o)return this._returnResult({error:o});const a=(r=s.session)===null||r===void 0?void 0:r.access_token;if(a){const{error:c}=await this.admin.signOut(a,t);if(c&&!(UP(c)&&(c.status===404||c.status===401||c.status===403)))return this._returnResult({error:c})}return t!=="others"&&(await this._removeSession(),await $t(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=YP(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,s;try{const{data:{session:o},error:a}=n;if(a)throw a;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",t,"session",o)}catch(o){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",o),console.error(o)}})}async resetPasswordForEmail(t,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await fi(this.storage,this.storageKey,!0));try{return await Oe(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(o))return this._returnResult({data:null,error:o});throw o}}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(Te(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:s}=await this._useSession(async o=>{var a,c,u,f,p;const{data:g,error:y}=o;if(y)throw y;const v=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(c=t.options)===null||c===void 0?void 0:c.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await Oe(this.fetch,"GET",v,{headers:this.headers,jwt:(p=(f=g.session)===null||f===void 0?void 0:f.access_token)!==null&&p!==void 0?p:void 0})});if(s)throw s;return Ut()&&!(!((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(Te(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:o}}=n;if(s)throw s;const{options:a,provider:c,token:u,access_token:f,nonce:p}=t,g=await Oe(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=o?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:c,id_token:u,access_token:f,nonce:p,link_identity:!0,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:Kn}),{data:y,error:v}=g;return v?this._returnResult({data:{user:null,session:null},error:v}):!y||!y.session||!y.user?this._returnResult({data:{user:null,session:null},error:new hi}):(y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("USER_UPDATED",y.session)),this._returnResult({data:y,error:v}))}catch(s){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,s;const{data:o,error:a}=n;if(a)throw a;return await Oe(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(Te(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 tO(async s=>(s>0&&await eO(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await Oe(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Kn})),(s,o)=>{const a=200*Math.pow(2,s);return o&&yh(o)&&Date.now()+a-r<ki})}catch(r){if(this._debug(n,"error",r),Te(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),Ut()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await vs(this.storage,this.storageKey);if(s&&this.userStorage){let a=await vs(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:s.user},await Si(this.userStorage,this.storageKey+"-user",a)),s.user=(t=a?.user)!==null&&t!==void 0?t:vh()}else if(s&&!s.user&&!s.user){const a=await vs(this.storage,this.storageKey+"-user");a&&a?.user?(s.user=a.user,await $t(this.storage,this.storageKey+"-user"),await Si(this.storage,this.storageKey,s)):s.user=vh()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const o=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<gh;if(this._debug(r,`session has${o?"":" not"} expired with margin of ${gh}s`),o){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(console.error(a),yh(a)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:c}=await this._getUser(s.access_token);!c&&a?.user?(s.user=a.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(r,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new wn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new Wc;const{data:o,error:a}=await this._refreshAccessToken(t);if(a)throw a;if(!o.session)throw new wn;await this._saveSession(o.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const c={data:o.session,error:null};return this.refreshingDeferred.resolve(c),c}catch(o){if(this._debug(s,"error",o),Te(o)){const a={data:null,error:o};return yh(o)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(a),a}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(o),o}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,n,r=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const o=[],a=Array.from(this.stateChangeEmitters.values()).map(async c=>{try{await c.callback(t,n)}catch(u){o.push(u)}});if(await Promise.all(a),o.length>0){for(let c=0;c<o.length;c+=1)console.error(o[c]);throw o[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await $t(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 Si(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const o=u0(s);await Si(this.storage,this.storageKey,o)}else{const s=u0(n);await Si(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await $t(this.storage,this.storageKey),await $t(this.storage,this.storageKey+"-code-verifier"),await $t(this.storage,this.storageKey+"-user"),this.userStorage&&await $t(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Ut()&&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(),ki);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-t)/ki);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${ki}ms, refresh threshold is ${kf} ticks`),s<=kf&&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 Fw)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ut()||!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 s=[`provider=${encodeURIComponent(n)}`];if(r?.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[o,a]=await fi(this.storage,this.storageKey),c=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(a)}`});s.push(c.toString())}if(r?.queryParams){const o=new URLSearchParams(r.queryParams);s.push(o.toString())}return r?.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:s,error:o}=n;return o?this._returnResult({data:null,error:o}):await Oe(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,s;const{data:o,error:a}=n;if(a)return this._returnResult({data:null,error:a});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:u,error:f}=await Oe(this.fetch,"POST",`${this.url}/factors`,{body:c,headers:this.headers,jwt:(r=o?.session)===null||r===void 0?void 0:r.access_token});return f?this._returnResult({data:null,error:f}):(t.factorType==="totp"&&u.type==="totp"&&(!((s=u?.totp)===null||s===void 0)&&s.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?RO(t.webauthn.credential_response):PO(t.webauthn.credential_response)})}:{code:t.code}),{data:c,error:u}=await Oe(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:a,headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token});return u?this._returnResult({data:null,error:u}):(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:u}))})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=await Oe(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token});if(a.error)return a;const{data:c}=a;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:NO(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:AO(c.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const o of(t=n?.factors)!==null&&t!==void 0?t:[])s.all.push(o),o.status==="verified"&&s[o.factor_type].push(o);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(){var t,n;const{data:{session:r},error:s}=await this.getSession();if(s)return this._returnResult({data:null,error:s});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=xh(r.access_token);let a=null;o.aal&&(a=o.aal);let c=a;((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=o.amr||[];return{data:{currentLevel:a,nextLevel:c,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?await Oe(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new wn})})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new wn});const a=await Oe(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:c=>({data:c,error:null})});return a.data&&a.data.redirect_url&&Ut()&&!n?.skipBrowserRedirect&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Te(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new wn});const a=await Oe(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:c=>({data:c,error:null})});return a.data&&a.data.redirect_url&&Ut()&&!n?.skipBrowserRedirect&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Te(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 Oe(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new wn})})}catch(t){if(Te(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?(await Oe(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 wn})})}catch(n){if(Te(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 s=Date.now();if(r=this.jwks.keys.find(c=>c.kid===t),r&&this.jwks_cached_at+FP>s)return r;const{data:o,error:a}=await Oe(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=s,r=o.keys.find(c=>c.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:v,error:b}=await this.getSession();if(b||!v.session)return this._returnResult({data:null,error:b});r=v.session.access_token}const{header:s,payload:o,signature:a,raw:{header:c,payload:u}}=xh(r);n?.allowExpired||lO(o.exp);const f=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!f){const{error:v}=await this.getUser(r);if(v)throw v;return{data:{claims:o,header:s,signature:a},error:null}}const p=cO(s.alg),g=await crypto.subtle.importKey("jwk",f,p,!0,["verify"]);if(!await crypto.subtle.verify(p,g,a,JP(`${c}.${u}`)))throw new Ef("Invalid JWT signature");return{data:{claims:o,header:s,signature:a},error:null}}catch(r){if(Te(r))return this._returnResult({data:null,error:r});throw r}}}ga.nextInstanceID={};const UO=ga,BO="2.91.0";let Ho="";typeof Deno<"u"?Ho="deno":typeof document<"u"?Ho="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ho="react-native":Ho="node";const VO={"X-Client-Info":`supabase-js-${Ho}/${BO}`},qO={headers:VO},HO={schema:"public"},KO={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},WO={};function ya(e){"@babel/helpers - typeof";return ya=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},ya(e)}function GO(e,t){if(ya(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ya(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function JO(e){var t=GO(e,"string");return ya(t)=="symbol"?t:t+""}function XO(e,t,n){return(t=JO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function vt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?y0(Object(n),!0).forEach(function(r){XO(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const YO=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),QO=()=>Headers,ZO=(e,t,n)=>{const r=YO(n),s=QO();return async(o,a)=>{var c;const u=(c=await t())!==null&&c!==void 0?c:e;let f=new s(a?.headers);return f.has("apikey")||f.set("apikey",e),f.has("Authorization")||f.set("Authorization",`Bearer ${u}`),r(o,vt(vt({},a),{},{headers:f}))}};function eL(e){return e.endsWith("/")?e:e+"/"}function tL(e,t){var n,r;const{db:s,auth:o,realtime:a,global:c}=e,{db:u,auth:f,realtime:p,global:g}=t,y={db:vt(vt({},u),s),auth:vt(vt({},f),o),realtime:vt(vt({},p),a),storage:{},global:vt(vt(vt({},g),c),{},{headers:vt(vt({},(n=g?.headers)!==null&&n!==void 0?n:{}),(r=c?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?y.accessToken=e.accessToken:delete y.accessToken,y}function nL(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(eL(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var rL=class extends UO{constructor(e){super(e)}},sL=class{constructor(e,t,n){var r,s;this.supabaseUrl=e,this.supabaseKey=t;const o=nL(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",o),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",o),this.storageUrl=new URL("storage/v1",o),this.functionsUrl=new URL("functions/v1",o);const a=`sb-${o.hostname.split(".")[0]}-auth-token`,c={db:HO,realtime:WO,auth:vt(vt({},KO),{},{storageKey:a}),global:qO},u=tL(n??{},c);if(this.storageKey=(r=u.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=u.global.headers)!==null&&s!==void 0?s:{},u.accessToken)this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(p,g)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(g)} is not possible`)}});else{var f;this.auth=this._initSupabaseAuthClient((f=u.auth)!==null&&f!==void 0?f:{},this.headers,u.global.fetch)}this.fetch=ZO(t,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(vt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.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 MR(new URL("rest/v1",o).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new LP(this.storageUrl.href,this.headers,this.fetch,n?.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new PR(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:a,lock:c,debug:u,throwOnError:f},p,g){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new rL({url:this.authUrl.href,headers:vt(vt({},y),p),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:a,lock:c,debug:u,throwOnError:f,fetch:g,hasCustomAuthorizationHeader:Object.keys(this.headers).some(v=>v.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new eP(this.realtimeUrl.href,vt(vt({},e),{},{params:vt(vt({},{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 Bw=(e,t,n)=>new sL(e,t,n);function iL(){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}iL()&&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 Gc="alchemy_supabase_config";function Os(){try{const e=localStorage.getItem(Gc);if(e)return JSON.parse(e)}catch(e){console.error("Error reading Supabase config:",e)}return null}function oL(e){try{localStorage.setItem(Gc,JSON.stringify(e))}catch(t){console.error("Error saving Supabase config:",t)}}function aL(){try{localStorage.removeItem(Gc)}catch(e){console.error("Error clearing Supabase config:",e)}}async function lL(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 s=await fetch(`${e}/rest/v1/`,{method:"GET",headers:{apikey:t,Authorization:`Bearer ${t}`}});return s.ok?{valid:!0}:s.status===401||s.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${s.statusText}`}}catch(n){return{valid:!1,error:n instanceof Error?n.message:"Connection failed"}}}function cL(){return localStorage.getItem(Gc)?"ui":"none"}const Pp=Os(),uL=Pp?.url||void 0||"https://placeholder.supabase.co",dL=Pp?.anonKey||void 0||"placeholder",ae=Bw(uL,dL,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),x0=!!Pp?.url;function hL({length:e=6,value:t,onChange:n,onComplete:r,disabled:s=!1,error:o=!1}){const a=R.useRef([]),[c,u]=R.useState(null),f=(y,v)=>{const b=v.replace(/[^0-9]/g,"");if(b.length===0){const S=t.split("");y<S.length&&S.splice(y,1);const C=S.join("");n(C),y>0&&a.current[y-1]?.focus();return}const w=[...t];w[y]=b[0];const k=w.join("");n(k),y<e-1&&b!==""&&a.current[y+1]?.focus(),k.length===e&&r&&r(k)},p=(y,v)=>{v.key==="Backspace"&&!t[y]&&y>0||v.key==="ArrowLeft"&&y>0?a.current[y-1]?.focus():v.key==="ArrowRight"&&y<e-1&&a.current[y+1]?.focus()},g=y=>{y.preventDefault();const b=y.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,e);n(b);const w=Math.min(b.length,e-1);a.current[w]?.focus(),b.length===e&&r&&r(b)};return h.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:e}).map((y,v)=>h.jsx("input",{ref:b=>{a.current[v]=b},type:"text",inputMode:"numeric",maxLength:1,value:t[v]||"",onChange:b=>f(v,b.target.value),onKeyDown:b=>p(v,b),onPaste:g,onFocus:()=>u(v),onBlur:()=>u(null),disabled:s,className:`
62
+ ${S}`}class Ct extends Error{constructor({message:t,code:n,cause:r,name:s}){var o;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(o=s??(r instanceof Error?r.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=n}}class kc extends Ct{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function jO({error:e,options:t}){var n,r,s;const{publicKey:o}=t;if(!o)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Ct({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=o.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Ct({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=o.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Ct({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Ct({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 Ct({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Ct({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return o.pubKeyCredParams.filter(c=>c.type==="public-key").length===0?new Ct({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Ct({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 a=window.location.hostname;if(Uw(a)){if(o.rp.id!==a)return new Ct({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ct({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new Ct({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 Ct({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 Ct({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function EO({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 Ct({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Ct({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(Uw(r)){if(n.rpId!==r)return new Ct({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ct({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Ct({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 Ct({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class CO{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const TO=new CO;function NO(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,s=Hc(e,["challenge","user","excludeCredentials"]),o=Pi(t).buffer,a=Object.assign(Object.assign({},n),{id:Pi(n.id).buffer}),c=Object.assign(Object.assign({},s),{challenge:o,user:a});if(r&&r.length>0){c.excludeCredentials=new Array(r.length);for(let u=0;u<r.length;u++){const f=r[u];c.excludeCredentials[u]=Object.assign(Object.assign({},f),{id:Pi(f.id).buffer,type:f.type||"public-key",transports:f.transports})}}return c}function AO(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=Hc(e,["challenge","allowCredentials"]),s=Pi(t).buffer,o=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){o.allowCredentials=new Array(n.length);for(let a=0;a<n.length;a++){const c=n[a];o.allowCredentials[a]=Object.assign(Object.assign({},c),{id:Pi(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function RO(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:Ts(new Uint8Array(e.response.attestationObject)),clientDataJSON:Ts(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function PO(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Ts(new Uint8Array(s.authenticatorData)),clientDataJSON:Ts(new Uint8Array(s.clientDataJSON)),signature:Ts(new Uint8Array(s.signature)),userHandle:s.userHandle?Ts(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Uw(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function m0(){var e,t;return!!(Ut()&&"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 OO(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new kc("Browser returned unexpected credential type",t)}:{data:null,error:new kc("Empty credential response",t)}}catch(t){return{data:null,error:jO({error:t,options:e})}}}async function LO(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new kc("Browser returned unexpected credential type",t)}:{data:null,error:new kc("Empty credential response",t)}}catch(t){return{data:null,error:EO({error:t,options:e})}}}const IO={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},DO={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Sc(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of e)if(s)for(const o in s){const a=s[o];if(a!==void 0)if(Array.isArray(a))r[o]=a;else if(n(a))r[o]=a;else if(t(a)){const c=r[o];t(c)?r[o]=Sc(c,a):r[o]=Sc(a)}else r[o]=a}return r}function MO(e,t){return Sc(IO,e,t||{})}function zO(e,t){return Sc(DO,e,t||{})}class FO{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:s},o){try{const{data:a,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!a)return{data:null,error:c};const u=s??TO.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:f}=a.webauthn.credential_options.publicKey;f.name||(f.name=`${f.id}:${r}`),f.displayName||(f.displayName=f.name)}switch(a.webauthn.type){case"create":{const f=MO(a.webauthn.credential_options.publicKey,o?.create),{data:p,error:g}=await OO({publicKey:f,signal:u});return p?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:p}},error:null}:{data:null,error:g}}case"request":{const f=zO(a.webauthn.credential_options.publicKey,o?.request),{data:p,error:g}=await LO(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:f,signal:u}));return p?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:p}},error:null}:{data:null,error:g}}}}catch(a){return Te(a)?{data:null,error:a}:{data:null,error:new js("Unexpected error in challenge",a)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},o){if(!n)return{data:null,error:new ma("rpId is required for WebAuthn authentication")};try{if(!m0())return{data:null,error:new js("Browser does not support WebAuthn",null)};const{data:a,error:c}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:o});if(!a)return{data:null,error:c};const{webauthn:u}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:u.type,rpId:n,rpOrigins:r,credential_response:u.credential_response}})}catch(a){return Te(a)?{data:null,error:a}:{data:null,error:new js("Unexpected error in authenticate",a)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},o){if(!n)return{data:null,error:new ma("rpId is required for WebAuthn registration")};try{if(!m0())return{data:null,error:new js("Browser does not support WebAuthn",null)};const{data:a,error:c}=await this._enroll({friendlyName:t});if(!a)return await this.client.mfa.listFactors().then(p=>{var g;return(g=p.data)===null||g===void 0?void 0:g.all.find(y=>y.factor_type==="webauthn"&&y.friendly_name===t&&y.status!=="unverified")}).then(p=>p?this.client.mfa.unenroll({factorId:p?.id}):void 0),{data:null,error:c};const{data:u,error:f}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:s},{create:o});return u?this._verify({factorId:a.id,challengeId:u.challengeId,webauthn:{rpId:n,rpOrigins:r,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:f}}catch(a){return Te(a)?{data:null,error:a}:{data:null,error:new js("Unexpected error in register",a)}}}}bO();const $O={url:IP,storageKey:DP,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:MP,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function g0(e,t,n){return await n()}const gi={};class ga{get jwks(){var t,n;return(n=(t=gi[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){gi[this.storageKey]=Object.assign(Object.assign({},gi[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=gi[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){gi[this.storageKey]=Object.assign(Object.assign({},gi[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},$O),t);if(this.storageKey=o.storageKey,this.instanceID=(n=ga.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,ga.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Ut()){const a=`${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(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.admin=new xO({url:o.url,headers:o.headers,fetch:o.fetch}),this.url=o.url,this.headers=o.headers,this.fetch=zw(o.fetch),this.lock=o.lock||g0,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&Ut()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=_O:this.lock=g0,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 FO(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?(o.storage?this.storage=o.storage:Mw()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=p0(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=p0(this.memoryStorage)),Ut()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),await this._notifyAllSubscribers(a.data.event,a.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} (${Lw}) ${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(Ut()&&(n=QP(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Ut()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:o}=await this._getSessionFromURL(n,r);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),VP(o)){const u=(t=o.details)===null||t===void 0?void 0:t.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:o}}return{error:o}}const{session:a,redirectType:c}=s;return this._debug("#_initialize()","detected session in URL",a,"redirect type",c),await this._saveSession(a),setTimeout(async()=>{c==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Te(n)?this._returnResult({error:n}):this._returnResult({error:new js("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,s;try{const o=await Le(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:(s=t?.options)===null||s===void 0?void 0:s.captchaToken}},xform:Gn}),{data:a,error:c}=o;if(c||!a)return this._returnResult({data:{user:null,session:null},error:c});const u=a.session,f=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:f,session:u},error:null})}catch(o){if(Te(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signUp(t){var n,r,s;try{let o;if("email"in t){const{email:p,password:g,options:y}=t;let v=null,b=null;this.flowType==="pkce"&&([v,b]=await fi(this.storage,this.storageKey)),o=await Le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:y?.emailRedirectTo,body:{email:p,password:g,data:(n=y?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:y?.captchaToken},code_challenge:v,code_challenge_method:b},xform:Gn})}else if("phone"in t){const{phone:p,password:g,options:y}=t;o=await Le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:p,password:g,data:(r=y?.data)!==null&&r!==void 0?r:{},channel:(s=y?.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:y?.captchaToken}},xform:Gn})}else throw new Jl("You must provide either an email or phone number and a password");const{data:a,error:c}=o;if(c||!a)return await $t(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:c});const u=a.session,f=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:f,session:u},error:null})}catch(o){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithPassword(t){try{let n;if("email"in t){const{email:o,password:a,options:c}=t;n=await Le(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:a,gotrue_meta_security:{captcha_token:c?.captchaToken}},xform:h0})}else if("phone"in t){const{phone:o,password:a,options:c}=t;n=await Le(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:a,gotrue_meta_security:{captcha_token:c?.captchaToken}},xform:h0})}else throw new Jl("You must provide either an email or phone number and a password");const{data:r,error:s}=n;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){const o=new hi;return this._returnResult({data:{user:null,session:null},error:o})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,s,o;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(o=t.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,s,o,a,c,u,f,p,g,y;let v,b;if("message"in t)v=t.message,b=t.signature;else{const{chain:w,wallet:k,statement:S,options:C}=t;let j;if(Ut())if(typeof k=="object")j=k;else{const U=window;if("ethereum"in U&&typeof U.ethereum=="object"&&"request"in U.ethereum&&typeof U.ethereum.request=="function")j=U.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!C?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=k}const O=new URL((n=C?.url)!==null&&n!==void 0?n:window.location.href),T=await j.request({method:"eth_requestAccounts"}).then(U=>U).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!T||T.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const N=$w(T[0]);let M=(r=C?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!M){const U=await j.request({method:"eth_chainId"});M=wO(U)}const V={domain:O.host,address:N,statement:S,uri:O.href,version:"1",chainId:M,nonce:(s=C?.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(a=(o=C?.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(c=C?.signInWithEthereum)===null||c===void 0?void 0:c.expirationTime,notBefore:(u=C?.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(f=C?.signInWithEthereum)===null||f===void 0?void 0:f.requestId,resources:(p=C?.signInWithEthereum)===null||p===void 0?void 0:p.resources};v=SO(V),b=await j.request({method:"personal_sign",params:[kO(v),N]})}try{const{data:w,error:k}=await Le(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:v,signature:b},!((g=t.options)===null||g===void 0)&&g.captchaToken?{gotrue_meta_security:{captcha_token:(y=t.options)===null||y===void 0?void 0:y.captchaToken}}:null),xform:Gn});if(k)throw k;if(!w||!w.session||!w.user){const S=new hi;return this._returnResult({data:{user:null,session:null},error:S})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:k})}catch(w){if(Te(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async signInWithSolana(t){var n,r,s,o,a,c,u,f,p,g,y,v;let b,w;if("message"in t)b=t.message,w=t.signature;else{const{chain:k,wallet:S,statement:C,options:j}=t;let O;if(Ut())if(typeof S=="object")O=S;else{const N=window;if("solana"in N&&typeof N.solana=="object"&&("signIn"in N.solana&&typeof N.solana.signIn=="function"||"signMessage"in N.solana&&typeof N.solana.signMessage=="function"))O=N.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 S!="object"||!j?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");O=S}const T=new URL((n=j?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in O&&O.signIn){const N=await O.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},j?.signInWithSolana),{version:"1",domain:T.host,uri:T.href}),C?{statement:C}:null));let M;if(Array.isArray(N)&&N[0]&&typeof N[0]=="object")M=N[0];else if(N&&typeof N=="object"&&"signedMessage"in N&&"signature"in N)M=N;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in M&&"signature"in M&&(typeof M.signedMessage=="string"||M.signedMessage instanceof Uint8Array)&&M.signature instanceof Uint8Array)b=typeof M.signedMessage=="string"?M.signedMessage:new TextDecoder().decode(M.signedMessage),w=M.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in O)||typeof O.signMessage!="function"||!("publicKey"in O)||typeof O!="object"||!O.publicKey||!("toBase58"in O.publicKey)||typeof O.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${T.host} wants you to sign in with your Solana account:`,O.publicKey.toBase58(),...C?["",C,""]:[""],"Version: 1",`URI: ${T.href}`,`Issued At: ${(s=(r=j?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((o=j?.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${j.signInWithSolana.notBefore}`]:[],...!((a=j?.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${j.signInWithSolana.expirationTime}`]:[],...!((c=j?.signInWithSolana)===null||c===void 0)&&c.chainId?[`Chain ID: ${j.signInWithSolana.chainId}`]:[],...!((u=j?.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${j.signInWithSolana.nonce}`]:[],...!((f=j?.signInWithSolana)===null||f===void 0)&&f.requestId?[`Request ID: ${j.signInWithSolana.requestId}`]:[],...!((g=(p=j?.signInWithSolana)===null||p===void 0?void 0:p.resources)===null||g===void 0)&&g.length?["Resources",...j.signInWithSolana.resources.map(M=>`- ${M}`)]:[]].join(`
63
+ `);const N=await O.signMessage(new TextEncoder().encode(b),"utf8");if(!N||!(N instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");w=N}}try{const{data:k,error:S}=await Le(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:Ts(w)},!((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:Gn});if(S)throw S;if(!k||!k.session||!k.user){const C=new hi;return this._returnResult({data:{user:null,session:null},error:C})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:S})}catch(k){if(Te(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(t){const n=await vs(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new qP;const{data:o,error:a}=await Le(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:Gn});if(await $t(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!o||!o.session||!o.user){const c=new hi;return this._returnResult({data:{user:null,session:null,redirectType:null},error:c})}return o.session&&(await this._saveSession(o.session),setTimeout(async()=>{await this._notifyAllSubscribers("SIGNED_IN",o.session)},0)),this._returnResult({data:Object.assign(Object.assign({},o),{redirectType:s??null}),error:a})}catch(o){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(o))return this._returnResult({data:{user:null,session:null,redirectType:null},error:o});throw o}}async signInWithIdToken(t){try{const{options:n,provider:r,token:s,access_token:o,nonce:a}=t,c=await Le(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:o,nonce:a,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Gn}),{data:u,error:f}=c;if(f)return this._returnResult({data:{user:null,session:null},error:f});if(!u||!u.session||!u.user){const p=new hi;return this._returnResult({data:{user:null,session:null},error:p})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:f})}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,s,o,a;try{if("email"in t){const{email:c,options:u}=t;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await fi(this.storage,this.storageKey));const{error:g}=await Le(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:c,data:(n=u?.data)!==null&&n!==void 0?n:{},create_user:(r=u?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:f,code_challenge_method:p},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:g})}if("phone"in t){const{phone:c,options:u}=t,{data:f,error:p}=await Le(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:c,data:(s=u?.data)!==null&&s!==void 0?s:{},create_user:(o=u?.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(a=u?.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:f?.message_id},error:p})}throw new Jl("You must provide either an email or phone number.")}catch(c){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async verifyOtp(t){var n,r;try{let s,o;"options"in t&&(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo,o=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:a,error:c}=await Le(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:s,xform:Gn});if(c)throw c;if(!a)throw new Error("An error occurred on token verification.");const u=a.session,f=a.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:f,session:u},error:null})}catch(s){if(Te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var n,r,s,o,a;try{let c=null,u=null;this.flowType==="pkce"&&([c,u]=await fi(this.storage,this.storageKey));const f=await Le(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=t?.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:c,code_challenge_method:u}),headers:this.headers,xform:mO});return!((o=f.data)===null||o===void 0)&&o.url&&Ut()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(f.data.url),this._returnResult(f)}catch(c){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(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 kn;const{error:s}=await Le(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(Te(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:s,options:o}=t,{error:a}=await Le(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:o?.captchaToken}},redirectTo:o?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in t){const{phone:r,type:s,options:o}=t,{data:a,error:c}=await Le(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:o?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a?.message_id},error:c})}throw new Jl("You must provide either an email or phone number and a type")}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await vs(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()<gh:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const a=await vs(this.userStorage,this.storageKey+"-user");a?.user?t.user=a.user:t.user=vh()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=dO(t.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:o}=await this._callRefreshToken(t.refresh_token);return o?this._returnResult({data:{session:null},error:o}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Le(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Qr}):await this._useSession(async n=>{var r,s,o;const{data:a,error:c}=n;if(c)throw c;return!(!((r=a.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new kn}:await Le(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&o!==void 0?o:void 0,xform:Qr})})}catch(n){if(Te(n))return BP(n)&&(await this._removeSession(),await $t(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:s,error:o}=r;if(o)throw o;if(!s.session)throw new kn;const a=s.session;let c=null,u=null;this.flowType==="pkce"&&t.email!=null&&([c,u]=await fi(this.storage,this.storageKey));const{data:f,error:p}=await Le(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:c,code_challenge_method:u}),jwt:a.access_token,xform:Qr});if(p)throw p;return a.user=f.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(r){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(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 kn;const n=Date.now()/1e3;let r=n,s=!0,o=null;const{payload:a}=xh(t.access_token);if(a.exp&&(r=a.exp,s=r<=n),s){const{data:c,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c)return{data:{user:null,session:null},error:null};o=c}else{const{data:c,error:u}=await this._getUser(t.access_token);if(u)throw u;o={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(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return this._returnResult({data:{user:o.user,session:o},error:null})}catch(n){if(Te(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:a,error:c}=n;if(c)throw c;t=(r=a.session)!==null&&r!==void 0?r:void 0}if(!t?.refresh_token)throw new kn;const{data:s,error:o}=await this._callRefreshToken(t.refresh_token);return o?this._returnResult({data:{user:null,session:null},error:o}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){try{if(!Ut())throw new Xl("No browser detected.");if(t.error||t.error_description||t.error_code)throw new Xl(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 i0("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Xl("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 i0("No code detected.");const{data:C,error:j}=await this._exchangeCodeForSession(t.code);if(j)throw j;const O=new URL(window.location.href);return O.searchParams.delete("code"),window.history.replaceState(window.history.state,"",O.toString()),{data:{session:C.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:s,access_token:o,refresh_token:a,expires_in:c,expires_at:u,token_type:f}=t;if(!o||!c||!a||!f)throw new Xl("No session defined in URL");const p=Math.round(Date.now()/1e3),g=parseInt(c);let y=p+g;u&&(y=parseInt(u));const v=y-p;v*1e3<=ki&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${v}s, should have been closer to ${g}s`);const b=y-g;p-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,y,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,y,p);const{data:w,error:k}=await this._getUser(o);if(k)throw k;const S={provider_token:r,provider_refresh_token:s,access_token:o,expires_in:g,expires_at:y,refresh_token:a,token_type:f,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:S,redirectType:t.type},error:null})}catch(r){if(Te(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 vs(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:o}=n;if(o)return this._returnResult({error:o});const a=(r=s.session)===null||r===void 0?void 0:r.access_token;if(a){const{error:c}=await this.admin.signOut(a,t);if(c&&!(UP(c)&&(c.status===404||c.status===401||c.status===403)))return this._returnResult({error:c})}return t!=="others"&&(await this._removeSession(),await $t(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=YP(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,s;try{const{data:{session:o},error:a}=n;if(a)throw a;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",t,"session",o)}catch(o){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",o),console.error(o)}})}async resetPasswordForEmail(t,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await fi(this.storage,this.storageKey,!0));try{return await Le(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(o))return this._returnResult({data:null,error:o});throw o}}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(Te(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:s}=await this._useSession(async o=>{var a,c,u,f,p;const{data:g,error:y}=o;if(y)throw y;const v=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(c=t.options)===null||c===void 0?void 0:c.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await Le(this.fetch,"GET",v,{headers:this.headers,jwt:(p=(f=g.session)===null||f===void 0?void 0:f.access_token)!==null&&p!==void 0?p:void 0})});if(s)throw s;return Ut()&&!(!((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(Te(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:o}}=n;if(s)throw s;const{options:a,provider:c,token:u,access_token:f,nonce:p}=t,g=await Le(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=o?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:c,id_token:u,access_token:f,nonce:p,link_identity:!0,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:Gn}),{data:y,error:v}=g;return v?this._returnResult({data:{user:null,session:null},error:v}):!y||!y.session||!y.user?this._returnResult({data:{user:null,session:null},error:new hi}):(y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("USER_UPDATED",y.session)),this._returnResult({data:y,error:v}))}catch(s){if(await $t(this.storage,`${this.storageKey}-code-verifier`),Te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,s;const{data:o,error:a}=n;if(a)throw a;return await Le(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(Te(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 tO(async s=>(s>0&&await eO(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await Le(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Gn})),(s,o)=>{const a=200*Math.pow(2,s);return o&&yh(o)&&Date.now()+a-r<ki})}catch(r){if(this._debug(n,"error",r),Te(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),Ut()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await vs(this.storage,this.storageKey);if(s&&this.userStorage){let a=await vs(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:s.user},await Si(this.userStorage,this.storageKey+"-user",a)),s.user=(t=a?.user)!==null&&t!==void 0?t:vh()}else if(s&&!s.user&&!s.user){const a=await vs(this.storage,this.storageKey+"-user");a&&a?.user?(s.user=a.user,await $t(this.storage,this.storageKey+"-user"),await Si(this.storage,this.storageKey,s)):s.user=vh()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const o=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<gh;if(this._debug(r,`session has${o?"":" not"} expired with margin of ${gh}s`),o){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(console.error(a),yh(a)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:c}=await this._getUser(s.access_token);!c&&a?.user?(s.user=a.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(r,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new kn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new Wc;const{data:o,error:a}=await this._refreshAccessToken(t);if(a)throw a;if(!o.session)throw new kn;await this._saveSession(o.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const c={data:o.session,error:null};return this.refreshingDeferred.resolve(c),c}catch(o){if(this._debug(s,"error",o),Te(o)){const a={data:null,error:o};return yh(o)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(a),a}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(o),o}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,n,r=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const o=[],a=Array.from(this.stateChangeEmitters.values()).map(async c=>{try{await c.callback(t,n)}catch(u){o.push(u)}});if(await Promise.all(a),o.length>0){for(let c=0;c<o.length;c+=1)console.error(o[c]);throw o[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await $t(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 Si(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const o=u0(s);await Si(this.storage,this.storageKey,o)}else{const s=u0(n);await Si(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await $t(this.storage,this.storageKey),await $t(this.storage,this.storageKey+"-code-verifier"),await $t(this.storage,this.storageKey+"-user"),this.userStorage&&await $t(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Ut()&&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(),ki);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-t)/ki);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${ki}ms, refresh threshold is ${kf} ticks`),s<=kf&&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 Fw)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ut()||!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 s=[`provider=${encodeURIComponent(n)}`];if(r?.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[o,a]=await fi(this.storage,this.storageKey),c=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(a)}`});s.push(c.toString())}if(r?.queryParams){const o=new URLSearchParams(r.queryParams);s.push(o.toString())}return r?.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:s,error:o}=n;return o?this._returnResult({data:null,error:o}):await Le(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,s;const{data:o,error:a}=n;if(a)return this._returnResult({data:null,error:a});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:u,error:f}=await Le(this.fetch,"POST",`${this.url}/factors`,{body:c,headers:this.headers,jwt:(r=o?.session)===null||r===void 0?void 0:r.access_token});return f?this._returnResult({data:null,error:f}):(t.factorType==="totp"&&u.type==="totp"&&(!((s=u?.totp)===null||s===void 0)&&s.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?RO(t.webauthn.credential_response):PO(t.webauthn.credential_response)})}:{code:t.code}),{data:c,error:u}=await Le(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:a,headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token});return u?this._returnResult({data:null,error:u}):(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:u}))})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=await Le(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token});if(a.error)return a;const{data:c}=a;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:NO(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:AO(c.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const o of(t=n?.factors)!==null&&t!==void 0?t:[])s.all.push(o),o.status==="verified"&&s[o.factor_type].push(o);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(){var t,n;const{data:{session:r},error:s}=await this.getSession();if(s)return this._returnResult({data:null,error:s});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=xh(r.access_token);let a=null;o.aal&&(a=o.aal);let c=a;((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=o.amr||[];return{data:{currentLevel:a,nextLevel:c,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?await Le(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new kn})})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new kn});const a=await Le(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:c=>({data:c,error:null})});return a.data&&a.data.redirect_url&&Ut()&&!n?.skipBrowserRedirect&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Te(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new kn});const a=await Le(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:c=>({data:c,error:null})});return a.data&&a.data.redirect_url&&Ut()&&!n?.skipBrowserRedirect&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Te(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 Le(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new kn})})}catch(t){if(Te(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?(await Le(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 kn})})}catch(n){if(Te(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 s=Date.now();if(r=this.jwks.keys.find(c=>c.kid===t),r&&this.jwks_cached_at+FP>s)return r;const{data:o,error:a}=await Le(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=s,r=o.keys.find(c=>c.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:v,error:b}=await this.getSession();if(b||!v.session)return this._returnResult({data:null,error:b});r=v.session.access_token}const{header:s,payload:o,signature:a,raw:{header:c,payload:u}}=xh(r);n?.allowExpired||lO(o.exp);const f=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!f){const{error:v}=await this.getUser(r);if(v)throw v;return{data:{claims:o,header:s,signature:a},error:null}}const p=cO(s.alg),g=await crypto.subtle.importKey("jwk",f,p,!0,["verify"]);if(!await crypto.subtle.verify(p,g,a,JP(`${c}.${u}`)))throw new Ef("Invalid JWT signature");return{data:{claims:o,header:s,signature:a},error:null}}catch(r){if(Te(r))return this._returnResult({data:null,error:r});throw r}}}ga.nextInstanceID={};const UO=ga,BO="2.91.0";let Ho="";typeof Deno<"u"?Ho="deno":typeof document<"u"?Ho="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ho="react-native":Ho="node";const VO={"X-Client-Info":`supabase-js-${Ho}/${BO}`},qO={headers:VO},HO={schema:"public"},KO={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},WO={};function ya(e){"@babel/helpers - typeof";return ya=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},ya(e)}function GO(e,t){if(ya(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ya(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function JO(e){var t=GO(e,"string");return ya(t)=="symbol"?t:t+""}function XO(e,t,n){return(t=JO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function vt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?y0(Object(n),!0).forEach(function(r){XO(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const YO=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),QO=()=>Headers,ZO=(e,t,n)=>{const r=YO(n),s=QO();return async(o,a)=>{var c;const u=(c=await t())!==null&&c!==void 0?c:e;let f=new s(a?.headers);return f.has("apikey")||f.set("apikey",e),f.has("Authorization")||f.set("Authorization",`Bearer ${u}`),r(o,vt(vt({},a),{},{headers:f}))}};function eL(e){return e.endsWith("/")?e:e+"/"}function tL(e,t){var n,r;const{db:s,auth:o,realtime:a,global:c}=e,{db:u,auth:f,realtime:p,global:g}=t,y={db:vt(vt({},u),s),auth:vt(vt({},f),o),realtime:vt(vt({},p),a),storage:{},global:vt(vt(vt({},g),c),{},{headers:vt(vt({},(n=g?.headers)!==null&&n!==void 0?n:{}),(r=c?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?y.accessToken=e.accessToken:delete y.accessToken,y}function nL(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(eL(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var rL=class extends UO{constructor(e){super(e)}},sL=class{constructor(e,t,n){var r,s;this.supabaseUrl=e,this.supabaseKey=t;const o=nL(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",o),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",o),this.storageUrl=new URL("storage/v1",o),this.functionsUrl=new URL("functions/v1",o);const a=`sb-${o.hostname.split(".")[0]}-auth-token`,c={db:HO,realtime:WO,auth:vt(vt({},KO),{},{storageKey:a}),global:qO},u=tL(n??{},c);if(this.storageKey=(r=u.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=u.global.headers)!==null&&s!==void 0?s:{},u.accessToken)this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(p,g)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(g)} is not possible`)}});else{var f;this.auth=this._initSupabaseAuthClient((f=u.auth)!==null&&f!==void 0?f:{},this.headers,u.global.fetch)}this.fetch=ZO(t,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(vt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.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 MR(new URL("rest/v1",o).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new LP(this.storageUrl.href,this.headers,this.fetch,n?.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new PR(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:a,lock:c,debug:u,throwOnError:f},p,g){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new rL({url:this.authUrl.href,headers:vt(vt({},y),p),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:a,lock:c,debug:u,throwOnError:f,fetch:g,hasCustomAuthorizationHeader:Object.keys(this.headers).some(v=>v.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new eP(this.realtimeUrl.href,vt(vt({},e),{},{params:vt(vt({},{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 Bw=(e,t,n)=>new sL(e,t,n);function iL(){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}iL()&&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 Gc="alchemy_supabase_config";function Os(){try{const e=localStorage.getItem(Gc);if(e)return JSON.parse(e)}catch(e){console.error("Error reading Supabase config:",e)}return null}function oL(e){try{localStorage.setItem(Gc,JSON.stringify(e))}catch(t){console.error("Error saving Supabase config:",t)}}function aL(){try{localStorage.removeItem(Gc)}catch(e){console.error("Error clearing Supabase config:",e)}}async function lL(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 s=await fetch(`${e}/rest/v1/`,{method:"GET",headers:{apikey:t,Authorization:`Bearer ${t}`}});return s.ok?{valid:!0}:s.status===401||s.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${s.statusText}`}}catch(n){return{valid:!1,error:n instanceof Error?n.message:"Connection failed"}}}function cL(){return localStorage.getItem(Gc)?"ui":"none"}const Pp=Os(),uL=Pp?.url||void 0||"https://placeholder.supabase.co",dL=Pp?.anonKey||void 0||"placeholder",ae=Bw(uL,dL,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),x0=!!Pp?.url;function hL({length:e=6,value:t,onChange:n,onComplete:r,disabled:s=!1,error:o=!1}){const a=R.useRef([]),[c,u]=R.useState(null),f=(y,v)=>{const b=v.replace(/[^0-9]/g,"");if(b.length===0){const S=t.split("");y<S.length&&S.splice(y,1);const C=S.join("");n(C),y>0&&a.current[y-1]?.focus();return}const w=[...t];w[y]=b[0];const k=w.join("");n(k),y<e-1&&b!==""&&a.current[y+1]?.focus(),k.length===e&&r&&r(k)},p=(y,v)=>{v.key==="Backspace"&&!t[y]&&y>0||v.key==="ArrowLeft"&&y>0?a.current[y-1]?.focus():v.key==="ArrowRight"&&y<e-1&&a.current[y+1]?.focus()},g=y=>{y.preventDefault();const b=y.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,e);n(b);const w=Math.min(b.length,e-1);a.current[w]?.focus(),b.length===e&&r&&r(b)};return h.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:e}).map((y,v)=>h.jsx("input",{ref:b=>{a.current[v]=b},type:"text",inputMode:"numeric",maxLength:1,value:t[v]||"",onChange:b=>f(v,b.target.value),onKeyDown:b=>p(v,b),onPaste:g,onFocus:()=>u(v),onBlur:()=>u(null),disabled:s,className:`
64
64
  w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-black
65
65
  bg-black/20 border border-border/50 rounded-xl outline-none transition-all
66
66
  ${o?"border-error/50 shadow-[0_0_15px_rgba(239,68,68,0.1)]":"focus:border-primary/50"}
67
67
  ${c===v?"border-primary/50 bg-black/40 scale-105":""}
68
68
  disabled:opacity-50 disabled:cursor-not-allowed
69
- `,"aria-label":`Digit ${v+1}`},v))})}const bh=[{code:"en",label:"English",flag:"🇺🇸"},{code:"fr",label:"Français",flag:"🇫🇷"},{code:"es",label:"Español",flag:"🇪🇸"},{code:"ko",label:"한국어",flag:"🇰🇷"},{code:"ja",label:"日本語",flag:"🇯🇵"},{code:"vi",label:"Tiếng Việt",flag:"🇻🇳"}];function Op({collapsed:e=!1,position:t="bottom"}){const{i18n:n}=et(),[r,s]=R.useState(!1),o=R.useRef(null),a=bh.find(u=>u.code===n.language)||bh[0];R.useEffect(()=>{const u=f=>{o.current&&!o.current.contains(f.target)&&s(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]);const c=u=>{n.changeLanguage(u),s(!1)};return h.jsxs("div",{className:"relative",ref:o,children:[h.jsxs("button",{onClick:()=>s(!r),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg bg-surface/50 border border-border hover:bg-surface hover:border-primary/30 transition-all text-xs font-medium text-fg/70 ${e?"justify-center px-1.5":""}`,title:e?a.label:void 0,children:[!e&&h.jsx(Cj,{size:14,className:"text-primary"}),h.jsx("span",{children:a.flag}),!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"hidden sm:inline",children:a.label}),h.jsx(Ls,{size:12,className:`transition-transform duration-300 ${r?"rotate-180":""}`})]})]}),h.jsx(Ot,{children:r&&h.jsx(Ue.div,{initial:{opacity:0,y:t==="top"?-10:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:t==="top"?-10:10,scale:.95},className:`absolute ${e?"left-0":"right-0"} ${t==="top"?"bottom-full mb-2":"top-full mt-2"} w-48 bg-surface border border-border rounded-xl shadow-2xl z-[9999] overflow-y-auto max-h-[280px] custom-scrollbar`,children:h.jsx("div",{className:"py-1",children:bh.map(u=>h.jsxs("button",{onClick:()=>c(u.code),className:"flex items-center justify-between w-full px-4 py-2.5 text-xs text-left hover:bg-bg transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("span",{children:u.flag}),h.jsx("span",{className:u.code===n.language?"text-primary font-bold":"text-fg/70",children:u.label})]}),u.code===n.language&&h.jsx(As,{size:14,className:"text-primary"})]},u.code))})})})]})}function fL({onAuthSuccess:e,isInitialized:t=!0}){const{t:n}=et(),[r,s]=R.useState(""),[o,a]=R.useState(""),[c,u]=R.useState(""),[f,p]=R.useState(""),[g,y]=R.useState(!1),[v,b]=R.useState(!t),[w,k]=R.useState(null),[S,C]=R.useState("password"),[j,O]=R.useState("email"),[T,N]=R.useState(""),M=async B=>{B.preventDefault(),y(!0),k(null);try{if(v){const{error:L}=await ae.auth.signUp({email:r,password:o,options:{data:{first_name:c,last_name:f,full_name:`${c} ${f}`.trim()}}});if(L)throw L;e()}else if(S==="password"){const{error:L}=await ae.auth.signInWithPassword({email:r,password:o});if(L)throw L;e()}else if(S==="otp")if(j==="email"){const{error:L}=await ae.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(L)throw L;O("verify")}else await V()}catch(L){k(L.message)}finally{y(!1)}},V=async()=>{y(!0),k(null);try{const{data:B,error:L}=await ae.auth.verifyOtp({email:r,token:T,type:"magiclink"});if(L)throw L;if(!B.session)throw new Error("Failed to create session");e()}catch(B){k(B.message||n("auth.invalid_code"))}finally{y(!1)}};return h.jsx("div",{className:"flex flex-col items-center justify-center p-8 h-full bg-gradient-to-t from-bg to-bg/50",children:h.jsxs(Ue.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-xl glass p-12 space-y-10 relative",children:[h.jsx("div",{className:"absolute top-4 right-4 z-50",children:h.jsx(Op,{position:"bottom"})}),h.jsxs("div",{className:"text-center space-y-2 pt-2",children:[h.jsx("h2",{className:"text-3xl font-black italic tracking-tighter uppercase",children:n(!t&&v?"auth.title_init":v?"auth.title_join":S==="otp"?"auth.title_mystic":"auth.title_login")}),h.jsx("p",{className:"text-xs text-fg/40 font-mono tracking-widest uppercase",children:n(!t&&v?"auth.desc_init":S==="otp"?j==="email"?"auth.desc_mystic_email":"auth.desc_mystic_code":"auth.desc_login")})]}),h.jsx("form",{onSubmit:M,className:"space-y-4",children:h.jsxs(Ot,{mode:"wait",children:[v&&h.jsxs(Ue.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:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:n("auth.first_name")}),h.jsx("input",{type:"text",value:c,onChange:B=>u(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:n("auth.first_name_placeholder"),required:!0})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:n("auth.last_name")}),h.jsx("input",{type:"text",value:f,onChange:B=>p(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:n("auth.last_name_placeholder"),required:!0})]})]},"signup-fields"),S==="otp"&&j==="verify"?h.jsxs(Ue.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6 py-4",children:[h.jsx("div",{className:"flex justify-center",children:h.jsx(hL,{value:T,onChange:N,length:6,onComplete:B=>{N(B)},error:!!w})}),h.jsx("button",{type:"button",onClick:()=>O("email"),className:"w-full text-[10px] font-bold uppercase text-primary/40 hover:text-primary transition-colors tracking-widest",children:n("auth.change_email")}),h.jsxs("button",{type:"button",disabled:g||T.length!==6,onClick:V,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:[g?h.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):h.jsx(Xy,{size:18}),n("auth.verify_code")]})]},"otp-verify"):h.jsxs(Ue.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:n("auth.email_address")}),h.jsxs("div",{className:"relative",children:[h.jsx(Aj,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),h.jsx("input",{type:"email",value:r,onChange:B=>s(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:n("auth.email_placeholder"),required:!0})]})]}),(v||S==="password")&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:n("auth.complexity_key")}),h.jsxs("div",{className:"relative",children:[h.jsx(Nj,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),h.jsx("input",{type:"password",value:o,onChange:B=>a(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:n("auth.password_placeholder"),required:!0})]})]}),h.jsxs("button",{type:"submit",disabled:g,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:[g&&h.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),v?h.jsx(Bj,{size:18}):h.jsx(Xy,{size:18}),n(v?"auth.init_account":S==="otp"?"auth.send_code":"auth.unseal_engine")]})]},"base-login")]})}),w&&S==="password"&&h.jsx(Ue.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:w}),h.jsxs("div",{className:"space-y-4",children:[!v&&h.jsx("div",{className:"flex flex-col gap-2",children:S==="password"?h.jsxs("button",{type:"button",onClick:()=>{C("otp"),O("email"),k(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:[h.jsx(Sj,{size:16})," ",n("auth.sign_in_code")]}):h.jsxs("button",{type:"button",onClick:()=>{C("password"),k(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:[h.jsx(f_,{size:16})," ",n("auth.sign_in_password")]})}),h.jsxs("p",{className:"text-center text-xs text-fg/40",children:[n(v?"auth.already_alchemist":"auth.new_to_alchemy")," "," ",h.jsx("button",{onClick:()=>{b(!v),C("password"),k(null)},className:"text-primary font-bold hover:underline",children:n(v?"auth.login_instead":"auth.create_account")})]})]})]})})}function pL(e){const t=e.trim();return t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}.supabase.co`:""}function mL(e){const t=e.match(/https?:\/\/([^.]+)\.supabase\.co/);return t?t[1]:""}function Vw({onComplete:e,open:t=!0,canClose:n=!1}){const{t:r}=et(),[s,o]=R.useState("welcome"),[a,c]=R.useState(""),[u,f]=R.useState(""),[p,g]=R.useState(""),[y,v]=R.useState(""),[b,w]=R.useState(null),[k,S]=R.useState(!1),[C,j]=R.useState([]),[O,T]=R.useState("idle"),N=R.useRef(null);if(R.useEffect(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[C]),!t)return null;const M=async()=>{w(null),S(!0),o("validating");const L=pL(a),Q=u.trim(),Y=await lL(L,Q);if(Y.valid){oL({url:L,anonKey:Q});try{const K=Bw(L,Q),{data:W,error:ne}=await K.from("init_state").select("is_initialized").single();if(!ne&&W&&W.is_initialized>0){o("success"),setTimeout(()=>{window.location.reload()},1500);return}}catch{console.log("[SetupWizard] init_state check failed, showing migration step")}const he=mL(L);g(he),o("migration"),S(!1)}else w(Y.error||r("common.error")),o("credentials"),S(!1)},V=async()=>{if(!p){w(r("setup.project_id_required"));return}if(!y){w(r("setup.access_token_required"));return}w(null),j([]),T("running"),o("migrating");try{const Q=(await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:p,accessToken:y})})).body?.getReader(),Y=new TextDecoder;if(!Q)throw new Error(r("setup.stream_error"));for(;;){const{done:he,value:K}=await Q.read();if(he)break;const ne=Y.decode(K).split(`
70
- `).filter(re=>re.startsWith("data: "));for(const re of ne)try{const J=JSON.parse(re.slice(6));J.type==="done"?J.data==="success"?(T("success"),o("success"),setTimeout(()=>{window.location.reload()},2e3)):(T("failed"),w(r("setup.migration_failed_logs"))):j(ce=>[...ce,J.data])}catch{}}}catch(L){T("failed"),w(L.message||"Migration failed"),j(Q=>[...Q,`Error: ${L.message}`])}},B=()=>{o("success"),setTimeout(()=>{window.location.reload()},1500)};return h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-bg/80 backdrop-blur-sm",children:h.jsxs(Ue.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"w-full max-w-xl glass p-12 space-y-10 relative",children:[h.jsx("div",{className:"absolute top-4 right-4 z-50",children:h.jsx(Op,{position:"bottom"})}),h.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 pointer-events-none"}),h.jsxs(Ot,{mode:"wait",children:[s==="welcome"&&h.jsxs(Ue.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:h.jsx(sa,{className:"w-6 h-6 text-primary"})}),h.jsx("div",{className:"flex-1",children:h.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:r("setup.welcome_title")})})]}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:r("setup.welcome_desc")})]}),h.jsxs("div",{className:"glass bg-white/5 border-white/10 p-4 rounded-xl space-y-3",children:[h.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-primary/70",children:r("setup.requirements")}),h.jsxs("ul",{className:"space-y-2",children:[h.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[h.jsx(As,{className:"w-4 h-4 text-emerald-500"})," ",r("setup.project_url")]}),h.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[h.jsx(As,{className:"w-4 h-4 text-emerald-500"})," ",r("setup.anon_key")]}),h.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[h.jsx(As,{className:"w-4 h-4 text-emerald-500"})," ",r("account.credentials")]})]})]}),h.jsxs("div",{className:"flex flex-col gap-3",children:[h.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:[r("setup.forge_project")," ",h.jsx(Bi,{size:14})]}),h.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:[r("setup.begin_init")," ",h.jsx(uj,{size:18})]})]})]},"welcome"),s==="credentials"&&h.jsxs(Ue.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:r("setup.credentials_title")}),h.jsx("p",{className:"text-sm text-fg/50 font-medium lowercase",children:r("setup.credentials_desc")})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:r("setup.project_url")}),h.jsx("input",{type:"text",value:a,onChange:L=>c(L.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:r("setup.project_url_placeholder")})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:r("setup.anon_key")}),h.jsx("input",{type:"password",value:u,onChange:L=>f(L.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:r("setup.anon_key_placeholder")})]})]}),b&&h.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[h.jsx(kr,{className:"w-5 h-5 text-error"}),h.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:b})]}),h.jsxs("div",{className:"flex gap-3",children:[h.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:r("common.back")}),h.jsxs("button",{onClick:M,disabled:!a||!u,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:[r("setup.connect_essence")," ",h.jsx(Vt,{size:18})]})]})]},"credentials"),s==="validating"&&h.jsxs(Ue.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[h.jsxs("div",{className:"relative",children:[h.jsx("div",{className:"absolute inset-0 bg-primary/20 blur-xl rounded-full"}),h.jsx(Pt,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),h.jsxs("div",{className:"text-center space-y-2",children:[h.jsx("h3",{className:"text-xl font-bold italic uppercase tracking-tighter",children:r("setup.validating")}),h.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase animate-pulse",children:r("setup.resonance")})]})]},"validating"),s==="migration"&&h.jsxs(Ue.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2 bg-accent/10 rounded-xl",children:h.jsx(uc,{className:"w-6 h-6 text-accent"})}),h.jsx("div",{className:"flex-1",children:h.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:r("setup.init_schema")})})]}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:r("setup.schema_desc")})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:r("setup.project_id")}),h.jsx("input",{type:"text",value:p,onChange:L=>g(L.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all font-mono",placeholder:r("setup.project_id_placeholder")}),h.jsx("p",{className:"text-[10px] text-fg/30 ml-1",children:r("setup.project_id_help")})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:r("setup.access_token")}),h.jsx("input",{type:"password",value:y,onChange:L=>v(L.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all font-mono",placeholder:r("setup.access_token_placeholder")}),h.jsxs("p",{className:"text-[10px] text-fg/30 ml-1",children:["Generate at"," ",h.jsx("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:r("setup.access_token_link")})]})]})]}),b&&h.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[h.jsx(kr,{className:"w-5 h-5 text-error"}),h.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:b})]}),h.jsxs("div",{className:"flex gap-3",children:[h.jsx("button",{onClick:B,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:r("common.skip")}),h.jsxs("button",{onClick:V,disabled:!p||!y,className:"flex-[2] py-4 bg-gradient-to-r from-accent to-primary text-white font-bold rounded-xl shadow-lg glow-accent hover:scale-[1.01] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale flex items-center justify-center gap-2",children:[h.jsx(Ij,{size:18})," ",r("setup.run_migrations")]})]})]},"migration"),s==="migrating"&&h.jsxs(Ue.div,{initial:{opacity:0},animate:{opacity:1},className:"space-y-6",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(Pt,{className:"w-6 h-6 animate-spin text-accent"}),h.jsx("h2",{className:"text-xl font-black italic tracking-tighter uppercase",children:r("setup.running_migrations")})]}),h.jsx("p",{className:"text-sm text-fg/40",children:r("setup.take_minute")})]}),h.jsxs("div",{className:"bg-black/40 border border-border/20 rounded-xl p-4 h-64 overflow-y-auto font-mono text-xs",children:[C.map((L,Q)=>h.jsx("div",{className:`py-0.5 ${L.includes("✅")||L.includes("SUCCESS")?"text-emerald-400":L.includes("❌")||L.includes("Error")?"text-red-400":L.includes("⚠️")?"text-amber-400":"text-fg/60"}`,children:L},Q)),h.jsx("div",{ref:N})]}),O==="failed"&&h.jsxs("div",{className:"flex gap-3",children:[h.jsxs("button",{onClick:()=>o("migration"),className:"flex-1 py-3 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/40",children:[h.jsx(f_,{size:14,className:"inline mr-2"})," ",r("setup.back")]}),h.jsx("button",{onClick:V,className:"flex-1 py-3 bg-accent/20 border border-accent/30 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-accent/30 transition-all text-accent",children:r("setup.retry")})]})]},"migrating"),s==="success"&&h.jsxs(Ue.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:[h.jsx("div",{className:"p-4 bg-emerald-500/20 rounded-full",children:h.jsx(Ns,{className:"w-16 h-16 text-emerald-500"})}),h.jsxs("div",{className:"text-center space-y-2",children:[h.jsx("h3",{className:"text-2xl font-black italic uppercase tracking-tighter",children:r("setup.engine_aligned")}),h.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase",children:r("setup.restarting")})]})]},"success")]})]})})}const Gr={chrome:{icon:h.jsx(Gy,{size:18}),name:"Google Chrome",color:"text-yellow-500"},firefox:{icon:h.jsx(Oo,{size:18}),name:"Mozilla Firefox",color:"text-orange-500"},safari:{icon:h.jsx(Oo,{size:18}),name:"Safari",color:"text-blue-500"},edge:{icon:h.jsx(Oo,{size:18}),name:"Microsoft Edge",color:"text-cyan-500"},brave:{icon:h.jsx(Vt,{size:18}),name:"Brave",color:"text-orange-400"},arc:{icon:h.jsx(Vt,{size:18}),name:"Arc",color:"text-purple-500"},vivaldi:{icon:h.jsx(Oo,{size:18}),name:"Vivaldi",color:"text-red-500"},opera:{icon:h.jsx(Oo,{size:18}),name:"Opera",color:"text-red-400"},"opera-gx":{icon:h.jsx(Vt,{size:18}),name:"Opera GX",color:"text-pink-500"},chromium:{icon:h.jsx(Gy,{size:18}),name:"Chromium",color:"text-blue-400"}};function gL({sources:e,onChange:t}){const{t:n}=et(),[r,s]=R.useState(!1),[o,a]=R.useState({}),[c,u]=R.useState(""),[f,p]=R.useState("chrome"),[g,y]=R.useState(!1),v=async()=>{s(!0);try{const{data:C}=await Xe.get("/api/browser-paths/detect");a(C)}catch(C){console.error("Detection failed:",C)}finally{s(!1)}},b=C=>{const j=o[C];if(!j||!j.found||!j.valid||e.find(N=>N.browser===C&&N.path===j.path))return;const T={browser:C,path:j.path,enabled:!0,label:`${Gr[C].name} (${n("engine.auto_detected")})`};t([...e,T])},w=async()=>{if(c.trim()){y(!0);try{const{data:C}=await Xe.post("/api/browser-paths/validate",{path:c});if(!C.valid){alert(n("engine.invalid_path",{error:C.error||n("engine.not_a_browser_db")})),y(!1);return}const j={browser:f,path:c,enabled:!0,label:`${Gr[f].name} (${n("engine.custom")})`};t([...e,j]),u("")}catch(C){console.error("Validation failed:",C),alert(n("engine.validation_failed"))}finally{y(!1)}}},k=C=>{const j=[...e];j[C].enabled=!j[C].enabled,t(j)},S=C=>{t(e.filter((j,O)=>O!==C))};return h.jsxs("div",{className:"space-y-6",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(ia,{size:14})," ",n("engine.auto_detect_title")]}),h.jsxs("button",{onClick:v,disabled:r,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:[r?h.jsx(Pt,{size:12,className:"animate-spin"}):h.jsx(ia,{size:12}),n(r?"engine.scanning":"engine.scan_system")]})]}),Object.keys(o).length>0&&h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.keys(Gr).map(C=>{const j=o[C],O=Gr[C],T=e.some(N=>N.browser===C&&N.path===j?.path);return h.jsxs(Ue.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`glass p-4 rounded-xl border ${j?.found&&j?.valid?"border-success/20 bg-success/5":j?.found?"border-error/20 bg-error/5":"border-border/10"}`,children:[h.jsxs("div",{className:"flex items-start justify-between mb-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:O.color,children:O.icon}),h.jsx("span",{className:"text-sm font-bold",children:O.name})]}),j?.found&&j?.valid?h.jsx(As,{size:16,className:"text-success"}):j?.found?h.jsx(kr,{size:16,className:"text-error"}):h.jsx(Tn,{size:16,className:"text-fg/20"})]}),j?.found?h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate mb-2",children:j.path}),j.valid?h.jsx("button",{onClick:()=>b(C),disabled:T,className:`w-full py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${T?"bg-fg/5 text-fg/30 cursor-not-allowed":"bg-success/10 hover:bg-success/20 text-success"}`,children:n(T?"engine.already_added":"engine.add_source")}):h.jsx("p",{className:"text-[10px] text-error font-medium",children:j.error})]}):h.jsx("p",{className:"text-[10px] text-fg/30 italic",children:n("engine.not_found")})]},C)})})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(wj,{size:14})," ",n("engine.add_custom_path")]}),h.jsxs("div",{className:"glass p-4 rounded-xl space-y-3",children:[h.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[h.jsx("select",{value:f,onChange:C=>p(C.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(Gr).map(C=>h.jsx("option",{value:C,children:Gr[C].name},C))}),h.jsx("input",{type:"text",value:c,onChange:C=>u(C.target.value),placeholder:n("engine.custom_path_placeholder"),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"})]}),h.jsxs("button",{onClick:w,disabled:!c.trim()||g,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:[g?h.jsx(Pt,{size:16,className:"animate-spin"}):h.jsx($f,{size:16}),n(g?"engine.validating":"engine.add_custom_source")]})]})]}),e.length>0&&h.jsxs("div",{className:"space-y-3",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("engine.configured_sources",{count:e.length})}),h.jsx("div",{className:"space-y-2",children:h.jsx(Ot,{children:e.map((C,j)=>h.jsxs(Ue.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 ${!C.enabled&&"opacity-50"}`,children:[h.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[h.jsx("div",{className:Gr[C.browser].color,children:Gr[C.browser].icon}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-sm font-bold",children:C.label}),h.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate",children:C.path})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:()=>k(j),className:`px-3 py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${C.enabled?"bg-success/10 text-success":"bg-fg/5 text-fg/40"}`,children:C.enabled?n("engine.enabled"):n("engine.disabled")}),h.jsx("button",{onClick:()=>S(j),className:"p-2 hover:bg-error/10 text-error rounded-lg transition-all",children:h.jsx(Tn,{size:16})})]})]},`${C.browser}-${C.path}`))})})]})]})}const qw=R.createContext(void 0);function yL({children:e}){const[t,n]=R.useState([]),r=R.useCallback((s,o="info")=>{const a=Math.random().toString(36).substr(2,9),c={id:a,type:o,message:s};n(u=>[...u,c]),setTimeout(()=>{n(u=>u.filter(f=>f.id!==a))},3e3)},[]);return h.jsxs(qw.Provider,{value:{showToast:r},children:[e,h.jsx(xL,{toasts:t})]})}function Jc(){const e=R.useContext(qw);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function xL({toasts:e}){return h.jsx("div",{className:"fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none",children:h.jsx(Ot,{children:e.map(t=>h.jsx(vL,{toast:t},t.id))})})}function vL({toast:e}){const t={success:h.jsx(As,{size:18,className:"text-success"}),error:h.jsx(Tn,{size:18,className:"text-error"}),warning:h.jsx(kr,{size:18,className:"text-accent"}),info:h.jsx(v_,{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 h.jsxs(Ue.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],h.jsx("span",{className:"text-sm font-medium flex-1",children:e.message})]})}const Hw=new Set(["login","log in","log-in","signin","sign in","sign-in","signup","sign up","sign-up","authentication","auth","password","register","registration","oauth","sso","navigation","menu","footer","header","sidebar","nav","breadcrumb","cookie","cookies","consent","privacy","terms","sitemap","ui","ux","user interface","interface","button","form","modal","popup","banner","facebook","meta","instagram","twitter","x","linkedin","tiktok","youtube","google","google drive","gmail","apple","icloud","microsoft","office","outlook","teams","pinterest","reddit","whatsapp","messenger","slack","discord","zoom","dropbox","notion","figma","github","gitlab","social media","social network","social","share","like","follow","post","error","not found","404","403","500","access denied","no content","empty","page not found","unavailable","blocked","forbidden","unauthorized","website","web page","webpage","page","site","web","app","application","download","install","home","homepage","main","index","default","about","contact","help","support","faq","blog","news","article"]);function _L(){const{t:e}=et(),{showToast:t}=Jc(),[n,r]=R.useState("realtimexai"),[s,o]=R.useState("gpt-4.1-mini"),[a,c]=R.useState("realtimexai"),[u,f]=R.useState("text-embedding-3-small"),[p,g]=R.useState([]),[y,v]=R.useState([]),[b,w]=R.useState([]),[k,S]=R.useState(!1),[C,j]=R.useState(!1),[O,T]=R.useState(!1),[N,M]=R.useState(!1),[V,B]=R.useState(!1),[L,Q]=R.useState(!1),[Y,he]=R.useState(null),[K,W]=R.useState([]),[ne,re]=R.useState([]);R.useEffect(()=>{J().then(ee=>{ce(ee)}),Qn()},[]);const J=async()=>{const ee={llmProvider:"realtimexai",llmModel:"gpt-4.1-mini",embeddingProvider:"realtimexai",embeddingModel:"text-embedding-3-small"},{data:{user:De}}=await ae.auth.getUser();if(!De)return ee;const{data:te}=await ae.from("alchemy_settings").select("*").eq("user_id",De.id).maybeSingle();if(te){const ge=te.llm_provider||ee.llmProvider,je=te.llm_model||ee.llmModel,be=te.embedding_provider||ee.embeddingProvider,Fe=te.embedding_model||ee.embeddingModel;r(ge),o(je),c(be),f(Fe),g(te.custom_browser_paths||[]),v(te.blacklist_domains||[]);const Se=te.blocked_tags||[];return Se.length>0?w(Se):w(Array.from(Hw)),{llmProvider:ge,llmModel:je,embeddingProvider:be,embeddingModel:Fe}}else{const ge=new Date(Date.now()-2592e6).toISOString();let je=[];try{const{data:Fe}=await Xe.get("/api/browser-paths/auto-discover");Fe.success&&(je=Fe.sources)}catch(Fe){console.warn("[AlchemistEngine] Auto-discovery failed:",Fe)}const{data:be}=await ae.from("alchemy_settings").insert({user_id:De.id,llm_provider:ee.llmProvider,llm_model:ee.llmModel,embedding_provider:ee.embeddingProvider,embedding_model:ee.embeddingModel,max_urls_per_sync:50,sync_mode:"incremental",sync_start_date:ge,custom_browser_paths:je}).select().single();return be&&g(be.custom_browser_paths||[]),ee}},ce=async ee=>{const De=ee?.llmProvider||"realtimexai",te=ee?.llmModel||"gpt-4.1-mini",ge=ee?.embeddingProvider||"realtimexai",je=ee?.embeddingModel||"text-embedding-3-small";try{const[be,Fe]=await Promise.all([Xe.get("/api/sdk/providers/chat",{timeout:65e3}),Xe.get("/api/sdk/providers/embed",{timeout:65e3})]);if(be.data.success&&Fe.data.success){const Se=be.data.providers||[],Qe=Fe.data.providers||[];if(he({chat:Se,embed:Qe}),Q(!0),console.log("[AlchemistEngine] SDK providers loaded"),console.log(" Chat providers:",Se.map(tt=>tt.provider)),console.log(" Embed providers:",Qe.map(tt=>tt.provider)),Se.length>0){const tt=Se.some(nt=>nt.provider===De);if(tt){const nt=Se.find(le=>le.provider===De);!nt?.models?.some(le=>le.id===te)&&nt?.models?.length>0&&o(nt.models[0].id)}else{const nt=Se[0];r(nt.provider),nt.models?.length>0&&o(nt.models[0].id)}D(tt?De:Se[0].provider,Se)}if(Qe.length>0){const tt=Qe.some(nt=>nt.provider===ge);if(tt){const nt=Qe.find(le=>le.provider===ge);!nt?.models?.some(le=>le.id===je)&&nt?.models?.length>0&&f(nt.models[0].id)}else{const nt=Qe[0];c(nt.provider),nt.models?.length>0&&f(nt.models[0].id)}A(tt?ge:Qe[0].provider,Qe)}}}catch{console.log("[AlchemistEngine] SDK not available"),Q(!1)}},A=(ee,De)=>{if(De&&Array.isArray(De)){const ge=De.find(je=>je.provider===ee);if(ge&&ge.models){const je=ge.models.map(be=>be.id);console.log(`[AlchemistEngine] Using SDK embedding models for ${ee}:`,je),W(je);return}}console.log(`[AlchemistEngine] Using hardcoded embedding models for ${ee}`);const te=[];ee==="realtimexai"||ee==="openai"?te.push("text-embedding-3-small","text-embedding-3-large","text-embedding-ada-002"):ee==="gemini"&&te.push("embedding-001"),W(te)},D=(ee,De)=>{if(De&&Array.isArray(De)){const ge=De.find(je=>je.provider===ee);if(ge&&ge.models){const je=ge.models.map(be=>be.id);console.log(`[AlchemistEngine] Using SDK chat models for ${ee}:`,je),re(je);return}}console.log(`[AlchemistEngine] Using hardcoded chat models for ${ee}`);const te=[];ee==="realtimexai"||ee==="openai"?te.push("gpt-4o","gpt-4o-mini","gpt-4-turbo","gpt-3.5-turbo"):ee==="anthropic"?te.push("claude-3-5-sonnet-20241022","claude-3-5-haiku-20241022","claude-3-opus-20240229"):ee==="google"?te.push("gemini-2.0-flash-exp","gemini-1.5-pro","gemini-1.5-flash"):ee==="ollama"&&te.push("llama3","mistral","codellama","phi"),re(te)},G=async()=>{S(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t(e("engine.save_error_login"),"error"),S(!1);return}const{error:De}=await ae.from("alchemy_settings").upsert({user_id:ee.id,llm_provider:n,llm_model:s,embedding_provider:a,embedding_model:u,customized_at:new Date().toISOString()},{onConflict:"user_id"});De?(console.error("[AlchemistEngine] Save error:",De),t(`${e("common.error")}: ${De.message}`,"error")):t(e("engine.save_success_llm"),"success")}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{S(!1)}},P=async()=>{j(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t(e("engine.save_error_login"),"error"),j(!1);return}const{error:De}=await ae.from("alchemy_settings").upsert({user_id:ee.id,custom_browser_paths:p},{onConflict:"user_id"});De?(console.error("[AlchemistEngine] Save browser sources error:",De),t(`${e("common.error")}: ${De.message}`,"error")):t(e("engine.save_success_browser"),"success")}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{j(!1)}},_e=async()=>{T(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t(e("engine.save_error_login"),"error"),T(!1);return}const De=y.filter(ge=>ge.trim().length>0),{error:te}=await ae.from("alchemy_settings").upsert({user_id:ee.id,blacklist_domains:De},{onConflict:"user_id"});te?(console.error("[AlchemistEngine] Save blacklist error:",te),t(`${e("common.error")}: ${te.message}`,"error")):(t(e("engine.save_success_blacklist"),"success"),await J())}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{T(!1)}},me=async()=>{M(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t(e("engine.save_error_login"),"error"),M(!1);return}const De=b.filter(ge=>ge.trim().length>0),{error:te}=await ae.from("alchemy_settings").upsert({user_id:ee.id,blocked_tags:De},{onConflict:"user_id"});te?(console.error("[AlchemistEngine] Save blocked tags error:",te),t(`${e("common.error")}: ${te.message}`,"error")):(t(e("engine.save_success_tags"),"success"),await J())}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{M(!1)}},[ye,Ne]=R.useState(""),[pe,Be]=R.useState(""),[st,bt]=R.useState(!1),Qn=async()=>{const{data:{user:ee}}=await ae.auth.getUser();if(!ee)return;const{data:De}=await ae.from("user_persona").select("*").eq("user_id",ee.id).maybeSingle();De&&(Ne(De.interest_summary||""),Be(De.anti_patterns||""))},Zn=async()=>{bt(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t("Please log in to save persona","error"),bt(!1);return}const{error:De}=await ae.from("user_persona").upsert({user_id:ee.id,interest_summary:ye,anti_patterns:pe,last_updated_at:new Date().toISOString()},{onConflict:"user_id"});De?(console.error("[AlchemistEngine] Save persona error:",De),t(`${e("common.error")}: ${De.message}`,"error")):t(e("engine.save_success_persona"),"success")}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{bt(!1)}},er=async()=>{B(!0);try{const{data:ee}=await Xe.post("/api/llm/test",{baseUrl,modelName,apiKey});ee.success?t(e("engine.test_success",{model:ee.model||""}),"success"):t(`${e("engine.test_fail",{message:ee.message})}`,"error")}catch(ee){console.error("[AlchemistEngine] Test error:",ee),t(`Test failed: ${ee.message}`,"error")}finally{B(!1)}};return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsxs("header",{className:"px-8 py-6 border-b border-border",children:[h.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e("engine.title")}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:e("engine.subtitle")})]}),h.jsx("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:h.jsxs("div",{className:"max-w-7xl mx-auto animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"space-y-6 mb-8",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(x_,{size:14})," ",e("engine.configuration")]}),h.jsxs("div",{className:"flex gap-3",children:[h.jsxs("button",{onClick:er,disabled:V||k,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:[V?h.jsx(Pt,{size:18,className:"animate-spin"}):h.jsx(Vt,{size:18,className:"text-accent"}),e("engine.test_connection")]}),h.jsxs("button",{onClick:G,disabled:k,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:[k?h.jsx(Pt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_config")]})]})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[h.jsxs("div",{className:"glass p-6 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("h3",{className:"text-sm font-semibold text-fg/80",children:e("engine.llm_provider")}),L?h.jsxs("span",{className:"text-xs text-green-500 flex items-center gap-1",children:[h.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full"}),e("engine.sdk_connected")]}):h.jsxs("span",{className:"text-xs text-orange-500 flex items-center gap-1",children:[h.jsx("span",{className:"w-2 h-2 bg-orange-500 rounded-full"}),e("engine.sdk_not_available")]})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-xs font-medium text-fg/60",children:e("engine.provider")}),h.jsx("select",{value:n,onChange:ee=>{r(ee.target.value),D(ee.target.value,Y?.chat)},className:"w-full px-4 py-3 bg-surface border border-border rounded-xl text-fg focus:outline-none focus:ring-2 focus:ring-primary/50",children:Y?.chat&&Y.chat.length>0?Y.chat.map(ee=>h.jsx("option",{value:ee.provider,children:ee.provider==="realtimexai"?"RealTimeX.AI":ee.provider.charAt(0).toUpperCase()+ee.provider.slice(1)},ee.provider)):h.jsx("option",{value:"",disabled:!0,children:e("engine.loading_providers")})})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-xs font-medium text-fg/60",children:e("engine.intelligence_model")}),h.jsx("select",{value:s,onChange:ee=>o(ee.target.value),className:"w-full px-4 py-3 bg-surface border border-border rounded-xl text-fg focus:outline-none focus:ring-2 focus:ring-primary/50",children:ne.length>0?ne.map(ee=>h.jsx("option",{value:ee,children:ee},ee)):h.jsxs(h.Fragment,{children:[h.jsx("option",{value:"gpt-4o",children:"gpt-4o"}),h.jsx("option",{value:"gpt-4o-mini",children:"gpt-4o-mini"}),h.jsx("option",{value:"gpt-4-turbo",children:"gpt-4-turbo"})]})})]}),h.jsx("div",{className:"p-3 bg-primary/5 rounded-xl",children:h.jsx("p",{className:"text-[10px] text-primary/60 font-medium leading-relaxed",children:e(L?"engine.sdk_info_success":"engine.sdk_info_fail")})})]}),h.jsxs("div",{className:"glass p-6 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("h3",{className:"text-sm font-semibold text-fg/80",children:e("engine.embedding_provider")}),L?h.jsxs("span",{className:"text-xs text-green-500 flex items-center gap-1",children:[h.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full"}),e("engine.sdk_connected")]}):h.jsxs("span",{className:"text-xs text-orange-500 flex items-center gap-1",children:[h.jsx("span",{className:"w-2 h-2 bg-orange-500 rounded-full"}),e("engine.sdk_not_available")]})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-xs font-medium text-fg/60",children:e("engine.provider")}),h.jsx("select",{value:a,onChange:ee=>{c(ee.target.value),A(ee.target.value,Y?.embed)},className:"w-full px-4 py-3 bg-surface border border-border rounded-xl text-fg focus:outline-none focus:ring-2 focus:ring-primary/50",children:Y?.embed&&Y.embed.length>0?Y.embed.map(ee=>h.jsx("option",{value:ee.provider,children:ee.provider==="realtimexai"?"RealTimeX.AI":ee.provider.charAt(0).toUpperCase()+ee.provider.slice(1)},ee.provider)):h.jsx("option",{value:"",disabled:!0,children:e("engine.loading_providers")})})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-xs font-medium text-fg/60",children:e("engine.embedding_model")}),h.jsx("select",{value:u,onChange:ee=>f(ee.target.value),className:"w-full px-4 py-3 bg-surface border border-border rounded-xl text-fg focus:outline-none focus:ring-2 focus:ring-primary/50",children:K.length>0?K.map(ee=>h.jsx("option",{value:ee,children:ee},ee)):h.jsxs(h.Fragment,{children:[h.jsx("option",{value:"text-embedding-3-small",children:"text-embedding-3-small"}),h.jsx("option",{value:"text-embedding-3-large",children:"text-embedding-3-large"}),h.jsx("option",{value:"text-embedding-ada-002",children:"text-embedding-ada-002"})]})})]}),h.jsx("div",{className:"p-3 bg-primary/5 rounded-xl",children:h.jsx("p",{className:"text-[10px] text-primary/60 font-medium leading-relaxed",children:e(L?"engine.embedding_info_success":"engine.embedding_info_fail")})})]})]})]}),h.jsxs("section",{className:"space-y-6 mb-8",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx("span",{className:"text-xl",children:"🧠"})," ",e("engine.persona_title")]}),h.jsxs("button",{onClick:Zn,disabled:st,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:[st?h.jsx(Pt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_memory")]})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[h.jsxs("div",{className:"glass p-6 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("h3",{className:"text-sm font-semibold text-fg/80",children:e("engine.interests_title")}),h.jsx("span",{className:"text-xs text-green-500 bg-green-500/10 px-2 py-1 rounded-full border border-green-500/20",children:e("engine.interests_priority")})]}),h.jsx("p",{className:"text-xs text-fg/50 leading-relaxed",children:e("engine.interests_desc")}),h.jsx("textarea",{value:ye,onChange:ee=>Ne(ee.target.value),placeholder:e("engine.interests_placeholder"),className:"w-full h-32 px-4 py-3 bg-surface border border-border rounded-xl text-sm text-fg placeholder:text-fg/40 focus:outline-none focus:ring-2 focus:ring-green-500/30 resize-none"})]}),h.jsxs("div",{className:"glass p-6 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("h3",{className:"text-sm font-semibold text-fg/80",children:e("engine.antipatterns_title")}),h.jsx("span",{className:"text-xs text-red-400 bg-red-500/10 px-2 py-1 rounded-full border border-red-500/20",children:e("engine.antipatterns_priority")})]}),h.jsx("p",{className:"text-xs text-fg/50 leading-relaxed",children:e("engine.antipatterns_desc")}),h.jsx("textarea",{value:pe,onChange:ee=>Be(ee.target.value),placeholder:e("engine.antipatterns_placeholder"),className:"w-full h-32 px-4 py-3 bg-surface border border-border rounded-xl text-sm text-fg placeholder:text-fg/40 focus:outline-none focus:ring-2 focus:ring-red-500/30 resize-none"})]})]})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[h.jsx("section",{className:"space-y-6",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(sa,{size:14})," ",e("engine.browser_sources")]}),h.jsxs("div",{className:"glass p-8 space-y-6",children:[h.jsx(gL,{sources:p,onChange:g}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:P,disabled:C,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:[C?h.jsx(Pt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_browser")]})})]})]})}),h.jsx("section",{className:"space-y-6",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(Vt,{size:14})," ",e("engine.blacklist_title")]}),h.jsxs("div",{className:"glass p-8 space-y-6",children:[h.jsx("div",{className:"space-y-2",children:h.jsx("p",{className:"text-sm text-fg/60",children:e("engine.blacklist_desc")})}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e("engine.blacklist_label")}),h.jsx("textarea",{value:y.join(`
69
+ `,"aria-label":`Digit ${v+1}`},v))})}const bh=[{code:"en",label:"English",flag:"🇺🇸"},{code:"fr",label:"Français",flag:"🇫🇷"},{code:"es",label:"Español",flag:"🇪🇸"},{code:"ko",label:"한국어",flag:"🇰🇷"},{code:"ja",label:"日本語",flag:"🇯🇵"},{code:"vi",label:"Tiếng Việt",flag:"🇻🇳"}];function Op({collapsed:e=!1,position:t="bottom"}){const{i18n:n}=et(),[r,s]=R.useState(!1),o=R.useRef(null),a=bh.find(u=>u.code===n.language)||bh[0];R.useEffect(()=>{const u=f=>{o.current&&!o.current.contains(f.target)&&s(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]);const c=u=>{n.changeLanguage(u),s(!1)};return h.jsxs("div",{className:"relative",ref:o,children:[h.jsxs("button",{onClick:()=>s(!r),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg bg-surface/50 border border-border hover:bg-surface hover:border-primary/30 transition-all text-xs font-medium text-fg/70 ${e?"justify-center px-1.5":""}`,title:e?a.label:void 0,children:[!e&&h.jsx(Cj,{size:14,className:"text-primary"}),h.jsx("span",{children:a.flag}),!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"hidden sm:inline",children:a.label}),h.jsx(Ls,{size:12,className:`transition-transform duration-300 ${r?"rotate-180":""}`})]})]}),h.jsx(Pt,{children:r&&h.jsx(Be.div,{initial:{opacity:0,y:t==="top"?-10:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:t==="top"?-10:10,scale:.95},className:`absolute ${e?"left-0":"right-0"} ${t==="top"?"bottom-full mb-2":"top-full mt-2"} w-48 bg-surface border border-border rounded-xl shadow-2xl z-[9999] overflow-y-auto max-h-[280px] custom-scrollbar`,children:h.jsx("div",{className:"py-1",children:bh.map(u=>h.jsxs("button",{onClick:()=>c(u.code),className:"flex items-center justify-between w-full px-4 py-2.5 text-xs text-left hover:bg-bg transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("span",{children:u.flag}),h.jsx("span",{className:u.code===n.language?"text-primary font-bold":"text-fg/70",children:u.label})]}),u.code===n.language&&h.jsx(As,{size:14,className:"text-primary"})]},u.code))})})})]})}function fL({onAuthSuccess:e,isInitialized:t=!0}){const{t:n}=et(),[r,s]=R.useState(""),[o,a]=R.useState(""),[c,u]=R.useState(""),[f,p]=R.useState(""),[g,y]=R.useState(!1),[v,b]=R.useState(!t),[w,k]=R.useState(null),[S,C]=R.useState("password"),[j,O]=R.useState("email"),[T,N]=R.useState(""),M=async U=>{U.preventDefault(),y(!0),k(null);try{if(v){const{error:L}=await ae.auth.signUp({email:r,password:o,options:{data:{first_name:c,last_name:f,full_name:`${c} ${f}`.trim()}}});if(L)throw L;e()}else if(S==="password"){const{error:L}=await ae.auth.signInWithPassword({email:r,password:o});if(L)throw L;e()}else if(S==="otp")if(j==="email"){const{error:L}=await ae.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(L)throw L;O("verify")}else await V()}catch(L){k(L.message)}finally{y(!1)}},V=async()=>{y(!0),k(null);try{const{data:U,error:L}=await ae.auth.verifyOtp({email:r,token:T,type:"magiclink"});if(L)throw L;if(!U.session)throw new Error("Failed to create session");e()}catch(U){k(U.message||n("auth.invalid_code"))}finally{y(!1)}};return h.jsx("div",{className:"flex flex-col items-center justify-center p-8 h-full bg-gradient-to-t from-bg to-bg/50",children:h.jsxs(Be.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-xl glass p-12 space-y-10 relative",children:[h.jsx("div",{className:"absolute top-4 right-4 z-50",children:h.jsx(Op,{position:"bottom"})}),h.jsxs("div",{className:"text-center space-y-2 pt-2",children:[h.jsx("h2",{className:"text-3xl font-black italic tracking-tighter uppercase",children:n(!t&&v?"auth.title_init":v?"auth.title_join":S==="otp"?"auth.title_mystic":"auth.title_login")}),h.jsx("p",{className:"text-xs text-fg/40 font-mono tracking-widest uppercase",children:n(!t&&v?"auth.desc_init":S==="otp"?j==="email"?"auth.desc_mystic_email":"auth.desc_mystic_code":"auth.desc_login")})]}),h.jsx("form",{onSubmit:M,className:"space-y-4",children:h.jsxs(Pt,{mode:"wait",children:[v&&h.jsxs(Be.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:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:n("auth.first_name")}),h.jsx("input",{type:"text",value:c,onChange:U=>u(U.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:n("auth.first_name_placeholder"),required:!0})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:n("auth.last_name")}),h.jsx("input",{type:"text",value:f,onChange:U=>p(U.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:n("auth.last_name_placeholder"),required:!0})]})]},"signup-fields"),S==="otp"&&j==="verify"?h.jsxs(Be.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6 py-4",children:[h.jsx("div",{className:"flex justify-center",children:h.jsx(hL,{value:T,onChange:N,length:6,onComplete:U=>{N(U)},error:!!w})}),h.jsx("button",{type:"button",onClick:()=>O("email"),className:"w-full text-[10px] font-bold uppercase text-primary/40 hover:text-primary transition-colors tracking-widest",children:n("auth.change_email")}),h.jsxs("button",{type:"button",disabled:g||T.length!==6,onClick:V,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:[g?h.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):h.jsx(Xy,{size:18}),n("auth.verify_code")]})]},"otp-verify"):h.jsxs(Be.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:n("auth.email_address")}),h.jsxs("div",{className:"relative",children:[h.jsx(Aj,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),h.jsx("input",{type:"email",value:r,onChange:U=>s(U.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:n("auth.email_placeholder"),required:!0})]})]}),(v||S==="password")&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:n("auth.complexity_key")}),h.jsxs("div",{className:"relative",children:[h.jsx(Nj,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),h.jsx("input",{type:"password",value:o,onChange:U=>a(U.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:n("auth.password_placeholder"),required:!0})]})]}),h.jsxs("button",{type:"submit",disabled:g,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:[g&&h.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),v?h.jsx(Bj,{size:18}):h.jsx(Xy,{size:18}),n(v?"auth.init_account":S==="otp"?"auth.send_code":"auth.unseal_engine")]})]},"base-login")]})}),w&&S==="password"&&h.jsx(Be.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:w}),h.jsxs("div",{className:"space-y-4",children:[!v&&h.jsx("div",{className:"flex flex-col gap-2",children:S==="password"?h.jsxs("button",{type:"button",onClick:()=>{C("otp"),O("email"),k(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:[h.jsx(Sj,{size:16})," ",n("auth.sign_in_code")]}):h.jsxs("button",{type:"button",onClick:()=>{C("password"),k(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:[h.jsx(f_,{size:16})," ",n("auth.sign_in_password")]})}),h.jsxs("p",{className:"text-center text-xs text-fg/40",children:[n(v?"auth.already_alchemist":"auth.new_to_alchemy")," "," ",h.jsx("button",{onClick:()=>{b(!v),C("password"),k(null)},className:"text-primary font-bold hover:underline",children:n(v?"auth.login_instead":"auth.create_account")})]})]})]})})}function pL(e){const t=e.trim();return t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}.supabase.co`:""}function mL(e){const t=e.match(/https?:\/\/([^.]+)\.supabase\.co/);return t?t[1]:""}function Vw({onComplete:e,open:t=!0,canClose:n=!1}){const{t:r}=et(),[s,o]=R.useState("welcome"),[a,c]=R.useState(""),[u,f]=R.useState(""),[p,g]=R.useState(""),[y,v]=R.useState(""),[b,w]=R.useState(null),[k,S]=R.useState(!1),[C,j]=R.useState([]),[O,T]=R.useState("idle"),N=R.useRef(null);if(R.useEffect(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[C]),!t)return null;const M=async()=>{w(null),S(!0),o("validating");const L=pL(a),Q=u.trim(),Y=await lL(L,Q);if(Y.valid){oL({url:L,anonKey:Q});try{const K=Bw(L,Q),{data:W,error:ne}=await K.from("init_state").select("is_initialized").single();if(!ne&&W&&W.is_initialized>0){o("success"),setTimeout(()=>{window.location.reload()},1500);return}}catch{console.log("[SetupWizard] init_state check failed, showing migration step")}const he=mL(L);g(he),o("migration"),S(!1)}else w(Y.error||r("common.error")),o("credentials"),S(!1)},V=async()=>{if(!p){w(r("setup.project_id_required"));return}if(!y){w(r("setup.access_token_required"));return}w(null),j([]),T("running"),o("migrating");try{const Q=(await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:p,accessToken:y})})).body?.getReader(),Y=new TextDecoder;if(!Q)throw new Error(r("setup.stream_error"));for(;;){const{done:he,value:K}=await Q.read();if(he)break;const ne=Y.decode(K).split(`
70
+ `).filter(re=>re.startsWith("data: "));for(const re of ne)try{const J=JSON.parse(re.slice(6));J.type==="done"?J.data==="success"?(T("success"),o("success"),setTimeout(()=>{window.location.reload()},2e3)):(T("failed"),w(r("setup.migration_failed_logs"))):j(ce=>[...ce,J.data])}catch{}}}catch(L){T("failed"),w(L.message||"Migration failed"),j(Q=>[...Q,`Error: ${L.message}`])}},U=()=>{o("success"),setTimeout(()=>{window.location.reload()},1500)};return h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-bg/80 backdrop-blur-sm",children:h.jsxs(Be.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"w-full max-w-xl glass p-12 space-y-10 relative",children:[h.jsx("div",{className:"absolute top-4 right-4 z-50",children:h.jsx(Op,{position:"bottom"})}),h.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 pointer-events-none"}),h.jsxs(Pt,{mode:"wait",children:[s==="welcome"&&h.jsxs(Be.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:h.jsx(sa,{className:"w-6 h-6 text-primary"})}),h.jsx("div",{className:"flex-1",children:h.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:r("setup.welcome_title")})})]}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:r("setup.welcome_desc")})]}),h.jsxs("div",{className:"glass bg-white/5 border-white/10 p-4 rounded-xl space-y-3",children:[h.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-primary/70",children:r("setup.requirements")}),h.jsxs("ul",{className:"space-y-2",children:[h.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[h.jsx(As,{className:"w-4 h-4 text-emerald-500"})," ",r("setup.project_url")]}),h.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[h.jsx(As,{className:"w-4 h-4 text-emerald-500"})," ",r("setup.anon_key")]}),h.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[h.jsx(As,{className:"w-4 h-4 text-emerald-500"})," ",r("account.credentials")]})]})]}),h.jsxs("div",{className:"flex flex-col gap-3",children:[h.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:[r("setup.forge_project")," ",h.jsx(Bi,{size:14})]}),h.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:[r("setup.begin_init")," ",h.jsx(uj,{size:18})]})]})]},"welcome"),s==="credentials"&&h.jsxs(Be.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:r("setup.credentials_title")}),h.jsx("p",{className:"text-sm text-fg/50 font-medium lowercase",children:r("setup.credentials_desc")})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:r("setup.project_url")}),h.jsx("input",{type:"text",value:a,onChange:L=>c(L.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:r("setup.project_url_placeholder")})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:r("setup.anon_key")}),h.jsx("input",{type:"password",value:u,onChange:L=>f(L.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:r("setup.anon_key_placeholder")})]})]}),b&&h.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[h.jsx(kr,{className:"w-5 h-5 text-error"}),h.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:b})]}),h.jsxs("div",{className:"flex gap-3",children:[h.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:r("common.back")}),h.jsxs("button",{onClick:M,disabled:!a||!u,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:[r("setup.connect_essence")," ",h.jsx(Vt,{size:18})]})]})]},"credentials"),s==="validating"&&h.jsxs(Be.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[h.jsxs("div",{className:"relative",children:[h.jsx("div",{className:"absolute inset-0 bg-primary/20 blur-xl rounded-full"}),h.jsx(Rt,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),h.jsxs("div",{className:"text-center space-y-2",children:[h.jsx("h3",{className:"text-xl font-bold italic uppercase tracking-tighter",children:r("setup.validating")}),h.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase animate-pulse",children:r("setup.resonance")})]})]},"validating"),s==="migration"&&h.jsxs(Be.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2 bg-accent/10 rounded-xl",children:h.jsx(uc,{className:"w-6 h-6 text-accent"})}),h.jsx("div",{className:"flex-1",children:h.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:r("setup.init_schema")})})]}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:r("setup.schema_desc")})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:r("setup.project_id")}),h.jsx("input",{type:"text",value:p,onChange:L=>g(L.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all font-mono",placeholder:r("setup.project_id_placeholder")}),h.jsx("p",{className:"text-[10px] text-fg/30 ml-1",children:r("setup.project_id_help")})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:r("setup.access_token")}),h.jsx("input",{type:"password",value:y,onChange:L=>v(L.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all font-mono",placeholder:r("setup.access_token_placeholder")}),h.jsxs("p",{className:"text-[10px] text-fg/30 ml-1",children:["Generate at"," ",h.jsx("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:r("setup.access_token_link")})]})]})]}),b&&h.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[h.jsx(kr,{className:"w-5 h-5 text-error"}),h.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:b})]}),h.jsxs("div",{className:"flex gap-3",children:[h.jsx("button",{onClick:U,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:r("common.skip")}),h.jsxs("button",{onClick:V,disabled:!p||!y,className:"flex-[2] py-4 bg-gradient-to-r from-accent to-primary text-white font-bold rounded-xl shadow-lg glow-accent hover:scale-[1.01] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale flex items-center justify-center gap-2",children:[h.jsx(Ij,{size:18})," ",r("setup.run_migrations")]})]})]},"migration"),s==="migrating"&&h.jsxs(Be.div,{initial:{opacity:0},animate:{opacity:1},className:"space-y-6",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(Rt,{className:"w-6 h-6 animate-spin text-accent"}),h.jsx("h2",{className:"text-xl font-black italic tracking-tighter uppercase",children:r("setup.running_migrations")})]}),h.jsx("p",{className:"text-sm text-fg/40",children:r("setup.take_minute")})]}),h.jsxs("div",{className:"bg-black/40 border border-border/20 rounded-xl p-4 h-64 overflow-y-auto font-mono text-xs",children:[C.map((L,Q)=>h.jsx("div",{className:`py-0.5 ${L.includes("✅")||L.includes("SUCCESS")?"text-emerald-400":L.includes("❌")||L.includes("Error")?"text-red-400":L.includes("⚠️")?"text-amber-400":"text-fg/60"}`,children:L},Q)),h.jsx("div",{ref:N})]}),O==="failed"&&h.jsxs("div",{className:"flex gap-3",children:[h.jsxs("button",{onClick:()=>o("migration"),className:"flex-1 py-3 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/40",children:[h.jsx(f_,{size:14,className:"inline mr-2"})," ",r("setup.back")]}),h.jsx("button",{onClick:V,className:"flex-1 py-3 bg-accent/20 border border-accent/30 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-accent/30 transition-all text-accent",children:r("setup.retry")})]})]},"migrating"),s==="success"&&h.jsxs(Be.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:[h.jsx("div",{className:"p-4 bg-emerald-500/20 rounded-full",children:h.jsx(Ns,{className:"w-16 h-16 text-emerald-500"})}),h.jsxs("div",{className:"text-center space-y-2",children:[h.jsx("h3",{className:"text-2xl font-black italic uppercase tracking-tighter",children:r("setup.engine_aligned")}),h.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase",children:r("setup.restarting")})]})]},"success")]})]})})}const Gr={chrome:{icon:h.jsx(Gy,{size:18}),name:"Google Chrome",color:"text-yellow-500"},firefox:{icon:h.jsx(Oo,{size:18}),name:"Mozilla Firefox",color:"text-orange-500"},safari:{icon:h.jsx(Oo,{size:18}),name:"Safari",color:"text-blue-500"},edge:{icon:h.jsx(Oo,{size:18}),name:"Microsoft Edge",color:"text-cyan-500"},brave:{icon:h.jsx(Vt,{size:18}),name:"Brave",color:"text-orange-400"},arc:{icon:h.jsx(Vt,{size:18}),name:"Arc",color:"text-purple-500"},vivaldi:{icon:h.jsx(Oo,{size:18}),name:"Vivaldi",color:"text-red-500"},opera:{icon:h.jsx(Oo,{size:18}),name:"Opera",color:"text-red-400"},"opera-gx":{icon:h.jsx(Vt,{size:18}),name:"Opera GX",color:"text-pink-500"},chromium:{icon:h.jsx(Gy,{size:18}),name:"Chromium",color:"text-blue-400"}};function gL({sources:e,onChange:t}){const{t:n}=et(),[r,s]=R.useState(!1),[o,a]=R.useState({}),[c,u]=R.useState(""),[f,p]=R.useState("chrome"),[g,y]=R.useState(!1),v=async()=>{s(!0);try{const{data:C}=await Je.get("/api/browser-paths/detect");a(C)}catch(C){console.error("Detection failed:",C)}finally{s(!1)}},b=C=>{const j=o[C];if(!j||!j.found||!j.valid||e.find(N=>N.browser===C&&N.path===j.path))return;const T={browser:C,path:j.path,enabled:!0,label:`${Gr[C].name} (${n("engine.auto_detected")})`};t([...e,T])},w=async()=>{if(c.trim()){y(!0);try{const{data:C}=await Je.post("/api/browser-paths/validate",{path:c});if(!C.valid){alert(n("engine.invalid_path",{error:C.error||n("engine.not_a_browser_db")})),y(!1);return}const j={browser:f,path:c,enabled:!0,label:`${Gr[f].name} (${n("engine.custom")})`};t([...e,j]),u("")}catch(C){console.error("Validation failed:",C),alert(n("engine.validation_failed"))}finally{y(!1)}}},k=C=>{const j=[...e];j[C].enabled=!j[C].enabled,t(j)},S=C=>{t(e.filter((j,O)=>O!==C))};return h.jsxs("div",{className:"space-y-6",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(ia,{size:14})," ",n("engine.auto_detect_title")]}),h.jsxs("button",{onClick:v,disabled:r,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:[r?h.jsx(Rt,{size:12,className:"animate-spin"}):h.jsx(ia,{size:12}),n(r?"engine.scanning":"engine.scan_system")]})]}),Object.keys(o).length>0&&h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.keys(Gr).map(C=>{const j=o[C],O=Gr[C],T=e.some(N=>N.browser===C&&N.path===j?.path);return h.jsxs(Be.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`glass p-4 rounded-xl border ${j?.found&&j?.valid?"border-success/20 bg-success/5":j?.found?"border-error/20 bg-error/5":"border-border/10"}`,children:[h.jsxs("div",{className:"flex items-start justify-between mb-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:O.color,children:O.icon}),h.jsx("span",{className:"text-sm font-bold",children:O.name})]}),j?.found&&j?.valid?h.jsx(As,{size:16,className:"text-success"}):j?.found?h.jsx(kr,{size:16,className:"text-error"}):h.jsx(Nn,{size:16,className:"text-fg/20"})]}),j?.found?h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate mb-2",children:j.path}),j.valid?h.jsx("button",{onClick:()=>b(C),disabled:T,className:`w-full py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${T?"bg-fg/5 text-fg/30 cursor-not-allowed":"bg-success/10 hover:bg-success/20 text-success"}`,children:n(T?"engine.already_added":"engine.add_source")}):h.jsx("p",{className:"text-[10px] text-error font-medium",children:j.error})]}):h.jsx("p",{className:"text-[10px] text-fg/30 italic",children:n("engine.not_found")})]},C)})})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(wj,{size:14})," ",n("engine.add_custom_path")]}),h.jsxs("div",{className:"glass p-4 rounded-xl space-y-3",children:[h.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[h.jsx("select",{value:f,onChange:C=>p(C.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(Gr).map(C=>h.jsx("option",{value:C,children:Gr[C].name},C))}),h.jsx("input",{type:"text",value:c,onChange:C=>u(C.target.value),placeholder:n("engine.custom_path_placeholder"),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"})]}),h.jsxs("button",{onClick:w,disabled:!c.trim()||g,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:[g?h.jsx(Rt,{size:16,className:"animate-spin"}):h.jsx($f,{size:16}),n(g?"engine.validating":"engine.add_custom_source")]})]})]}),e.length>0&&h.jsxs("div",{className:"space-y-3",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("engine.configured_sources",{count:e.length})}),h.jsx("div",{className:"space-y-2",children:h.jsx(Pt,{children:e.map((C,j)=>h.jsxs(Be.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 ${!C.enabled&&"opacity-50"}`,children:[h.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[h.jsx("div",{className:Gr[C.browser].color,children:Gr[C.browser].icon}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-sm font-bold",children:C.label}),h.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate",children:C.path})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:()=>k(j),className:`px-3 py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${C.enabled?"bg-success/10 text-success":"bg-fg/5 text-fg/40"}`,children:C.enabled?n("engine.enabled"):n("engine.disabled")}),h.jsx("button",{onClick:()=>S(j),className:"p-2 hover:bg-error/10 text-error rounded-lg transition-all",children:h.jsx(Nn,{size:16})})]})]},`${C.browser}-${C.path}`))})})]})]})}const qw=R.createContext(void 0);function yL({children:e}){const[t,n]=R.useState([]),r=R.useCallback((s,o="info")=>{const a=Math.random().toString(36).substr(2,9),c={id:a,type:o,message:s};n(u=>[...u,c]),setTimeout(()=>{n(u=>u.filter(f=>f.id!==a))},3e3)},[]);return h.jsxs(qw.Provider,{value:{showToast:r},children:[e,h.jsx(xL,{toasts:t})]})}function Jc(){const e=R.useContext(qw);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function xL({toasts:e}){return h.jsx("div",{className:"fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none",children:h.jsx(Pt,{children:e.map(t=>h.jsx(vL,{toast:t},t.id))})})}function vL({toast:e}){const t={success:h.jsx(As,{size:18,className:"text-success"}),error:h.jsx(Nn,{size:18,className:"text-error"}),warning:h.jsx(kr,{size:18,className:"text-accent"}),info:h.jsx(v_,{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 h.jsxs(Be.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],h.jsx("span",{className:"text-sm font-medium flex-1",children:e.message})]})}const Hw=new Set(["login","log in","log-in","signin","sign in","sign-in","signup","sign up","sign-up","authentication","auth","password","register","registration","oauth","sso","navigation","menu","footer","header","sidebar","nav","breadcrumb","cookie","cookies","consent","privacy","terms","sitemap","ui","ux","user interface","interface","button","form","modal","popup","banner","facebook","meta","instagram","twitter","x","linkedin","tiktok","youtube","google","google drive","gmail","apple","icloud","microsoft","office","outlook","teams","pinterest","reddit","whatsapp","messenger","slack","discord","zoom","dropbox","notion","figma","github","gitlab","social media","social network","social","share","like","follow","post","error","not found","404","403","500","access denied","no content","empty","page not found","unavailable","blocked","forbidden","unauthorized","website","web page","webpage","page","site","web","app","application","download","install","home","homepage","main","index","default","about","contact","help","support","faq","blog","news","article"]);function _L(){const{t:e}=et(),{showToast:t}=Jc(),[n,r]=R.useState("realtimexai"),[s,o]=R.useState("gpt-4.1-mini"),[a,c]=R.useState("realtimexai"),[u,f]=R.useState("text-embedding-3-small"),[p,g]=R.useState([]),[y,v]=R.useState([]),[b,w]=R.useState([]),[k,S]=R.useState(!1),[C,j]=R.useState(!1),[O,T]=R.useState(!1),[N,M]=R.useState(!1),[V,U]=R.useState(!1),[L,Q]=R.useState(!1),[Y,he]=R.useState(null),[K,W]=R.useState([]),[ne,re]=R.useState([]);R.useEffect(()=>{J().then(ee=>{ce(ee)}),Zt()},[]);const J=async()=>{const ee={llmProvider:"realtimexai",llmModel:"gpt-4.1-mini",embeddingProvider:"realtimexai",embeddingModel:"text-embedding-3-small"},{data:{user:Me}}=await ae.auth.getUser();if(!Me)return ee;const{data:te}=await ae.from("alchemy_settings").select("*").eq("user_id",Me.id).maybeSingle();if(te){const ge=te.llm_provider||ee.llmProvider,je=te.llm_model||ee.llmModel,be=te.embedding_provider||ee.embeddingProvider,$e=te.embedding_model||ee.embeddingModel;r(ge),o(je),c(be),f($e),g(te.custom_browser_paths||[]),v(te.blacklist_domains||[]);const Se=te.blocked_tags||[];return Se.length>0?w(Se):w(Array.from(Hw)),{llmProvider:ge,llmModel:je,embeddingProvider:be,embeddingModel:$e}}else{const ge=new Date(Date.now()-2592e6).toISOString();let je=[];try{const{data:$e}=await Je.get("/api/browser-paths/auto-discover");$e.success&&(je=$e.sources)}catch($e){console.warn("[AlchemistEngine] Auto-discovery failed:",$e)}const{data:be}=await ae.from("alchemy_settings").insert({user_id:Me.id,llm_provider:ee.llmProvider,llm_model:ee.llmModel,embedding_provider:ee.embeddingProvider,embedding_model:ee.embeddingModel,max_urls_per_sync:50,sync_mode:"incremental",sync_start_date:ge,custom_browser_paths:je}).select().single();return be&&g(be.custom_browser_paths||[]),ee}},ce=async ee=>{const Me=ee?.llmProvider||"realtimexai",te=ee?.llmModel||"gpt-4.1-mini",ge=ee?.embeddingProvider||"realtimexai",je=ee?.embeddingModel||"text-embedding-3-small";try{const[be,$e]=await Promise.all([Je.get("/api/sdk/providers/chat",{timeout:65e3}),Je.get("/api/sdk/providers/embed",{timeout:65e3})]);if(be.data.success&&$e.data.success){const Se=be.data.providers||[],Qe=$e.data.providers||[];if(he({chat:Se,embed:Qe}),Q(!0),console.log("[AlchemistEngine] SDK providers loaded"),console.log(" Chat providers:",Se.map(nt=>nt.provider)),console.log(" Embed providers:",Qe.map(nt=>nt.provider)),Se.length>0){const nt=Se.some(rt=>rt.provider===Me);if(nt){const rt=Se.find(le=>le.provider===Me);!rt?.models?.some(le=>le.id===te)&&rt?.models?.length>0&&o(rt.models[0].id)}else{const rt=Se[0];r(rt.provider),rt.models?.length>0&&o(rt.models[0].id)}D(nt?Me:Se[0].provider,Se)}if(Qe.length>0){const nt=Qe.some(rt=>rt.provider===ge);if(nt){const rt=Qe.find(le=>le.provider===ge);!rt?.models?.some(le=>le.id===je)&&rt?.models?.length>0&&f(rt.models[0].id)}else{const rt=Qe[0];c(rt.provider),rt.models?.length>0&&f(rt.models[0].id)}A(nt?ge:Qe[0].provider,Qe)}}}catch{console.log("[AlchemistEngine] SDK not available"),Q(!1)}},A=(ee,Me)=>{if(Me&&Array.isArray(Me)){const ge=Me.find(je=>je.provider===ee);if(ge&&ge.models){const je=ge.models.map(be=>be.id);console.log(`[AlchemistEngine] Using SDK embedding models for ${ee}:`,je),W(je);return}}console.log(`[AlchemistEngine] Using hardcoded embedding models for ${ee}`);const te=[];ee==="realtimexai"||ee==="openai"?te.push("text-embedding-3-small","text-embedding-3-large","text-embedding-ada-002"):ee==="gemini"&&te.push("embedding-001"),W(te)},D=(ee,Me)=>{if(Me&&Array.isArray(Me)){const ge=Me.find(je=>je.provider===ee);if(ge&&ge.models){const je=ge.models.map(be=>be.id);console.log(`[AlchemistEngine] Using SDK chat models for ${ee}:`,je),re(je);return}}console.log(`[AlchemistEngine] Using hardcoded chat models for ${ee}`);const te=[];ee==="realtimexai"||ee==="openai"?te.push("gpt-4o","gpt-4o-mini","gpt-4-turbo","gpt-3.5-turbo"):ee==="anthropic"?te.push("claude-3-5-sonnet-20241022","claude-3-5-haiku-20241022","claude-3-opus-20240229"):ee==="google"?te.push("gemini-2.0-flash-exp","gemini-1.5-pro","gemini-1.5-flash"):ee==="ollama"&&te.push("llama3","mistral","codellama","phi"),re(te)},G=async()=>{S(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t(e("engine.save_error_login"),"error"),S(!1);return}const{error:Me}=await ae.from("alchemy_settings").upsert({user_id:ee.id,llm_provider:n,llm_model:s,embedding_provider:a,embedding_model:u,customized_at:new Date().toISOString()},{onConflict:"user_id"});Me?(console.error("[AlchemistEngine] Save error:",Me),t(`${e("common.error")}: ${Me.message}`,"error")):t(e("engine.save_success_llm"),"success")}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{S(!1)}},P=async()=>{j(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t(e("engine.save_error_login"),"error"),j(!1);return}const{error:Me}=await ae.from("alchemy_settings").upsert({user_id:ee.id,custom_browser_paths:p},{onConflict:"user_id"});Me?(console.error("[AlchemistEngine] Save browser sources error:",Me),t(`${e("common.error")}: ${Me.message}`,"error")):t(e("engine.save_success_browser"),"success")}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{j(!1)}},ve=async()=>{T(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t(e("engine.save_error_login"),"error"),T(!1);return}const Me=y.filter(ge=>ge.trim().length>0),{error:te}=await ae.from("alchemy_settings").upsert({user_id:ee.id,blacklist_domains:Me},{onConflict:"user_id"});te?(console.error("[AlchemistEngine] Save blacklist error:",te),t(`${e("common.error")}: ${te.message}`,"error")):(t(e("engine.save_success_blacklist"),"success"),await J())}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{T(!1)}},Ne=async()=>{M(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t(e("engine.save_error_login"),"error"),M(!1);return}const Me=b.filter(ge=>ge.trim().length>0),{error:te}=await ae.from("alchemy_settings").upsert({user_id:ee.id,blocked_tags:Me},{onConflict:"user_id"});te?(console.error("[AlchemistEngine] Save blocked tags error:",te),t(`${e("common.error")}: ${te.message}`,"error")):(t(e("engine.save_success_tags"),"success"),await J())}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{M(!1)}},[fe,Ae]=R.useState(""),[_e,me]=R.useState(""),[tt,Ot]=R.useState(!1),Zt=async()=>{const{data:{user:ee}}=await ae.auth.getUser();if(!ee)return;const{data:Me}=await ae.from("user_persona").select("*").eq("user_id",ee.id).maybeSingle();Me&&(Ae(Me.interest_summary||""),me(Me.anti_patterns||""))},Rn=async()=>{Ot(!0);try{const{data:{user:ee}}=await ae.auth.getUser();if(!ee){t("Please log in to save persona","error"),Ot(!1);return}const{error:Me}=await ae.from("user_persona").upsert({user_id:ee.id,interest_summary:fe,anti_patterns:_e,last_updated_at:new Date().toISOString()},{onConflict:"user_id"});Me?(console.error("[AlchemistEngine] Save persona error:",Me),t(`${e("common.error")}: ${Me.message}`,"error")):t(e("engine.save_success_persona"),"success")}catch(ee){console.error("[AlchemistEngine] Unexpected error:",ee),t(`Unexpected error: ${ee.message}`,"error")}finally{Ot(!1)}},er=async()=>{U(!0);try{const{data:ee}=await Je.post("/api/llm/test",{baseUrl,modelName,apiKey});ee.success?t(e("engine.test_success",{model:ee.model||""}),"success"):t(`${e("engine.test_fail",{message:ee.message})}`,"error")}catch(ee){console.error("[AlchemistEngine] Test error:",ee),t(`Test failed: ${ee.message}`,"error")}finally{U(!1)}};return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsxs("header",{className:"px-8 py-6 border-b border-border",children:[h.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e("engine.title")}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:e("engine.subtitle")})]}),h.jsx("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:h.jsxs("div",{className:"max-w-7xl mx-auto animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"space-y-6 mb-8",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(x_,{size:14})," ",e("engine.configuration")]}),h.jsxs("div",{className:"flex gap-3",children:[h.jsxs("button",{onClick:er,disabled:V||k,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:[V?h.jsx(Rt,{size:18,className:"animate-spin"}):h.jsx(Vt,{size:18,className:"text-accent"}),e("engine.test_connection")]}),h.jsxs("button",{onClick:G,disabled:k,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:[k?h.jsx(Rt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_config")]})]})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[h.jsxs("div",{className:"glass p-6 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("h3",{className:"text-sm font-semibold text-fg/80",children:e("engine.llm_provider")}),L?h.jsxs("span",{className:"text-xs text-green-500 flex items-center gap-1",children:[h.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full"}),e("engine.sdk_connected")]}):h.jsxs("span",{className:"text-xs text-orange-500 flex items-center gap-1",children:[h.jsx("span",{className:"w-2 h-2 bg-orange-500 rounded-full"}),e("engine.sdk_not_available")]})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-xs font-medium text-fg/60",children:e("engine.provider")}),h.jsx("select",{value:n,onChange:ee=>{r(ee.target.value),D(ee.target.value,Y?.chat)},className:"w-full px-4 py-3 bg-surface border border-border rounded-xl text-fg focus:outline-none focus:ring-2 focus:ring-primary/50",children:Y?.chat&&Y.chat.length>0?Y.chat.map(ee=>h.jsx("option",{value:ee.provider,children:ee.provider==="realtimexai"?"RealTimeX.AI":ee.provider.charAt(0).toUpperCase()+ee.provider.slice(1)},ee.provider)):h.jsx("option",{value:"",disabled:!0,children:e("engine.loading_providers")})})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-xs font-medium text-fg/60",children:e("engine.intelligence_model")}),h.jsx("select",{value:s,onChange:ee=>o(ee.target.value),className:"w-full px-4 py-3 bg-surface border border-border rounded-xl text-fg focus:outline-none focus:ring-2 focus:ring-primary/50",children:ne.length>0?ne.map(ee=>h.jsx("option",{value:ee,children:ee},ee)):h.jsxs(h.Fragment,{children:[h.jsx("option",{value:"gpt-4o",children:"gpt-4o"}),h.jsx("option",{value:"gpt-4o-mini",children:"gpt-4o-mini"}),h.jsx("option",{value:"gpt-4-turbo",children:"gpt-4-turbo"})]})})]}),h.jsx("div",{className:"p-3 bg-primary/5 rounded-xl",children:h.jsx("p",{className:"text-[10px] text-primary/60 font-medium leading-relaxed",children:e(L?"engine.sdk_info_success":"engine.sdk_info_fail")})})]}),h.jsxs("div",{className:"glass p-6 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("h3",{className:"text-sm font-semibold text-fg/80",children:e("engine.embedding_provider")}),L?h.jsxs("span",{className:"text-xs text-green-500 flex items-center gap-1",children:[h.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full"}),e("engine.sdk_connected")]}):h.jsxs("span",{className:"text-xs text-orange-500 flex items-center gap-1",children:[h.jsx("span",{className:"w-2 h-2 bg-orange-500 rounded-full"}),e("engine.sdk_not_available")]})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-xs font-medium text-fg/60",children:e("engine.provider")}),h.jsx("select",{value:a,onChange:ee=>{c(ee.target.value),A(ee.target.value,Y?.embed)},className:"w-full px-4 py-3 bg-surface border border-border rounded-xl text-fg focus:outline-none focus:ring-2 focus:ring-primary/50",children:Y?.embed&&Y.embed.length>0?Y.embed.map(ee=>h.jsx("option",{value:ee.provider,children:ee.provider==="realtimexai"?"RealTimeX.AI":ee.provider.charAt(0).toUpperCase()+ee.provider.slice(1)},ee.provider)):h.jsx("option",{value:"",disabled:!0,children:e("engine.loading_providers")})})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-xs font-medium text-fg/60",children:e("engine.embedding_model")}),h.jsx("select",{value:u,onChange:ee=>f(ee.target.value),className:"w-full px-4 py-3 bg-surface border border-border rounded-xl text-fg focus:outline-none focus:ring-2 focus:ring-primary/50",children:K.length>0?K.map(ee=>h.jsx("option",{value:ee,children:ee},ee)):h.jsxs(h.Fragment,{children:[h.jsx("option",{value:"text-embedding-3-small",children:"text-embedding-3-small"}),h.jsx("option",{value:"text-embedding-3-large",children:"text-embedding-3-large"}),h.jsx("option",{value:"text-embedding-ada-002",children:"text-embedding-ada-002"})]})})]}),h.jsx("div",{className:"p-3 bg-primary/5 rounded-xl",children:h.jsx("p",{className:"text-[10px] text-primary/60 font-medium leading-relaxed",children:e(L?"engine.embedding_info_success":"engine.embedding_info_fail")})})]})]})]}),h.jsxs("section",{className:"space-y-6 mb-8",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx("span",{className:"text-xl",children:"🧠"})," ",e("engine.persona_title")]}),h.jsxs("button",{onClick:Rn,disabled:tt,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:[tt?h.jsx(Rt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_memory")]})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[h.jsxs("div",{className:"glass p-6 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("h3",{className:"text-sm font-semibold text-fg/80",children:e("engine.interests_title")}),h.jsx("span",{className:"text-xs text-green-500 bg-green-500/10 px-2 py-1 rounded-full border border-green-500/20",children:e("engine.interests_priority")})]}),h.jsx("p",{className:"text-xs text-fg/50 leading-relaxed",children:e("engine.interests_desc")}),h.jsx("textarea",{value:fe,onChange:ee=>Ae(ee.target.value),placeholder:e("engine.interests_placeholder"),className:"w-full h-32 px-4 py-3 bg-surface border border-border rounded-xl text-sm text-fg placeholder:text-fg/40 focus:outline-none focus:ring-2 focus:ring-green-500/30 resize-none"})]}),h.jsxs("div",{className:"glass p-6 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("h3",{className:"text-sm font-semibold text-fg/80",children:e("engine.antipatterns_title")}),h.jsx("span",{className:"text-xs text-red-400 bg-red-500/10 px-2 py-1 rounded-full border border-red-500/20",children:e("engine.antipatterns_priority")})]}),h.jsx("p",{className:"text-xs text-fg/50 leading-relaxed",children:e("engine.antipatterns_desc")}),h.jsx("textarea",{value:_e,onChange:ee=>me(ee.target.value),placeholder:e("engine.antipatterns_placeholder"),className:"w-full h-32 px-4 py-3 bg-surface border border-border rounded-xl text-sm text-fg placeholder:text-fg/40 focus:outline-none focus:ring-2 focus:ring-red-500/30 resize-none"})]})]})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[h.jsx("section",{className:"space-y-6",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(sa,{size:14})," ",e("engine.browser_sources")]}),h.jsxs("div",{className:"glass p-8 space-y-6",children:[h.jsx(gL,{sources:p,onChange:g}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:P,disabled:C,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:[C?h.jsx(Rt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_browser")]})})]})]})}),h.jsx("section",{className:"space-y-6",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(Vt,{size:14})," ",e("engine.blacklist_title")]}),h.jsxs("div",{className:"glass p-8 space-y-6",children:[h.jsx("div",{className:"space-y-2",children:h.jsx("p",{className:"text-sm text-fg/60",children:e("engine.blacklist_desc")})}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e("engine.blacklist_label")}),h.jsx("textarea",{value:y.join(`
71
71
  `),onChange:ee=>v(ee.target.value.split(`
72
- `).map(De=>De.trim())),placeholder:e("engine.blacklist_placeholder"),className:"w-full h-40 px-4 py-3 rounded-xl border border-border bg-surface text-fg text-sm placeholder:text-fg/40 focus:outline-none focus:border-[var(--border-hover)] transition-all resize-none"}),h.jsx("p",{className:"text-xs text-fg/50 ml-1",children:e("engine.blacklist_examples")})]}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:_e,disabled:O,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:[O?h.jsx(Pt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_blacklist")]})})]})]})})]}),h.jsx("section",{className:"space-y-6 mt-8",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(Ff,{size:14})," ",e("engine.blocked_tags_title")]}),h.jsxs("div",{className:"glass p-8 space-y-6",children:[h.jsx("div",{className:"space-y-2",children:h.jsx("p",{className:"text-sm text-fg/60",children:e("engine.blocked_tags_desc")})}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e("engine.blocked_tags_label")}),h.jsx("textarea",{value:b.join("; "),onChange:ee=>w(ee.target.value.split(";").map(De=>De.trim())),placeholder:e("engine.blocked_tags_placeholder"),className:"w-full h-40 px-4 py-3 rounded-xl border border-border bg-surface text-fg text-sm placeholder:text-fg/40 focus:outline-none focus:border-[var(--border-hover)] transition-all resize-none"}),h.jsx("p",{className:"text-xs text-fg/50 ml-1",children:e("engine.blocked_tags_info")})]}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:me,disabled:N,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:[N?h.jsx(Pt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_blocked_tags")]})})]})]})})]})})]})}const Kw=R.createContext(null);function bL({children:e}){const[t,n]=R.useState(!1),r=()=>n(!0),s=()=>n(!1);return h.jsx(Kw.Provider,{value:{isExpanded:t,setIsExpanded:n,openTerminal:r,closeTerminal:s},children:e})}function wL(){const e=R.useContext(Kw);if(!e)throw new Error("useTerminal must be used within a TerminalProvider");return e}function kL({isExpanded:e,onToggle:t,onNavigate:n,liftUp:r,isSyncing:s,onStop:o}={}){const{t:a}=et(),[c,u]=R.useState([]),{isExpanded:f,setIsExpanded:p}=wL(),[g,y]=R.useState({}),v=e!==void 0?e:f,b=t||(()=>p(!f)),w=r?"bottom-32":"bottom-6";R.useEffect(()=>{k();const T=ae.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},N=>{const M=N.new;M.event_type==="error"&&y(V=>({...V,[M.id]:!0})),u(V=>{const B=[M,...V];return B.length>50?B.slice(0,50):B})}).subscribe();return()=>{ae.removeChannel(T)}},[]);const k=async()=>{const{data:T}=await ae.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(30);T&&u(T)},S=T=>{y(N=>({...N,[T]:!N[T]}))},C=T=>{switch(T.toLowerCase()){case"reading":return a("terminal.state_reading");case"thinking":return a("terminal.state_thinking");case"signal":return a("terminal.state_signal");case"skipped":return a("terminal.state_skipped");case"error":return a("terminal.state_error");case"completed":return a("terminal.state_completed");default:return T}},j=T=>{const N=T.message||"";if(N.startsWith("Reading content from:")){const M=N.split("Reading content from: ")[1]||"";return a("terminal.msg_reading",{url:M})}if(N.startsWith("Analyzing relevance of:")){const M=N.split("Analyzing relevance of: ")[1]||"";return a("terminal.msg_thinking",{title:M})}if(N.startsWith("Found signal:")){const M=T.metadata?.summary||T.details?.summary||"",V=T.metadata?.score||T.details?.score||0;return a("terminal.msg_found_signal",{summary:M,score:V})}if(N.startsWith("Low signal stored for review")){const M=N.match(/\((\d+)%\)/),V=M?M[1]:"0",B=N.split("): ")[1]||"";return a("terminal.msg_low_signal",{score:V,title:B})}if(N.startsWith("Analysis failed for")){const M=N.split("Analysis failed for ")[1]||"",V=M.split(": ")[0]||"",B=M.split(": ")[1]||"";return a("terminal.msg_failed",{title:V,error:B})}return N.startsWith("Sync completed:")?a("terminal.msg_sync_completed",{signals:T.metadata?.signals_found||T.details?.signals_found||0,skipped:T.metadata?.skipped||T.details?.skipped||0,errors:T.metadata?.errors||T.details?.errors||0}):N},O=(T,N,M,V)=>{if(N==="debug")return h.jsx(pj,{size:14,className:"text-fg/40"});if(M?.is_completion||V?.is_completion)return h.jsx(Ns,{size:14,className:"text-success"});switch(T){case"analysis":return h.jsx(m_,{size:14,className:"text-primary"});case"action":return h.jsx(Vt,{size:14,className:"text-accent"});case"error":return h.jsx(Wy,{size:14,className:"text-error"});case"system":return h.jsx(_a,{size:14,className:"text-success"});default:return h.jsx(v_,{size:14,className:"text-fg/40"})}};return v?h.jsxs(Ue.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:[h.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(uc,{size:18,className:"text-primary"}),h.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:a("terminal.title")}),h.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:[h.jsx(cj,{size:10})," ",a("terminal.live")]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[s&&o&&h.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 bg-error/10 hover:bg-error/20 text-error px-2 py-1 rounded text-[10px] uppercase font-bold tracking-wider transition-all border border-error/20 mr-2",children:[h.jsx(X,{size:12})," ",a("terminal.stop_sync")]}),h.jsx("button",{onClick:()=>u([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:a("terminal.clear")}),h.jsx("button",{onClick:b,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:h.jsx(Pj,{size:18})})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[c.length===0&&h.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:a("terminal.idle")}),c.map(T=>h.jsxs("div",{className:"relative flex items-start gap-3 group",children:[h.jsx("div",{className:`mt-1 flex-shrink-0 w-6 h-6 rounded-full bg-surface border flex items-center justify-center ${T.metadata?.is_completion||T.details?.is_completion?"border-success/50 bg-success/5":"border-white/5"}`,children:O(T.event_type,T.level,T.metadata,T.details)}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(T.created_at||Date.now()).toLocaleTimeString()}),h.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${T.level==="error"?"text-error":T.level==="warn"?"text-orange-400":T.event_type==="analysis"?"text-primary":"text-fg/90"}`,children:C(T.agent_state)}),T.metadata?.actionable&&n&&h.jsxs("button",{onClick:()=>n("logs",T.metadata?.actionable),className:"ml-auto flex items-center gap-1 bg-primary/10 text-primary border border-primary/20 px-1.5 py-0.5 rounded text-[10px] uppercase font-bold tracking-wider hover:bg-primary/20 transition-all font-mono",children:[T.metadata.actionable.label,h.jsx(Ls,{size:10,className:"-rotate-90"})]}),T.duration_ms&&!T.metadata?.actionable&&h.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:[h.jsx(Li,{size:10}),T.duration_ms,"ms"]})]}),T.metadata?.is_completion||T.details?.is_completion?h.jsxs("div",{className:"bg-success/5 border border-success/20 rounded-lg p-3 space-y-2 mt-2",children:[h.jsxs("div",{className:"flex items-center gap-2 text-success font-bold uppercase text-[9px] tracking-[0.2em]",children:[h.jsx(Ns,{className:"w-3.5 h-3.5"}),a("terminal.run_completed")]}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 pt-1",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:a("terminal.signals")}),h.jsx("p",{className:"text-sm font-bold text-primary",children:T.metadata?.signals_found||T.details?.signals_found||0})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:a("terminal.urls")}),h.jsx("p",{className:"text-sm font-bold",children:T.metadata?.total_urls||T.details?.total_urls||0})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:a("terminal.skipped")}),h.jsx("p",{className:"text-sm font-bold text-fg/60",children:T.metadata?.skipped||T.details?.skipped||0})]})]}),(T.metadata?.errors||T.details?.errors)>0&&h.jsxs("div",{className:"pt-1 border-t border-success/10 flex items-center justify-between mt-1",children:[h.jsxs("p",{className:"text-[10px] text-error font-bold flex items-center gap-1.5",children:[h.jsx(Wy,{size:12}),a("terminal.failed_to_process",{count:T.metadata?.errors||T.details?.errors})]}),n&&h.jsxs("button",{onClick:()=>n("logs",{filter:"errors"}),className:"flex items-center gap-1 text-[9px] uppercase font-bold text-error bg-error/10 border border-error/20 px-2 py-1 rounded hover:bg-error/20 transition-all group/btn",children:[a("terminal.view_logs"),h.jsx(tc,{size:10,className:"group-hover/btn:translate-x-0.5 transition-transform"})]})]})]}):h.jsx("p",{className:`text-sm break-words leading-relaxed ${T.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:j(T)}),(T.details||T.metadata)&&h.jsxs("div",{className:"mt-2 text-xs",children:[h.jsxs("button",{onClick:()=>S(T.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[g[T.id]?h.jsx(g_,{size:12}):h.jsx(Ls,{size:12}),g[T.id]?a("terminal.hide_details"):a("terminal.view_details")]}),h.jsx(Ot,{children:g[T.id]&&h.jsx(Ue.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:h.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({...T.details,...T.metadata},null,2)})})})]})]})]},T.id))]})]}):h.jsxs("button",{onClick:b,className:`fixed ${w} right-6 z-50 glass p-4 flex items-center gap-3 hover:bg-surface transition-all shadow-xl group border-primary/10`,children:[h.jsxs("div",{className:"relative",children:[h.jsx(uc,{size:20,className:"text-primary"}),c.length>0&&h.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[h.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),h.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),h.jsx("span",{className:"text-xs font-bold uppercase tracking-widest hidden group-hover:block animate-in fade-in slide-in-from-right-2",children:a("terminal.engine_log")})]})}const Ww="1.0.0",SL="20260129000000";async function jL(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:Ww,latestMigrationTimestamp:t||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function EL(e){const t=Ww,n=SL,r=await jL(e);if(r.latestMigrationTimestamp&&r.latestMigrationTimestamp.trim()!==""){const s=n,o=r.latestMigrationTimestamp;return s>o?{needsMigration:!0,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:o,message:`New migrations available. Database is at ${o}, app has ${s}.`}:{needsMigration:!1,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:o,message:"Database schema is up-to-date."}}return{needsMigration:!0,appVersion:t,dbVersion:null,latestMigrationTimestamp:null,message:"Database schema unknown. Migration required."}}function CL(){const{t:e}=et(),[t,n]=R.useState("profile"),[r,s]=R.useState(!1);return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsxs("header",{className:"px-8 py-6 border-b border-border",children:[h.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e("account.title")}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:e("account.desc")})]}),h.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[h.jsxs("aside",{className:"w-64 border-r border-border p-4 space-y-1",children:[h.jsx(wh,{active:t==="profile",onClick:()=>n("profile"),icon:h.jsx(Pc,{size:18}),label:e("account.profile")}),h.jsx(wh,{active:t==="security",onClick:()=>n("security"),icon:h.jsx(Uf,{size:18}),label:e("account.security")}),h.jsx(wh,{active:t==="supabase",onClick:()=>n("supabase"),icon:h.jsx(sa,{size:18}),label:e("account.supabase")})]}),h.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[t==="profile"&&h.jsx(TL,{}),t==="security"&&h.jsx(NL,{}),t==="supabase"&&h.jsx(AL,{})]})]})]})}function TL(){const[e,t]=R.useState(""),[n,r]=R.useState(""),[s,o]=R.useState(""),[a,c]=R.useState(!1),[u,f]=R.useState(!1),[p,g]=R.useState(null),[y,v]=R.useState(!0),{t:b}=et();R.useEffect(()=>{w()},[]);const w=async()=>{const{data:{user:C}}=await ae.auth.getUser();if(!C)return;o(C.email||"");const{data:j}=await ae.from("profiles").select("*").eq("id",C.id).maybeSingle();j?(t(j.first_name||C.user_metadata?.first_name||""),r(j.last_name||C.user_metadata?.last_name||""),g(j.avatar_url)):(t(C.user_metadata?.first_name||""),r(C.user_metadata?.last_name||""));const{data:O}=await ae.from("alchemy_settings").select("sound_enabled").eq("user_id",C.id).maybeSingle();O&&v(O.sound_enabled??!0)},k=async()=>{c(!0);const{data:{user:C}}=await ae.auth.getUser();C&&(await ae.from("profiles").upsert({id:C.id,first_name:e,last_name:n,full_name:e&&n?`${e} ${n}`:e||n||null}),await ae.from("alchemy_settings").update({sound_enabled:y}).eq("user_id",C.id),c(!1))},S=async C=>{const j=C.target.files?.[0];if(j){f(!0);try{const{data:{user:O}}=await ae.auth.getUser();if(!O)return;const T=j.name.split(".").pop(),N=`${O.id}/avatar-${Date.now()}.${T}`,{error:M}=await ae.storage.from("avatars").upload(N,j,{upsert:!0});if(M)throw M;const{data:{publicUrl:V}}=ae.storage.from("avatars").getPublicUrl(N);await ae.from("profiles").update({avatar_url:V}).eq("id",O.id),g(V)}catch(O){console.error("Avatar upload failed:",O)}finally{f(!1)}}};return h.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"flex items-start gap-8",children:[h.jsxs("div",{className:"relative group",children:[h.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?h.jsx("img",{src:p,alt:"Avatar",className:"w-full h-full object-cover"}):h.jsx(Pc,{size:48,className:"text-fg/20"})}),h.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:[h.jsx(gj,{size:24,className:"text-white"}),h.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:S,disabled:u})]}),u&&h.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:h.jsx(Pt,{size:24,className:"text-primary animate-spin"})})]}),h.jsxs("div",{className:"flex-1 space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsx(jc,{label:b("account.first_name"),value:e,onChange:t,placeholder:"Zosimos"}),h.jsx(jc,{label:b("account.last_name"),value:n,onChange:r,placeholder:"of Panopolis"})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:b("account.email_locked")}),h.jsx("input",{type:"email",value:s,readOnly:!0,className:"w-full bg-black/5 border border-border rounded-xl py-3 px-4 text-sm text-fg/40 cursor-not-allowed"})]})]})]}),h.jsxs("section",{className:"glass p-6 space-y-4",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[y?h.jsx(Zy,{size:20,className:"text-primary"}):h.jsx(ex,{size:20,className:"text-fg/40"}),b("account.sound_effects")]}),h.jsx("p",{className:"text-xs text-fg/40",children:b("account.sound_desc")}),h.jsx("button",{onClick:()=>v(!y),className:`w-full p-4 rounded-xl border-2 transition-all ${y?"bg-primary/10 border-primary/30 text-primary":"bg-surface border-border text-fg/40"}`,children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-semibold text-sm",children:b(y?"common.enabled":"common.disabled")}),y?h.jsx(Zy,{size:18}):h.jsx(ex,{size:18})]})})]}),h.jsxs("section",{className:"glass p-6 space-y-4",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(Yy,{size:20,className:"text-error"}),b("account.sign_out")]}),h.jsx("p",{className:"text-xs text-fg/40",children:b("account.logout_desc")}),h.jsx("button",{onClick:()=>ae.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:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-semibold text-sm",children:b("account.sign_out")}),h.jsx(Yy,{size:18})]})})]}),h.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:h.jsxs("button",{onClick:k,disabled:a,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:[a?h.jsx(Pt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),b("account.preserve_profile")]})})]})}function NL(){const[e,t]=R.useState(""),[n,r]=R.useState(""),[s,o]=R.useState(!1),[a,c]=R.useState(null),[u,f]=R.useState(!1),{t:p}=et(),g=async()=>{if(!e||e!==n){c(p("account.password_mismatch"));return}if(e.length<8){c(p("account.password_too_short"));return}o(!0),c(null),f(!1);const{error:y}=await ae.auth.updateUser({password:e});y?c(y.message):(f(!0),t(""),r("")),o(!1)};return h.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:h.jsxs("div",{className:"glass p-6 space-y-6",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(jj,{size:20,className:"text-error"})," ",p("account.security_title")]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx(jc,{label:p("account.new_password"),type:"password",value:e,onChange:t,placeholder:"••••••••"}),h.jsx(jc,{label:p("account.confirm_password"),type:"password",value:n,onChange:r,placeholder:"••••••••"})]}),a&&h.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:a}),u&&h.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:p("account.password_rotate_success")}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:g,disabled:s,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:[s?h.jsx(Pt,{size:18,className:"animate-spin"}):h.jsx(Uf,{size:18}),p("account.rotate_key")]})})]})})}function AL(){const[e,t]=R.useState(!1),[n,r]=R.useState(null),s=Os(),o=cL(),{t:a}=et();R.useEffect(()=>{s&&EL(ae).then(r)},[]);const c=()=>{confirm(a("account.sever_confirm"))&&(aL(),window.location.reload())};return h.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"space-y-6",children:[h.jsx("div",{className:"flex items-center justify-between",children:h.jsxs("div",{children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(sa,{size:20,className:"text-primary"})," ",a("account.essence_resonance")]}),h.jsx("p",{className:"text-xs text-fg/40 font-medium",children:a("account.byok_desc")})]})}),h.jsx("div",{className:"glass p-8 space-y-8",children:s?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[h.jsx(Ns,{className:"w-6 h-6 text-emerald-500 mt-1"}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:a("account.established_link")}),n?.latestMigrationTimestamp&&h.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]})]}),h.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:s.url})]})]}),o==="env"&&h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[h.jsx(kr,{size:16,className:"text-amber-500"}),h.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:a("account.env_notice")})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.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:[h.jsx(_a,{size:14})," ",a("account.realign_link")]}),o==="ui"&&h.jsxs("button",{onClick:c,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:[h.jsx(Bf,{size:14})," ",a("account.sever_link")]})]}),h.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[h.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:a("account.anon_secret_fragment")}),h.jsxs("div",{className:"p-3 bg-surface/50 rounded-xl font-mono text-[11px] text-fg/30 break-all border border-border",children:[s.anonKey.substring(0,32),"..."]})]})]}):h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[h.jsx(sa,{size:48,className:"text-fg/10"}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:a("account.no_resonance")}),h.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:a("account.no_resonance_desc")})]}),h.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:a("account.initiate_link")})]})})]}),h.jsx(Vw,{open:e,onComplete:()=>t(!1),canClose:!0})]})}function wh({active:e,icon:t,label:n,onClick:r}){return h.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?ra.cloneElement(t,{className:"text-primary"}):t,h.jsx("span",{className:"font-semibold text-sm",children:n})]})}function jc({label:e,value:t,onChange:n,placeholder:r,type:s="text"}){return h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e}),h.jsx("input",{type:s,value:t,onChange:o=>n(o.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 RL({signal:e,onClose:t}){const{t:n}=et(),[r,s]=ra.useState(!1);if(!e)return null;const o=()=>{const u=`# ${e.title}
72
+ `).map(Me=>Me.trim())),placeholder:e("engine.blacklist_placeholder"),className:"w-full h-40 px-4 py-3 rounded-xl border border-border bg-surface text-fg text-sm placeholder:text-fg/40 focus:outline-none focus:border-[var(--border-hover)] transition-all resize-none"}),h.jsx("p",{className:"text-xs text-fg/50 ml-1",children:e("engine.blacklist_examples")})]}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:ve,disabled:O,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:[O?h.jsx(Rt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_blacklist")]})})]})]})})]}),h.jsx("section",{className:"space-y-6 mt-8",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[h.jsx(Ff,{size:14})," ",e("engine.blocked_tags_title")]}),h.jsxs("div",{className:"glass p-8 space-y-6",children:[h.jsx("div",{className:"space-y-2",children:h.jsx("p",{className:"text-sm text-fg/60",children:e("engine.blocked_tags_desc")})}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e("engine.blocked_tags_label")}),h.jsx("textarea",{value:b.join("; "),onChange:ee=>w(ee.target.value.split(";").map(Me=>Me.trim())),placeholder:e("engine.blocked_tags_placeholder"),className:"w-full h-40 px-4 py-3 rounded-xl border border-border bg-surface text-fg text-sm placeholder:text-fg/40 focus:outline-none focus:border-[var(--border-hover)] transition-all resize-none"}),h.jsx("p",{className:"text-xs text-fg/50 ml-1",children:e("engine.blocked_tags_info")})]}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:Ne,disabled:N,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:[N?h.jsx(Rt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),e("engine.save_blocked_tags")]})})]})]})})]})})]})}const Kw=R.createContext(null);function bL({children:e}){const[t,n]=R.useState(!1),r=()=>n(!0),s=()=>n(!1);return h.jsx(Kw.Provider,{value:{isExpanded:t,setIsExpanded:n,openTerminal:r,closeTerminal:s},children:e})}function wL(){const e=R.useContext(Kw);if(!e)throw new Error("useTerminal must be used within a TerminalProvider");return e}function kL({isExpanded:e,onToggle:t,onNavigate:n,liftUp:r,isSyncing:s,onStop:o}={}){const{t:a}=et(),[c,u]=R.useState([]),{isExpanded:f,setIsExpanded:p}=wL(),[g,y]=R.useState({}),v=e!==void 0?e:f,b=t||(()=>p(!f)),w=r?"bottom-32":"bottom-6";R.useEffect(()=>{k();const T=ae.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},N=>{const M=N.new;M.event_type==="error"&&y(V=>({...V,[M.id]:!0})),u(V=>{const U=[M,...V];return U.length>50?U.slice(0,50):U})}).subscribe();return()=>{ae.removeChannel(T)}},[]);const k=async()=>{const{data:T}=await ae.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(30);T&&u(T)},S=T=>{y(N=>({...N,[T]:!N[T]}))},C=T=>{switch(T.toLowerCase()){case"reading":return a("terminal.state_reading");case"thinking":return a("terminal.state_thinking");case"signal":return a("terminal.state_signal");case"skipped":return a("terminal.state_skipped");case"error":return a("terminal.state_error");case"completed":return a("terminal.state_completed");default:return T}},j=T=>{const N=T.message||"";if(N.startsWith("Reading content from:")){const M=N.split("Reading content from: ")[1]||"";return a("terminal.msg_reading",{url:M})}if(N.startsWith("Analyzing relevance of:")){const M=N.split("Analyzing relevance of: ")[1]||"";return a("terminal.msg_thinking",{title:M})}if(N.startsWith("Found signal:")){const M=T.metadata?.summary||T.details?.summary||"",V=T.metadata?.score||T.details?.score||0;return a("terminal.msg_found_signal",{summary:M,score:V})}if(N.startsWith("Low signal stored for review")){const M=N.match(/\((\d+)%\)/),V=M?M[1]:"0",U=N.split("): ")[1]||"";return a("terminal.msg_low_signal",{score:V,title:U})}if(N.startsWith("Analysis failed for")){const M=N.split("Analysis failed for ")[1]||"",V=M.split(": ")[0]||"",U=M.split(": ")[1]||"";return a("terminal.msg_failed",{title:V,error:U})}return N.startsWith("Sync completed:")?a("terminal.msg_sync_completed",{signals:T.metadata?.signals_found||T.details?.signals_found||0,skipped:T.metadata?.skipped||T.details?.skipped||0,errors:T.metadata?.errors||T.details?.errors||0}):N},O=(T,N,M,V)=>{if(N==="debug")return h.jsx(pj,{size:14,className:"text-fg/40"});if(M?.is_completion||V?.is_completion)return h.jsx(Ns,{size:14,className:"text-success"});switch(T){case"analysis":return h.jsx(m_,{size:14,className:"text-primary"});case"action":return h.jsx(Vt,{size:14,className:"text-accent"});case"error":return h.jsx(Wy,{size:14,className:"text-error"});case"system":return h.jsx(_a,{size:14,className:"text-success"});default:return h.jsx(v_,{size:14,className:"text-fg/40"})}};return v?h.jsxs(Be.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:[h.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(uc,{size:18,className:"text-primary"}),h.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:a("terminal.title")}),h.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:[h.jsx(cj,{size:10})," ",a("terminal.live")]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[s&&o&&h.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 bg-error/10 hover:bg-error/20 text-error px-2 py-1 rounded text-[10px] uppercase font-bold tracking-wider transition-all border border-error/20 mr-2",children:[h.jsx(X,{size:12})," ",a("terminal.stop_sync")]}),h.jsx("button",{onClick:()=>u([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:a("terminal.clear")}),h.jsx("button",{onClick:b,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:h.jsx(Pj,{size:18})})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[c.length===0&&h.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:a("terminal.idle")}),c.map(T=>h.jsxs("div",{className:"relative flex items-start gap-3 group",children:[h.jsx("div",{className:`mt-1 flex-shrink-0 w-6 h-6 rounded-full bg-surface border flex items-center justify-center ${T.metadata?.is_completion||T.details?.is_completion?"border-success/50 bg-success/5":"border-white/5"}`,children:O(T.event_type,T.level,T.metadata,T.details)}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(T.created_at||Date.now()).toLocaleTimeString()}),h.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${T.level==="error"?"text-error":T.level==="warn"?"text-orange-400":T.event_type==="analysis"?"text-primary":"text-fg/90"}`,children:C(T.agent_state)}),T.metadata?.actionable&&n&&h.jsxs("button",{onClick:()=>n("logs",T.metadata?.actionable),className:"ml-auto flex items-center gap-1 bg-primary/10 text-primary border border-primary/20 px-1.5 py-0.5 rounded text-[10px] uppercase font-bold tracking-wider hover:bg-primary/20 transition-all font-mono",children:[T.metadata.actionable.label,h.jsx(Ls,{size:10,className:"-rotate-90"})]}),T.duration_ms&&!T.metadata?.actionable&&h.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:[h.jsx(Li,{size:10}),T.duration_ms,"ms"]})]}),T.metadata?.is_completion||T.details?.is_completion?h.jsxs("div",{className:"bg-success/5 border border-success/20 rounded-lg p-3 space-y-2 mt-2",children:[h.jsxs("div",{className:"flex items-center gap-2 text-success font-bold uppercase text-[9px] tracking-[0.2em]",children:[h.jsx(Ns,{className:"w-3.5 h-3.5"}),a("terminal.run_completed")]}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 pt-1",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:a("terminal.signals")}),h.jsx("p",{className:"text-sm font-bold text-primary",children:T.metadata?.signals_found||T.details?.signals_found||0})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:a("terminal.urls")}),h.jsx("p",{className:"text-sm font-bold",children:T.metadata?.total_urls||T.details?.total_urls||0})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:a("terminal.skipped")}),h.jsx("p",{className:"text-sm font-bold text-fg/60",children:T.metadata?.skipped||T.details?.skipped||0})]})]}),(T.metadata?.errors||T.details?.errors)>0&&h.jsxs("div",{className:"pt-1 border-t border-success/10 flex items-center justify-between mt-1",children:[h.jsxs("p",{className:"text-[10px] text-error font-bold flex items-center gap-1.5",children:[h.jsx(Wy,{size:12}),a("terminal.failed_to_process",{count:T.metadata?.errors||T.details?.errors})]}),n&&h.jsxs("button",{onClick:()=>n("logs",{filter:"errors"}),className:"flex items-center gap-1 text-[9px] uppercase font-bold text-error bg-error/10 border border-error/20 px-2 py-1 rounded hover:bg-error/20 transition-all group/btn",children:[a("terminal.view_logs"),h.jsx(tc,{size:10,className:"group-hover/btn:translate-x-0.5 transition-transform"})]})]})]}):h.jsx("p",{className:`text-sm break-words leading-relaxed ${T.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:j(T)}),(T.details||T.metadata)&&h.jsxs("div",{className:"mt-2 text-xs",children:[h.jsxs("button",{onClick:()=>S(T.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[g[T.id]?h.jsx(g_,{size:12}):h.jsx(Ls,{size:12}),g[T.id]?a("terminal.hide_details"):a("terminal.view_details")]}),h.jsx(Pt,{children:g[T.id]&&h.jsx(Be.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:h.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({...T.details,...T.metadata},null,2)})})})]})]})]},T.id))]})]}):h.jsxs("button",{onClick:b,className:`fixed ${w} right-6 z-50 glass p-4 flex items-center gap-3 hover:bg-surface transition-all shadow-xl group border-primary/10`,children:[h.jsxs("div",{className:"relative",children:[h.jsx(uc,{size:20,className:"text-primary"}),c.length>0&&h.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[h.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),h.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),h.jsx("span",{className:"text-xs font-bold uppercase tracking-widest hidden group-hover:block animate-in fade-in slide-in-from-right-2",children:a("terminal.engine_log")})]})}const Ww="1.0.0",SL="20260129000000";async function jL(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:Ww,latestMigrationTimestamp:t||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function EL(e){const t=Ww,n=SL,r=await jL(e);if(r.latestMigrationTimestamp&&r.latestMigrationTimestamp.trim()!==""){const s=n,o=r.latestMigrationTimestamp;return s>o?{needsMigration:!0,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:o,message:`New migrations available. Database is at ${o}, app has ${s}.`}:{needsMigration:!1,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:o,message:"Database schema is up-to-date."}}return{needsMigration:!0,appVersion:t,dbVersion:null,latestMigrationTimestamp:null,message:"Database schema unknown. Migration required."}}function CL(){const{t:e}=et(),[t,n]=R.useState("profile"),[r,s]=R.useState(!1);return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsxs("header",{className:"px-8 py-6 border-b border-border",children:[h.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e("account.title")}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:e("account.desc")})]}),h.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[h.jsxs("aside",{className:"w-64 border-r border-border p-4 space-y-1",children:[h.jsx(wh,{active:t==="profile",onClick:()=>n("profile"),icon:h.jsx(Pc,{size:18}),label:e("account.profile")}),h.jsx(wh,{active:t==="security",onClick:()=>n("security"),icon:h.jsx(Uf,{size:18}),label:e("account.security")}),h.jsx(wh,{active:t==="supabase",onClick:()=>n("supabase"),icon:h.jsx(sa,{size:18}),label:e("account.supabase")})]}),h.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[t==="profile"&&h.jsx(TL,{}),t==="security"&&h.jsx(NL,{}),t==="supabase"&&h.jsx(AL,{})]})]})]})}function TL(){const[e,t]=R.useState(""),[n,r]=R.useState(""),[s,o]=R.useState(""),[a,c]=R.useState(!1),[u,f]=R.useState(!1),[p,g]=R.useState(null),[y,v]=R.useState(!0),{t:b}=et();R.useEffect(()=>{w()},[]);const w=async()=>{const{data:{user:C}}=await ae.auth.getUser();if(!C)return;o(C.email||"");const{data:j}=await ae.from("profiles").select("*").eq("id",C.id).maybeSingle();j?(t(j.first_name||C.user_metadata?.first_name||""),r(j.last_name||C.user_metadata?.last_name||""),g(j.avatar_url)):(t(C.user_metadata?.first_name||""),r(C.user_metadata?.last_name||""));const{data:O}=await ae.from("alchemy_settings").select("sound_enabled").eq("user_id",C.id).maybeSingle();O&&v(O.sound_enabled??!0)},k=async()=>{c(!0);const{data:{user:C}}=await ae.auth.getUser();C&&(await ae.from("profiles").upsert({id:C.id,first_name:e,last_name:n,full_name:e&&n?`${e} ${n}`:e||n||null}),await ae.from("alchemy_settings").update({sound_enabled:y}).eq("user_id",C.id),c(!1))},S=async C=>{const j=C.target.files?.[0];if(j){f(!0);try{const{data:{user:O}}=await ae.auth.getUser();if(!O)return;const T=j.name.split(".").pop(),N=`${O.id}/avatar-${Date.now()}.${T}`,{error:M}=await ae.storage.from("avatars").upload(N,j,{upsert:!0});if(M)throw M;const{data:{publicUrl:V}}=ae.storage.from("avatars").getPublicUrl(N);await ae.from("profiles").update({avatar_url:V}).eq("id",O.id),g(V)}catch(O){console.error("Avatar upload failed:",O)}finally{f(!1)}}};return h.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"flex items-start gap-8",children:[h.jsxs("div",{className:"relative group",children:[h.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?h.jsx("img",{src:p,alt:"Avatar",className:"w-full h-full object-cover"}):h.jsx(Pc,{size:48,className:"text-fg/20"})}),h.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:[h.jsx(gj,{size:24,className:"text-white"}),h.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:S,disabled:u})]}),u&&h.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:h.jsx(Rt,{size:24,className:"text-primary animate-spin"})})]}),h.jsxs("div",{className:"flex-1 space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsx(jc,{label:b("account.first_name"),value:e,onChange:t,placeholder:"Zosimos"}),h.jsx(jc,{label:b("account.last_name"),value:n,onChange:r,placeholder:"of Panopolis"})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:b("account.email_locked")}),h.jsx("input",{type:"email",value:s,readOnly:!0,className:"w-full bg-black/5 border border-border rounded-xl py-3 px-4 text-sm text-fg/40 cursor-not-allowed"})]})]})]}),h.jsxs("section",{className:"glass p-6 space-y-4",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[y?h.jsx(Zy,{size:20,className:"text-primary"}):h.jsx(ex,{size:20,className:"text-fg/40"}),b("account.sound_effects")]}),h.jsx("p",{className:"text-xs text-fg/40",children:b("account.sound_desc")}),h.jsx("button",{onClick:()=>v(!y),className:`w-full p-4 rounded-xl border-2 transition-all ${y?"bg-primary/10 border-primary/30 text-primary":"bg-surface border-border text-fg/40"}`,children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-semibold text-sm",children:b(y?"common.enabled":"common.disabled")}),y?h.jsx(Zy,{size:18}):h.jsx(ex,{size:18})]})})]}),h.jsxs("section",{className:"glass p-6 space-y-4",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(Yy,{size:20,className:"text-error"}),b("account.sign_out")]}),h.jsx("p",{className:"text-xs text-fg/40",children:b("account.logout_desc")}),h.jsx("button",{onClick:()=>ae.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:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-semibold text-sm",children:b("account.sign_out")}),h.jsx(Yy,{size:18})]})})]}),h.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:h.jsxs("button",{onClick:k,disabled:a,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:[a?h.jsx(Rt,{size:18,className:"animate-spin"}):h.jsx(wr,{size:18}),b("account.preserve_profile")]})})]})}function NL(){const[e,t]=R.useState(""),[n,r]=R.useState(""),[s,o]=R.useState(!1),[a,c]=R.useState(null),[u,f]=R.useState(!1),{t:p}=et(),g=async()=>{if(!e||e!==n){c(p("account.password_mismatch"));return}if(e.length<8){c(p("account.password_too_short"));return}o(!0),c(null),f(!1);const{error:y}=await ae.auth.updateUser({password:e});y?c(y.message):(f(!0),t(""),r("")),o(!1)};return h.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:h.jsxs("div",{className:"glass p-6 space-y-6",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(jj,{size:20,className:"text-error"})," ",p("account.security_title")]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx(jc,{label:p("account.new_password"),type:"password",value:e,onChange:t,placeholder:"••••••••"}),h.jsx(jc,{label:p("account.confirm_password"),type:"password",value:n,onChange:r,placeholder:"••••••••"})]}),a&&h.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:a}),u&&h.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:p("account.password_rotate_success")}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:g,disabled:s,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:[s?h.jsx(Rt,{size:18,className:"animate-spin"}):h.jsx(Uf,{size:18}),p("account.rotate_key")]})})]})})}function AL(){const[e,t]=R.useState(!1),[n,r]=R.useState(null),s=Os(),o=cL(),{t:a}=et();R.useEffect(()=>{s&&EL(ae).then(r)},[]);const c=()=>{confirm(a("account.sever_confirm"))&&(aL(),window.location.reload())};return h.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"space-y-6",children:[h.jsx("div",{className:"flex items-center justify-between",children:h.jsxs("div",{children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(sa,{size:20,className:"text-primary"})," ",a("account.essence_resonance")]}),h.jsx("p",{className:"text-xs text-fg/40 font-medium",children:a("account.byok_desc")})]})}),h.jsx("div",{className:"glass p-8 space-y-8",children:s?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[h.jsx(Ns,{className:"w-6 h-6 text-emerald-500 mt-1"}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:a("account.established_link")}),n?.latestMigrationTimestamp&&h.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]})]}),h.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:s.url})]})]}),o==="env"&&h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[h.jsx(kr,{size:16,className:"text-amber-500"}),h.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:a("account.env_notice")})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.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:[h.jsx(_a,{size:14})," ",a("account.realign_link")]}),o==="ui"&&h.jsxs("button",{onClick:c,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:[h.jsx(Bf,{size:14})," ",a("account.sever_link")]})]}),h.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[h.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:a("account.anon_secret_fragment")}),h.jsxs("div",{className:"p-3 bg-surface/50 rounded-xl font-mono text-[11px] text-fg/30 break-all border border-border",children:[s.anonKey.substring(0,32),"..."]})]})]}):h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[h.jsx(sa,{size:48,className:"text-fg/10"}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:a("account.no_resonance")}),h.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:a("account.no_resonance_desc")})]}),h.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:a("account.initiate_link")})]})})]}),h.jsx(Vw,{open:e,onComplete:()=>t(!1),canClose:!0})]})}function wh({active:e,icon:t,label:n,onClick:r}){return h.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?ra.cloneElement(t,{className:"text-primary"}):t,h.jsx("span",{className:"font-semibold text-sm",children:n})]})}function jc({label:e,value:t,onChange:n,placeholder:r,type:s="text"}){return h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e}),h.jsx("input",{type:s,value:t,onChange:o=>n(o.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 RL({signal:e,onClose:t}){const{t:n}=et(),[r,s]=ra.useState(!1);if(!e)return null;const o=()=>{const u=`# ${e.title}
73
73
 
74
74
  **${n("discovery.category")}**: ${n(`common.categories.${e.category?.toLowerCase()||"other"}`,e.category||"Research")}
75
75
  **${n("discovery.intelligence_score")}**: ${e.score}/100
@@ -101,10 +101,10 @@ ${e.entities.map(y=>`- ${y}`).join(`
101
101
  `:""}
102
102
  ${e.content?`
103
103
  ## ${n("discovery.full_content")}
104
- ${e.content}`:""}`,f=new Blob([u],{type:"text/markdown"}),p=URL.createObjectURL(f),g=document.createElement("a");g.href=p,g.download=`${e.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,g.click(),URL.revokeObjectURL(p)},c=()=>{const u=JSON.stringify(e,null,2),f=new Blob([u],{type:"application/json"}),p=URL.createObjectURL(f),g=document.createElement("a");g.href=p,g.download=`signal_${e.id}.json`,g.click(),URL.revokeObjectURL(p)};return h.jsx(Ot,{children:h.jsx(Ue.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:h.jsxs(Ue.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:u=>u.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[h.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[h.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:n(`common.categories.${e.category?.toLowerCase()||"other"}`,e.category||"Research")}),h.jsx("span",{className:`text-3xl font-black ${e.score>=80?"text-accent":"text-fg/40"}`,children:e.score})]}),h.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:e.title}),h.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:[n("discovery.discovered")," ",new Date(e.date).toLocaleDateString(n("common.locale_code",void 0),{month:"long",day:"numeric",year:"numeric"})]})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all","aria-label":n("common.close"),children:h.jsx(Tn,{size:24})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[e.url&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("discovery.original_source")}),h.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:[h.jsx(Bi,{size:16,className:"flex-shrink-0"}),h.jsx("span",{className:"truncate",children:e.url}),h.jsxs("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:[n("discovery.open_link")," →"]})]})]}),e.entities&&e.entities.length>0&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("discovery.entities")}),h.jsx("div",{className:"flex flex-wrap gap-2",children:e.entities.map(u=>h.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:u},u))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("discovery.ai_summary")}),h.jsx("div",{className:"p-4 glass rounded-xl",children:h.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:e.summary})})]}),e.content&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("discovery.full_content")}),h.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:h.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:e.content})})]})]}),h.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[h.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:[r?h.jsx(As,{size:16,className:"text-success"}):h.jsx(zf,{size:16}),n(r?"discovery.copied":"common.copy")]}),h.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:[h.jsx($h,{size:16}),"Markdown"]}),h.jsxs("button",{onClick:c,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:[h.jsx($h,{size:16}),"JSON"]})]})]})})})}function PL({isOpen:e,onClose:t}){const{t:n}=et(),{showToast:r}=Jc(),[s,o]=R.useState(""),[a,c]=R.useState(50),[u,f]=R.useState(!1),[p,g]=R.useState(!1);R.useEffect(()=>{e&&y()},[e]);const y=async()=>{const{data:{user:w}}=await ae.auth.getUser();if(!w)return;const{data:k}=await ae.from("alchemy_settings").select("*").eq("user_id",w.id).maybeSingle();if(k){c(k.max_urls_per_sync||50);const S=k.sync_start_date||k.last_sync_checkpoint;if(S){const C=new Date(S),j=T=>T<10?"0"+T:T,O=C.getFullYear()+"-"+j(C.getMonth()+1)+"-"+j(C.getDate())+"T"+j(C.getHours())+":"+j(C.getMinutes());o(O)}else o("")}},v=async()=>{f(!0);try{const{data:{user:w}}=await ae.auth.getUser();if(!w){r(n("discovery.login_to_save"),"error"),f(!1);return}const{error:k}=await ae.from("alchemy_settings").update({max_urls_per_sync:a,sync_start_date:s?new Date(s).toISOString():null}).eq("user_id",w.id);k?r(`${n("common.error")}: ${k.message}`,"error"):(r(n("discovery.sync_saved"),"success"),t())}catch(w){r(`${n("common.error")}: ${w.message}`,"error")}finally{f(!1)}},b=async()=>{g(!0);try{const{data:{user:w}}=await ae.auth.getUser();if(!w){r(n("discovery.login_to_reset"),"error"),g(!1);return}const{error:k}=await ae.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",w.id);k?r(`${n("common.error")}: ${k.message}`,"error"):r(n("discovery.checkpoint_reset"),"success")}catch(w){r(`${n("common.error")}: ${w.message}`,"error")}finally{g(!1)}};return e?h.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:h.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:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[h.jsx("h2",{className:"text-xl font-bold",children:n("discovery.sync_settings")}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-black/10 rounded-lg transition-colors","aria-label":n("common.close"),children:h.jsx(Tn,{className:"w-5 h-5"})})]}),h.jsxs("div",{className:"p-6 space-y-6",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[h.jsx(mj,{className:"w-4 h-4 text-primary"}),n("discovery.sync_from")]}),h.jsx("input",{type:"datetime-local",value:s,onChange:w=>o(w.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"}),h.jsx("p",{className:"text-xs text-fg/50",children:n("discovery.sync_from_hint")})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[h.jsx(kj,{className:"w-4 h-4 text-primary"}),n("discovery.urls_per_sync")]}),h.jsx("span",{className:"text-sm font-mono text-primary",children:a})]}),h.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:a,onChange:w=>c(Number(w.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),h.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[h.jsx("span",{children:n("common.quick","Quick (5)")}),h.jsx("span",{children:n("common.balanced","Balanced (50)")}),h.jsx("span",{children:n("common.thorough","Thorough (200)")})]})]}),h.jsxs("div",{className:"pt-4 border-t border-border/10",children:[h.jsxs("button",{onClick:async()=>{f(!0);try{const{data:w}=await Xe.get("/api/browser-paths/auto-discover");if(w.success&&w.sources.length>0){const{data:{user:k}}=await ae.auth.getUser();k&&(await ae.from("alchemy_settings").update({custom_browser_paths:w.sources}).eq("user_id",k.id),r(n("engine.discovered_sources",{count:w.sources.length}),"success"))}else r(n("engine.no_sources_found"),"info")}catch{r(n("engine.discovery_failed"),"error")}finally{f(!1)}},disabled:u,className:"w-full px-4 py-2.5 bg-primary/10 hover:bg-primary/20 border border-primary/20 text-primary font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[h.jsx(ia,{size:16,className:u?"animate-spin":""}),u?n("common.searching","Searching..."):n("engine.auto_discover_sources","Auto-discover Sources")]}),h.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:n("engine.auto_discover_hint","Automatically find history paths for all browser profiles.")})]}),h.jsxs("div",{className:"pt-4 border-t border-border/10",children:[h.jsxs("button",{onClick:b,disabled:p,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[h.jsx(Dj,{size:16,className:p?"animate-spin":""}),p?n("common.resetting","Resetting..."):n("discovery.reset_checkpoint")]}),h.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:n("discovery.reset_checkpoint_hint")})]}),h.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:h.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:n("discovery.sync_info")})})]}),h.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[h.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:n("common.cancel")}),h.jsxs("button",{onClick:v,disabled:u,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:[h.jsx(wr,{size:18,className:u?"animate-spin":""}),n(u?"common.saving":"discovery.save_settings")]})]})]})}):null}const $i=[{id:"ai",name:"AI & ML",icon:m_,color:"blue",priority:1},{id:"business",name:"Business",icon:fj,color:"purple",priority:1},{id:"politics",name:"Politics",icon:Ej,color:"red",priority:1},{id:"technology",name:"Technology",icon:x_,color:"cyan",priority:1},{id:"finance",name:"Finance",icon:_j,color:"green",priority:1},{id:"crypto",name:"Crypto",icon:dj,color:"orange",priority:1},{id:"science",name:"Science",icon:Rj,color:"teal",priority:1}],Lp={id:"other",name:"Other",icon:qh,color:"gray",priority:3},OL=[...$i,Lp];function LL(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 Gw(e,t){if(t){const n=t.toLowerCase().trim(),r=$i.find(s=>s.id===n||s.name.toLowerCase()===n);if(r)return r.id;if(n==="other")return"other"}for(const n of e){const r=n.toLowerCase(),s=$i.find(o=>r.includes(o.id)||r.includes(o.name.toLowerCase()));if(s)return s.id}return null}function IL({count:e}){const{t}=et();return e<=1?null:h.jsxs("div",{className:"absolute top-3 right-3 px-3 py-1.5 bg-gradient-to-r from-orange-500 to-red-500 rounded-full shadow-lg flex items-center gap-1.5 z-10",title:t("discovery.source_found_in",{count:e}),children:[h.jsx("span",{className:"text-lg",children:"🔥"}),h.jsx("span",{className:"text-white font-bold text-sm",children:e===1?t("discovery.source_count_one",{count:e}):t("discovery.source_count_other",{count:e})})]})}function DL({urls:e,timestamps:t=[]}){const{t:n}=et(),[r,s]=R.useState(!1);return e.length<=1?null:h.jsxs("div",{className:"mt-4 border-t border-border pt-4",children:[h.jsxs("button",{onClick:()=>s(!r),className:"flex items-center justify-between w-full text-sm text-fg/60 hover:text-fg transition-colors",children:[h.jsxs("span",{className:"font-medium",children:[n("discovery.view_all_sources")," (",e.length,")"]}),h.jsx(Ls,{size:16,className:`transition-transform duration-200 ${r?"rotate-180":""}`})]}),r&&h.jsx("div",{className:"mt-3 space-y-2 animate-in fade-in slide-in-from-top-2 duration-200",children:e.map((o,a)=>h.jsxs("div",{className:"flex items-start gap-2 text-xs p-2 rounded-lg hover:bg-surface/50 transition-colors",children:[h.jsx(Bi,{size:12,className:"text-primary mt-0.5 flex-shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-fg/70 hover:text-primary underline truncate block",children:o}),t[a]&&h.jsx("span",{className:"text-fg/40 text-[10px]",children:new Date(t[a]).toLocaleDateString(n("common.locale_code",void 0),{month:"short",day:"numeric",year:"numeric"})})]})]},a))})]})}function Ip({signal:e,onOpen:t,onFavourite:n,onNote:r,onBoost:s,onDismiss:o}){const{t:a}=et(),[c,u]=R.useState(!1),f=v=>v>=80?"text-yellow-400 border-yellow-400/30":v>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",p=v=>v>=80?a("discovery.score_high"):v>=50?a("discovery.score_medium"):a("discovery.score_low"),g=(v,b)=>{const w=Gw(b||[],v);if(w){const k=$i.find(S=>S.id===w);if(k)return k}return Lp},y=v=>{const b=new Date(v),k=new Date().getTime()-b.getTime(),S=Math.floor(k/6e4),C=Math.floor(k/36e5),j=Math.floor(k/864e5);return S<60?a("discovery.time_min_ago",{count:S}):C<24?a("discovery.time_hour_ago",{count:C}):j<7?a("discovery.time_day_ago",{count:j}):b.toLocaleDateString(void 0,{month:"short",day:"numeric"})};return h.jsxs(Ue.div,{whileHover:{scale:1.01,translateY:-2},onHoverStart:()=>u(!0),onHoverEnd:()=>u(!1),className:`relative bg-surface/50 backdrop-blur-sm border rounded-xl p-5 flex flex-col gap-4 transition-all duration-300 ${e.is_favorite?"border-yellow-500/30 shadow-[0_0_20px_rgba(234,179,8,0.1)]":e.is_dismissed?"opacity-50 grayscale":"border-border"}`,children:[h.jsx(IL,{count:e.mention_count||1}),h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs("div",{className:`flex flex-col items-center justify-center w-14 h-14 rounded-2xl border ${f(e.score)} bg-surface`,children:[h.jsx("span",{className:"text-xl font-bold",children:e.score}),h.jsx("span",{className:"text-[9px] font-bold tracking-wider opacity-70",children:p(e.score)})]}),h.jsxs("div",{children:[(()=>{const v=g(e.category,e.tags),b=v.icon;return h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsxs("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold uppercase tracking-wider rounded border border-primary/20 flex items-center gap-1.5 w-fit",children:[h.jsx(b,{size:10}),v.name]}),e.is_boosted&&h.jsxs("span",{className:"px-2 py-0.5 bg-accent/10 text-accent text-[10px] font-bold uppercase tracking-wider rounded border border-accent/20 flex items-center gap-1 w-fit",children:[h.jsx(Vh,{size:10}),a("discovery.boosted")]}),e.is_dismissed&&h.jsxs("span",{className:"px-2 py-0.5 bg-red-500/10 text-red-400 text-[10px] font-bold uppercase tracking-wider rounded border border-red-500/20 flex items-center gap-1 w-fit",children:[h.jsx(Jy,{size:10}),a("discovery.dismissed")]})]})})(),h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-fg/40 font-mono",children:[h.jsx(Li,{size:10}),y(e.created_at),(e.mention_count||1)>1&&h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"•"}),h.jsx("span",{children:a("discovery.sources_count",{count:e.mention_count})})]})]})]})]}),n&&h.jsx("button",{onClick:()=>n(e.id,!!e.is_favorite),className:`p-2 rounded-lg transition-all ${e.is_favorite?"bg-yellow-500/10 text-yellow-500 hover:bg-yellow-500/20":"bg-white/5 text-fg/40 hover:bg-white/10 hover:text-yellow-500"}`,title:e.is_favorite?a("discovery.remove_favourite"):a("discovery.add_favourite"),children:h.jsx($j,{size:18,fill:e.is_favorite?"currentColor":"none"})})]}),h.jsxs("div",{className:"flex-1",children:[h.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-base font-bold text-fg/90 hover:text-primary transition-colors line-clamp-2 mb-2 leading-tight block",onClick:v=>{v.preventDefault(),t?.(e.url)},children:e.title}),h.jsx("p",{className:"text-xs text-fg/60 line-clamp-3 leading-relaxed",children:e.summary}),e.user_notes&&h.jsxs("div",{className:"mt-3 p-3 bg-yellow-500/5 border border-yellow-500/20 rounded-lg flex gap-2",children:[h.jsx(Ii,{size:14,className:"text-yellow-500 shrink-0 mt-0.5"}),h.jsxs("p",{className:"text-xs text-fg/80 italic font-medium line-clamp-2",children:['"',e.user_notes,'"']})]})]}),e.entities&&e.entities.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.entities.slice(0,4).map((v,b)=>h.jsx("span",{className:"px-2 py-0.5 bg-white/5 text-fg/50 text-[10px] rounded border border-white/5",children:v},b)),e.entities.length>4&&h.jsxs("span",{className:"px-2 py-0.5 text-fg/30 text-[10px]",children:["+",e.entities.length-4]})]}),h.jsx(DL,{urls:e.metadata?.source_urls||[],timestamps:e.metadata?.timestamps||[]}),h.jsxs("div",{className:"grid grid-cols-5 gap-2 pt-2 border-t border-border",children:[h.jsxs("button",{onClick:()=>t?.(e.url),className:"flex items-center justify-center gap-1.5 px-3 py-2 bg-white/5 hover:bg-white/10 rounded-lg transition-colors text-xs font-semibold text-fg/70",title:a("discovery.open_source"),children:[h.jsx(Bi,{size:14}),a("discovery.open_source")]}),r&&h.jsxs("button",{onClick:()=>r(e.id,e.user_notes||null,e.title),className:`flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.user_notes?"bg-blue-500/10 text-blue-400 hover:bg-blue-500/20":"bg-white/5 text-fg/70 hover:bg-white/10 hover:text-blue-400"}`,title:a("discovery.add_note"),children:[h.jsx(Ii,{size:14}),a("discovery.add_note")]}),s&&h.jsxs("button",{onClick:()=>s(e.id,!!e.is_boosted),className:`col-span-2 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.is_boosted?"bg-accent/20 text-accent hover:bg-accent/30 shadow-sm border border-accent/20":"bg-white/5 text-fg/70 hover:bg-accent/10 hover:text-accent group"}`,title:a("discovery.boost_topic"),children:[h.jsx(Vh,{size:14,className:e.is_boosted?"fill-current":"group-hover:text-accent"}),e.is_boosted?a("discovery.boosted"):a("discovery.boost_topic")]}),o&&h.jsx("button",{onClick:()=>o(e.id,!!e.is_dismissed),className:`flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.is_dismissed?"bg-red-500/10 text-red-400 hover:bg-red-500/20":"bg-white/5 text-fg/70 hover:bg-white/10 hover:text-red-400"}`,title:a("discovery.dismiss_hint"),children:h.jsx(Jy,{size:14})})]})]})}function Jw({isOpen:e,onClose:t,initialNote:n,title:r,onSave:s}){const{t:o}=et(),[a,c]=R.useState(n||""),[u,f]=R.useState(!1);R.useEffect(()=>{c(n||"")},[n,e]);const p=async()=>{f(!0);try{await s(a),t()}catch(g){console.error("Failed to save note:",g)}finally{f(!1)}};return h.jsx(Ot,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx(Ue.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60]"}),h.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none",children:h.jsxs(Ue.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-lg overflow-hidden pointer-events-auto",children:[h.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("h3",{className:"font-bold flex items-center gap-2",children:[h.jsx(Ii,{size:18,className:"text-primary"}),o("discovery.add_note_title")]}),h.jsx("button",{onClick:t,className:"p-1 hover:bg-surface rounded text-fg/40 hover:text-fg transition-colors",children:h.jsx(Tn,{size:18})})]}),h.jsxs("div",{className:"p-4 space-y-3",children:[h.jsxs("p",{className:"text-xs text-fg/50 line-clamp-1 font-mono",children:[o("discovery.target"),": ",r]}),h.jsx("textarea",{value:a,onChange:g=>c(g.target.value),placeholder:o("discovery.note_placeholder"),className:"w-full h-40 bg-surface/50 border border-border/20 rounded-lg p-3 text-sm focus:border-primary/50 focus:ring-1 focus:ring-primary/20 outline-none resize-none placeholder:text-fg/20",autoFocus:!0})]}),h.jsxs("div",{className:"p-4 border-t border-border bg-surface/10 flex justify-end gap-2",children:[h.jsx("button",{onClick:t,className:"px-4 py-2 hover:bg-surface rounded-lg text-xs font-bold text-fg/60 transition-colors",disabled:u,children:o("common.cancel")}),h.jsx("button",{onClick:p,disabled:u,className:"px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg text-xs font-bold flex items-center gap-2 transition-colors disabled:opacity-50",children:u?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}),o("common.saving")]}):h.jsxs(h.Fragment,{children:[h.jsx(wr,{size:14}),o("discovery.save_note")]})})]})]})})]})})}function ML({initialState:e}){const{t}=et(),[n,r]=R.useState([]),[s,o]=R.useState(!0),[a,c]=R.useState(null),[u,f]=R.useState(null),[p,g]=R.useState([]),[y,v]=R.useState([]),[b,w]=R.useState([]),[k,S]=R.useState(!1),[C,j]=R.useState(!1),[O,T]=R.useState(!1),[N,M]=R.useState(!1),[V,B]=R.useState(null),[L,Q]=R.useState(0),[Y,he]=R.useState(""),[K,W]=R.useState(null),[ne,re]=R.useState("all"),[J,ce]=R.useState(!1),[A,D]=R.useState([]),[G,P]=R.useState([]),[_e,me]=R.useState([]),[ye,Ne]=R.useState({errors:0,signals:0});R.useEffect(()=>{st()},[]),R.useEffect(()=>{N&&Be(L)},[N,L,K,ne]),R.useEffect(()=>{const te=setTimeout(()=>{N&&Be(0)},500);return()=>clearTimeout(te)},[Y]),R.useEffect(()=>{e&&(e.type==="blacklist_suggestion"&&(D(e.data?.suggestions||[]),j(!0)),e.filter==="errors"&&(T(!0),pe()))},[e]),R.useEffect(()=>{if(n.length>0){const te=n.reduce((je,be)=>je+be.errors,0),ge=n.reduce((je,be)=>je+be.signals_found,0);Ne({errors:te,signals:ge})}},[n]);const pe=async()=>{const{data:{user:te}}=await ae.auth.getUser();if(!te)return;const{data:ge,error:je}=await ae.from("processing_events").select("*").eq("user_id",te.id).eq("event_type","error").order("created_at",{ascending:!1}).limit(50);!je&&ge&&P(ge)},Be=async(te=0)=>{ce(!0);const{data:{user:ge}}=await ae.auth.getUser();if(!ge)return;const je=20,be=te*je,Fe=be+je-1;let Se=ae.from("signals").select("*").eq("user_id",ge.id).order("created_at",{ascending:!1}).range(be,Fe);K&&(Se=Se.eq("category",K)),ne==="high"?Se=Se.gte("score",80):ne==="medium"?Se=Se.gte("score",50).lt("score",80):ne==="low"&&(Se=Se.lt("score",50)),Y&&(Se=Se.or(`title.ilike.%${Y}%,url.ilike.%${Y}%`));const{data:Qe,error:tt}=await Se;!tt&&Qe&&me(Qe),ce(!1)},st=async()=>{o(!0);try{const{data:{user:te}}=await ae.auth.getUser();if(!te)return;const{data:ge,error:je}=await ae.from("processing_events").select("*").eq("user_id",te.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(je){console.error("Error fetching sync runs:",je);return}const be=(ge||[]).map(Fe=>{const Se=Fe.metadata||{},Qe=Se.errors||0,tt=Se.signals_found||0,nt=Se.skipped||0;return{id:Fe.id,started_at:Fe.created_at,completed_at:Fe.created_at,duration_ms:Fe.duration_ms||0,signals_found:tt,urls_processed:Se.total_urls||0,skipped:nt,errors:Qe,status:Qe>0?"partial":tt>0?"success":"failed"}});r(be)}catch(te){console.error("Failed to fetch sync runs:",te)}finally{o(!1)}},bt=async te=>{S(!0);try{const{data:{user:ge}}=await ae.auth.getUser();if(!ge)return;const je=n.find(we=>we.id===te);if(!je)return;const be=new Date(new Date(je.started_at).getTime()-je.duration_ms),Fe=new Date(je.completed_at),{data:Se,error:Qe}=await ae.from("processing_events").select("*").eq("user_id",ge.id).gte("created_at",be.toISOString()).lte("created_at",Fe.toISOString()).order("created_at",{ascending:!0});if(Qe){console.error("Error fetching run events:",Qe);return}g(Se||[]);const tt=[],nt=(Se||[]).filter(we=>we.agent_state==="Mining"&&we.message.includes("Mining source:"));for(const we of nt){const $e=we.message.match(/Mining source: (.+) \((.+)\)/);if($e){const qe=$e[1],ot=$e[2],Mt=(Se||[]).find(Zt=>Zt.agent_state==="Mining"&&Zt.message.includes("Found")&&Zt.message.includes(qe)&&Zt.created_at>we.created_at),jt=Mt?.message.match(/Found (\d+) URLs/),on=jt?parseInt(jt[1]):0;tt.push({label:qe,browser:ot,urls_found:on,duration_ms:Mt?.duration_ms||0,status:we.event_type==="error"?"error":"success"})}}v(tt);const Z=[],le=(Se||[]).filter(we=>we.agent_state==="Reading");for(const we of le){const $e=we.message.match(/Reading content from: (.+)/);if(!$e)continue;const qe=$e[1];let ot=tt.length>0?tt[0].label:"Unknown";const Mt=tt.filter(Ke=>Ke.urls_found>0);(Mt.length===1||Mt.length>1)&&(ot=Mt[0].label),console.log(`[SystemLogs] URL ${qe} assigned to source: ${ot}`);const jt=(Se||[]).find(Ke=>Ke.agent_state==="Signal"&&Ke.created_at>we.created_at&&Ke.message.includes("Found signal")),on=(Se||[]).find(Ke=>Ke.agent_state==="Skipped"&&Ke.created_at>we.created_at&&Ke.message.includes("Irrelevant content")),Zt=(Se||[]).find(Ke=>Ke.event_type==="error"&&Ke.created_at>we.created_at);if(jt){const Ke=jt.message.match(/\((\d+)%\)/),an=Ke?parseInt(Ke[1]):0;Z.push({url:qe,result:"signal",score:an,category:jt.details?.category||"Unknown",duration_ms:jt.duration_ms,source_label:ot})}else if(on){const Ke=on.message.match(/\((\d+)%\): (.+)/),an=Ke?parseInt(Ke[1]):0,en=Ke?Ke[2]:"Irrelevant";Z.push({url:qe,result:"skipped",score:an,reason:en,duration_ms:on.duration_ms,source_label:ot})}else Zt&&Z.push({url:qe,result:"error",reason:Zt.message,source_label:ot})}w(Z)}catch(ge){console.error("Failed to fetch run details:",ge)}finally{S(!1)}},Qn=te=>{a===te?(c(null),f(null),v([]),w([])):(c(te),f(null),bt(te))},Zn=te=>{f(u===te?null:te)},er=te=>{if(te<1e3)return`${te}ms`;const ge=Math.floor(te/1e3);if(ge<60)return`${ge}s`;const je=Math.floor(ge/60),be=ge%60;return`${je}m ${be}s`},ee=te=>{switch(te){case"success":return h.jsx(Ns,{className:"w-5 h-5 text-success"});case"failed":return h.jsx(gs,{className:"w-5 h-5 text-error"});case"partial":return h.jsx(kr,{className:"w-5 h-5 text-warning"});default:return h.jsx(Li,{className:"w-5 h-5 text-fg/40"})}},De=te=>{switch(te){case"signal":return h.jsx(Vt,{className:"w-4 h-4 text-primary"});case"skipped":return h.jsx(zj,{className:"w-4 h-4 text-fg/40"});case"error":return h.jsx(gs,{className:"w-4 h-4 text-error"});default:return null}};return s?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[h.jsxs("div",{className:"mb-6",children:[h.jsx("h2",{className:"text-2xl font-bold",children:t("logs.title")}),h.jsx("p",{className:"text-sm text-fg/50",children:t("logs.desc")}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6",children:[h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group relative overflow-hidden",onClick:()=>j(!0),children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:t("logs.blacklist_suggestion")}),h.jsx(kr,{size:16,className:"text-orange-400"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:A.length>0?A.length:"--"}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:t("logs.blacklist_desc")}),A.length>0&&h.jsxs("div",{className:"absolute top-2 right-2 flex h-2 w-2",children:[h.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-orange-400 opacity-75"}),h.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-orange-400"})]})]}),h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group",onClick:()=>{T(!0),pe()},children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:t("logs.recent_errors")}),h.jsx(gs,{size:16,className:"text-error"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:ye.errors}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:t("logs.errors_desc")})]}),h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group",onClick:()=>{M(!0),Be()},children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:t("logs.total_signals")}),h.jsx(Vt,{size:16,className:"text-primary"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:ye.signals}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:t("logs.signals_desc")})]})]})]}),h.jsxs(Ot,{children:[C&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs(Ue.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(kr,{className:"text-orange-400"}),t("logs.blacklist_modal_title")]}),h.jsx("p",{className:"text-sm text-fg/60",children:t("logs.blacklist_modal_desc")})]}),h.jsx("button",{onClick:()=>j(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(gs,{size:20,className:"text-fg/40"})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10 space-y-4",children:A.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx("div",{className:"bg-surface/50 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4",children:h.jsx(Ns,{size:32,className:"text-success"})}),h.jsx("p",{className:"font-medium",children:t("logs.no_suggestions")}),h.jsx("p",{className:"text-xs opacity-70 mt-1",children:t("logs.quality_good")})]}):A.map((te,ge)=>h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 flex items-center justify-between group hover:border-primary/20 transition-all",children:[h.jsxs("div",{children:[h.jsx("div",{className:"font-mono text-sm font-bold text-fg/90",children:te.domain}),h.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[h.jsx("span",{className:"text-[10px] bg-surface px-1.5 py-0.5 rounded text-fg/50",children:t("logs.signals_count",{count:te.signalCount})}),h.jsx("span",{className:"text-[10px] bg-surface px-1.5 py-0.5 rounded text-fg/50",children:t("logs.avg_score",{score:te.avgScore})}),h.jsx("span",{className:"text-[10px] text-orange-400 font-medium",children:te.reason==="low_score"?t("logs.low_quality"):t("logs.repetitive")})]})]}),h.jsx("button",{onClick:async()=>{const{data:{user:je}}=await ae.auth.getUser();if(je){const{data:be}=await ae.from("alchemy_settings").select("blacklist_domains").eq("user_id",je.id).single(),Fe=be?.blacklist_domains||[];Fe.includes(te.domain)||await ae.from("alchemy_settings").update({blacklist_domains:[...Fe,te.domain]}).eq("user_id",je.id),D(Se=>Se.filter(Qe=>Qe.domain!==te.domain))}},className:"px-4 py-2 bg-orange-500/10 text-orange-500 hover:bg-orange-500 hover:text-white rounded-lg text-xs font-bold transition-all border border-orange-500/20",children:t("logs.blacklist_domain")})]},ge))})]})}),O&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs(Ue.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(gs,{className:"text-error"}),t("logs.errors_modal_title")]}),h.jsx("p",{className:"text-sm text-fg/60",children:t("logs.errors_modal_desc")})]}),h.jsx("button",{onClick:()=>T(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(gs,{size:20,className:"text-fg/40"})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10 space-y-3",children:G.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx(Ns,{size:32,className:"mx-auto mb-4 text-success opacity-50"}),h.jsx("p",{children:t("logs.no_recent_errors")})]}):G.map((te,ge)=>h.jsxs("div",{className:"glass p-4 rounded-xl border border-error/20 bg-error/5 flex items-start gap-3",children:[h.jsx(kr,{size:16,className:"text-error mt-0.5 shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("span",{className:"text-xs font-mono text-fg/40",children:new Date(te.created_at).toLocaleString()}),h.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-error",children:te.agent_state})]}),h.jsx("p",{className:"text-sm font-mono text-fg/90 break-words",children:te.message}),te.details&&Object.keys(te.details).length>0&&h.jsx("pre",{className:"mt-2 p-2 bg-black/20 rounded text-[10px] text-fg/60 overflow-x-auto",children:JSON.stringify(te.details,null,2)})]})]},ge))})]})})]}),h.jsx(Ot,{children:N&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs(Ue.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border bg-surface/30 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(Vt,{className:"text-primary"}),t("logs.signals_modal_title")]}),h.jsx("p",{className:"text-sm text-fg/60",children:t("logs.signals_modal_desc")})]}),h.jsx("button",{onClick:()=>M(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(gs,{size:20,className:"text-fg/40"})})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("div",{className:"relative flex-1",children:[h.jsx("input",{type:"text",placeholder:t("logs.search_placeholder"),className:"w-full bg-black/5 border border-border/20 rounded-lg pl-9 pr-4 py-2 text-sm text-fg focus:ring-2 focus:ring-primary/20 focus:border-primary/50 outline-none",value:Y,onChange:te=>{he(te.target.value),Q(0)},onKeyDown:te=>te.key==="Enter"&&Be(0)}),h.jsx(ia,{className:"absolute left-3 top-2.5 w-4 h-4 text-fg/40"})]}),h.jsxs("select",{className:"bg-black/5 border border-border/20 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:border-primary/50",value:ne||"all",onChange:te=>{re(te.target.value),Q(0)},children:[h.jsx("option",{value:"all",children:t("logs.any_score")}),h.jsx("option",{value:"high",children:t("logs.high_score")}),h.jsx("option",{value:"medium",children:t("logs.medium_score")}),h.jsx("option",{value:"low",children:t("logs.low_score")})]}),h.jsxs("select",{className:"bg-black/5 border border-border/20 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:border-primary/50",value:K||"",onChange:te=>{W(te.target.value||null),Q(0)},children:[h.jsx("option",{value:"",children:t("logs.all_categories")}),h.jsx("option",{value:"AI & ML",children:"AI & ML"}),h.jsx("option",{value:"Technology",children:"Technology"}),h.jsx("option",{value:"Business",children:"Business"}),h.jsx("option",{value:"Finance",children:"Finance"}),h.jsx("option",{value:"Politics",children:"Politics"}),h.jsx("option",{value:"Science",children:"Science"}),h.jsx("option",{value:"Crypto",children:"Crypto"}),h.jsx("option",{value:"Other",children:"Other"})]}),h.jsxs("div",{className:"flex items-center gap-2 border-l border-border/10 pl-4",children:[h.jsx("button",{disabled:L===0,onClick:()=>Q(te=>Math.max(0,te-1)),className:"p-2 hover:bg-surface rounded-lg disabled:opacity-30 transition-colors",children:h.jsx(yj,{size:20})}),h.jsx("span",{className:"text-xs font-mono text-fg/50 w-16 text-center",children:t("logs.page_x",{page:L+1})}),h.jsx("button",{disabled:_e.length<20,onClick:()=>Q(te=>te+1),className:"p-2 hover:bg-surface rounded-lg disabled:opacity-30 transition-colors",children:h.jsx(tc,{size:20})})]})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10",children:J?h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):_e.length===0?h.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-fg/40 gap-4",children:[h.jsx("div",{className:"w-16 h-16 rounded-full bg-surface/50 flex items-center justify-center",children:h.jsx(Vt,{size:32,className:"opacity-50"})}),h.jsx("p",{children:"No signals found matching your criteria."})]}):h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:_e.map(te=>h.jsx(Ip,{signal:te,onOpen:ge=>window.open(ge,"_blank"),onFavourite:async(ge,je)=>{const be=!je;me(Fe=>Fe.map(Se=>Se.id===ge?{...Se,is_favorite:be}:Se)),await ae.from("signals").update({is_favorite:be}).eq("id",ge)},onBoost:async(ge,je)=>{const be=!je;me(Fe=>Fe.map(Se=>Se.id===ge?{...Se,is_boosted:be}:Se));try{const{data:{session:Fe}}=await ae.auth.getSession(),Se=Fe?.access_token,Qe=Os(),tt={"Content-Type":"application/json","x-user-id":Fe?.user?.id||""};if(Se&&(tt.Authorization=`Bearer ${Se}`),Qe&&(tt["x-supabase-url"]=Qe.url,tt["x-supabase-key"]=Qe.anonKey),!(await fetch(`/api/signals/${ge}/boost`,{method:"POST",headers:tt,body:JSON.stringify({value:be,settings:{}})})).ok)throw new Error("Boost failed")}catch(Fe){console.error("Boost API error:",Fe),me(Se=>Se.map(Qe=>Qe.id===ge?{...Qe,is_boosted:je}:Qe))}},onDismiss:async(ge,je)=>{const be=!je;me(Fe=>Fe.map(Se=>Se.id===ge?{...Se,is_dismissed:be}:Se)),await ae.from("signals").update({is_dismissed:be}).eq("id",ge)},onNote:(ge,je,be)=>B({id:ge,note:je,title:be})},te.id))})})]})})}),V&&h.jsx(Jw,{isOpen:!!V,onClose:()=>B(null),title:V.title,initialNote:V.note,onSave:async te=>{V&&(me(ge=>ge.map(je=>je.id===V.id?{...je,user_notes:te}:je)),await ae.from("signals").update({user_notes:te}).eq("id",V.id),B(null))}}),h.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:n.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx(Li,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),h.jsx("p",{children:"No sync runs yet"})]}):h.jsx("div",{className:"space-y-2",children:n.map(te=>h.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[h.jsxs("button",{onClick:()=>Qn(te.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[a===te.id?h.jsx(Ls,{className:"w-5 h-5 text-primary shrink-0"}):h.jsx(tc,{className:"w-5 h-5 text-fg/40 shrink-0"}),ee(te.status),h.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),h.jsx("div",{className:"text-sm font-mono",children:new Date(te.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),h.jsx("div",{className:"text-sm font-mono",children:er(te.duration_ms)})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),h.jsx("div",{className:"text-sm font-semibold text-primary",children:te.signals_found})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),h.jsx("div",{className:"text-sm font-semibold text-fg/60",children:te.skipped})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),h.jsx("div",{className:"text-sm font-semibold",children:te.urls_processed})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),h.jsx("div",{className:`text-sm font-semibold ${te.errors>0?"text-error":"text-fg/40"}`,children:te.errors})]})]})]}),h.jsx(Ot,{children:a===te.id&&h.jsx(Ue.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border overflow-hidden",children:h.jsx("div",{className:"p-4 bg-surface/30 space-y-2",children:k?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):y.length===0?h.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):y.map((ge,je)=>h.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>Zn(ge.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[u===ge.label?h.jsx(Ls,{className:"w-4 h-4 text-primary shrink-0"}):h.jsx(tc,{className:"w-4 h-4 text-fg/40 shrink-0"}),h.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[h.jsxs("div",{className:"flex-1",children:[h.jsx("div",{className:"text-sm font-semibold",children:ge.label}),h.jsx("div",{className:"text-xs text-fg/40",children:ge.browser})]}),h.jsxs("div",{className:"text-right",children:[h.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),h.jsx("div",{className:"text-sm font-semibold",children:ge.urls_found})]}),h.jsxs("div",{className:"text-right",children:[h.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),h.jsx("div",{className:"text-sm font-mono",children:er(ge.duration_ms)})]})]})]}),h.jsx(Ot,{children:u===ge.label&&h.jsx(Ue.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border overflow-hidden",children:h.jsx("div",{className:"p-3 bg-surface/50 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:b.filter(be=>be.source_label===ge.label).length===0?h.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):b.filter(be=>be.source_label===ge.label).map((be,Fe)=>h.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[De(be.result),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:be.url}),be.result==="signal"&&h.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",be.score,"%) - ",be.category]}),be.result==="skipped"&&h.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",be.score,"%) - ",be.reason]}),be.result==="error"&&h.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",be.reason]})]}),h.jsx("a",{href:be.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:Se=>Se.stopPropagation(),children:h.jsx(Bi,{className:"w-3 h-3 text-fg/40"})})]},Fe))})})})]},je))})})})]},te.id))})})]})}function zL({signals:e,limit:t=10,onSignalClick:n}){const{t:r}=et(),s=e.slice(0,t),[o,a]=R.useState(()=>{const f=localStorage.getItem("newSignalsFeedExpanded");return f!==null?f==="true":!0});R.useEffect(()=>{localStorage.setItem("newSignalsFeedExpanded",String(o))},[o]);const c=f=>f>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":f>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",u=f=>{const p=new Date(f),y=new Date().getTime()-p.getTime(),v=Math.floor(y/6e4),b=Math.floor(y/36e5);return v<1?r("common.just_now"):v<60?r("discovery.time_min_ago",{count:v}):b<24?r("discovery.time_hour_ago",{count:b}):p.toLocaleDateString(r("common.locale_code",void 0),{month:"short",day:"numeric"})};return s.length===0?null:h.jsxs("div",{className:"mb-3",children:[h.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:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsxs("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:[r("discovery.new_signals")," (",s.length,")"]})}),o?h.jsx(g_,{size:16,className:"text-fg/40"}):h.jsx(Ls,{size:16,className:"text-fg/40"})]}),h.jsx(Ot,{children:o&&h.jsx(Ue.div,{initial:{height:0,opacity:0,overflow:"hidden"},animate:{height:"auto",opacity:1,transitionEnd:{overflow:"visible"}},exit:{height:0,opacity:0,overflow:"hidden"},transition:{duration:.2},className:"py-3",children:h.jsx("div",{className:"overflow-x-auto pb-2 -mx-4 px-4 scrollbar-on-hover",children:h.jsx("div",{className:"flex gap-3 min-w-max",children:s.map(f=>h.jsxs(Ue.button,{onClick:()=>n(f.id),whileHover:{scale:1.05},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 relative z-0 hover:z-10",children:[h.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${c(f.score)}`,children:h.jsx("span",{className:"text-xl font-bold",children:f.score})}),h.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:f.title}),h.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[h.jsx(Li,{size:10}),h.jsx("span",{children:u(f.created_at)})]})]},f.id))})})})})]})}function FL({category:e,signalCount:t,latestTimestamp:n,onClick:r}){const{t:s}=et(),o=c=>{const u=new Date(c),p=new Date().getTime()-u.getTime(),g=Math.floor(p/6e4),y=Math.floor(p/36e5),v=Math.floor(p/864e5);return g<60?s("discovery.time_min_ago",{count:g}):y<24?s("discovery.time_hour_ago",{count:y}):v<7?s("discovery.time_day_ago",{count:v}):u.toLocaleDateString(s("common.locale_code",void 0),{month:"short",day:"numeric"})},a=e.icon;return h.jsxs(Ue.button,{whileHover:{scale:1.05},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 relative z-0 hover:z-10",children:[h.jsx("div",{className:"mb-4",children:h.jsx(a,{size:40,className:"text-current opacity-80"})}),h.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:s(`common.categories.${e.id}`,e.name)}),h.jsxs("div",{className:"flex items-center justify-between text-sm",children:[h.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${LL(e.color)}`,children:s("discovery.sources_count",{count:t})}),h.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[h.jsx(Li,{size:12}),o(n)]})]})]})}const $L=3,UL={ai:"artificial intelligence",ml:"machine learning",llm:"large language models",llms:"large language models",gpt:"large language models",genai:"generative ai","gen ai":"generative ai",js:"javascript",ts:"typescript",py:"python",api:"apis",apis:"apis",saas:"software as a service",iot:"internet of things",ar:"augmented reality",vr:"virtual reality",xr:"extended reality",vc:"venture capital",pe:"private equity",ipo:"initial public offering","m&a":"mergers and acquisitions",b2b:"business to business",b2c:"business to consumer",btc:"bitcoin",eth:"ethereum",nft:"nfts",nfts:"nfts",defi:"decentralized finance",web3:"web3",infosec:"cybersecurity",security:"cybersecurity",devops:"devops",dev:"development"};function BL(e){const t=e.toLowerCase().trim();return UL[t]||t}function VL({signals:e,externalCounts:t,onCategoryClick:n,onSync:r,isSyncing:s}){const{t:o}=et(),[a,c]=R.useState(new Set);R.useEffect(()=>{(async()=>{const{data:{user:g}}=await ae.auth.getUser();if(!g)return;const{data:y}=await ae.from("alchemy_settings").select("blocked_tags").eq("user_id",g.id).maybeSingle();y?.blocked_tags&&c(new Set(y.blocked_tags))})()},[]);const{categories:u,finalCounts:f}=R.useMemo(()=>{const p=a.size>0?a:Hw,g=S=>{const C=S.toLowerCase().trim();if(p.has(C))return!0;for(const j of p)if(C===j||j.length>3&&C.startsWith(j+" "))return!0;return!1},y=new Map;t&&($i.forEach(S=>{const C=t[S.id],j=t[S.name.toLowerCase()],O=C||j;O&&O.count>0&&y.set(S.id,O)}),t.other&&t.other.count>0&&y.set("other",t.other));const v=new Map;e.forEach(S=>{const C=S.tags||[],j=Gw(C,S.category);if(!t&&j){const O=y.get(j)||{count:0,latest:S.created_at};y.set(j,{count:O.count+1,latest:S.created_at>O.latest?S.created_at:O.latest})}j||C.forEach(O=>{if(!O||g(O))return;const T=BL(O);if(!T||g(T))return;v.set(T,(v.get(T)||0)+1);const N=y.get(T)||{count:0,latest:S.created_at};y.set(T,{count:N.count+1,latest:S.created_at>N.latest?S.created_at:N.latest})})});const b=Array.from(v.entries()).filter(([S,C])=>C>=$L).map(([S,C])=>({id:S,name:S.split(" ").map(j=>j.charAt(0).toUpperCase()+j.slice(1)).join(" "),icon:Ff,color:"gray",priority:2}));return{categories:[...$i,...b,Lp].filter(S=>{const C=y.get(S.id);return C&&C.count>0}).sort((S,C)=>S.priority-C.priority),finalCounts:y}},[e,t,a]);return u.length===0?h.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center bg-surface/10 rounded-2xl border border-dashed border-border/20 m-2",children:[h.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center mb-6 text-primary",children:h.jsx(Vh,{className:"w-8 h-8 animate-pulse"})}),h.jsx("h3",{className:"text-xl font-bold mb-2",children:o("discovery.welcome_title","Welcome to Alchemist!")}),h.jsx("p",{className:"max-w-md text-fg/50 mb-8 leading-relaxed",children:o("discovery.welcome_desc","Connect your browser history to start discovering signals. We'll automatically analyze your visited pages to find mentions of AI, tech, and more.")}),h.jsxs("button",{onClick:r,disabled:s||!r,className:"px-8 py-3.5 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 disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx(_a,{size:20,className:s?"animate-spin":""}),s?o("discovery.syncing"):o("discovery.auto_detect_sync","Auto-detect & Sync")]}),h.jsxs("div",{className:"mt-8 flex items-center gap-6 text-[11px] font-medium text-fg/30 uppercase tracking-widest",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Uf,{size:12})," ",o("discovery.privacy_first","Privacy First")]}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Vt,{size:12})," ",o("discovery.offline_first","Offline First")]})]})]}):h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 p-2",children:u.map(p=>{const g=f.get(p.id);return h.jsx(FL,{category:p,signalCount:g.count,latestTimestamp:g.latest,onClick:()=>n(p.id)},p.id)})})}function qL({isOpen:e,onClose:t,categoryId:n,signals:r,onOpenUrl:s,onFavourite:o,onNote:a,onBoost:c,onDismiss:u}){const{t:f}=et(),p=OL.find(T=>T.id===n),[g,y]=R.useState(null),[v,b]=R.useState([]),[w,k]=R.useState(!1);R.useEffect(()=>{if(!e||!n){b([]);return}(async()=>{k(!0);const N=p?.name||n,{data:M,error:V}=await ae.from("signals").select("*").ilike("category",N).order("created_at",{ascending:!1}).limit(50);V?(console.error("Error fetching category signals:",V),b(r.filter(B=>{const L=B.tags||[],Q=B.category?.toLowerCase()===n,Y=L.some(he=>he.toLowerCase().includes(n));return Q||Y}))):b(M||[]),k(!1)})()},[e,n,p?.name]);const S=v,C=T=>{s?s(T):window.open(T,"_blank","noopener,noreferrer")},j=(T,N,M)=>{y({id:T,note:N,title:M})},O=async T=>{g&&a&&(await a(g.id,T),y(null))};return h.jsx(Ot,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx(Ue.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),h.jsxs(Ue.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:[h.jsx("div",{className:"sticky top-0 z-10 bg-bg/95 backdrop-blur-md border-b border-border p-6 shadow-sm",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[p?.icon&&h.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-surface/50 rounded-xl border border-white/5",children:h.jsx(p.icon,{size:28,className:"text-primary"})}),h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-bold",children:f(`common.categories.${n}`,p?.name)}),h.jsx("p",{className:"text-sm text-fg/50 font-mono",children:S.length===1?f("discovery.signal_count_one",{count:S.length}):f("discovery.signal_count_other",{count:S.length})})]})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors text-fg/60 hover:text-fg","aria-label":f("common.close"),children:h.jsx(Tn,{size:24})})]})}),h.jsx("div",{className:"p-6 space-y-4",children:w?h.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/30 gap-2",children:[h.jsx(Pt,{size:32,className:"animate-spin"}),h.jsx("p",{children:f("discovery.loading_signals")})]}):S.length===0?h.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/30 gap-2",children:[p?.icon&&h.jsx(p.icon,{size:48,className:"opacity-20"}),h.jsx("p",{className:"italic",children:f("discovery.no_signals_in_category",{category:f(`common.categories.${n}`,p?.name)})})]}):S.map(T=>h.jsx(Ip,{signal:T,onOpen:C,onFavourite:o,onNote:j,onBoost:c,onDismiss:u},T.id))})]}),g&&h.jsx(Jw,{isOpen:!!g,onClose:()=>y(null),title:g.title,initialNote:g.note,onSave:O})]})})}function HL({onOpenUrl:e,onCopyText:t,onSync:n,isSyncing:r}){const{t:s}=et(),[o,a]=R.useState([]),[c,u]=R.useState({}),[f,p]=R.useState(!0),[g,y]=R.useState(null),[v,b]=R.useState(""),[w,k]=R.useState(null);R.useEffect(()=>{(async()=>{const{data:j,error:O}=await ae.from("signals").select("category, created_at").order("created_at",{ascending:!1});if(O){console.error("Error fetching category counts:",O);return}const T={};j?.forEach(N=>{const M=N.category?.toLowerCase()||"other";T[M]||(T[M]={count:0,latest:N.created_at}),T[M].count++,N.created_at>T[M].latest&&(T[M].latest=N.created_at)}),u(T)})()},[]),R.useEffect(()=>{(async()=>{p(!0);let O=ae.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);w&&(O=O.ilike("category",w)),v&&(O=O.or(`title.ilike.%${v}%,summary.ilike.%${v}%,url.ilike.%${v}%`));const{data:T,error:N}=await O;N?console.error("Error fetching signals:",N):a(T||[]),p(!1)})();const j=ae.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},O=>{a(T=>[O.new,...T])}).subscribe();return()=>{j.unsubscribe()}},[v,w]);const S=C=>{e?e(C):window.open(C,"_blank","noopener,noreferrer")};return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsx("div",{className:"px-4 pt-2",children:h.jsx(zL,{signals:o,limit:10,onSignalClick:C=>{const j=o.find(O=>O.id===C);j&&j.category&&y(j.category.toLowerCase())}})}),h.jsxs("div",{className:"px-4 pt-1 pb-2 space-y-3",children:[h.jsxs("div",{className:"relative",children:[h.jsx(ia,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),h.jsx("input",{type:"text",placeholder:s("chat.ask_anything","Search signals..."),value:v,onChange:C=>b(C.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"}),v&&h.jsx("button",{onClick:()=>b(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:s("common.clear"),children:h.jsx(Tn,{size:16})})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx(bj,{className:"w-3.5 h-3.5 text-fg/40"}),h.jsx("button",{onClick:()=>k(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${w===null?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:s("common.all")}),[{id:"AI & ML",key:"common.categories.ai_ml"},{id:"Business",key:"common.categories.business"},{id:"Politics",key:"common.categories.politics"},{id:"Technology",key:"common.categories.technology"},{id:"Finance",key:"common.categories.finance"},{id:"Crypto",key:"common.categories.crypto"},{id:"Science",key:"common.categories.science"},{id:"Other",key:"common.categories.other"}].map(C=>h.jsx("button",{onClick:()=>k(C.id),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${w===C.id?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:s(C.key)},C.id))]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 scrollbar-on-hover",children:f?h.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:h.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):w?h.jsx("div",{className:"space-y-4 py-2",children:o.length===0?h.jsx("div",{className:"h-64 flex flex-col items-center justify-center text-fg/30 gap-2",children:h.jsx("p",{className:"italic",children:s("discovery.no_signals_in_category",{category:s(`common.categories.${w.toLowerCase()}`,w)})})}):o.map(C=>h.jsx(Ip,{signal:C,onOpen:S,onFavourite:async(j,O)=>{const T=!O;a(N=>N.map(M=>M.id===j?{...M,is_favorite:T}:M)),await ae.from("signals").update({is_favorite:T}).eq("id",j)},onBoost:async(j,O)=>{const T=!O;a(N=>N.map(M=>M.id===j?{...M,is_boosted:T}:M)),await ae.from("signals").update({is_boosted:T}).eq("id",j)},onDismiss:async(j,O)=>{const T=!O;a(N=>N.map(M=>M.id===j?{...M,is_dismissed:T}:M)),await ae.from("signals").update({is_dismissed:T}).eq("id",j)}},C.id))}):h.jsx(VL,{signals:o,externalCounts:c,onCategoryClick:C=>y(C),onSync:n,isSyncing:r})}),h.jsx(qL,{isOpen:!!g,onClose:()=>y(null),categoryId:g||"",signals:o,onOpenUrl:S,onFavourite:async(C,j)=>{const O=!j;a(N=>N.map(M=>M.id===C?{...M,is_favorite:O}:M));const{error:T}=await ae.from("signals").update({is_favorite:O}).eq("id",C);T&&(console.error("Failed to update favorite:",T),a(N=>N.map(M=>M.id===C?{...M,is_favorite:j}:M)))},onNote:async(C,j)=>{a(T=>T.map(N=>N.id===C?{...N,user_notes:j}:N));const{error:O}=await ae.from("signals").update({user_notes:j}).eq("id",C);O&&console.error("Failed to update note:",O)},onBoost:async(C,j)=>{const O=!j;a(N=>N.map(M=>M.id===C?{...M,is_boosted:O}:M));const{error:T}=await ae.from("signals").update({is_boosted:O}).eq("id",C);T&&(console.error("Failed to update boost:",T),a(N=>N.map(M=>M.id===C?{...M,is_boosted:j}:M)))},onDismiss:async(C,j)=>{const O=!j;a(N=>N.map(M=>M.id===C?{...M,is_dismissed:O}:M));const{error:T}=await ae.from("signals").update({is_dismissed:O}).eq("id",C);T&&(console.error("Failed to update dismiss:",T),a(N=>N.map(M=>M.id===C?{...M,is_dismissed:j}:M)))}})]})}function KL({activeSessionId:e,onSelectSession:t}){const{t:n}=et(),[r,s]=R.useState([]),[o,a]=R.useState(!0);R.useEffect(()=>{c()},[]);const c=async()=>{try{const{data:{session:f}}=await ae.auth.getSession();if(!f)return;const p=await Xe.get("/api/chat/sessions",{headers:{"x-user-id":f.user.id}});p.data.success&&s(p.data.sessions)}catch(f){console.error("Failed to fetch sessions",f)}finally{a(!1)}},u=async(f,p)=>{f.stopPropagation();try{const{error:g}=await ae.from("chat_sessions").delete().eq("id",p);g||(s(y=>y.filter(v=>v.id!==p)),e===p&&t(null))}catch(g){console.error(g)}};return h.jsxs("div",{className:"w-64 bg-surface/25 backdrop-blur-xl flex flex-col rounded-xl border border-border overflow-hidden",children:[h.jsx("div",{className:"p-3 border-b border-border bg-surface/15",children:h.jsxs("button",{onClick:()=>t(null),className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-primary/10 hover:bg-primary/20 text-primary rounded-xl transition-all font-semibold text-sm border border-primary/20",children:[h.jsx($f,{size:16}),n("chat.new_chat")]})}),h.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:o?h.jsx("div",{className:"p-4 text-center text-xs text-fg/40",children:n("common.loading")}):r.length===0?h.jsxs("div",{className:"p-8 text-center",children:[h.jsx(Uh,{size:24,className:"mx-auto text-fg/20 mb-2"}),h.jsx("p",{className:"text-xs text-fg/40",children:n("chat.no_history")})]}):r.map(f=>h.jsxs("div",{onClick:()=>t(f.id),className:`group flex items-center justify-between px-3 py-3 rounded-lg cursor-pointer transition-all text-sm ${e===f.id?"bg-surface/60 text-fg ring-1 ring-primary/20":"text-fg/60 hover:bg-surface/35 hover:text-fg"}`,children:[h.jsxs("div",{className:"flex items-center gap-2.5 overflow-hidden",children:[h.jsx(Uh,{size:14,className:e===f.id?"text-primary":"opacity-50"}),h.jsx("span",{className:"truncate",children:f.title})]}),h.jsx("button",{onClick:p=>u(p,f.id),className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1.5 hover:bg-red-500/10 hover:text-red-400 rounded transition-all focus-visible:ring-2 focus-visible:ring-red-500/40",children:h.jsx(Bf,{size:12})})]},f.id))})]})}function WL(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const GL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XL={};function v0(e,t){return(XL.jsx?JL:GL).test(e)}const YL=/[ \t\n\f\r]/g;function QL(e){return typeof e=="object"?e.type==="text"?_0(e.value):!1:_0(e)}function _0(e){return e.replace(YL,"")===""}class Aa{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Aa.prototype.normal={};Aa.prototype.property={};Aa.prototype.space=void 0;function Xw(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Aa(n,r,t)}function Cf(e){return e.toLowerCase()}class yn{constructor(t,n){this.attribute=n,this.property=t}}yn.prototype.attribute="";yn.prototype.booleanish=!1;yn.prototype.boolean=!1;yn.prototype.commaOrSpaceSeparated=!1;yn.prototype.commaSeparated=!1;yn.prototype.defined=!1;yn.prototype.mustUseProperty=!1;yn.prototype.number=!1;yn.prototype.overloadedBoolean=!1;yn.prototype.property="";yn.prototype.spaceSeparated=!1;yn.prototype.space=void 0;let ZL=0;const He=Fs(),Ct=Fs(),Tf=Fs(),ue=Fs(),ct=Fs(),Oi=Fs(),kn=Fs();function Fs(){return 2**++ZL}const Nf=Object.freeze(Object.defineProperty({__proto__:null,boolean:He,booleanish:Ct,commaOrSpaceSeparated:kn,commaSeparated:Oi,number:ue,overloadedBoolean:Tf,spaceSeparated:ct},Symbol.toStringTag,{value:"Module"})),kh=Object.keys(Nf);class Dp extends yn{constructor(t,n,r,s){let o=-1;if(super(t,n),b0(this,"space",s),typeof r=="number")for(;++o<kh.length;){const a=kh[o];b0(this,kh[o],(r&Nf[a])===Nf[a])}}}Dp.prototype.defined=!0;function b0(e,t,n){n&&(e[t]=n)}function Wi(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const o=new Dp(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Cf(r)]=r,n[Cf(o.attribute)]=r}return new Aa(t,n,e.space)}const Yw=Wi({properties:{ariaActiveDescendant:null,ariaAtomic:Ct,ariaAutoComplete:null,ariaBusy:Ct,ariaChecked:Ct,ariaColCount:ue,ariaColIndex:ue,ariaColSpan:ue,ariaControls:ct,ariaCurrent:null,ariaDescribedBy:ct,ariaDetails:null,ariaDisabled:Ct,ariaDropEffect:ct,ariaErrorMessage:null,ariaExpanded:Ct,ariaFlowTo:ct,ariaGrabbed:Ct,ariaHasPopup:null,ariaHidden:Ct,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ct,ariaLevel:ue,ariaLive:null,ariaModal:Ct,ariaMultiLine:Ct,ariaMultiSelectable:Ct,ariaOrientation:null,ariaOwns:ct,ariaPlaceholder:null,ariaPosInSet:ue,ariaPressed:Ct,ariaReadOnly:Ct,ariaRelevant:null,ariaRequired:Ct,ariaRoleDescription:ct,ariaRowCount:ue,ariaRowIndex:ue,ariaRowSpan:ue,ariaSelected:Ct,ariaSetSize:ue,ariaSort:null,ariaValueMax:ue,ariaValueMin:ue,ariaValueNow:ue,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Qw(e,t){return t in e?e[t]:t}function Zw(e,t){return Qw(e,t.toLowerCase())}const eI=Wi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Oi,acceptCharset:ct,accessKey:ct,action:null,allow:null,allowFullScreen:He,allowPaymentRequest:He,allowUserMedia:He,alt:null,as:null,async:He,autoCapitalize:null,autoComplete:ct,autoFocus:He,autoPlay:He,blocking:ct,capture:null,charSet:null,checked:He,cite:null,className:ct,cols:ue,colSpan:null,content:null,contentEditable:Ct,controls:He,controlsList:ct,coords:ue|Oi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:He,defer:He,dir:null,dirName:null,disabled:He,download:Tf,draggable:Ct,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:He,formTarget:null,headers:ct,height:ue,hidden:Tf,high:ue,href:null,hrefLang:null,htmlFor:ct,httpEquiv:ct,id:null,imageSizes:null,imageSrcSet:null,inert:He,inputMode:null,integrity:null,is:null,isMap:He,itemId:null,itemProp:ct,itemRef:ct,itemScope:He,itemType:ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:He,low:ue,manifest:null,max:null,maxLength:ue,media:null,method:null,min:null,minLength:ue,multiple:He,muted:He,name:null,nonce:null,noModule:He,noValidate:He,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:He,optimum:ue,pattern:null,ping:ct,placeholder:null,playsInline:He,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:He,referrerPolicy:null,rel:ct,required:He,reversed:He,rows:ue,rowSpan:ue,sandbox:ct,scope:null,scoped:He,seamless:He,selected:He,shadowRootClonable:He,shadowRootDelegatesFocus:He,shadowRootMode:null,shape:null,size:ue,sizes:null,slot:null,span:ue,spellCheck:Ct,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ue,step:null,style:null,tabIndex:ue,target:null,title:null,translate:null,type:null,typeMustMatch:He,useMap:null,value:Ct,width:ue,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ct,axis:null,background:null,bgColor:null,border:ue,borderColor:null,bottomMargin:ue,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:He,declare:He,event:null,face:null,frame:null,frameBorder:null,hSpace:ue,leftMargin:ue,link:null,longDesc:null,lowSrc:null,marginHeight:ue,marginWidth:ue,noResize:He,noHref:He,noShade:He,noWrap:He,object:null,profile:null,prompt:null,rev:null,rightMargin:ue,rules:null,scheme:null,scrolling:Ct,standby:null,summary:null,text:null,topMargin:ue,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ue,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:He,disableRemotePlayback:He,prefix:null,property:null,results:ue,security:null,unselectable:null},space:"html",transform:Zw}),tI=Wi({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:kn,accentHeight:ue,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ue,amplitude:ue,arabicForm:null,ascent:ue,attributeName:null,attributeType:null,azimuth:ue,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ue,by:null,calcMode:null,capHeight:ue,className:ct,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:ue,diffuseConstant:ue,direction:null,display:null,dur:null,divisor:ue,dominantBaseline:null,download:He,dx:null,dy:null,edgeMode:null,editable:null,elevation:ue,enableBackground:null,end:null,event:null,exponent:ue,externalResourcesRequired:null,fill:null,fillOpacity:ue,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:Oi,g2:Oi,glyphName:Oi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ue,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ue,horizOriginX:ue,horizOriginY:ue,id:null,ideographic:ue,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ue,k:ue,k1:ue,k2:ue,k3:ue,k4:ue,kernelMatrix:kn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ue,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:ue,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:ue,overlineThickness:ue,paintOrder:null,panose1:null,path:null,pathLength:ue,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ue,pointsAtY:ue,pointsAtZ:ue,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kn,rev:kn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kn,requiredFeatures:kn,requiredFonts:kn,requiredFormats:kn,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:ue,specularExponent:ue,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ue,strikethroughThickness:ue,string:null,stroke:null,strokeDashArray:kn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ue,strokeOpacity:ue,strokeWidth:null,style:null,surfaceScale:ue,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kn,tabIndex:ue,tableValues:null,target:null,targetX:ue,targetY:ue,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ue,underlineThickness:ue,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ue,values:null,vAlphabetic:ue,vMathematical:ue,vectorEffect:null,vHanging:ue,vIdeographic:ue,version:null,vertAdvY:ue,vertOriginX:ue,vertOriginY:ue,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ue,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Qw}),ek=Wi({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()}}),tk=Wi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zw}),nk=Wi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),nI={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"},rI=/[A-Z]/g,w0=/-[a-z]/g,sI=/^data[-\w.:]+$/i;function iI(e,t){const n=Cf(t);let r=t,s=yn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&sI.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(w0,aI);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!w0.test(o)){let a=o.replace(rI,oI);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Dp}return new s(r,t)}function oI(e){return"-"+e.toLowerCase()}function aI(e){return e.charAt(1).toUpperCase()}const lI=Xw([Yw,eI,ek,tk,nk],"html"),Mp=Xw([Yw,tI,ek,tk,nk],"svg");function cI(e){return e.join(" ").trim()}var yi={},Sh,k0;function uI(){if(k0)return Sh;k0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,c=/^\s+|\s+$/g,u=`
105
- `,f="/",p="*",g="",y="comment",v="declaration";function b(k,S){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];S=S||{};var C=1,j=1;function O(K){var W=K.match(t);W&&(C+=W.length);var ne=K.lastIndexOf(u);j=~ne?K.length-ne:j+K.length}function T(){var K={line:C,column:j};return function(W){return W.position=new N(K),B(),W}}function N(K){this.start=K,this.end={line:C,column:j},this.source=S.source}N.prototype.content=k;function M(K){var W=new Error(S.source+":"+C+":"+j+": "+K);if(W.reason=K,W.filename=S.source,W.line=C,W.column=j,W.source=k,!S.silent)throw W}function V(K){var W=K.exec(k);if(W){var ne=W[0];return O(ne),k=k.slice(ne.length),W}}function B(){V(n)}function L(K){var W;for(K=K||[];W=Q();)W!==!1&&K.push(W);return K}function Q(){var K=T();if(!(f!=k.charAt(0)||p!=k.charAt(1))){for(var W=2;g!=k.charAt(W)&&(p!=k.charAt(W)||f!=k.charAt(W+1));)++W;if(W+=2,g===k.charAt(W-1))return M("End of comment missing");var ne=k.slice(2,W-2);return j+=2,O(ne),k=k.slice(W),j+=2,K({type:y,comment:ne})}}function Y(){var K=T(),W=V(r);if(W){if(Q(),!V(s))return M("property missing ':'");var ne=V(o),re=K({type:v,property:w(W[0].replace(e,g)),value:ne?w(ne[0].replace(e,g)):g});return V(a),re}}function he(){var K=[];L(K);for(var W;W=Y();)W!==!1&&(K.push(W),L(K));return K}return B(),he()}function w(k){return k?k.replace(c,g):g}return Sh=b,Sh}var S0;function dI(){if(S0)return yi;S0=1;var e=yi&&yi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(yi,"__esModule",{value:!0}),yi.default=n;const t=e(uI());function n(r,s){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),c=typeof s=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:p}=u;c?s(f,p,u):p&&(o=o||{},o[f]=p)}),o}return yi}var Mo={},j0;function hI(){if(j0)return Mo;j0=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},a=function(f,p){return p.toUpperCase()},c=function(f,p){return"".concat(p,"-")},u=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(s,c):f=f.replace(r,c),f.replace(t,a))};return Mo.camelCase=u,Mo}var zo,E0;function fI(){if(E0)return zo;E0=1;var e=zo&&zo.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(dI()),n=hI();function r(s,o){var a={};return!s||typeof s!="string"||(0,t.default)(s,function(c,u){c&&u&&(a[(0,n.camelCase)(c,o)]=u)}),a}return r.default=r,zo=r,zo}var pI=fI();const mI=Ac(pI),rk=sk("end"),zp=sk("start");function sk(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 gI(e){const t=zp(e),n=rk(e);if(t&&n)return{start:t,end:n}}function ea(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?C0(e.position):"start"in e||"end"in e?C0(e):"line"in e||"column"in e?Af(e):""}function Af(e){return T0(e&&e.line)+":"+T0(e&&e.column)}function C0(e){return Af(e&&e.start)+"-"+Af(e&&e.end)}function T0(e){return e&&typeof e=="number"?e:1}class Qt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(a=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?o.ruleId=r:(o.source=r.slice(0,u),o.ruleId=r.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){const u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=ea(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Qt.prototype.file="";Qt.prototype.name="";Qt.prototype.reason="";Qt.prototype.message="";Qt.prototype.stack="";Qt.prototype.column=void 0;Qt.prototype.line=void 0;Qt.prototype.ancestors=void 0;Qt.prototype.cause=void 0;Qt.prototype.fatal=void 0;Qt.prototype.place=void 0;Qt.prototype.ruleId=void 0;Qt.prototype.source=void 0;const Fp={}.hasOwnProperty,yI=new Map,xI=/[A-Z]/g,vI=new Set(["table","tbody","thead","tfoot","tr"]),_I=new Set(["td","th"]),ik="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function bI(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=NI(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=TI(n,t.jsx,t.jsxs)}const s={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"?Mp:lI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=ok(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function ok(e,t,n){if(t.type==="element")return wI(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return kI(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return jI(e,t,n);if(t.type==="mdxjsEsm")return SI(e,t);if(t.type==="root")return EI(e,t,n);if(t.type==="text")return CI(e,t)}function wI(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Mp,e.schema=s),e.ancestors.push(t);const o=lk(e,t.tagName,!1),a=AI(e,t);let c=Up(e,t);return vI.has(t.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!QL(u):!0})),ak(e,a,o,t),$p(a,c),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function kI(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)}xa(e,t.position)}function SI(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xa(e,t.position)}function jI(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Mp,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:lk(e,t.name,!0),a=RI(e,t),c=Up(e,t);return ak(e,a,o,t),$p(a,c),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function EI(e,t,n){const r={};return $p(r,Up(e,t)),e.create(t,e.Fragment,r,n)}function CI(e,t){return t.value}function ak(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $p(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function TI(e,t,n){return r;function r(s,o,a,c){const f=Array.isArray(a.children)?n:t;return c?f(o,a,c):f(o,a)}}function NI(e,t){return n;function n(r,s,o,a){const c=Array.isArray(o.children),u=zp(r);return t(s,o,a,c,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function AI(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Fp.call(t.properties,s)){const o=PI(e,s,t.properties[s]);if(o){const[a,c]=o;e.tableCellAlignToStyle&&a==="align"&&typeof c=="string"&&_I.has(t.tagName)?r=c:n[a]=c}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function RI(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const c=a.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else xa(e,t.position);else{const s=r.name;let o;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,o=e.evaluater.evaluateExpression(c.expression)}else xa(e,t.position);else o=r.value===null?!0:r.value;n[s]=o}return n}function Up(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:yI;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const u=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(u){const f=s.get(u)||0;a=u+"-"+f,s.set(u,f+1)}}const c=ok(e,o,a);c!==void 0&&n.push(c)}return n}function PI(e,t,n){const r=iI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?WL(n):cI(n)),r.property==="style"){let s=typeof n=="object"?n:OI(e,String(n));return e.stylePropertyNameCase==="css"&&(s=LI(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?nI[r.property]||r.property:r.attribute,n]}}function OI(e,t){try{return mI(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Qt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=ik+"#cannot-parse-style-attribute",s}}function lk(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,a;for(;++o<s.length;){const c=v0(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};a=a?{type:"MemberExpression",object:a,property:c,computed:!!(o&&c.type==="Literal"),optional:!1}:c}r=a}else r=v0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Fp.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);xa(e)}function xa(e,t){const n=new Qt("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=ik+"#cannot-handle-mdx-estrees-without-createevaluater",n}function LI(e){const t={};let n;for(n in e)Fp.call(e,n)&&(t[II(n)]=e[n]);return t}function II(e){let t=e.replace(xI,DI);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function DI(e){return"-"+e.toLowerCase()}const jh={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"]},MI={};function Bp(e,t){const n=MI,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ck(e,r,s)}function ck(e,t,n){if(zI(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 N0(e.children,t,n)}return Array.isArray(e)?N0(e,t,n):""}function N0(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=ck(e[s],t,n);return r.join("")}function zI(e){return!!(e&&typeof e=="object")}const A0=document.createElement("i");function Vp(e){const t="&"+e+";";A0.innerHTML=t;const n=A0.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Cn(e,t,n,r){const s=e.length;let o=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function zn(e,t){return e.length>0?(Cn(e,e.length,0,t),e):t}const R0={}.hasOwnProperty;function uk(e){const t={};let n=-1;for(;++n<e.length;)FI(t,e[n]);return t}function FI(e,t){let n;for(n in t){const s=(R0.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){R0.call(s,a)||(s[a]=[]);const c=o[a];$I(s[a],Array.isArray(c)?c:c?[c]:[])}}}function $I(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Cn(e,0,0,r)}function dk(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 Xn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rn=ns(/[A-Za-z]/),Yt=ns(/[\dA-Za-z]/),UI=ns(/[#-'*+\--9=?A-Z^-~]/);function Ec(e){return e!==null&&(e<32||e===127)}const Rf=ns(/\d/),BI=ns(/[\dA-Fa-f]/),VI=ns(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function it(e){return e!==null&&(e<0||e===32)}function Ge(e){return e===-2||e===-1||e===32}const Xc=ns(new RegExp("\\p{P}|\\p{S}","u")),Ms=ns(/\s/);function ns(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gi(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&Yt(e.charCodeAt(n+1))&&Yt(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const c=e.charCodeAt(n+1);o<56320&&c>56319&&c<57344?(a=String.fromCharCode(o,c),s=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Je(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(u){return Ge(u)?(e.enter(n),c(u)):t(u)}function c(u){return Ge(u)&&o++<s?(e.consume(u),c):(e.exit(n),t(u))}}const qI={tokenize:HI};function HI(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Je(e,t,"linePrefix")}function s(c){return e.enter("paragraph"),o(c)}function o(c){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(c)}function a(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Pe(c)?(e.consume(c),e.exit("chunkText"),o):(e.consume(c),a)}}const KI={tokenize:WI},P0={tokenize:GI};function WI(e){const t=this,n=[];let r=0,s,o,a;return c;function c(j){if(r<n.length){const O=n[r];return t.containerState=O[1],e.attempt(O[0].continuation,u,f)(j)}return f(j)}function u(j){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&C();const O=t.events.length;let T=O,N;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){N=t.events[T][1].end;break}S(r);let M=O;for(;M<t.events.length;)t.events[M][1].end={...N},M++;return Cn(t.events,T+1,0,t.events.slice(O)),t.events.length=M,f(j)}return c(j)}function f(j){if(r===n.length){if(!s)return y(j);if(s.currentConstruct&&s.currentConstruct.concrete)return b(j);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(P0,p,g)(j)}function p(j){return s&&C(),S(r),y(j)}function g(j){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,b(j)}function y(j){return t.containerState={},e.attempt(P0,v,b)(j)}function v(j){return r++,n.push([t.currentConstruct,t.containerState]),y(j)}function b(j){if(j===null){s&&C(),S(0),e.consume(j);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),w(j)}function w(j){if(j===null){k(e.exit("chunkFlow"),!0),S(0),e.consume(j);return}return Pe(j)?(e.consume(j),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(j),w)}function k(j,O){const T=t.sliceStream(j);if(O&&T.push(null),j.previous=o,o&&(o.next=j),o=j,s.defineSkip(j.start),s.write(T),t.parser.lazy[j.start.line]){let N=s.events.length;for(;N--;)if(s.events[N][1].start.offset<a&&(!s.events[N][1].end||s.events[N][1].end.offset>a))return;const M=t.events.length;let V=M,B,L;for(;V--;)if(t.events[V][0]==="exit"&&t.events[V][1].type==="chunkFlow"){if(B){L=t.events[V][1].end;break}B=!0}for(S(r),N=M;N<t.events.length;)t.events[N][1].end={...L},N++;Cn(t.events,V+1,0,t.events.slice(M)),t.events.length=N}}function S(j){let O=n.length;for(;O-- >j;){const T=n[O];t.containerState=T[1],T[0].exit.call(t,e)}n.length=j}function C(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function GI(e,t,n){return Je(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ui(e){if(e===null||it(e)||Ms(e))return 1;if(Xc(e))return 2}function Yc(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Pf={name:"attention",resolveAll:JI,tokenize:XI};function JI(e,t){let n=-1,r,s,o,a,c,u,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;u=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 g={...e[r][1].end},y={...e[n][1].start};O0(g,-u),O0(y,u),a={type:u>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},c={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:u>1?"strong":"emphasis",start:{...a.start},end:{...c.end}},e[r][1].end={...a.start},e[n][1].start={...c.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=zn(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=zn(f,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",o,t]]),f=zn(f,Yc(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=zn(f,[["exit",o,t],["enter",c,t],["exit",c,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=zn(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Cn(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 XI(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Ui(r);let o;return a;function a(u){return o=u,e.enter("attentionSequence"),c(u)}function c(u){if(u===o)return e.consume(u),c;const f=e.exit("attentionSequence"),p=Ui(u),g=!p||p===2&&s||n.includes(u),y=!s||s===2&&p||n.includes(r);return f._open=!!(o===42?g:g&&(s||!y)),f._close=!!(o===42?y:y&&(p||!g)),t(u)}}function O0(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const YI={name:"autolink",tokenize:QI};function QI(e,t,n){let r=0;return s;function s(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return rn(v)?(e.consume(v),a):v===64?n(v):f(v)}function a(v){return v===43||v===45||v===46||Yt(v)?(r=1,c(v)):f(v)}function c(v){return v===58?(e.consume(v),r=0,u):(v===43||v===45||v===46||Yt(v))&&r++<32?(e.consume(v),c):(r=0,f(v))}function u(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Ec(v)?n(v):(e.consume(v),u)}function f(v){return v===64?(e.consume(v),p):UI(v)?(e.consume(v),f):n(v)}function p(v){return Yt(v)?g(v):n(v)}function g(v){return v===46?(e.consume(v),r=0,p):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):y(v)}function y(v){if((v===45||Yt(v))&&r++<63){const b=v===45?y:g;return e.consume(v),b}return n(v)}}const Ra={partial:!0,tokenize:ZI};function ZI(e,t,n){return r;function r(o){return Ge(o)?Je(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||Pe(o)?t(o):n(o)}}const hk={continuation:{tokenize:t4},exit:n4,name:"blockQuote",tokenize:e4};function e4(e,t,n){const r=this;return s;function s(a){if(a===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return Ge(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function t4(e,t,n){const r=this;return s;function s(a){return Ge(a)?Je(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(hk,t,n)(a)}}function n4(e){e.exit("blockQuote")}const fk={name:"characterEscape",tokenize:r4};function r4(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return VI(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const pk={name:"characterReference",tokenize:s4};function s4(e,t,n){const r=this;let s=0,o,a;return c;function c(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),u}function u(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,a=Yt,p(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=BI,p):(e.enter("characterReferenceValue"),o=7,a=Rf,p(g))}function p(g){if(g===59&&s){const y=e.exit("characterReferenceValue");return a===Yt&&!Vp(r.sliceSerialize(y))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(g)&&s++<o?(e.consume(g),p):n(g)}}const L0={partial:!0,tokenize:o4},I0={concrete:!0,name:"codeFenced",tokenize:i4};function i4(e,t,n){const r=this,s={partial:!0,tokenize:T};let o=0,a=0,c;return u;function u(N){return f(N)}function f(N){const M=r.events[r.events.length-1];return o=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,c=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(N)}function p(N){return N===c?(a++,e.consume(N),p):a<3?n(N):(e.exit("codeFencedFenceSequence"),Ge(N)?Je(e,g,"whitespace")(N):g(N))}function g(N){return N===null||Pe(N)?(e.exit("codeFencedFence"),r.interrupt?t(N):e.check(L0,w,O)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(N)):Ge(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Je(e,v,"whitespace")(N)):N===96&&N===c?n(N):(e.consume(N),y)}function v(N){return N===null||Pe(N)?g(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(N))}function b(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(N)):N===96&&N===c?n(N):(e.consume(N),b)}function w(N){return e.attempt(s,O,k)(N)}function k(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),S}function S(N){return o>0&&Ge(N)?Je(e,C,"linePrefix",o+1)(N):C(N)}function C(N){return N===null||Pe(N)?e.check(L0,w,O)(N):(e.enter("codeFlowValue"),j(N))}function j(N){return N===null||Pe(N)?(e.exit("codeFlowValue"),C(N)):(e.consume(N),j)}function O(N){return e.exit("codeFenced"),t(N)}function T(N,M,V){let B=0;return L;function L(W){return N.enter("lineEnding"),N.consume(W),N.exit("lineEnding"),Q}function Q(W){return N.enter("codeFencedFence"),Ge(W)?Je(N,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):Y(W)}function Y(W){return W===c?(N.enter("codeFencedFenceSequence"),he(W)):V(W)}function he(W){return W===c?(B++,N.consume(W),he):B>=a?(N.exit("codeFencedFenceSequence"),Ge(W)?Je(N,K,"whitespace")(W):K(W)):V(W)}function K(W){return W===null||Pe(W)?(N.exit("codeFencedFence"),M(W)):V(W)}}}function o4(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Eh={name:"codeIndented",tokenize:l4},a4={partial:!0,tokenize:c4};function l4(e,t,n){const r=this;return s;function s(f){return e.enter("codeIndented"),Je(e,o,"linePrefix",5)(f)}function o(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(f):n(f)}function a(f){return f===null?u(f):Pe(f)?e.attempt(a4,a,u)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Pe(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),c)}function u(f){return e.exit("codeIndented"),t(f)}}function c4(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):Pe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):Je(e,o,"linePrefix",5)(a)}function o(a){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(a):Pe(a)?s(a):n(a)}}const u4={name:"codeText",previous:h4,resolve:d4,tokenize:f4};function d4(e){let t=e.length-4,n=3,r,s;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;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function h4(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function f4(e,t,n){let r=0,s,o;return a;function a(g){return e.enter("codeText"),e.enter("codeTextSequence"),c(g)}function c(g){return g===96?(e.consume(g),r++,c):(e.exit("codeTextSequence"),u(g))}function u(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),u):g===96?(o=e.enter("codeTextSequence"),s=0,p(g)):Pe(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),u):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||Pe(g)?(e.exit("codeTextData"),u(g)):(e.consume(g),f)}function p(g){return g===96?(e.consume(g),s++,p):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",f(g))}}class p4{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 s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Fo(this.left,r),o.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),Fo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Fo(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);Fo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Fo(this.left,n.reverse())}}}function Fo(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 mk(e){const t={};let n=-1,r,s,o,a,c,u,f;const p=new p4(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"&&(u=r[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,m4(p,n)),n=t[n],f=!0);else if(r[1]._container){for(o=n,s=void 0;o--;)if(a=p.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...p.get(s)[1].start},c=p.slice(s,n),c.unshift(r),p.splice(s,n-s+1,c))}}return Cn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function m4(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const c=a.events,u=[],f={};let p,g,y=-1,v=n,b=0,w=0;const k=[w];for(;v;){for(;e.get(++s)[1]!==v;);o.push(s),v._tokenizer||(p=r.sliceStream(v),v.next||p.push(null),g&&a.defineSkip(v.start),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),g=v,v=v.next}for(v=n;++y<c.length;)c[y][0]==="exit"&&c[y-1][0]==="enter"&&c[y][1].type===c[y-1][1].type&&c[y][1].start.line!==c[y][1].end.line&&(w=y+1,k.push(w),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(a.events=[],v?(v._tokenizer=void 0,v.previous=void 0):k.pop(),y=k.length;y--;){const S=c.slice(k[y],k[y+1]),C=o.pop();u.push([C,C+S.length-1]),e.splice(C,2,S)}for(u.reverse(),y=-1;++y<u.length;)f[b+u[y][0]]=b+u[y][1],b+=u[y][1]-u[y][0]-1;return f}const g4={resolve:x4,tokenize:v4},y4={partial:!0,tokenize:_4};function x4(e){return mk(e),e}function v4(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(c)}function s(c){return c===null?o(c):Pe(c)?e.check(y4,a,o)(c):(e.consume(c),s)}function o(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function a(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function _4(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Je(e,o,"linePrefix")}function o(a){if(a===null||Pe(a))return n(a);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(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function gk(e,t,n,r,s,o,a,c,u){const f=u||Number.POSITIVE_INFINITY;let p=0;return g;function g(S){return S===60?(e.enter(r),e.enter(s),e.enter(o),e.consume(S),e.exit(o),y):S===null||S===32||S===41||Ec(S)?n(S):(e.enter(r),e.enter(a),e.enter(c),e.enter("chunkString",{contentType:"string"}),w(S))}function y(S){return S===62?(e.enter(o),e.consume(S),e.exit(o),e.exit(s),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(c),y(S)):S===null||S===60||Pe(S)?n(S):(e.consume(S),S===92?b:v)}function b(S){return S===60||S===62||S===92?(e.consume(S),v):v(S)}function w(S){return!p&&(S===null||S===41||it(S))?(e.exit("chunkString"),e.exit(c),e.exit(a),e.exit(r),t(S)):p<f&&S===40?(e.consume(S),p++,w):S===41?(e.consume(S),p--,w):S===null||S===32||S===40||Ec(S)?n(S):(e.consume(S),S===92?k:w)}function k(S){return S===40||S===41||S===92?(e.consume(S),w):w(S)}}function yk(e,t,n,r,s,o){const a=this;let c=0,u;return f;function f(v){return e.enter(r),e.enter(s),e.consume(v),e.exit(s),e.enter(o),p}function p(v){return c>999||v===null||v===91||v===93&&!u||v===94&&!c&&"_hiddenFootnoteSupport"in a.parser.constructs?n(v):v===93?(e.exit(o),e.enter(s),e.consume(v),e.exit(s),e.exit(r),t):Pe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Pe(v)||c++>999?(e.exit("chunkString"),p(v)):(e.consume(v),u||(u=!Ge(v)),v===92?y:g)}function y(v){return v===91||v===92||v===93?(e.consume(v),c++,g):g(v)}}function xk(e,t,n,r,s,o){let a;return c;function c(y){return y===34||y===39||y===40?(e.enter(r),e.enter(s),e.consume(y),e.exit(s),a=y===40?41:y,u):n(y)}function u(y){return y===a?(e.enter(s),e.consume(y),e.exit(s),e.exit(r),t):(e.enter(o),f(y))}function f(y){return y===a?(e.exit(o),u(a)):y===null?n(y):Pe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Je(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===a||y===null||Pe(y)?(e.exit("chunkString"),f(y)):(e.consume(y),y===92?g:p)}function g(y){return y===a||y===92?(e.consume(y),p):p(y)}}function ta(e,t){let n;return r;function r(s){return Pe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ge(s)?Je(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const b4={name:"definition",tokenize:k4},w4={partial:!0,tokenize:S4};function k4(e,t,n){const r=this;let s;return o;function o(v){return e.enter("definition"),a(v)}function a(v){return yk.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Xn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),u):n(v)}function u(v){return it(v)?ta(e,f)(v):f(v)}function f(v){return gk(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return e.attempt(w4,g,g)(v)}function g(v){return Ge(v)?Je(e,y,"whitespace")(v):y(v)}function y(v){return v===null||Pe(v)?(e.exit("definition"),r.parser.defined.push(s),t(v)):n(v)}}function S4(e,t,n){return r;function r(c){return it(c)?ta(e,s)(c):n(c)}function s(c){return xk(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return Ge(c)?Je(e,a,"whitespace")(c):a(c)}function a(c){return c===null||Pe(c)?t(c):n(c)}}const j4={name:"hardBreakEscape",tokenize:E4};function E4(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return Pe(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const C4={name:"headingAtx",resolve:T4,tokenize:N4};function T4(e,t){let n=e.length-2,r=3,s,o;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&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Cn(e,r,n-r+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function N4(e,t,n){let r=0;return s;function s(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||it(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||Pe(p)?(e.exit("atxHeading"),t(p)):Ge(p)?Je(e,c,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),c(p))}function f(p){return p===null||p===35||it(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),f)}}const A4=["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"],D0=["pre","script","style","textarea"],R4={concrete:!0,name:"htmlFlow",resolveTo:L4,tokenize:I4},P4={partial:!0,tokenize:M4},O4={partial:!0,tokenize:D4};function L4(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 I4(e,t,n){const r=this;let s,o,a,c,u;return f;function f(P){return p(P)}function p(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),g}function g(P){return P===33?(e.consume(P),y):P===47?(e.consume(P),o=!0,w):P===63?(e.consume(P),s=3,r.interrupt?t:A):rn(P)?(e.consume(P),a=String.fromCharCode(P),k):n(P)}function y(P){return P===45?(e.consume(P),s=2,v):P===91?(e.consume(P),s=5,c=0,b):rn(P)?(e.consume(P),s=4,r.interrupt?t:A):n(P)}function v(P){return P===45?(e.consume(P),r.interrupt?t:A):n(P)}function b(P){const _e="CDATA[";return P===_e.charCodeAt(c++)?(e.consume(P),c===_e.length?r.interrupt?t:Y:b):n(P)}function w(P){return rn(P)?(e.consume(P),a=String.fromCharCode(P),k):n(P)}function k(P){if(P===null||P===47||P===62||it(P)){const _e=P===47,me=a.toLowerCase();return!_e&&!o&&D0.includes(me)?(s=1,r.interrupt?t(P):Y(P)):A4.includes(a.toLowerCase())?(s=6,_e?(e.consume(P),S):r.interrupt?t(P):Y(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):o?C(P):j(P))}return P===45||Yt(P)?(e.consume(P),a+=String.fromCharCode(P),k):n(P)}function S(P){return P===62?(e.consume(P),r.interrupt?t:Y):n(P)}function C(P){return Ge(P)?(e.consume(P),C):L(P)}function j(P){return P===47?(e.consume(P),L):P===58||P===95||rn(P)?(e.consume(P),O):Ge(P)?(e.consume(P),j):L(P)}function O(P){return P===45||P===46||P===58||P===95||Yt(P)?(e.consume(P),O):T(P)}function T(P){return P===61?(e.consume(P),N):Ge(P)?(e.consume(P),T):j(P)}function N(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),u=P,M):Ge(P)?(e.consume(P),N):V(P)}function M(P){return P===u?(e.consume(P),u=null,B):P===null||Pe(P)?n(P):(e.consume(P),M)}function V(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||it(P)?T(P):(e.consume(P),V)}function B(P){return P===47||P===62||Ge(P)?j(P):n(P)}function L(P){return P===62?(e.consume(P),Q):n(P)}function Q(P){return P===null||Pe(P)?Y(P):Ge(P)?(e.consume(P),Q):n(P)}function Y(P){return P===45&&s===2?(e.consume(P),ne):P===60&&s===1?(e.consume(P),re):P===62&&s===4?(e.consume(P),D):P===63&&s===3?(e.consume(P),A):P===93&&s===5?(e.consume(P),ce):Pe(P)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(P4,G,he)(P)):P===null||Pe(P)?(e.exit("htmlFlowData"),he(P)):(e.consume(P),Y)}function he(P){return e.check(O4,K,G)(P)}function K(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),W}function W(P){return P===null||Pe(P)?he(P):(e.enter("htmlFlowData"),Y(P))}function ne(P){return P===45?(e.consume(P),A):Y(P)}function re(P){return P===47?(e.consume(P),a="",J):Y(P)}function J(P){if(P===62){const _e=a.toLowerCase();return D0.includes(_e)?(e.consume(P),D):Y(P)}return rn(P)&&a.length<8?(e.consume(P),a+=String.fromCharCode(P),J):Y(P)}function ce(P){return P===93?(e.consume(P),A):Y(P)}function A(P){return P===62?(e.consume(P),D):P===45&&s===2?(e.consume(P),A):Y(P)}function D(P){return P===null||Pe(P)?(e.exit("htmlFlowData"),G(P)):(e.consume(P),D)}function G(P){return e.exit("htmlFlow"),t(P)}}function D4(e,t,n){const r=this;return s;function s(a){return Pe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function M4(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Ra,t,n)}}const z4={name:"htmlText",tokenize:F4};function F4(e,t,n){const r=this;let s,o,a;return c;function c(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),u}function u(A){return A===33?(e.consume(A),f):A===47?(e.consume(A),T):A===63?(e.consume(A),j):rn(A)?(e.consume(A),V):n(A)}function f(A){return A===45?(e.consume(A),p):A===91?(e.consume(A),o=0,b):rn(A)?(e.consume(A),C):n(A)}function p(A){return A===45?(e.consume(A),v):n(A)}function g(A){return A===null?n(A):A===45?(e.consume(A),y):Pe(A)?(a=g,re(A)):(e.consume(A),g)}function y(A){return A===45?(e.consume(A),v):g(A)}function v(A){return A===62?ne(A):A===45?y(A):g(A)}function b(A){const D="CDATA[";return A===D.charCodeAt(o++)?(e.consume(A),o===D.length?w:b):n(A)}function w(A){return A===null?n(A):A===93?(e.consume(A),k):Pe(A)?(a=w,re(A)):(e.consume(A),w)}function k(A){return A===93?(e.consume(A),S):w(A)}function S(A){return A===62?ne(A):A===93?(e.consume(A),S):w(A)}function C(A){return A===null||A===62?ne(A):Pe(A)?(a=C,re(A)):(e.consume(A),C)}function j(A){return A===null?n(A):A===63?(e.consume(A),O):Pe(A)?(a=j,re(A)):(e.consume(A),j)}function O(A){return A===62?ne(A):j(A)}function T(A){return rn(A)?(e.consume(A),N):n(A)}function N(A){return A===45||Yt(A)?(e.consume(A),N):M(A)}function M(A){return Pe(A)?(a=M,re(A)):Ge(A)?(e.consume(A),M):ne(A)}function V(A){return A===45||Yt(A)?(e.consume(A),V):A===47||A===62||it(A)?B(A):n(A)}function B(A){return A===47?(e.consume(A),ne):A===58||A===95||rn(A)?(e.consume(A),L):Pe(A)?(a=B,re(A)):Ge(A)?(e.consume(A),B):ne(A)}function L(A){return A===45||A===46||A===58||A===95||Yt(A)?(e.consume(A),L):Q(A)}function Q(A){return A===61?(e.consume(A),Y):Pe(A)?(a=Q,re(A)):Ge(A)?(e.consume(A),Q):B(A)}function Y(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),s=A,he):Pe(A)?(a=Y,re(A)):Ge(A)?(e.consume(A),Y):(e.consume(A),K)}function he(A){return A===s?(e.consume(A),s=void 0,W):A===null?n(A):Pe(A)?(a=he,re(A)):(e.consume(A),he)}function K(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||it(A)?B(A):(e.consume(A),K)}function W(A){return A===47||A===62||it(A)?B(A):n(A)}function ne(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function re(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),J}function J(A){return Ge(A)?Je(e,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):ce(A)}function ce(A){return e.enter("htmlTextData"),a(A)}}const qp={name:"labelEnd",resolveAll:V4,resolveTo:q4,tokenize:H4},$4={tokenize:K4},U4={tokenize:W4},B4={tokenize:G4};function V4(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 s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Cn(e,0,e.length,n),e}function q4(e,t){let n=e.length,r=0,s,o,a,c;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const u={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return c=[["enter",u,t],["enter",f,t]],c=zn(c,e.slice(o+1,o+r+3)),c=zn(c,[["enter",p,t]]),c=zn(c,Yc(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),c=zn(c,[["exit",p,t],e[a-2],e[a-1],["exit",f,t]]),c=zn(c,e.slice(a+1)),c=zn(c,[["exit",u,t]]),Cn(e,o,e.length,c),e}function H4(e,t,n){const r=this;let s=r.events.length,o,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){o=r.events[s][1];break}return c;function c(y){return o?o._inactive?g(y):(a=r.parser.defined.includes(Xn(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),u):n(y)}function u(y){return y===40?e.attempt($4,p,a?p:g)(y):y===91?e.attempt(U4,p,a?f:g)(y):a?p(y):g(y)}function f(y){return e.attempt(B4,p,g)(y)}function p(y){return t(y)}function g(y){return o._balanced=!0,n(y)}}function K4(e,t,n){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return it(g)?ta(e,o)(g):o(g)}function o(g){return g===41?p(g):gk(e,a,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function a(g){return it(g)?ta(e,u)(g):p(g)}function c(g){return n(g)}function u(g){return g===34||g===39||g===40?xk(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function f(g){return it(g)?ta(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function W4(e,t,n){const r=this;return s;function s(c){return yk.call(r,e,o,a,"reference","referenceMarker","referenceString")(c)}function o(c){return r.parser.defined.includes(Xn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function a(c){return n(c)}}function G4(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const J4={name:"labelStartImage",resolveAll:qp.resolveAll,tokenize:X4};function X4(e,t,n){const r=this;return s;function s(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),o}function o(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),a):n(c)}function a(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const Y4={name:"labelStartLink",resolveAll:qp.resolveAll,tokenize:Q4};function Q4(e,t,n){const r=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Ch={name:"lineEnding",tokenize:Z4};function Z4(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Je(e,t,"linePrefix")}}const lc={name:"thematicBreak",tokenize:eD};function eD(e,t,n){let r=0,s;return o;function o(f){return e.enter("thematicBreak"),a(f)}function a(f){return s=f,c(f)}function c(f){return f===s?(e.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||Pe(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===s?(e.consume(f),r++,u):(e.exit("thematicBreakSequence"),Ge(f)?Je(e,c,"whitespace")(f):c(f))}}const pn={continuation:{tokenize:sD},exit:oD,name:"list",tokenize:rD},tD={partial:!0,tokenize:aD},nD={partial:!0,tokenize:iD};function rD(e,t,n){const r=this,s=r.events[r.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:Rf(v)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(lc,n,f)(v):f(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(v)}return n(v)}function u(v){return Rf(v)&&++a<10?(e.consume(v),u):(!r.interrupt||a<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(Ra,r.interrupt?n:p,e.attempt(tD,y,g))}function p(v){return r.containerState.initialBlankLine=!0,o++,y(v)}function g(v){return Ge(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),y):n(v)}function y(v){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function sD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ra,s,o);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Je(e,t,"listItemIndent",r.containerState.size+1)(c)}function o(c){return r.containerState.furtherBlankLines||!Ge(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(nD,t,a)(c))}function a(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Je(e,e.attempt(pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function iD(e,t,n){const r=this;return Je(e,s,"listItemIndent",r.containerState.size+1);function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function oD(e){e.exit(this.containerState.type)}function aD(e,t,n){const r=this;return Je(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const a=r.events[r.events.length-1];return!Ge(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const M0={name:"setextUnderline",resolveTo:lD,tokenize:cD};function lD(e,t){let n=e.length,r,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function cD(e,t,n){const r=this;let s;return o;function o(f){let p=r.events.length,g;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){g=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),s=f,a(f)):n(f)}function a(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===s?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),Ge(f)?Je(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||Pe(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const uD={tokenize:dD};function dD(e){const t=this,n=e.attempt(Ra,r,e.attempt(this.parser.constructs.flowInitial,s,Je(e,e.attempt(this.parser.constructs.flow,s,e.attempt(g4,s)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const hD={resolveAll:_k()},fD=vk("string"),pD=vk("text");function vk(e){return{resolveAll:_k(e==="text"?mD:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],o=n.attempt(s,a,c);return a;function a(p){return f(p)?o(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),u}function u(p){return f(p)?(n.exit("data"),o(p)):(n.consume(p),u)}function f(p){if(p===null)return!0;const g=s[p];let y=-1;if(g)for(;++y<g.length;){const v=g[y];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function _k(e){return t;function t(n,r){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,r):n}}function mD(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],s=t.sliceStream(r);let o=s.length,a=-1,c=0,u;for(;o--;){const f=s[o];if(typeof f=="string"){for(a=f.length;f.charCodeAt(a-1)===32;)c++,a--;if(a)break;a=-1}else if(f===-2)u=!0,c++;else if(f!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const f={type:n===e.length||u||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,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 gD={42:pn,43:pn,45:pn,48:pn,49:pn,50:pn,51:pn,52:pn,53:pn,54:pn,55:pn,56:pn,57:pn,62:hk},yD={91:b4},xD={[-2]:Eh,[-1]:Eh,32:Eh},vD={35:C4,42:lc,45:[M0,lc],60:R4,61:M0,95:lc,96:I0,126:I0},_D={38:pk,92:fk},bD={[-5]:Ch,[-4]:Ch,[-3]:Ch,33:J4,38:pk,42:Pf,60:[YI,z4],91:Y4,92:[j4,fk],93:qp,95:Pf,96:u4},wD={null:[Pf,hD]},kD={null:[42,95]},SD={null:[]},jD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kD,contentInitial:yD,disable:SD,document:gD,flow:vD,flowInitial:xD,insideSpan:wD,string:_D,text:bD},Symbol.toStringTag,{value:"Module"}));function ED(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 s={},o=[];let a=[],c=[];const u={attempt:M(T),check:M(N),consume:C,enter:j,exit:O,interrupt:M(N,{interrupt:!0})},f={code:null,containerState:{},defineSkip:w,events:[],now:b,parser:e,previous:null,sliceSerialize:y,sliceStream:v,write:g};let p=t.tokenize.call(f,u);return t.resolveAll&&o.push(t),f;function g(Q){return a=zn(a,Q),k(),a[a.length-1]!==null?[]:(V(t,0),f.events=Yc(o,f.events,f),f.events)}function y(Q,Y){return TD(v(Q),Y)}function v(Q){return CD(a,Q)}function b(){const{_bufferIndex:Q,_index:Y,line:he,column:K,offset:W}=r;return{_bufferIndex:Q,_index:Y,line:he,column:K,offset:W}}function w(Q){s[Q.line]=Q.column,L()}function k(){let Q;for(;r._index<a.length;){const Y=a[r._index];if(typeof Y=="string")for(Q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===Q&&r._bufferIndex<Y.length;)S(Y.charCodeAt(r._bufferIndex));else S(Y)}}function S(Q){p=p(Q)}function C(Q){Pe(Q)?(r.line++,r.column=1,r.offset+=Q===-3?2:1,L()):Q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=Q}function j(Q,Y){const he=Y||{};return he.type=Q,he.start=b(),f.events.push(["enter",he,f]),c.push(he),he}function O(Q){const Y=c.pop();return Y.end=b(),f.events.push(["exit",Y,f]),Y}function T(Q,Y){V(Q,Y.from)}function N(Q,Y){Y.restore()}function M(Q,Y){return he;function he(K,W,ne){let re,J,ce,A;return Array.isArray(K)?G(K):"tokenize"in K?G([K]):D(K);function D(ye){return Ne;function Ne(pe){const Be=pe!==null&&ye[pe],st=pe!==null&&ye.null,bt=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(st)?st:st?[st]:[]];return G(bt)(pe)}}function G(ye){return re=ye,J=0,ye.length===0?ne:P(ye[J])}function P(ye){return Ne;function Ne(pe){return A=B(),ce=ye,ye.partial||(f.currentConstruct=ye),ye.name&&f.parser.constructs.disable.null.includes(ye.name)?me():ye.tokenize.call(Y?Object.assign(Object.create(f),Y):f,u,_e,me)(pe)}}function _e(ye){return Q(ce,A),W}function me(ye){return A.restore(),++J<re.length?P(re[J]):ne}}}function V(Q,Y){Q.resolveAll&&!o.includes(Q)&&o.push(Q),Q.resolve&&Cn(f.events,Y,f.events.length-Y,Q.resolve(f.events.slice(Y),f)),Q.resolveTo&&(f.events=Q.resolveTo(f.events,f))}function B(){const Q=b(),Y=f.previous,he=f.currentConstruct,K=f.events.length,W=Array.from(c);return{from:K,restore:ne};function ne(){r=Q,f.previous=Y,f.currentConstruct=he,f.events.length=K,c=W,L()}}function L(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function CD(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let a;if(n===s)a=[e[n].slice(r,o)];else{if(a=e.slice(n,s),r>-1){const c=a[0];typeof c=="string"?a[0]=c.slice(r):a.shift()}o>0&&a.push(e[s].slice(0,o))}return a}function TD(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
104
+ ${e.content}`:""}`,f=new Blob([u],{type:"text/markdown"}),p=URL.createObjectURL(f),g=document.createElement("a");g.href=p,g.download=`${e.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,g.click(),URL.revokeObjectURL(p)},c=()=>{const u=JSON.stringify(e,null,2),f=new Blob([u],{type:"application/json"}),p=URL.createObjectURL(f),g=document.createElement("a");g.href=p,g.download=`signal_${e.id}.json`,g.click(),URL.revokeObjectURL(p)};return h.jsx(Pt,{children:h.jsx(Be.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:h.jsxs(Be.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:u=>u.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[h.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[h.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:n(`common.categories.${e.category?.toLowerCase()||"other"}`,e.category||"Research")}),h.jsx("span",{className:`text-3xl font-black ${e.score>=80?"text-accent":"text-fg/40"}`,children:e.score})]}),h.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:e.title}),h.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:[n("discovery.discovered")," ",new Date(e.date).toLocaleDateString(n("common.locale_code",void 0),{month:"long",day:"numeric",year:"numeric"})]})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all","aria-label":n("common.close"),children:h.jsx(Nn,{size:24})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[e.url&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("discovery.original_source")}),h.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:[h.jsx(Bi,{size:16,className:"flex-shrink-0"}),h.jsx("span",{className:"truncate",children:e.url}),h.jsxs("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:[n("discovery.open_link")," →"]})]})]}),e.entities&&e.entities.length>0&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("discovery.entities")}),h.jsx("div",{className:"flex flex-wrap gap-2",children:e.entities.map(u=>h.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:u},u))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("discovery.ai_summary")}),h.jsx("div",{className:"p-4 glass rounded-xl",children:h.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:e.summary})})]}),e.content&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:n("discovery.full_content")}),h.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:h.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:e.content})})]})]}),h.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[h.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:[r?h.jsx(As,{size:16,className:"text-success"}):h.jsx(zf,{size:16}),n(r?"discovery.copied":"common.copy")]}),h.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:[h.jsx($h,{size:16}),"Markdown"]}),h.jsxs("button",{onClick:c,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:[h.jsx($h,{size:16}),"JSON"]})]})]})})})}function PL({isOpen:e,onClose:t}){const{t:n}=et(),{showToast:r}=Jc(),[s,o]=R.useState(""),[a,c]=R.useState(50),[u,f]=R.useState(!1),[p,g]=R.useState(!1);R.useEffect(()=>{e&&y()},[e]);const y=async()=>{const{data:{user:w}}=await ae.auth.getUser();if(!w)return;const{data:k}=await ae.from("alchemy_settings").select("*").eq("user_id",w.id).maybeSingle();if(k){c(k.max_urls_per_sync||50);const S=k.sync_start_date||k.last_sync_checkpoint;if(S){const C=new Date(S),j=T=>T<10?"0"+T:T,O=C.getFullYear()+"-"+j(C.getMonth()+1)+"-"+j(C.getDate())+"T"+j(C.getHours())+":"+j(C.getMinutes());o(O)}else o("")}},v=async()=>{f(!0);try{const{data:{user:w}}=await ae.auth.getUser();if(!w){r(n("discovery.login_to_save"),"error"),f(!1);return}const{error:k}=await ae.from("alchemy_settings").update({max_urls_per_sync:a,sync_start_date:s?new Date(s).toISOString():null}).eq("user_id",w.id);k?r(`${n("common.error")}: ${k.message}`,"error"):(r(n("discovery.sync_saved"),"success"),t())}catch(w){r(`${n("common.error")}: ${w.message}`,"error")}finally{f(!1)}},b=async()=>{g(!0);try{const{data:{user:w}}=await ae.auth.getUser();if(!w){r(n("discovery.login_to_reset"),"error"),g(!1);return}const{error:k}=await ae.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",w.id);k?r(`${n("common.error")}: ${k.message}`,"error"):r(n("discovery.checkpoint_reset"),"success")}catch(w){r(`${n("common.error")}: ${w.message}`,"error")}finally{g(!1)}};return e?h.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:h.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:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[h.jsx("h2",{className:"text-xl font-bold",children:n("discovery.sync_settings")}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-black/10 rounded-lg transition-colors","aria-label":n("common.close"),children:h.jsx(Nn,{className:"w-5 h-5"})})]}),h.jsxs("div",{className:"p-6 space-y-6",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[h.jsx(mj,{className:"w-4 h-4 text-primary"}),n("discovery.sync_from")]}),h.jsx("input",{type:"datetime-local",value:s,onChange:w=>o(w.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"}),h.jsx("p",{className:"text-xs text-fg/50",children:n("discovery.sync_from_hint")})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[h.jsx(kj,{className:"w-4 h-4 text-primary"}),n("discovery.urls_per_sync")]}),h.jsx("span",{className:"text-sm font-mono text-primary",children:a})]}),h.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:a,onChange:w=>c(Number(w.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),h.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[h.jsx("span",{children:n("common.quick","Quick (5)")}),h.jsx("span",{children:n("common.balanced","Balanced (50)")}),h.jsx("span",{children:n("common.thorough","Thorough (200)")})]})]}),h.jsxs("div",{className:"pt-4 border-t border-border/10",children:[h.jsxs("button",{onClick:async()=>{f(!0);try{const{data:w}=await Je.get("/api/browser-paths/auto-discover");if(w.success&&w.sources.length>0){const{data:{user:k}}=await ae.auth.getUser();k&&(await ae.from("alchemy_settings").update({custom_browser_paths:w.sources}).eq("user_id",k.id),r(n("engine.discovered_sources",{count:w.sources.length}),"success"))}else r(n("engine.no_sources_found"),"info")}catch{r(n("engine.discovery_failed"),"error")}finally{f(!1)}},disabled:u,className:"w-full px-4 py-2.5 bg-primary/10 hover:bg-primary/20 border border-primary/20 text-primary font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[h.jsx(ia,{size:16,className:u?"animate-spin":""}),u?n("common.searching","Searching..."):n("engine.auto_discover_sources","Auto-discover Sources")]}),h.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:n("engine.auto_discover_hint","Automatically find history paths for all browser profiles.")})]}),h.jsxs("div",{className:"pt-4 border-t border-border/10",children:[h.jsxs("button",{onClick:b,disabled:p,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[h.jsx(Dj,{size:16,className:p?"animate-spin":""}),p?n("common.resetting","Resetting..."):n("discovery.reset_checkpoint")]}),h.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:n("discovery.reset_checkpoint_hint")})]}),h.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:h.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:n("discovery.sync_info")})})]}),h.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[h.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:n("common.cancel")}),h.jsxs("button",{onClick:v,disabled:u,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:[h.jsx(wr,{size:18,className:u?"animate-spin":""}),n(u?"common.saving":"discovery.save_settings")]})]})]})}):null}const $i=[{id:"ai",name:"AI & ML",icon:m_,color:"blue",priority:1},{id:"business",name:"Business",icon:fj,color:"purple",priority:1},{id:"politics",name:"Politics",icon:Ej,color:"red",priority:1},{id:"technology",name:"Technology",icon:x_,color:"cyan",priority:1},{id:"finance",name:"Finance",icon:_j,color:"green",priority:1},{id:"crypto",name:"Crypto",icon:dj,color:"orange",priority:1},{id:"science",name:"Science",icon:Rj,color:"teal",priority:1}],Lp={id:"other",name:"Other",icon:qh,color:"gray",priority:3},OL=[...$i,Lp];function LL(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 Gw(e,t){if(t){const n=t.toLowerCase().trim(),r=$i.find(s=>s.id===n||s.name.toLowerCase()===n);if(r)return r.id;if(n==="other")return"other"}for(const n of e){const r=n.toLowerCase(),s=$i.find(o=>r.includes(o.id)||r.includes(o.name.toLowerCase()));if(s)return s.id}return null}function IL({count:e}){const{t}=et();return e<=1?null:h.jsxs("div",{className:"absolute top-3 right-3 px-3 py-1.5 bg-gradient-to-r from-orange-500 to-red-500 rounded-full shadow-lg flex items-center gap-1.5 z-10",title:t("discovery.source_found_in",{count:e}),children:[h.jsx("span",{className:"text-lg",children:"🔥"}),h.jsx("span",{className:"text-white font-bold text-sm",children:e===1?t("discovery.source_count_one",{count:e}):t("discovery.source_count_other",{count:e})})]})}function DL({urls:e,timestamps:t=[]}){const{t:n}=et(),[r,s]=R.useState(!1);return e.length<=1?null:h.jsxs("div",{className:"mt-4 border-t border-border pt-4",children:[h.jsxs("button",{onClick:()=>s(!r),className:"flex items-center justify-between w-full text-sm text-fg/60 hover:text-fg transition-colors",children:[h.jsxs("span",{className:"font-medium",children:[n("discovery.view_all_sources")," (",e.length,")"]}),h.jsx(Ls,{size:16,className:`transition-transform duration-200 ${r?"rotate-180":""}`})]}),r&&h.jsx("div",{className:"mt-3 space-y-2 animate-in fade-in slide-in-from-top-2 duration-200",children:e.map((o,a)=>h.jsxs("div",{className:"flex items-start gap-2 text-xs p-2 rounded-lg hover:bg-surface/50 transition-colors",children:[h.jsx(Bi,{size:12,className:"text-primary mt-0.5 flex-shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-fg/70 hover:text-primary underline truncate block",children:o}),t[a]&&h.jsx("span",{className:"text-fg/40 text-[10px]",children:new Date(t[a]).toLocaleDateString(n("common.locale_code",void 0),{month:"short",day:"numeric",year:"numeric"})})]})]},a))})]})}function Ip({signal:e,onOpen:t,onFavourite:n,onNote:r,onBoost:s,onDismiss:o}){const{t:a}=et(),[c,u]=R.useState(!1),f=v=>v>=80?"text-yellow-400 border-yellow-400/30":v>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",p=v=>v>=80?a("discovery.score_high"):v>=50?a("discovery.score_medium"):a("discovery.score_low"),g=(v,b)=>{const w=Gw(b||[],v);if(w){const k=$i.find(S=>S.id===w);if(k)return k}return Lp},y=v=>{const b=new Date(v),k=new Date().getTime()-b.getTime(),S=Math.floor(k/6e4),C=Math.floor(k/36e5),j=Math.floor(k/864e5);return S<60?a("discovery.time_min_ago",{count:S}):C<24?a("discovery.time_hour_ago",{count:C}):j<7?a("discovery.time_day_ago",{count:j}):b.toLocaleDateString(void 0,{month:"short",day:"numeric"})};return h.jsxs(Be.div,{whileHover:{scale:1.01,translateY:-2},onHoverStart:()=>u(!0),onHoverEnd:()=>u(!1),className:`relative bg-surface/50 backdrop-blur-sm border rounded-xl p-5 flex flex-col gap-4 transition-all duration-300 ${e.is_favorite?"border-yellow-500/30 shadow-[0_0_20px_rgba(234,179,8,0.1)]":e.is_dismissed?"opacity-50 grayscale":"border-border"}`,children:[h.jsx(IL,{count:e.mention_count||1}),h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs("div",{className:`flex flex-col items-center justify-center w-14 h-14 rounded-2xl border ${f(e.score)} bg-surface`,children:[h.jsx("span",{className:"text-xl font-bold",children:e.score}),h.jsx("span",{className:"text-[9px] font-bold tracking-wider opacity-70",children:p(e.score)})]}),h.jsxs("div",{children:[(()=>{const v=g(e.category,e.tags),b=v.icon;return h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsxs("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold uppercase tracking-wider rounded border border-primary/20 flex items-center gap-1.5 w-fit",children:[h.jsx(b,{size:10}),v.name]}),e.is_boosted&&h.jsxs("span",{className:"px-2 py-0.5 bg-accent/10 text-accent text-[10px] font-bold uppercase tracking-wider rounded border border-accent/20 flex items-center gap-1 w-fit",children:[h.jsx(Vh,{size:10}),a("discovery.boosted")]}),e.is_dismissed&&h.jsxs("span",{className:"px-2 py-0.5 bg-red-500/10 text-red-400 text-[10px] font-bold uppercase tracking-wider rounded border border-red-500/20 flex items-center gap-1 w-fit",children:[h.jsx(Jy,{size:10}),a("discovery.dismissed")]})]})})(),h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-fg/40 font-mono",children:[h.jsx(Li,{size:10}),y(e.created_at),(e.mention_count||1)>1&&h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"•"}),h.jsx("span",{children:a("discovery.sources_count",{count:e.mention_count})})]})]})]})]}),n&&h.jsx("button",{onClick:()=>n(e.id,!!e.is_favorite),className:`p-2 rounded-lg transition-all ${e.is_favorite?"bg-yellow-500/10 text-yellow-500 hover:bg-yellow-500/20":"bg-white/5 text-fg/40 hover:bg-white/10 hover:text-yellow-500"}`,title:e.is_favorite?a("discovery.remove_favourite"):a("discovery.add_favourite"),children:h.jsx($j,{size:18,fill:e.is_favorite?"currentColor":"none"})})]}),h.jsxs("div",{className:"flex-1",children:[h.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-base font-bold text-fg/90 hover:text-primary transition-colors line-clamp-2 mb-2 leading-tight block",onClick:v=>{v.preventDefault(),t?.(e.url)},children:e.title}),h.jsx("p",{className:"text-xs text-fg/60 line-clamp-3 leading-relaxed",children:e.summary}),e.user_notes&&h.jsxs("div",{className:"mt-3 p-3 bg-yellow-500/5 border border-yellow-500/20 rounded-lg flex gap-2",children:[h.jsx(Ii,{size:14,className:"text-yellow-500 shrink-0 mt-0.5"}),h.jsxs("p",{className:"text-xs text-fg/80 italic font-medium line-clamp-2",children:['"',e.user_notes,'"']})]})]}),e.entities&&e.entities.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.entities.slice(0,4).map((v,b)=>h.jsx("span",{className:"px-2 py-0.5 bg-white/5 text-fg/50 text-[10px] rounded border border-white/5",children:v},b)),e.entities.length>4&&h.jsxs("span",{className:"px-2 py-0.5 text-fg/30 text-[10px]",children:["+",e.entities.length-4]})]}),h.jsx(DL,{urls:e.metadata?.source_urls||[],timestamps:e.metadata?.timestamps||[]}),h.jsxs("div",{className:"grid grid-cols-5 gap-2 pt-2 border-t border-border",children:[h.jsxs("button",{onClick:()=>t?.(e.url),className:"flex items-center justify-center gap-1.5 px-3 py-2 bg-white/5 hover:bg-white/10 rounded-lg transition-colors text-xs font-semibold text-fg/70",title:a("discovery.open_source"),children:[h.jsx(Bi,{size:14}),a("discovery.open_source")]}),r&&h.jsxs("button",{onClick:()=>r(e.id,e.user_notes||null,e.title),className:`flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.user_notes?"bg-blue-500/10 text-blue-400 hover:bg-blue-500/20":"bg-white/5 text-fg/70 hover:bg-white/10 hover:text-blue-400"}`,title:a("discovery.add_note"),children:[h.jsx(Ii,{size:14}),a("discovery.add_note")]}),s&&h.jsxs("button",{onClick:()=>s(e.id,!!e.is_boosted),className:`col-span-2 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.is_boosted?"bg-accent/20 text-accent hover:bg-accent/30 shadow-sm border border-accent/20":"bg-white/5 text-fg/70 hover:bg-accent/10 hover:text-accent group"}`,title:a("discovery.boost_topic"),children:[h.jsx(Vh,{size:14,className:e.is_boosted?"fill-current":"group-hover:text-accent"}),e.is_boosted?a("discovery.boosted"):a("discovery.boost_topic")]}),o&&h.jsx("button",{onClick:()=>o(e.id,!!e.is_dismissed),className:`flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.is_dismissed?"bg-red-500/10 text-red-400 hover:bg-red-500/20":"bg-white/5 text-fg/70 hover:bg-white/10 hover:text-red-400"}`,title:a("discovery.dismiss_hint"),children:h.jsx(Jy,{size:14})})]})]})}function Jw({isOpen:e,onClose:t,initialNote:n,title:r,onSave:s}){const{t:o}=et(),[a,c]=R.useState(n||""),[u,f]=R.useState(!1);R.useEffect(()=>{c(n||"")},[n,e]);const p=async()=>{f(!0);try{await s(a),t()}catch(g){console.error("Failed to save note:",g)}finally{f(!1)}};return h.jsx(Pt,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx(Be.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60]"}),h.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none",children:h.jsxs(Be.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-lg overflow-hidden pointer-events-auto",children:[h.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("h3",{className:"font-bold flex items-center gap-2",children:[h.jsx(Ii,{size:18,className:"text-primary"}),o("discovery.add_note_title")]}),h.jsx("button",{onClick:t,className:"p-1 hover:bg-surface rounded text-fg/40 hover:text-fg transition-colors",children:h.jsx(Nn,{size:18})})]}),h.jsxs("div",{className:"p-4 space-y-3",children:[h.jsxs("p",{className:"text-xs text-fg/50 line-clamp-1 font-mono",children:[o("discovery.target"),": ",r]}),h.jsx("textarea",{value:a,onChange:g=>c(g.target.value),placeholder:o("discovery.note_placeholder"),className:"w-full h-40 bg-surface/50 border border-border/20 rounded-lg p-3 text-sm focus:border-primary/50 focus:ring-1 focus:ring-primary/20 outline-none resize-none placeholder:text-fg/20",autoFocus:!0})]}),h.jsxs("div",{className:"p-4 border-t border-border bg-surface/10 flex justify-end gap-2",children:[h.jsx("button",{onClick:t,className:"px-4 py-2 hover:bg-surface rounded-lg text-xs font-bold text-fg/60 transition-colors",disabled:u,children:o("common.cancel")}),h.jsx("button",{onClick:p,disabled:u,className:"px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg text-xs font-bold flex items-center gap-2 transition-colors disabled:opacity-50",children:u?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}),o("common.saving")]}):h.jsxs(h.Fragment,{children:[h.jsx(wr,{size:14}),o("discovery.save_note")]})})]})]})})]})})}function ML({initialState:e}){const{t}=et(),[n,r]=R.useState([]),[s,o]=R.useState(!0),[a,c]=R.useState(null),[u,f]=R.useState(null),[p,g]=R.useState([]),[y,v]=R.useState([]),[b,w]=R.useState([]),[k,S]=R.useState(!1),[C,j]=R.useState(!1),[O,T]=R.useState(!1),[N,M]=R.useState(!1),[V,U]=R.useState(null),[L,Q]=R.useState(0),[Y,he]=R.useState(""),[K,W]=R.useState(null),[ne,re]=R.useState("all"),[J,ce]=R.useState(!1),[A,D]=R.useState([]),[G,P]=R.useState([]),[ve,Ne]=R.useState([]),[fe,Ae]=R.useState({errors:0,signals:0});R.useEffect(()=>{tt()},[]),R.useEffect(()=>{N&&me(L)},[N,L,K,ne]),R.useEffect(()=>{const te=setTimeout(()=>{N&&me(0)},500);return()=>clearTimeout(te)},[Y]),R.useEffect(()=>{e&&(e.type==="blacklist_suggestion"&&(D(e.data?.suggestions||[]),j(!0)),e.filter==="errors"&&(T(!0),_e()))},[e]),R.useEffect(()=>{if(n.length>0){const te=n.reduce((je,be)=>je+be.errors,0),ge=n.reduce((je,be)=>je+be.signals_found,0);Ae({errors:te,signals:ge})}},[n]);const _e=async()=>{const{data:{user:te}}=await ae.auth.getUser();if(!te)return;const{data:ge,error:je}=await ae.from("processing_events").select("*").eq("user_id",te.id).eq("event_type","error").order("created_at",{ascending:!1}).limit(50);!je&&ge&&P(ge)},me=async(te=0)=>{ce(!0);const{data:{user:ge}}=await ae.auth.getUser();if(!ge)return;const je=20,be=te*je,$e=be+je-1;let Se=ae.from("signals").select("*").eq("user_id",ge.id).order("created_at",{ascending:!1}).range(be,$e);K&&(Se=Se.eq("category",K)),ne==="high"?Se=Se.gte("score",80):ne==="medium"?Se=Se.gte("score",50).lt("score",80):ne==="low"&&(Se=Se.lt("score",50)),Y&&(Se=Se.or(`title.ilike.%${Y}%,url.ilike.%${Y}%`));const{data:Qe,error:nt}=await Se;!nt&&Qe&&Ne(Qe),ce(!1)},tt=async()=>{o(!0);try{const{data:{user:te}}=await ae.auth.getUser();if(!te)return;const{data:ge,error:je}=await ae.from("processing_events").select("*").eq("user_id",te.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(je){console.error("Error fetching sync runs:",je);return}const be=(ge||[]).map($e=>{const Se=$e.metadata||{},Qe=Se.errors||0,nt=Se.signals_found||0,rt=Se.skipped||0;return{id:$e.id,started_at:$e.created_at,completed_at:$e.created_at,duration_ms:$e.duration_ms||0,signals_found:nt,urls_processed:Se.total_urls||0,skipped:rt,errors:Qe,status:Qe>0?"partial":nt>0?"success":"failed"}});r(be)}catch(te){console.error("Failed to fetch sync runs:",te)}finally{o(!1)}},Ot=async te=>{S(!0);try{const{data:{user:ge}}=await ae.auth.getUser();if(!ge)return;const je=n.find(we=>we.id===te);if(!je)return;const be=new Date(new Date(je.started_at).getTime()-je.duration_ms),$e=new Date(je.completed_at),{data:Se,error:Qe}=await ae.from("processing_events").select("*").eq("user_id",ge.id).gte("created_at",be.toISOString()).lte("created_at",$e.toISOString()).order("created_at",{ascending:!0});if(Qe){console.error("Error fetching run events:",Qe);return}g(Se||[]);const nt=[],rt=(Se||[]).filter(we=>we.agent_state==="Mining"&&we.message.includes("Mining source:"));for(const we of rt){const Ue=we.message.match(/Mining source: (.+) \((.+)\)/);if(Ue){const qe=Ue[1],ot=Ue[2],Mt=(Se||[]).find(en=>en.agent_state==="Mining"&&en.message.includes("Found")&&en.message.includes(qe)&&en.created_at>we.created_at),St=Mt?.message.match(/Found (\d+) URLs/),an=St?parseInt(St[1]):0;nt.push({label:qe,browser:ot,urls_found:an,duration_ms:Mt?.duration_ms||0,status:we.event_type==="error"?"error":"success"})}}v(nt);const Z=[],le=(Se||[]).filter(we=>we.agent_state==="Reading");for(const we of le){const Ue=we.message.match(/Reading content from: (.+)/);if(!Ue)continue;const qe=Ue[1];let ot=nt.length>0?nt[0].label:"Unknown";const Mt=nt.filter(Ke=>Ke.urls_found>0);(Mt.length===1||Mt.length>1)&&(ot=Mt[0].label),console.log(`[SystemLogs] URL ${qe} assigned to source: ${ot}`);const St=(Se||[]).find(Ke=>Ke.agent_state==="Signal"&&Ke.created_at>we.created_at&&Ke.message.includes("Found signal")),an=(Se||[]).find(Ke=>Ke.agent_state==="Skipped"&&Ke.created_at>we.created_at&&Ke.message.includes("Irrelevant content")),en=(Se||[]).find(Ke=>Ke.event_type==="error"&&Ke.created_at>we.created_at);if(St){const Ke=St.message.match(/\((\d+)%\)/),ln=Ke?parseInt(Ke[1]):0;Z.push({url:qe,result:"signal",score:ln,category:St.details?.category||"Unknown",duration_ms:St.duration_ms,source_label:ot})}else if(an){const Ke=an.message.match(/\((\d+)%\): (.+)/),ln=Ke?parseInt(Ke[1]):0,tn=Ke?Ke[2]:"Irrelevant";Z.push({url:qe,result:"skipped",score:ln,reason:tn,duration_ms:an.duration_ms,source_label:ot})}else en&&Z.push({url:qe,result:"error",reason:en.message,source_label:ot})}w(Z)}catch(ge){console.error("Failed to fetch run details:",ge)}finally{S(!1)}},Zt=te=>{a===te?(c(null),f(null),v([]),w([])):(c(te),f(null),Ot(te))},Rn=te=>{f(u===te?null:te)},er=te=>{if(te<1e3)return`${te}ms`;const ge=Math.floor(te/1e3);if(ge<60)return`${ge}s`;const je=Math.floor(ge/60),be=ge%60;return`${je}m ${be}s`},ee=te=>{switch(te){case"success":return h.jsx(Ns,{className:"w-5 h-5 text-success"});case"failed":return h.jsx(gs,{className:"w-5 h-5 text-error"});case"partial":return h.jsx(kr,{className:"w-5 h-5 text-warning"});default:return h.jsx(Li,{className:"w-5 h-5 text-fg/40"})}},Me=te=>{switch(te){case"signal":return h.jsx(Vt,{className:"w-4 h-4 text-primary"});case"skipped":return h.jsx(zj,{className:"w-4 h-4 text-fg/40"});case"error":return h.jsx(gs,{className:"w-4 h-4 text-error"});default:return null}};return s?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[h.jsxs("div",{className:"mb-6",children:[h.jsx("h2",{className:"text-2xl font-bold",children:t("logs.title")}),h.jsx("p",{className:"text-sm text-fg/50",children:t("logs.desc")}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6",children:[h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group relative overflow-hidden",onClick:()=>j(!0),children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:t("logs.blacklist_suggestion")}),h.jsx(kr,{size:16,className:"text-orange-400"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:A.length>0?A.length:"--"}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:t("logs.blacklist_desc")}),A.length>0&&h.jsxs("div",{className:"absolute top-2 right-2 flex h-2 w-2",children:[h.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-orange-400 opacity-75"}),h.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-orange-400"})]})]}),h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group",onClick:()=>{T(!0),_e()},children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:t("logs.recent_errors")}),h.jsx(gs,{size:16,className:"text-error"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:fe.errors}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:t("logs.errors_desc")})]}),h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group",onClick:()=>{M(!0),me()},children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:t("logs.total_signals")}),h.jsx(Vt,{size:16,className:"text-primary"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:fe.signals}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:t("logs.signals_desc")})]})]})]}),h.jsxs(Pt,{children:[C&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs(Be.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(kr,{className:"text-orange-400"}),t("logs.blacklist_modal_title")]}),h.jsx("p",{className:"text-sm text-fg/60",children:t("logs.blacklist_modal_desc")})]}),h.jsx("button",{onClick:()=>j(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(gs,{size:20,className:"text-fg/40"})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10 space-y-4",children:A.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx("div",{className:"bg-surface/50 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4",children:h.jsx(Ns,{size:32,className:"text-success"})}),h.jsx("p",{className:"font-medium",children:t("logs.no_suggestions")}),h.jsx("p",{className:"text-xs opacity-70 mt-1",children:t("logs.quality_good")})]}):A.map((te,ge)=>h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 flex items-center justify-between group hover:border-primary/20 transition-all",children:[h.jsxs("div",{children:[h.jsx("div",{className:"font-mono text-sm font-bold text-fg/90",children:te.domain}),h.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[h.jsx("span",{className:"text-[10px] bg-surface px-1.5 py-0.5 rounded text-fg/50",children:t("logs.signals_count",{count:te.signalCount})}),h.jsx("span",{className:"text-[10px] bg-surface px-1.5 py-0.5 rounded text-fg/50",children:t("logs.avg_score",{score:te.avgScore})}),h.jsx("span",{className:"text-[10px] text-orange-400 font-medium",children:te.reason==="low_score"?t("logs.low_quality"):t("logs.repetitive")})]})]}),h.jsx("button",{onClick:async()=>{const{data:{user:je}}=await ae.auth.getUser();if(je){const{data:be}=await ae.from("alchemy_settings").select("blacklist_domains").eq("user_id",je.id).single(),$e=be?.blacklist_domains||[];$e.includes(te.domain)||await ae.from("alchemy_settings").update({blacklist_domains:[...$e,te.domain]}).eq("user_id",je.id),D(Se=>Se.filter(Qe=>Qe.domain!==te.domain))}},className:"px-4 py-2 bg-orange-500/10 text-orange-500 hover:bg-orange-500 hover:text-white rounded-lg text-xs font-bold transition-all border border-orange-500/20",children:t("logs.blacklist_domain")})]},ge))})]})}),O&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs(Be.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(gs,{className:"text-error"}),t("logs.errors_modal_title")]}),h.jsx("p",{className:"text-sm text-fg/60",children:t("logs.errors_modal_desc")})]}),h.jsx("button",{onClick:()=>T(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(gs,{size:20,className:"text-fg/40"})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10 space-y-3",children:G.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx(Ns,{size:32,className:"mx-auto mb-4 text-success opacity-50"}),h.jsx("p",{children:t("logs.no_recent_errors")})]}):G.map((te,ge)=>h.jsxs("div",{className:"glass p-4 rounded-xl border border-error/20 bg-error/5 flex items-start gap-3",children:[h.jsx(kr,{size:16,className:"text-error mt-0.5 shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("span",{className:"text-xs font-mono text-fg/40",children:new Date(te.created_at).toLocaleString()}),h.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-error",children:te.agent_state})]}),h.jsx("p",{className:"text-sm font-mono text-fg/90 break-words",children:te.message}),te.details&&Object.keys(te.details).length>0&&h.jsx("pre",{className:"mt-2 p-2 bg-black/20 rounded text-[10px] text-fg/60 overflow-x-auto",children:JSON.stringify(te.details,null,2)})]})]},ge))})]})})]}),h.jsx(Pt,{children:N&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs(Be.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border bg-surface/30 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(Vt,{className:"text-primary"}),t("logs.signals_modal_title")]}),h.jsx("p",{className:"text-sm text-fg/60",children:t("logs.signals_modal_desc")})]}),h.jsx("button",{onClick:()=>M(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(gs,{size:20,className:"text-fg/40"})})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("div",{className:"relative flex-1",children:[h.jsx("input",{type:"text",placeholder:t("logs.search_placeholder"),className:"w-full bg-black/5 border border-border/20 rounded-lg pl-9 pr-4 py-2 text-sm text-fg focus:ring-2 focus:ring-primary/20 focus:border-primary/50 outline-none",value:Y,onChange:te=>{he(te.target.value),Q(0)},onKeyDown:te=>te.key==="Enter"&&me(0)}),h.jsx(ia,{className:"absolute left-3 top-2.5 w-4 h-4 text-fg/40"})]}),h.jsxs("select",{className:"bg-black/5 border border-border/20 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:border-primary/50",value:ne||"all",onChange:te=>{re(te.target.value),Q(0)},children:[h.jsx("option",{value:"all",children:t("logs.any_score")}),h.jsx("option",{value:"high",children:t("logs.high_score")}),h.jsx("option",{value:"medium",children:t("logs.medium_score")}),h.jsx("option",{value:"low",children:t("logs.low_score")})]}),h.jsxs("select",{className:"bg-black/5 border border-border/20 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:border-primary/50",value:K||"",onChange:te=>{W(te.target.value||null),Q(0)},children:[h.jsx("option",{value:"",children:t("logs.all_categories")}),h.jsx("option",{value:"AI & ML",children:"AI & ML"}),h.jsx("option",{value:"Technology",children:"Technology"}),h.jsx("option",{value:"Business",children:"Business"}),h.jsx("option",{value:"Finance",children:"Finance"}),h.jsx("option",{value:"Politics",children:"Politics"}),h.jsx("option",{value:"Science",children:"Science"}),h.jsx("option",{value:"Crypto",children:"Crypto"}),h.jsx("option",{value:"Other",children:"Other"})]}),h.jsxs("div",{className:"flex items-center gap-2 border-l border-border/10 pl-4",children:[h.jsx("button",{disabled:L===0,onClick:()=>Q(te=>Math.max(0,te-1)),className:"p-2 hover:bg-surface rounded-lg disabled:opacity-30 transition-colors",children:h.jsx(yj,{size:20})}),h.jsx("span",{className:"text-xs font-mono text-fg/50 w-16 text-center",children:t("logs.page_x",{page:L+1})}),h.jsx("button",{disabled:ve.length<20,onClick:()=>Q(te=>te+1),className:"p-2 hover:bg-surface rounded-lg disabled:opacity-30 transition-colors",children:h.jsx(tc,{size:20})})]})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10",children:J?h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):ve.length===0?h.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-fg/40 gap-4",children:[h.jsx("div",{className:"w-16 h-16 rounded-full bg-surface/50 flex items-center justify-center",children:h.jsx(Vt,{size:32,className:"opacity-50"})}),h.jsx("p",{children:"No signals found matching your criteria."})]}):h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:ve.map(te=>h.jsx(Ip,{signal:te,onOpen:ge=>window.open(ge,"_blank"),onFavourite:async(ge,je)=>{const be=!je;Ne($e=>$e.map(Se=>Se.id===ge?{...Se,is_favorite:be}:Se)),await ae.from("signals").update({is_favorite:be}).eq("id",ge)},onBoost:async(ge,je)=>{const be=!je;Ne($e=>$e.map(Se=>Se.id===ge?{...Se,is_boosted:be}:Se));try{const{data:{session:$e}}=await ae.auth.getSession(),Se=$e?.access_token,Qe=Os(),nt={"Content-Type":"application/json","x-user-id":$e?.user?.id||""};if(Se&&(nt.Authorization=`Bearer ${Se}`),Qe&&(nt["x-supabase-url"]=Qe.url,nt["x-supabase-key"]=Qe.anonKey),!(await fetch(`/api/signals/${ge}/boost`,{method:"POST",headers:nt,body:JSON.stringify({value:be,settings:{}})})).ok)throw new Error("Boost failed")}catch($e){console.error("Boost API error:",$e),Ne(Se=>Se.map(Qe=>Qe.id===ge?{...Qe,is_boosted:je}:Qe))}},onDismiss:async(ge,je)=>{const be=!je;Ne($e=>$e.map(Se=>Se.id===ge?{...Se,is_dismissed:be}:Se)),await ae.from("signals").update({is_dismissed:be}).eq("id",ge)},onNote:(ge,je,be)=>U({id:ge,note:je,title:be})},te.id))})})]})})}),V&&h.jsx(Jw,{isOpen:!!V,onClose:()=>U(null),title:V.title,initialNote:V.note,onSave:async te=>{V&&(Ne(ge=>ge.map(je=>je.id===V.id?{...je,user_notes:te}:je)),await ae.from("signals").update({user_notes:te}).eq("id",V.id),U(null))}}),h.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:n.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx(Li,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),h.jsx("p",{children:"No sync runs yet"})]}):h.jsx("div",{className:"space-y-2",children:n.map(te=>h.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[h.jsxs("button",{onClick:()=>Zt(te.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[a===te.id?h.jsx(Ls,{className:"w-5 h-5 text-primary shrink-0"}):h.jsx(tc,{className:"w-5 h-5 text-fg/40 shrink-0"}),ee(te.status),h.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),h.jsx("div",{className:"text-sm font-mono",children:new Date(te.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),h.jsx("div",{className:"text-sm font-mono",children:er(te.duration_ms)})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),h.jsx("div",{className:"text-sm font-semibold text-primary",children:te.signals_found})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),h.jsx("div",{className:"text-sm font-semibold text-fg/60",children:te.skipped})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),h.jsx("div",{className:"text-sm font-semibold",children:te.urls_processed})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),h.jsx("div",{className:`text-sm font-semibold ${te.errors>0?"text-error":"text-fg/40"}`,children:te.errors})]})]})]}),h.jsx(Pt,{children:a===te.id&&h.jsx(Be.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border overflow-hidden",children:h.jsx("div",{className:"p-4 bg-surface/30 space-y-2",children:k?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):y.length===0?h.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):y.map((ge,je)=>h.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>Rn(ge.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[u===ge.label?h.jsx(Ls,{className:"w-4 h-4 text-primary shrink-0"}):h.jsx(tc,{className:"w-4 h-4 text-fg/40 shrink-0"}),h.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[h.jsxs("div",{className:"flex-1",children:[h.jsx("div",{className:"text-sm font-semibold",children:ge.label}),h.jsx("div",{className:"text-xs text-fg/40",children:ge.browser})]}),h.jsxs("div",{className:"text-right",children:[h.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),h.jsx("div",{className:"text-sm font-semibold",children:ge.urls_found})]}),h.jsxs("div",{className:"text-right",children:[h.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),h.jsx("div",{className:"text-sm font-mono",children:er(ge.duration_ms)})]})]})]}),h.jsx(Pt,{children:u===ge.label&&h.jsx(Be.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border overflow-hidden",children:h.jsx("div",{className:"p-3 bg-surface/50 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:b.filter(be=>be.source_label===ge.label).length===0?h.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):b.filter(be=>be.source_label===ge.label).map((be,$e)=>h.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[Me(be.result),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:be.url}),be.result==="signal"&&h.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",be.score,"%) - ",be.category]}),be.result==="skipped"&&h.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",be.score,"%) - ",be.reason]}),be.result==="error"&&h.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",be.reason]})]}),h.jsx("a",{href:be.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:Se=>Se.stopPropagation(),children:h.jsx(Bi,{className:"w-3 h-3 text-fg/40"})})]},$e))})})})]},je))})})})]},te.id))})})]})}function zL({signals:e,limit:t=10,onSignalClick:n}){const{t:r}=et(),s=e.slice(0,t),[o,a]=R.useState(()=>{const f=localStorage.getItem("newSignalsFeedExpanded");return f!==null?f==="true":!0});R.useEffect(()=>{localStorage.setItem("newSignalsFeedExpanded",String(o))},[o]);const c=f=>f>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":f>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",u=f=>{const p=new Date(f),y=new Date().getTime()-p.getTime(),v=Math.floor(y/6e4),b=Math.floor(y/36e5);return v<1?r("common.just_now"):v<60?r("discovery.time_min_ago",{count:v}):b<24?r("discovery.time_hour_ago",{count:b}):p.toLocaleDateString(r("common.locale_code",void 0),{month:"short",day:"numeric"})};return s.length===0?null:h.jsxs("div",{className:"mb-3",children:[h.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:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsxs("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:[r("discovery.new_signals")," (",s.length,")"]})}),o?h.jsx(g_,{size:16,className:"text-fg/40"}):h.jsx(Ls,{size:16,className:"text-fg/40"})]}),h.jsx(Pt,{children:o&&h.jsx(Be.div,{initial:{height:0,opacity:0,overflow:"hidden"},animate:{height:"auto",opacity:1,transitionEnd:{overflow:"visible"}},exit:{height:0,opacity:0,overflow:"hidden"},transition:{duration:.2},className:"py-3",children:h.jsx("div",{className:"overflow-x-auto pb-2 -mx-4 px-4 scrollbar-on-hover",children:h.jsx("div",{className:"flex gap-3 min-w-max",children:s.map(f=>h.jsxs(Be.button,{onClick:()=>n(f.id),whileHover:{scale:1.05},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 relative z-0 hover:z-10",children:[h.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${c(f.score)}`,children:h.jsx("span",{className:"text-xl font-bold",children:f.score})}),h.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:f.title}),h.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[h.jsx(Li,{size:10}),h.jsx("span",{children:u(f.created_at)})]})]},f.id))})})})})]})}function FL({category:e,signalCount:t,latestTimestamp:n,onClick:r}){const{t:s}=et(),o=c=>{const u=new Date(c),p=new Date().getTime()-u.getTime(),g=Math.floor(p/6e4),y=Math.floor(p/36e5),v=Math.floor(p/864e5);return g<60?s("discovery.time_min_ago",{count:g}):y<24?s("discovery.time_hour_ago",{count:y}):v<7?s("discovery.time_day_ago",{count:v}):u.toLocaleDateString(s("common.locale_code",void 0),{month:"short",day:"numeric"})},a=e.icon;return h.jsxs(Be.button,{whileHover:{scale:1.05},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 relative z-0 hover:z-10",children:[h.jsx("div",{className:"mb-4",children:h.jsx(a,{size:40,className:"text-current opacity-80"})}),h.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:s(`common.categories.${e.id}`,e.name)}),h.jsxs("div",{className:"flex items-center justify-between text-sm",children:[h.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${LL(e.color)}`,children:s("discovery.sources_count",{count:t})}),h.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[h.jsx(Li,{size:12}),o(n)]})]})]})}const $L=3,UL={ai:"artificial intelligence",ml:"machine learning",llm:"large language models",llms:"large language models",gpt:"large language models",genai:"generative ai","gen ai":"generative ai",js:"javascript",ts:"typescript",py:"python",api:"apis",apis:"apis",saas:"software as a service",iot:"internet of things",ar:"augmented reality",vr:"virtual reality",xr:"extended reality",vc:"venture capital",pe:"private equity",ipo:"initial public offering","m&a":"mergers and acquisitions",b2b:"business to business",b2c:"business to consumer",btc:"bitcoin",eth:"ethereum",nft:"nfts",nfts:"nfts",defi:"decentralized finance",web3:"web3",infosec:"cybersecurity",security:"cybersecurity",devops:"devops",dev:"development"};function BL(e){const t=e.toLowerCase().trim();return UL[t]||t}function VL({signals:e,externalCounts:t,onCategoryClick:n,onSync:r,isSyncing:s}){const{t:o}=et(),[a,c]=R.useState(new Set);R.useEffect(()=>{(async()=>{const{data:{user:g}}=await ae.auth.getUser();if(!g)return;const{data:y}=await ae.from("alchemy_settings").select("blocked_tags").eq("user_id",g.id).maybeSingle();y?.blocked_tags&&c(new Set(y.blocked_tags))})()},[]);const{categories:u,finalCounts:f}=R.useMemo(()=>{const p=a.size>0?a:Hw,g=S=>{const C=S.toLowerCase().trim();if(p.has(C))return!0;for(const j of p)if(C===j||j.length>3&&C.startsWith(j+" "))return!0;return!1},y=new Map;t&&($i.forEach(S=>{const C=t[S.id],j=t[S.name.toLowerCase()],O=C||j;O&&O.count>0&&y.set(S.id,O)}),t.other&&t.other.count>0&&y.set("other",t.other));const v=new Map;e.forEach(S=>{const C=S.tags||[],j=Gw(C,S.category);if(!t&&j){const O=y.get(j)||{count:0,latest:S.created_at};y.set(j,{count:O.count+1,latest:S.created_at>O.latest?S.created_at:O.latest})}j||C.forEach(O=>{if(!O||g(O))return;const T=BL(O);if(!T||g(T))return;v.set(T,(v.get(T)||0)+1);const N=y.get(T)||{count:0,latest:S.created_at};y.set(T,{count:N.count+1,latest:S.created_at>N.latest?S.created_at:N.latest})})});const b=Array.from(v.entries()).filter(([S,C])=>C>=$L).map(([S,C])=>({id:S,name:S.split(" ").map(j=>j.charAt(0).toUpperCase()+j.slice(1)).join(" "),icon:Ff,color:"gray",priority:2}));return{categories:[...$i,...b,Lp].filter(S=>{const C=y.get(S.id);return C&&C.count>0}).sort((S,C)=>S.priority-C.priority),finalCounts:y}},[e,t,a]);return u.length===0?h.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center bg-surface/10 rounded-2xl border border-dashed border-border/20 m-2",children:[h.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center mb-6 text-primary",children:h.jsx(Vh,{className:"w-8 h-8 animate-pulse"})}),h.jsx("h3",{className:"text-xl font-bold mb-2",children:o("discovery.welcome_title","Welcome to Alchemist!")}),h.jsx("p",{className:"max-w-md text-fg/50 mb-8 leading-relaxed",children:o("discovery.welcome_desc","Connect your browser history to start discovering signals. We'll automatically analyze your visited pages to find mentions of AI, tech, and more.")}),h.jsxs("button",{onClick:r,disabled:s||!r,className:"px-8 py-3.5 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 disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx(_a,{size:20,className:s?"animate-spin":""}),s?o("discovery.syncing"):o("discovery.auto_detect_sync","Auto-detect & Sync")]}),h.jsxs("div",{className:"mt-8 flex items-center gap-6 text-[11px] font-medium text-fg/30 uppercase tracking-widest",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Uf,{size:12})," ",o("discovery.privacy_first","Privacy First")]}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Vt,{size:12})," ",o("discovery.offline_first","Offline First")]})]})]}):h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 p-2",children:u.map(p=>{const g=f.get(p.id);return h.jsx(FL,{category:p,signalCount:g.count,latestTimestamp:g.latest,onClick:()=>n(p.id)},p.id)})})}function qL({isOpen:e,onClose:t,categoryId:n,signals:r,onOpenUrl:s,onFavourite:o,onNote:a,onBoost:c,onDismiss:u}){const{t:f}=et(),p=OL.find(T=>T.id===n),[g,y]=R.useState(null),[v,b]=R.useState([]),[w,k]=R.useState(!1);R.useEffect(()=>{if(!e||!n){b([]);return}(async()=>{k(!0);const N=p?.name||n,{data:M,error:V}=await ae.from("signals").select("*").ilike("category",N).order("created_at",{ascending:!1}).limit(50);V?(console.error("Error fetching category signals:",V),b(r.filter(U=>{const L=U.tags||[],Q=U.category?.toLowerCase()===n,Y=L.some(he=>he.toLowerCase().includes(n));return Q||Y}))):b(M||[]),k(!1)})()},[e,n,p?.name]);const S=v,C=T=>{s?s(T):window.open(T,"_blank","noopener,noreferrer")},j=(T,N,M)=>{y({id:T,note:N,title:M})},O=async T=>{g&&a&&(await a(g.id,T),y(null))};return h.jsx(Pt,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx(Be.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),h.jsxs(Be.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:[h.jsx("div",{className:"sticky top-0 z-10 bg-bg/95 backdrop-blur-md border-b border-border p-6 shadow-sm",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[p?.icon&&h.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-surface/50 rounded-xl border border-white/5",children:h.jsx(p.icon,{size:28,className:"text-primary"})}),h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-bold",children:f(`common.categories.${n}`,p?.name)}),h.jsx("p",{className:"text-sm text-fg/50 font-mono",children:S.length===1?f("discovery.signal_count_one",{count:S.length}):f("discovery.signal_count_other",{count:S.length})})]})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors text-fg/60 hover:text-fg","aria-label":f("common.close"),children:h.jsx(Nn,{size:24})})]})}),h.jsx("div",{className:"p-6 space-y-4",children:w?h.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/30 gap-2",children:[h.jsx(Rt,{size:32,className:"animate-spin"}),h.jsx("p",{children:f("discovery.loading_signals")})]}):S.length===0?h.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/30 gap-2",children:[p?.icon&&h.jsx(p.icon,{size:48,className:"opacity-20"}),h.jsx("p",{className:"italic",children:f("discovery.no_signals_in_category",{category:f(`common.categories.${n}`,p?.name)})})]}):S.map(T=>h.jsx(Ip,{signal:T,onOpen:C,onFavourite:o,onNote:j,onBoost:c,onDismiss:u},T.id))})]}),g&&h.jsx(Jw,{isOpen:!!g,onClose:()=>y(null),title:g.title,initialNote:g.note,onSave:O})]})})}function HL({onOpenUrl:e,onCopyText:t,onSync:n,isSyncing:r}){const{t:s}=et(),[o,a]=R.useState([]),[c,u]=R.useState({}),[f,p]=R.useState(!0),[g,y]=R.useState(null),[v,b]=R.useState(""),[w,k]=R.useState(null);R.useEffect(()=>{(async()=>{const{data:j,error:O}=await ae.from("signals").select("category, created_at").order("created_at",{ascending:!1});if(O){console.error("Error fetching category counts:",O);return}const T={};j?.forEach(N=>{const M=N.category?.toLowerCase()||"other";T[M]||(T[M]={count:0,latest:N.created_at}),T[M].count++,N.created_at>T[M].latest&&(T[M].latest=N.created_at)}),u(T)})()},[]),R.useEffect(()=>{(async()=>{p(!0);let O=ae.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);w&&(O=O.ilike("category",w)),v&&(O=O.or(`title.ilike.%${v}%,summary.ilike.%${v}%,url.ilike.%${v}%`));const{data:T,error:N}=await O;N?console.error("Error fetching signals:",N):a(T||[]),p(!1)})();const j=ae.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},O=>{a(T=>[O.new,...T])}).subscribe();return()=>{j.unsubscribe()}},[v,w]);const S=C=>{e?e(C):window.open(C,"_blank","noopener,noreferrer")};return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsx("div",{className:"px-4 pt-2",children:h.jsx(zL,{signals:o,limit:10,onSignalClick:C=>{const j=o.find(O=>O.id===C);j&&j.category&&y(j.category.toLowerCase())}})}),h.jsxs("div",{className:"px-4 pt-1 pb-2 space-y-3",children:[h.jsxs("div",{className:"relative",children:[h.jsx(ia,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),h.jsx("input",{type:"text",placeholder:s("chat.ask_anything","Search signals..."),value:v,onChange:C=>b(C.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"}),v&&h.jsx("button",{onClick:()=>b(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:s("common.clear"),children:h.jsx(Nn,{size:16})})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx(bj,{className:"w-3.5 h-3.5 text-fg/40"}),h.jsx("button",{onClick:()=>k(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${w===null?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:s("common.all")}),[{id:"AI & ML",key:"common.categories.ai_ml"},{id:"Business",key:"common.categories.business"},{id:"Politics",key:"common.categories.politics"},{id:"Technology",key:"common.categories.technology"},{id:"Finance",key:"common.categories.finance"},{id:"Crypto",key:"common.categories.crypto"},{id:"Science",key:"common.categories.science"},{id:"Other",key:"common.categories.other"}].map(C=>h.jsx("button",{onClick:()=>k(C.id),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${w===C.id?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:s(C.key)},C.id))]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 scrollbar-on-hover",children:f?h.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:h.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):w?h.jsx("div",{className:"space-y-4 py-2",children:o.length===0?h.jsx("div",{className:"h-64 flex flex-col items-center justify-center text-fg/30 gap-2",children:h.jsx("p",{className:"italic",children:s("discovery.no_signals_in_category",{category:s(`common.categories.${w.toLowerCase()}`,w)})})}):o.map(C=>h.jsx(Ip,{signal:C,onOpen:S,onFavourite:async(j,O)=>{const T=!O;a(N=>N.map(M=>M.id===j?{...M,is_favorite:T}:M)),await ae.from("signals").update({is_favorite:T}).eq("id",j)},onBoost:async(j,O)=>{const T=!O;a(N=>N.map(M=>M.id===j?{...M,is_boosted:T}:M)),await ae.from("signals").update({is_boosted:T}).eq("id",j)},onDismiss:async(j,O)=>{const T=!O;a(N=>N.map(M=>M.id===j?{...M,is_dismissed:T}:M)),await ae.from("signals").update({is_dismissed:T}).eq("id",j)}},C.id))}):h.jsx(VL,{signals:o,externalCounts:c,onCategoryClick:C=>y(C),onSync:n,isSyncing:r})}),h.jsx(qL,{isOpen:!!g,onClose:()=>y(null),categoryId:g||"",signals:o,onOpenUrl:S,onFavourite:async(C,j)=>{const O=!j;a(N=>N.map(M=>M.id===C?{...M,is_favorite:O}:M));const{error:T}=await ae.from("signals").update({is_favorite:O}).eq("id",C);T&&(console.error("Failed to update favorite:",T),a(N=>N.map(M=>M.id===C?{...M,is_favorite:j}:M)))},onNote:async(C,j)=>{a(T=>T.map(N=>N.id===C?{...N,user_notes:j}:N));const{error:O}=await ae.from("signals").update({user_notes:j}).eq("id",C);O&&console.error("Failed to update note:",O)},onBoost:async(C,j)=>{const O=!j;a(N=>N.map(M=>M.id===C?{...M,is_boosted:O}:M));const{error:T}=await ae.from("signals").update({is_boosted:O}).eq("id",C);T&&(console.error("Failed to update boost:",T),a(N=>N.map(M=>M.id===C?{...M,is_boosted:j}:M)))},onDismiss:async(C,j)=>{const O=!j;a(N=>N.map(M=>M.id===C?{...M,is_dismissed:O}:M));const{error:T}=await ae.from("signals").update({is_dismissed:O}).eq("id",C);T&&(console.error("Failed to update dismiss:",T),a(N=>N.map(M=>M.id===C?{...M,is_dismissed:j}:M)))}})]})}function KL({activeSessionId:e,onSelectSession:t}){const{t:n}=et(),[r,s]=R.useState([]),[o,a]=R.useState(!0);R.useEffect(()=>{c()},[]);const c=async()=>{try{const{data:{session:f}}=await ae.auth.getSession();if(!f)return;const p=await Je.get("/api/chat/sessions",{headers:{"x-user-id":f.user.id}});p.data.success&&s(p.data.sessions)}catch(f){console.error("Failed to fetch sessions",f)}finally{a(!1)}},u=async(f,p)=>{f.stopPropagation();try{const{error:g}=await ae.from("chat_sessions").delete().eq("id",p);g||(s(y=>y.filter(v=>v.id!==p)),e===p&&t(null))}catch(g){console.error(g)}};return h.jsxs("div",{className:"w-64 bg-surface/25 backdrop-blur-xl flex flex-col rounded-xl border border-border overflow-hidden",children:[h.jsx("div",{className:"p-3 border-b border-border bg-surface/15",children:h.jsxs("button",{onClick:()=>t(null),className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-primary/10 hover:bg-primary/20 text-primary rounded-xl transition-all font-semibold text-sm border border-primary/20",children:[h.jsx($f,{size:16}),n("chat.new_chat")]})}),h.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:o?h.jsx("div",{className:"p-4 text-center text-xs text-fg/40",children:n("common.loading")}):r.length===0?h.jsxs("div",{className:"p-8 text-center",children:[h.jsx(Uh,{size:24,className:"mx-auto text-fg/20 mb-2"}),h.jsx("p",{className:"text-xs text-fg/40",children:n("chat.no_history")})]}):r.map(f=>h.jsxs("div",{onClick:()=>t(f.id),className:`group flex items-center justify-between px-3 py-3 rounded-lg cursor-pointer transition-all text-sm ${e===f.id?"bg-surface/60 text-fg ring-1 ring-primary/20":"text-fg/60 hover:bg-surface/35 hover:text-fg"}`,children:[h.jsxs("div",{className:"flex items-center gap-2.5 overflow-hidden",children:[h.jsx(Uh,{size:14,className:e===f.id?"text-primary":"opacity-50"}),h.jsx("span",{className:"truncate",children:f.title})]}),h.jsx("button",{onClick:p=>u(p,f.id),className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1.5 hover:bg-red-500/10 hover:text-red-400 rounded transition-all focus-visible:ring-2 focus-visible:ring-red-500/40",children:h.jsx(Bf,{size:12})})]},f.id))})]})}function WL(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const GL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XL={};function v0(e,t){return(XL.jsx?JL:GL).test(e)}const YL=/[ \t\n\f\r]/g;function QL(e){return typeof e=="object"?e.type==="text"?_0(e.value):!1:_0(e)}function _0(e){return e.replace(YL,"")===""}class Aa{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Aa.prototype.normal={};Aa.prototype.property={};Aa.prototype.space=void 0;function Xw(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Aa(n,r,t)}function Cf(e){return e.toLowerCase()}class xn{constructor(t,n){this.attribute=n,this.property=t}}xn.prototype.attribute="";xn.prototype.booleanish=!1;xn.prototype.boolean=!1;xn.prototype.commaOrSpaceSeparated=!1;xn.prototype.commaSeparated=!1;xn.prototype.defined=!1;xn.prototype.mustUseProperty=!1;xn.prototype.number=!1;xn.prototype.overloadedBoolean=!1;xn.prototype.property="";xn.prototype.spaceSeparated=!1;xn.prototype.space=void 0;let ZL=0;const He=Fs(),Et=Fs(),Tf=Fs(),ue=Fs(),ct=Fs(),Oi=Fs(),Sn=Fs();function Fs(){return 2**++ZL}const Nf=Object.freeze(Object.defineProperty({__proto__:null,boolean:He,booleanish:Et,commaOrSpaceSeparated:Sn,commaSeparated:Oi,number:ue,overloadedBoolean:Tf,spaceSeparated:ct},Symbol.toStringTag,{value:"Module"})),kh=Object.keys(Nf);class Dp extends xn{constructor(t,n,r,s){let o=-1;if(super(t,n),b0(this,"space",s),typeof r=="number")for(;++o<kh.length;){const a=kh[o];b0(this,kh[o],(r&Nf[a])===Nf[a])}}}Dp.prototype.defined=!0;function b0(e,t,n){n&&(e[t]=n)}function Wi(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const o=new Dp(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Cf(r)]=r,n[Cf(o.attribute)]=r}return new Aa(t,n,e.space)}const Yw=Wi({properties:{ariaActiveDescendant:null,ariaAtomic:Et,ariaAutoComplete:null,ariaBusy:Et,ariaChecked:Et,ariaColCount:ue,ariaColIndex:ue,ariaColSpan:ue,ariaControls:ct,ariaCurrent:null,ariaDescribedBy:ct,ariaDetails:null,ariaDisabled:Et,ariaDropEffect:ct,ariaErrorMessage:null,ariaExpanded:Et,ariaFlowTo:ct,ariaGrabbed:Et,ariaHasPopup:null,ariaHidden:Et,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ct,ariaLevel:ue,ariaLive:null,ariaModal:Et,ariaMultiLine:Et,ariaMultiSelectable:Et,ariaOrientation:null,ariaOwns:ct,ariaPlaceholder:null,ariaPosInSet:ue,ariaPressed:Et,ariaReadOnly:Et,ariaRelevant:null,ariaRequired:Et,ariaRoleDescription:ct,ariaRowCount:ue,ariaRowIndex:ue,ariaRowSpan:ue,ariaSelected:Et,ariaSetSize:ue,ariaSort:null,ariaValueMax:ue,ariaValueMin:ue,ariaValueNow:ue,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Qw(e,t){return t in e?e[t]:t}function Zw(e,t){return Qw(e,t.toLowerCase())}const eI=Wi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Oi,acceptCharset:ct,accessKey:ct,action:null,allow:null,allowFullScreen:He,allowPaymentRequest:He,allowUserMedia:He,alt:null,as:null,async:He,autoCapitalize:null,autoComplete:ct,autoFocus:He,autoPlay:He,blocking:ct,capture:null,charSet:null,checked:He,cite:null,className:ct,cols:ue,colSpan:null,content:null,contentEditable:Et,controls:He,controlsList:ct,coords:ue|Oi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:He,defer:He,dir:null,dirName:null,disabled:He,download:Tf,draggable:Et,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:He,formTarget:null,headers:ct,height:ue,hidden:Tf,high:ue,href:null,hrefLang:null,htmlFor:ct,httpEquiv:ct,id:null,imageSizes:null,imageSrcSet:null,inert:He,inputMode:null,integrity:null,is:null,isMap:He,itemId:null,itemProp:ct,itemRef:ct,itemScope:He,itemType:ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:He,low:ue,manifest:null,max:null,maxLength:ue,media:null,method:null,min:null,minLength:ue,multiple:He,muted:He,name:null,nonce:null,noModule:He,noValidate:He,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:He,optimum:ue,pattern:null,ping:ct,placeholder:null,playsInline:He,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:He,referrerPolicy:null,rel:ct,required:He,reversed:He,rows:ue,rowSpan:ue,sandbox:ct,scope:null,scoped:He,seamless:He,selected:He,shadowRootClonable:He,shadowRootDelegatesFocus:He,shadowRootMode:null,shape:null,size:ue,sizes:null,slot:null,span:ue,spellCheck:Et,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ue,step:null,style:null,tabIndex:ue,target:null,title:null,translate:null,type:null,typeMustMatch:He,useMap:null,value:Et,width:ue,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ct,axis:null,background:null,bgColor:null,border:ue,borderColor:null,bottomMargin:ue,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:He,declare:He,event:null,face:null,frame:null,frameBorder:null,hSpace:ue,leftMargin:ue,link:null,longDesc:null,lowSrc:null,marginHeight:ue,marginWidth:ue,noResize:He,noHref:He,noShade:He,noWrap:He,object:null,profile:null,prompt:null,rev:null,rightMargin:ue,rules:null,scheme:null,scrolling:Et,standby:null,summary:null,text:null,topMargin:ue,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ue,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:He,disableRemotePlayback:He,prefix:null,property:null,results:ue,security:null,unselectable:null},space:"html",transform:Zw}),tI=Wi({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:Sn,accentHeight:ue,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ue,amplitude:ue,arabicForm:null,ascent:ue,attributeName:null,attributeType:null,azimuth:ue,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ue,by:null,calcMode:null,capHeight:ue,className:ct,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:ue,diffuseConstant:ue,direction:null,display:null,dur:null,divisor:ue,dominantBaseline:null,download:He,dx:null,dy:null,edgeMode:null,editable:null,elevation:ue,enableBackground:null,end:null,event:null,exponent:ue,externalResourcesRequired:null,fill:null,fillOpacity:ue,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:Oi,g2:Oi,glyphName:Oi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ue,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ue,horizOriginX:ue,horizOriginY:ue,id:null,ideographic:ue,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ue,k:ue,k1:ue,k2:ue,k3:ue,k4:ue,kernelMatrix:Sn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ue,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:ue,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:ue,overlineThickness:ue,paintOrder:null,panose1:null,path:null,pathLength:ue,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ue,pointsAtY:ue,pointsAtZ:ue,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Sn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Sn,rev:Sn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Sn,requiredFeatures:Sn,requiredFonts:Sn,requiredFormats:Sn,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:ue,specularExponent:ue,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ue,strikethroughThickness:ue,string:null,stroke:null,strokeDashArray:Sn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ue,strokeOpacity:ue,strokeWidth:null,style:null,surfaceScale:ue,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Sn,tabIndex:ue,tableValues:null,target:null,targetX:ue,targetY:ue,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Sn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ue,underlineThickness:ue,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ue,values:null,vAlphabetic:ue,vMathematical:ue,vectorEffect:null,vHanging:ue,vIdeographic:ue,version:null,vertAdvY:ue,vertOriginX:ue,vertOriginY:ue,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ue,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Qw}),ek=Wi({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()}}),tk=Wi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zw}),nk=Wi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),nI={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"},rI=/[A-Z]/g,w0=/-[a-z]/g,sI=/^data[-\w.:]+$/i;function iI(e,t){const n=Cf(t);let r=t,s=xn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&sI.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(w0,aI);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!w0.test(o)){let a=o.replace(rI,oI);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Dp}return new s(r,t)}function oI(e){return"-"+e.toLowerCase()}function aI(e){return e.charAt(1).toUpperCase()}const lI=Xw([Yw,eI,ek,tk,nk],"html"),Mp=Xw([Yw,tI,ek,tk,nk],"svg");function cI(e){return e.join(" ").trim()}var yi={},Sh,k0;function uI(){if(k0)return Sh;k0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,c=/^\s+|\s+$/g,u=`
105
+ `,f="/",p="*",g="",y="comment",v="declaration";function b(k,S){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];S=S||{};var C=1,j=1;function O(K){var W=K.match(t);W&&(C+=W.length);var ne=K.lastIndexOf(u);j=~ne?K.length-ne:j+K.length}function T(){var K={line:C,column:j};return function(W){return W.position=new N(K),U(),W}}function N(K){this.start=K,this.end={line:C,column:j},this.source=S.source}N.prototype.content=k;function M(K){var W=new Error(S.source+":"+C+":"+j+": "+K);if(W.reason=K,W.filename=S.source,W.line=C,W.column=j,W.source=k,!S.silent)throw W}function V(K){var W=K.exec(k);if(W){var ne=W[0];return O(ne),k=k.slice(ne.length),W}}function U(){V(n)}function L(K){var W;for(K=K||[];W=Q();)W!==!1&&K.push(W);return K}function Q(){var K=T();if(!(f!=k.charAt(0)||p!=k.charAt(1))){for(var W=2;g!=k.charAt(W)&&(p!=k.charAt(W)||f!=k.charAt(W+1));)++W;if(W+=2,g===k.charAt(W-1))return M("End of comment missing");var ne=k.slice(2,W-2);return j+=2,O(ne),k=k.slice(W),j+=2,K({type:y,comment:ne})}}function Y(){var K=T(),W=V(r);if(W){if(Q(),!V(s))return M("property missing ':'");var ne=V(o),re=K({type:v,property:w(W[0].replace(e,g)),value:ne?w(ne[0].replace(e,g)):g});return V(a),re}}function he(){var K=[];L(K);for(var W;W=Y();)W!==!1&&(K.push(W),L(K));return K}return U(),he()}function w(k){return k?k.replace(c,g):g}return Sh=b,Sh}var S0;function dI(){if(S0)return yi;S0=1;var e=yi&&yi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(yi,"__esModule",{value:!0}),yi.default=n;const t=e(uI());function n(r,s){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),c=typeof s=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:p}=u;c?s(f,p,u):p&&(o=o||{},o[f]=p)}),o}return yi}var Mo={},j0;function hI(){if(j0)return Mo;j0=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},a=function(f,p){return p.toUpperCase()},c=function(f,p){return"".concat(p,"-")},u=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(s,c):f=f.replace(r,c),f.replace(t,a))};return Mo.camelCase=u,Mo}var zo,E0;function fI(){if(E0)return zo;E0=1;var e=zo&&zo.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(dI()),n=hI();function r(s,o){var a={};return!s||typeof s!="string"||(0,t.default)(s,function(c,u){c&&u&&(a[(0,n.camelCase)(c,o)]=u)}),a}return r.default=r,zo=r,zo}var pI=fI();const mI=Ac(pI),rk=sk("end"),zp=sk("start");function sk(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 gI(e){const t=zp(e),n=rk(e);if(t&&n)return{start:t,end:n}}function ea(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?C0(e.position):"start"in e||"end"in e?C0(e):"line"in e||"column"in e?Af(e):""}function Af(e){return T0(e&&e.line)+":"+T0(e&&e.column)}function C0(e){return Af(e&&e.start)+"-"+Af(e&&e.end)}function T0(e){return e&&typeof e=="number"?e:1}class Qt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(a=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?o.ruleId=r:(o.source=r.slice(0,u),o.ruleId=r.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){const u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=ea(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Qt.prototype.file="";Qt.prototype.name="";Qt.prototype.reason="";Qt.prototype.message="";Qt.prototype.stack="";Qt.prototype.column=void 0;Qt.prototype.line=void 0;Qt.prototype.ancestors=void 0;Qt.prototype.cause=void 0;Qt.prototype.fatal=void 0;Qt.prototype.place=void 0;Qt.prototype.ruleId=void 0;Qt.prototype.source=void 0;const Fp={}.hasOwnProperty,yI=new Map,xI=/[A-Z]/g,vI=new Set(["table","tbody","thead","tfoot","tr"]),_I=new Set(["td","th"]),ik="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function bI(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=NI(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=TI(n,t.jsx,t.jsxs)}const s={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"?Mp:lI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=ok(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function ok(e,t,n){if(t.type==="element")return wI(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return kI(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return jI(e,t,n);if(t.type==="mdxjsEsm")return SI(e,t);if(t.type==="root")return EI(e,t,n);if(t.type==="text")return CI(e,t)}function wI(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Mp,e.schema=s),e.ancestors.push(t);const o=lk(e,t.tagName,!1),a=AI(e,t);let c=Up(e,t);return vI.has(t.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!QL(u):!0})),ak(e,a,o,t),$p(a,c),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function kI(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)}xa(e,t.position)}function SI(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xa(e,t.position)}function jI(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Mp,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:lk(e,t.name,!0),a=RI(e,t),c=Up(e,t);return ak(e,a,o,t),$p(a,c),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function EI(e,t,n){const r={};return $p(r,Up(e,t)),e.create(t,e.Fragment,r,n)}function CI(e,t){return t.value}function ak(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $p(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function TI(e,t,n){return r;function r(s,o,a,c){const f=Array.isArray(a.children)?n:t;return c?f(o,a,c):f(o,a)}}function NI(e,t){return n;function n(r,s,o,a){const c=Array.isArray(o.children),u=zp(r);return t(s,o,a,c,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function AI(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Fp.call(t.properties,s)){const o=PI(e,s,t.properties[s]);if(o){const[a,c]=o;e.tableCellAlignToStyle&&a==="align"&&typeof c=="string"&&_I.has(t.tagName)?r=c:n[a]=c}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function RI(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const c=a.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else xa(e,t.position);else{const s=r.name;let o;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,o=e.evaluater.evaluateExpression(c.expression)}else xa(e,t.position);else o=r.value===null?!0:r.value;n[s]=o}return n}function Up(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:yI;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const u=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(u){const f=s.get(u)||0;a=u+"-"+f,s.set(u,f+1)}}const c=ok(e,o,a);c!==void 0&&n.push(c)}return n}function PI(e,t,n){const r=iI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?WL(n):cI(n)),r.property==="style"){let s=typeof n=="object"?n:OI(e,String(n));return e.stylePropertyNameCase==="css"&&(s=LI(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?nI[r.property]||r.property:r.attribute,n]}}function OI(e,t){try{return mI(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Qt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=ik+"#cannot-parse-style-attribute",s}}function lk(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,a;for(;++o<s.length;){const c=v0(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};a=a?{type:"MemberExpression",object:a,property:c,computed:!!(o&&c.type==="Literal"),optional:!1}:c}r=a}else r=v0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Fp.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);xa(e)}function xa(e,t){const n=new Qt("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=ik+"#cannot-handle-mdx-estrees-without-createevaluater",n}function LI(e){const t={};let n;for(n in e)Fp.call(e,n)&&(t[II(n)]=e[n]);return t}function II(e){let t=e.replace(xI,DI);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function DI(e){return"-"+e.toLowerCase()}const jh={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"]},MI={};function Bp(e,t){const n=MI,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ck(e,r,s)}function ck(e,t,n){if(zI(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 N0(e.children,t,n)}return Array.isArray(e)?N0(e,t,n):""}function N0(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=ck(e[s],t,n);return r.join("")}function zI(e){return!!(e&&typeof e=="object")}const A0=document.createElement("i");function Vp(e){const t="&"+e+";";A0.innerHTML=t;const n=A0.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Tn(e,t,n,r){const s=e.length;let o=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function $n(e,t){return e.length>0?(Tn(e,e.length,0,t),e):t}const R0={}.hasOwnProperty;function uk(e){const t={};let n=-1;for(;++n<e.length;)FI(t,e[n]);return t}function FI(e,t){let n;for(n in t){const s=(R0.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){R0.call(s,a)||(s[a]=[]);const c=o[a];$I(s[a],Array.isArray(c)?c:c?[c]:[])}}}function $I(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Tn(e,0,0,r)}function dk(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 Qn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=ns(/[A-Za-z]/),Yt=ns(/[\dA-Za-z]/),UI=ns(/[#-'*+\--9=?A-Z^-~]/);function Ec(e){return e!==null&&(e<32||e===127)}const Rf=ns(/\d/),BI=ns(/[\dA-Fa-f]/),VI=ns(/[!-/:-@[-`{-~]/);function Oe(e){return e!==null&&e<-2}function it(e){return e!==null&&(e<0||e===32)}function Ge(e){return e===-2||e===-1||e===32}const Xc=ns(new RegExp("\\p{P}|\\p{S}","u")),Ms=ns(/\s/);function ns(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gi(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&Yt(e.charCodeAt(n+1))&&Yt(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const c=e.charCodeAt(n+1);o<56320&&c>56319&&c<57344?(a=String.fromCharCode(o,c),s=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Xe(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(u){return Ge(u)?(e.enter(n),c(u)):t(u)}function c(u){return Ge(u)&&o++<s?(e.consume(u),c):(e.exit(n),t(u))}}const qI={tokenize:HI};function HI(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Xe(e,t,"linePrefix")}function s(c){return e.enter("paragraph"),o(c)}function o(c){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(c)}function a(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Oe(c)?(e.consume(c),e.exit("chunkText"),o):(e.consume(c),a)}}const KI={tokenize:WI},P0={tokenize:GI};function WI(e){const t=this,n=[];let r=0,s,o,a;return c;function c(j){if(r<n.length){const O=n[r];return t.containerState=O[1],e.attempt(O[0].continuation,u,f)(j)}return f(j)}function u(j){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&C();const O=t.events.length;let T=O,N;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){N=t.events[T][1].end;break}S(r);let M=O;for(;M<t.events.length;)t.events[M][1].end={...N},M++;return Tn(t.events,T+1,0,t.events.slice(O)),t.events.length=M,f(j)}return c(j)}function f(j){if(r===n.length){if(!s)return y(j);if(s.currentConstruct&&s.currentConstruct.concrete)return b(j);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(P0,p,g)(j)}function p(j){return s&&C(),S(r),y(j)}function g(j){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,b(j)}function y(j){return t.containerState={},e.attempt(P0,v,b)(j)}function v(j){return r++,n.push([t.currentConstruct,t.containerState]),y(j)}function b(j){if(j===null){s&&C(),S(0),e.consume(j);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),w(j)}function w(j){if(j===null){k(e.exit("chunkFlow"),!0),S(0),e.consume(j);return}return Oe(j)?(e.consume(j),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(j),w)}function k(j,O){const T=t.sliceStream(j);if(O&&T.push(null),j.previous=o,o&&(o.next=j),o=j,s.defineSkip(j.start),s.write(T),t.parser.lazy[j.start.line]){let N=s.events.length;for(;N--;)if(s.events[N][1].start.offset<a&&(!s.events[N][1].end||s.events[N][1].end.offset>a))return;const M=t.events.length;let V=M,U,L;for(;V--;)if(t.events[V][0]==="exit"&&t.events[V][1].type==="chunkFlow"){if(U){L=t.events[V][1].end;break}U=!0}for(S(r),N=M;N<t.events.length;)t.events[N][1].end={...L},N++;Tn(t.events,V+1,0,t.events.slice(M)),t.events.length=N}}function S(j){let O=n.length;for(;O-- >j;){const T=n[O];t.containerState=T[1],T[0].exit.call(t,e)}n.length=j}function C(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function GI(e,t,n){return Xe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ui(e){if(e===null||it(e)||Ms(e))return 1;if(Xc(e))return 2}function Yc(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Pf={name:"attention",resolveAll:JI,tokenize:XI};function JI(e,t){let n=-1,r,s,o,a,c,u,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;u=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 g={...e[r][1].end},y={...e[n][1].start};O0(g,-u),O0(y,u),a={type:u>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},c={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:u>1?"strong":"emphasis",start:{...a.start},end:{...c.end}},e[r][1].end={...a.start},e[n][1].start={...c.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=$n(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=$n(f,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",o,t]]),f=$n(f,Yc(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=$n(f,[["exit",o,t],["enter",c,t],["exit",c,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=$n(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Tn(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 XI(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Ui(r);let o;return a;function a(u){return o=u,e.enter("attentionSequence"),c(u)}function c(u){if(u===o)return e.consume(u),c;const f=e.exit("attentionSequence"),p=Ui(u),g=!p||p===2&&s||n.includes(u),y=!s||s===2&&p||n.includes(r);return f._open=!!(o===42?g:g&&(s||!y)),f._close=!!(o===42?y:y&&(p||!g)),t(u)}}function O0(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const YI={name:"autolink",tokenize:QI};function QI(e,t,n){let r=0;return s;function s(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return sn(v)?(e.consume(v),a):v===64?n(v):f(v)}function a(v){return v===43||v===45||v===46||Yt(v)?(r=1,c(v)):f(v)}function c(v){return v===58?(e.consume(v),r=0,u):(v===43||v===45||v===46||Yt(v))&&r++<32?(e.consume(v),c):(r=0,f(v))}function u(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Ec(v)?n(v):(e.consume(v),u)}function f(v){return v===64?(e.consume(v),p):UI(v)?(e.consume(v),f):n(v)}function p(v){return Yt(v)?g(v):n(v)}function g(v){return v===46?(e.consume(v),r=0,p):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):y(v)}function y(v){if((v===45||Yt(v))&&r++<63){const b=v===45?y:g;return e.consume(v),b}return n(v)}}const Ra={partial:!0,tokenize:ZI};function ZI(e,t,n){return r;function r(o){return Ge(o)?Xe(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||Oe(o)?t(o):n(o)}}const hk={continuation:{tokenize:t4},exit:n4,name:"blockQuote",tokenize:e4};function e4(e,t,n){const r=this;return s;function s(a){if(a===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return Ge(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function t4(e,t,n){const r=this;return s;function s(a){return Ge(a)?Xe(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(hk,t,n)(a)}}function n4(e){e.exit("blockQuote")}const fk={name:"characterEscape",tokenize:r4};function r4(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return VI(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const pk={name:"characterReference",tokenize:s4};function s4(e,t,n){const r=this;let s=0,o,a;return c;function c(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),u}function u(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,a=Yt,p(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=BI,p):(e.enter("characterReferenceValue"),o=7,a=Rf,p(g))}function p(g){if(g===59&&s){const y=e.exit("characterReferenceValue");return a===Yt&&!Vp(r.sliceSerialize(y))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(g)&&s++<o?(e.consume(g),p):n(g)}}const L0={partial:!0,tokenize:o4},I0={concrete:!0,name:"codeFenced",tokenize:i4};function i4(e,t,n){const r=this,s={partial:!0,tokenize:T};let o=0,a=0,c;return u;function u(N){return f(N)}function f(N){const M=r.events[r.events.length-1];return o=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,c=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(N)}function p(N){return N===c?(a++,e.consume(N),p):a<3?n(N):(e.exit("codeFencedFenceSequence"),Ge(N)?Xe(e,g,"whitespace")(N):g(N))}function g(N){return N===null||Oe(N)?(e.exit("codeFencedFence"),r.interrupt?t(N):e.check(L0,w,O)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===null||Oe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(N)):Ge(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Xe(e,v,"whitespace")(N)):N===96&&N===c?n(N):(e.consume(N),y)}function v(N){return N===null||Oe(N)?g(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(N))}function b(N){return N===null||Oe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(N)):N===96&&N===c?n(N):(e.consume(N),b)}function w(N){return e.attempt(s,O,k)(N)}function k(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),S}function S(N){return o>0&&Ge(N)?Xe(e,C,"linePrefix",o+1)(N):C(N)}function C(N){return N===null||Oe(N)?e.check(L0,w,O)(N):(e.enter("codeFlowValue"),j(N))}function j(N){return N===null||Oe(N)?(e.exit("codeFlowValue"),C(N)):(e.consume(N),j)}function O(N){return e.exit("codeFenced"),t(N)}function T(N,M,V){let U=0;return L;function L(W){return N.enter("lineEnding"),N.consume(W),N.exit("lineEnding"),Q}function Q(W){return N.enter("codeFencedFence"),Ge(W)?Xe(N,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):Y(W)}function Y(W){return W===c?(N.enter("codeFencedFenceSequence"),he(W)):V(W)}function he(W){return W===c?(U++,N.consume(W),he):U>=a?(N.exit("codeFencedFenceSequence"),Ge(W)?Xe(N,K,"whitespace")(W):K(W)):V(W)}function K(W){return W===null||Oe(W)?(N.exit("codeFencedFence"),M(W)):V(W)}}}function o4(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Eh={name:"codeIndented",tokenize:l4},a4={partial:!0,tokenize:c4};function l4(e,t,n){const r=this;return s;function s(f){return e.enter("codeIndented"),Xe(e,o,"linePrefix",5)(f)}function o(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(f):n(f)}function a(f){return f===null?u(f):Oe(f)?e.attempt(a4,a,u)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Oe(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),c)}function u(f){return e.exit("codeIndented"),t(f)}}function c4(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):Oe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):Xe(e,o,"linePrefix",5)(a)}function o(a){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(a):Oe(a)?s(a):n(a)}}const u4={name:"codeText",previous:h4,resolve:d4,tokenize:f4};function d4(e){let t=e.length-4,n=3,r,s;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;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function h4(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function f4(e,t,n){let r=0,s,o;return a;function a(g){return e.enter("codeText"),e.enter("codeTextSequence"),c(g)}function c(g){return g===96?(e.consume(g),r++,c):(e.exit("codeTextSequence"),u(g))}function u(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),u):g===96?(o=e.enter("codeTextSequence"),s=0,p(g)):Oe(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),u):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||Oe(g)?(e.exit("codeTextData"),u(g)):(e.consume(g),f)}function p(g){return g===96?(e.consume(g),s++,p):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",f(g))}}class p4{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 s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Fo(this.left,r),o.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),Fo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Fo(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);Fo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Fo(this.left,n.reverse())}}}function Fo(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 mk(e){const t={};let n=-1,r,s,o,a,c,u,f;const p=new p4(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"&&(u=r[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,m4(p,n)),n=t[n],f=!0);else if(r[1]._container){for(o=n,s=void 0;o--;)if(a=p.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...p.get(s)[1].start},c=p.slice(s,n),c.unshift(r),p.splice(s,n-s+1,c))}}return Tn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function m4(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const c=a.events,u=[],f={};let p,g,y=-1,v=n,b=0,w=0;const k=[w];for(;v;){for(;e.get(++s)[1]!==v;);o.push(s),v._tokenizer||(p=r.sliceStream(v),v.next||p.push(null),g&&a.defineSkip(v.start),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),g=v,v=v.next}for(v=n;++y<c.length;)c[y][0]==="exit"&&c[y-1][0]==="enter"&&c[y][1].type===c[y-1][1].type&&c[y][1].start.line!==c[y][1].end.line&&(w=y+1,k.push(w),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(a.events=[],v?(v._tokenizer=void 0,v.previous=void 0):k.pop(),y=k.length;y--;){const S=c.slice(k[y],k[y+1]),C=o.pop();u.push([C,C+S.length-1]),e.splice(C,2,S)}for(u.reverse(),y=-1;++y<u.length;)f[b+u[y][0]]=b+u[y][1],b+=u[y][1]-u[y][0]-1;return f}const g4={resolve:x4,tokenize:v4},y4={partial:!0,tokenize:_4};function x4(e){return mk(e),e}function v4(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(c)}function s(c){return c===null?o(c):Oe(c)?e.check(y4,a,o)(c):(e.consume(c),s)}function o(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function a(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function _4(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Xe(e,o,"linePrefix")}function o(a){if(a===null||Oe(a))return n(a);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(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function gk(e,t,n,r,s,o,a,c,u){const f=u||Number.POSITIVE_INFINITY;let p=0;return g;function g(S){return S===60?(e.enter(r),e.enter(s),e.enter(o),e.consume(S),e.exit(o),y):S===null||S===32||S===41||Ec(S)?n(S):(e.enter(r),e.enter(a),e.enter(c),e.enter("chunkString",{contentType:"string"}),w(S))}function y(S){return S===62?(e.enter(o),e.consume(S),e.exit(o),e.exit(s),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(c),y(S)):S===null||S===60||Oe(S)?n(S):(e.consume(S),S===92?b:v)}function b(S){return S===60||S===62||S===92?(e.consume(S),v):v(S)}function w(S){return!p&&(S===null||S===41||it(S))?(e.exit("chunkString"),e.exit(c),e.exit(a),e.exit(r),t(S)):p<f&&S===40?(e.consume(S),p++,w):S===41?(e.consume(S),p--,w):S===null||S===32||S===40||Ec(S)?n(S):(e.consume(S),S===92?k:w)}function k(S){return S===40||S===41||S===92?(e.consume(S),w):w(S)}}function yk(e,t,n,r,s,o){const a=this;let c=0,u;return f;function f(v){return e.enter(r),e.enter(s),e.consume(v),e.exit(s),e.enter(o),p}function p(v){return c>999||v===null||v===91||v===93&&!u||v===94&&!c&&"_hiddenFootnoteSupport"in a.parser.constructs?n(v):v===93?(e.exit(o),e.enter(s),e.consume(v),e.exit(s),e.exit(r),t):Oe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Oe(v)||c++>999?(e.exit("chunkString"),p(v)):(e.consume(v),u||(u=!Ge(v)),v===92?y:g)}function y(v){return v===91||v===92||v===93?(e.consume(v),c++,g):g(v)}}function xk(e,t,n,r,s,o){let a;return c;function c(y){return y===34||y===39||y===40?(e.enter(r),e.enter(s),e.consume(y),e.exit(s),a=y===40?41:y,u):n(y)}function u(y){return y===a?(e.enter(s),e.consume(y),e.exit(s),e.exit(r),t):(e.enter(o),f(y))}function f(y){return y===a?(e.exit(o),u(a)):y===null?n(y):Oe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Xe(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===a||y===null||Oe(y)?(e.exit("chunkString"),f(y)):(e.consume(y),y===92?g:p)}function g(y){return y===a||y===92?(e.consume(y),p):p(y)}}function ta(e,t){let n;return r;function r(s){return Oe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ge(s)?Xe(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const b4={name:"definition",tokenize:k4},w4={partial:!0,tokenize:S4};function k4(e,t,n){const r=this;let s;return o;function o(v){return e.enter("definition"),a(v)}function a(v){return yk.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),u):n(v)}function u(v){return it(v)?ta(e,f)(v):f(v)}function f(v){return gk(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return e.attempt(w4,g,g)(v)}function g(v){return Ge(v)?Xe(e,y,"whitespace")(v):y(v)}function y(v){return v===null||Oe(v)?(e.exit("definition"),r.parser.defined.push(s),t(v)):n(v)}}function S4(e,t,n){return r;function r(c){return it(c)?ta(e,s)(c):n(c)}function s(c){return xk(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return Ge(c)?Xe(e,a,"whitespace")(c):a(c)}function a(c){return c===null||Oe(c)?t(c):n(c)}}const j4={name:"hardBreakEscape",tokenize:E4};function E4(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return Oe(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const C4={name:"headingAtx",resolve:T4,tokenize:N4};function T4(e,t){let n=e.length-2,r=3,s,o;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&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Tn(e,r,n-r+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function N4(e,t,n){let r=0;return s;function s(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||it(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||Oe(p)?(e.exit("atxHeading"),t(p)):Ge(p)?Xe(e,c,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),c(p))}function f(p){return p===null||p===35||it(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),f)}}const A4=["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"],D0=["pre","script","style","textarea"],R4={concrete:!0,name:"htmlFlow",resolveTo:L4,tokenize:I4},P4={partial:!0,tokenize:M4},O4={partial:!0,tokenize:D4};function L4(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 I4(e,t,n){const r=this;let s,o,a,c,u;return f;function f(P){return p(P)}function p(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),g}function g(P){return P===33?(e.consume(P),y):P===47?(e.consume(P),o=!0,w):P===63?(e.consume(P),s=3,r.interrupt?t:A):sn(P)?(e.consume(P),a=String.fromCharCode(P),k):n(P)}function y(P){return P===45?(e.consume(P),s=2,v):P===91?(e.consume(P),s=5,c=0,b):sn(P)?(e.consume(P),s=4,r.interrupt?t:A):n(P)}function v(P){return P===45?(e.consume(P),r.interrupt?t:A):n(P)}function b(P){const ve="CDATA[";return P===ve.charCodeAt(c++)?(e.consume(P),c===ve.length?r.interrupt?t:Y:b):n(P)}function w(P){return sn(P)?(e.consume(P),a=String.fromCharCode(P),k):n(P)}function k(P){if(P===null||P===47||P===62||it(P)){const ve=P===47,Ne=a.toLowerCase();return!ve&&!o&&D0.includes(Ne)?(s=1,r.interrupt?t(P):Y(P)):A4.includes(a.toLowerCase())?(s=6,ve?(e.consume(P),S):r.interrupt?t(P):Y(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):o?C(P):j(P))}return P===45||Yt(P)?(e.consume(P),a+=String.fromCharCode(P),k):n(P)}function S(P){return P===62?(e.consume(P),r.interrupt?t:Y):n(P)}function C(P){return Ge(P)?(e.consume(P),C):L(P)}function j(P){return P===47?(e.consume(P),L):P===58||P===95||sn(P)?(e.consume(P),O):Ge(P)?(e.consume(P),j):L(P)}function O(P){return P===45||P===46||P===58||P===95||Yt(P)?(e.consume(P),O):T(P)}function T(P){return P===61?(e.consume(P),N):Ge(P)?(e.consume(P),T):j(P)}function N(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),u=P,M):Ge(P)?(e.consume(P),N):V(P)}function M(P){return P===u?(e.consume(P),u=null,U):P===null||Oe(P)?n(P):(e.consume(P),M)}function V(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||it(P)?T(P):(e.consume(P),V)}function U(P){return P===47||P===62||Ge(P)?j(P):n(P)}function L(P){return P===62?(e.consume(P),Q):n(P)}function Q(P){return P===null||Oe(P)?Y(P):Ge(P)?(e.consume(P),Q):n(P)}function Y(P){return P===45&&s===2?(e.consume(P),ne):P===60&&s===1?(e.consume(P),re):P===62&&s===4?(e.consume(P),D):P===63&&s===3?(e.consume(P),A):P===93&&s===5?(e.consume(P),ce):Oe(P)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(P4,G,he)(P)):P===null||Oe(P)?(e.exit("htmlFlowData"),he(P)):(e.consume(P),Y)}function he(P){return e.check(O4,K,G)(P)}function K(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),W}function W(P){return P===null||Oe(P)?he(P):(e.enter("htmlFlowData"),Y(P))}function ne(P){return P===45?(e.consume(P),A):Y(P)}function re(P){return P===47?(e.consume(P),a="",J):Y(P)}function J(P){if(P===62){const ve=a.toLowerCase();return D0.includes(ve)?(e.consume(P),D):Y(P)}return sn(P)&&a.length<8?(e.consume(P),a+=String.fromCharCode(P),J):Y(P)}function ce(P){return P===93?(e.consume(P),A):Y(P)}function A(P){return P===62?(e.consume(P),D):P===45&&s===2?(e.consume(P),A):Y(P)}function D(P){return P===null||Oe(P)?(e.exit("htmlFlowData"),G(P)):(e.consume(P),D)}function G(P){return e.exit("htmlFlow"),t(P)}}function D4(e,t,n){const r=this;return s;function s(a){return Oe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function M4(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Ra,t,n)}}const z4={name:"htmlText",tokenize:F4};function F4(e,t,n){const r=this;let s,o,a;return c;function c(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),u}function u(A){return A===33?(e.consume(A),f):A===47?(e.consume(A),T):A===63?(e.consume(A),j):sn(A)?(e.consume(A),V):n(A)}function f(A){return A===45?(e.consume(A),p):A===91?(e.consume(A),o=0,b):sn(A)?(e.consume(A),C):n(A)}function p(A){return A===45?(e.consume(A),v):n(A)}function g(A){return A===null?n(A):A===45?(e.consume(A),y):Oe(A)?(a=g,re(A)):(e.consume(A),g)}function y(A){return A===45?(e.consume(A),v):g(A)}function v(A){return A===62?ne(A):A===45?y(A):g(A)}function b(A){const D="CDATA[";return A===D.charCodeAt(o++)?(e.consume(A),o===D.length?w:b):n(A)}function w(A){return A===null?n(A):A===93?(e.consume(A),k):Oe(A)?(a=w,re(A)):(e.consume(A),w)}function k(A){return A===93?(e.consume(A),S):w(A)}function S(A){return A===62?ne(A):A===93?(e.consume(A),S):w(A)}function C(A){return A===null||A===62?ne(A):Oe(A)?(a=C,re(A)):(e.consume(A),C)}function j(A){return A===null?n(A):A===63?(e.consume(A),O):Oe(A)?(a=j,re(A)):(e.consume(A),j)}function O(A){return A===62?ne(A):j(A)}function T(A){return sn(A)?(e.consume(A),N):n(A)}function N(A){return A===45||Yt(A)?(e.consume(A),N):M(A)}function M(A){return Oe(A)?(a=M,re(A)):Ge(A)?(e.consume(A),M):ne(A)}function V(A){return A===45||Yt(A)?(e.consume(A),V):A===47||A===62||it(A)?U(A):n(A)}function U(A){return A===47?(e.consume(A),ne):A===58||A===95||sn(A)?(e.consume(A),L):Oe(A)?(a=U,re(A)):Ge(A)?(e.consume(A),U):ne(A)}function L(A){return A===45||A===46||A===58||A===95||Yt(A)?(e.consume(A),L):Q(A)}function Q(A){return A===61?(e.consume(A),Y):Oe(A)?(a=Q,re(A)):Ge(A)?(e.consume(A),Q):U(A)}function Y(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),s=A,he):Oe(A)?(a=Y,re(A)):Ge(A)?(e.consume(A),Y):(e.consume(A),K)}function he(A){return A===s?(e.consume(A),s=void 0,W):A===null?n(A):Oe(A)?(a=he,re(A)):(e.consume(A),he)}function K(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||it(A)?U(A):(e.consume(A),K)}function W(A){return A===47||A===62||it(A)?U(A):n(A)}function ne(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function re(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),J}function J(A){return Ge(A)?Xe(e,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):ce(A)}function ce(A){return e.enter("htmlTextData"),a(A)}}const qp={name:"labelEnd",resolveAll:V4,resolveTo:q4,tokenize:H4},$4={tokenize:K4},U4={tokenize:W4},B4={tokenize:G4};function V4(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 s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Tn(e,0,e.length,n),e}function q4(e,t){let n=e.length,r=0,s,o,a,c;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const u={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return c=[["enter",u,t],["enter",f,t]],c=$n(c,e.slice(o+1,o+r+3)),c=$n(c,[["enter",p,t]]),c=$n(c,Yc(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),c=$n(c,[["exit",p,t],e[a-2],e[a-1],["exit",f,t]]),c=$n(c,e.slice(a+1)),c=$n(c,[["exit",u,t]]),Tn(e,o,e.length,c),e}function H4(e,t,n){const r=this;let s=r.events.length,o,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){o=r.events[s][1];break}return c;function c(y){return o?o._inactive?g(y):(a=r.parser.defined.includes(Qn(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),u):n(y)}function u(y){return y===40?e.attempt($4,p,a?p:g)(y):y===91?e.attempt(U4,p,a?f:g)(y):a?p(y):g(y)}function f(y){return e.attempt(B4,p,g)(y)}function p(y){return t(y)}function g(y){return o._balanced=!0,n(y)}}function K4(e,t,n){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return it(g)?ta(e,o)(g):o(g)}function o(g){return g===41?p(g):gk(e,a,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function a(g){return it(g)?ta(e,u)(g):p(g)}function c(g){return n(g)}function u(g){return g===34||g===39||g===40?xk(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function f(g){return it(g)?ta(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function W4(e,t,n){const r=this;return s;function s(c){return yk.call(r,e,o,a,"reference","referenceMarker","referenceString")(c)}function o(c){return r.parser.defined.includes(Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function a(c){return n(c)}}function G4(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const J4={name:"labelStartImage",resolveAll:qp.resolveAll,tokenize:X4};function X4(e,t,n){const r=this;return s;function s(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),o}function o(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),a):n(c)}function a(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const Y4={name:"labelStartLink",resolveAll:qp.resolveAll,tokenize:Q4};function Q4(e,t,n){const r=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Ch={name:"lineEnding",tokenize:Z4};function Z4(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Xe(e,t,"linePrefix")}}const lc={name:"thematicBreak",tokenize:eD};function eD(e,t,n){let r=0,s;return o;function o(f){return e.enter("thematicBreak"),a(f)}function a(f){return s=f,c(f)}function c(f){return f===s?(e.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||Oe(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===s?(e.consume(f),r++,u):(e.exit("thematicBreakSequence"),Ge(f)?Xe(e,c,"whitespace")(f):c(f))}}const mn={continuation:{tokenize:sD},exit:oD,name:"list",tokenize:rD},tD={partial:!0,tokenize:aD},nD={partial:!0,tokenize:iD};function rD(e,t,n){const r=this,s=r.events[r.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:Rf(v)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(lc,n,f)(v):f(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(v)}return n(v)}function u(v){return Rf(v)&&++a<10?(e.consume(v),u):(!r.interrupt||a<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(Ra,r.interrupt?n:p,e.attempt(tD,y,g))}function p(v){return r.containerState.initialBlankLine=!0,o++,y(v)}function g(v){return Ge(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),y):n(v)}function y(v){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function sD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ra,s,o);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Xe(e,t,"listItemIndent",r.containerState.size+1)(c)}function o(c){return r.containerState.furtherBlankLines||!Ge(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(nD,t,a)(c))}function a(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Xe(e,e.attempt(mn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function iD(e,t,n){const r=this;return Xe(e,s,"listItemIndent",r.containerState.size+1);function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function oD(e){e.exit(this.containerState.type)}function aD(e,t,n){const r=this;return Xe(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const a=r.events[r.events.length-1];return!Ge(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const M0={name:"setextUnderline",resolveTo:lD,tokenize:cD};function lD(e,t){let n=e.length,r,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function cD(e,t,n){const r=this;let s;return o;function o(f){let p=r.events.length,g;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){g=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),s=f,a(f)):n(f)}function a(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===s?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),Ge(f)?Xe(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||Oe(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const uD={tokenize:dD};function dD(e){const t=this,n=e.attempt(Ra,r,e.attempt(this.parser.constructs.flowInitial,s,Xe(e,e.attempt(this.parser.constructs.flow,s,e.attempt(g4,s)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const hD={resolveAll:_k()},fD=vk("string"),pD=vk("text");function vk(e){return{resolveAll:_k(e==="text"?mD:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],o=n.attempt(s,a,c);return a;function a(p){return f(p)?o(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),u}function u(p){return f(p)?(n.exit("data"),o(p)):(n.consume(p),u)}function f(p){if(p===null)return!0;const g=s[p];let y=-1;if(g)for(;++y<g.length;){const v=g[y];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function _k(e){return t;function t(n,r){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,r):n}}function mD(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],s=t.sliceStream(r);let o=s.length,a=-1,c=0,u;for(;o--;){const f=s[o];if(typeof f=="string"){for(a=f.length;f.charCodeAt(a-1)===32;)c++,a--;if(a)break;a=-1}else if(f===-2)u=!0,c++;else if(f!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const f={type:n===e.length||u||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,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 gD={42:mn,43:mn,45:mn,48:mn,49:mn,50:mn,51:mn,52:mn,53:mn,54:mn,55:mn,56:mn,57:mn,62:hk},yD={91:b4},xD={[-2]:Eh,[-1]:Eh,32:Eh},vD={35:C4,42:lc,45:[M0,lc],60:R4,61:M0,95:lc,96:I0,126:I0},_D={38:pk,92:fk},bD={[-5]:Ch,[-4]:Ch,[-3]:Ch,33:J4,38:pk,42:Pf,60:[YI,z4],91:Y4,92:[j4,fk],93:qp,95:Pf,96:u4},wD={null:[Pf,hD]},kD={null:[42,95]},SD={null:[]},jD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kD,contentInitial:yD,disable:SD,document:gD,flow:vD,flowInitial:xD,insideSpan:wD,string:_D,text:bD},Symbol.toStringTag,{value:"Module"}));function ED(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 s={},o=[];let a=[],c=[];const u={attempt:M(T),check:M(N),consume:C,enter:j,exit:O,interrupt:M(N,{interrupt:!0})},f={code:null,containerState:{},defineSkip:w,events:[],now:b,parser:e,previous:null,sliceSerialize:y,sliceStream:v,write:g};let p=t.tokenize.call(f,u);return t.resolveAll&&o.push(t),f;function g(Q){return a=$n(a,Q),k(),a[a.length-1]!==null?[]:(V(t,0),f.events=Yc(o,f.events,f),f.events)}function y(Q,Y){return TD(v(Q),Y)}function v(Q){return CD(a,Q)}function b(){const{_bufferIndex:Q,_index:Y,line:he,column:K,offset:W}=r;return{_bufferIndex:Q,_index:Y,line:he,column:K,offset:W}}function w(Q){s[Q.line]=Q.column,L()}function k(){let Q;for(;r._index<a.length;){const Y=a[r._index];if(typeof Y=="string")for(Q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===Q&&r._bufferIndex<Y.length;)S(Y.charCodeAt(r._bufferIndex));else S(Y)}}function S(Q){p=p(Q)}function C(Q){Oe(Q)?(r.line++,r.column=1,r.offset+=Q===-3?2:1,L()):Q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=Q}function j(Q,Y){const he=Y||{};return he.type=Q,he.start=b(),f.events.push(["enter",he,f]),c.push(he),he}function O(Q){const Y=c.pop();return Y.end=b(),f.events.push(["exit",Y,f]),Y}function T(Q,Y){V(Q,Y.from)}function N(Q,Y){Y.restore()}function M(Q,Y){return he;function he(K,W,ne){let re,J,ce,A;return Array.isArray(K)?G(K):"tokenize"in K?G([K]):D(K);function D(fe){return Ae;function Ae(_e){const me=_e!==null&&fe[_e],tt=_e!==null&&fe.null,Ot=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(tt)?tt:tt?[tt]:[]];return G(Ot)(_e)}}function G(fe){return re=fe,J=0,fe.length===0?ne:P(fe[J])}function P(fe){return Ae;function Ae(_e){return A=U(),ce=fe,fe.partial||(f.currentConstruct=fe),fe.name&&f.parser.constructs.disable.null.includes(fe.name)?Ne():fe.tokenize.call(Y?Object.assign(Object.create(f),Y):f,u,ve,Ne)(_e)}}function ve(fe){return Q(ce,A),W}function Ne(fe){return A.restore(),++J<re.length?P(re[J]):ne}}}function V(Q,Y){Q.resolveAll&&!o.includes(Q)&&o.push(Q),Q.resolve&&Tn(f.events,Y,f.events.length-Y,Q.resolve(f.events.slice(Y),f)),Q.resolveTo&&(f.events=Q.resolveTo(f.events,f))}function U(){const Q=b(),Y=f.previous,he=f.currentConstruct,K=f.events.length,W=Array.from(c);return{from:K,restore:ne};function ne(){r=Q,f.previous=Y,f.currentConstruct=he,f.events.length=K,c=W,L()}}function L(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function CD(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let a;if(n===s)a=[e[n].slice(r,o)];else{if(a=e.slice(n,s),r>-1){const c=a[0];typeof c=="string"?a[0]=c.slice(r):a.shift()}o>0&&a.push(e[s].slice(0,o))}return a}function TD(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
106
106
  `;break}case-3:{a=`\r
107
- `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(o)}s=o===-2,r.push(a)}return r.join("")}function ND(e){const r={constructs:uk([jD,...(e||{}).extensions||[]]),content:s(qI),defined:[],document:s(KI),flow:s(uD),lazy:{},string:s(fD),text:s(pD)};return r;function s(o){return a;function a(c){return ED(r,o,c)}}}function AD(e){for(;!mk(e););return e}const z0=/[\0\t\n\r]/g;function RD(){let e=1,t="",n=!0,r;return s;function s(o,a,c){const u=[];let f,p,g,y,v;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(z0.lastIndex=g,f=z0.exec(o),y=f&&f.index!==void 0?f.index:o.length,v=o.charCodeAt(y),!f){t=o.slice(g);break}if(v===10&&g===y&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),g<y&&(u.push(o.slice(g,y)),e+=y-g),v){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}g=y+1}return c&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const PD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function OD(e){return e.replace(PD,LD)}function LD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return dk(n.slice(o?2:1),o?16:10)}return Vp(n)||e}const bk={}.hasOwnProperty;function ID(e,t,n){return typeof t!="string"&&(n=t,t=void 0),DD(n)(AD(ND(n).document().write(RD()(e,t,!0))))}function DD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(je),autolinkProtocol:B,autolinkEmail:B,atxHeading:o(ee),blockQuote:o(st),characterEscape:B,characterReference:B,codeFenced:o(bt),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(bt,a),codeText:o(Qn,a),codeTextData:B,data:B,codeFlowValue:B,definition:o(Zn),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(er),hardBreakEscape:o(De),hardBreakTrailing:o(De),htmlFlow:o(te,a),htmlFlowData:B,htmlText:o(te,a),htmlTextData:B,image:o(ge),label:a,link:o(je),listItem:o(Fe),listItemValue:y,listOrdered:o(be,g),listUnordered:o(be),paragraph:o(Se),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(ee),strong:o(Qe),thematicBreak:o(nt)},exit:{atxHeading:u(),atxHeadingSequence:T,autolink:u(),autolinkEmail:Be,autolinkProtocol:pe,blockQuote:u(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:ye,characterReference:Ne,codeFenced:u(k),codeFencedFence:w,codeFencedFenceInfo:v,codeFencedFenceMeta:b,codeFlowValue:L,codeIndented:u(S),codeText:u(W),codeTextData:L,data:L,definition:u(),definitionDestinationString:O,definitionLabelString:C,definitionTitleString:j,emphasis:u(),hardBreakEscape:u(Y),hardBreakTrailing:u(Y),htmlFlow:u(he),htmlFlowData:L,htmlText:u(K),htmlTextData:L,image:u(re),label:ce,labelText:J,lineEnding:Q,link:u(ne),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:_e,resourceDestinationString:A,resourceTitleString:D,resource:G,setextHeading:u(V),setextHeadingLineSequence:M,setextHeadingText:N,strong:u(),thematicBreak:u()}};wk(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let le={type:"root",children:[]};const we={stack:[le],tokenStack:[],config:t,enter:c,exit:f,buffer:a,resume:p,data:n},$e=[];let qe=-1;for(;++qe<Z.length;)if(Z[qe][1].type==="listOrdered"||Z[qe][1].type==="listUnordered")if(Z[qe][0]==="enter")$e.push(qe);else{const ot=$e.pop();qe=s(Z,ot,qe)}for(qe=-1;++qe<Z.length;){const ot=t[Z[qe][0]];bk.call(ot,Z[qe][1].type)&&ot[Z[qe][1].type].call(Object.assign({sliceSerialize:Z[qe][2].sliceSerialize},we),Z[qe][1])}if(we.tokenStack.length>0){const ot=we.tokenStack[we.tokenStack.length-1];(ot[1]||F0).call(we,void 0,ot[0])}for(le.position={start:Jr(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:Jr(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<t.transforms.length;)le=t.transforms[qe](le)||le;return le}function s(Z,le,we){let $e=le-1,qe=-1,ot=!1,Mt,jt,on,Zt;for(;++$e<=we;){const Ke=Z[$e];switch(Ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ke[0]==="enter"?qe++:qe--,Zt=void 0;break}case"lineEndingBlank":{Ke[0]==="enter"&&(Mt&&!Zt&&!qe&&!on&&(on=$e),Zt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Zt=void 0}if(!qe&&Ke[0]==="enter"&&Ke[1].type==="listItemPrefix"||qe===-1&&Ke[0]==="exit"&&(Ke[1].type==="listUnordered"||Ke[1].type==="listOrdered")){if(Mt){let an=$e;for(jt=void 0;an--;){const en=Z[an];if(en[1].type==="lineEnding"||en[1].type==="lineEndingBlank"){if(en[0]==="exit")continue;jt&&(Z[jt][1].type="lineEndingBlank",ot=!0),en[1].type="lineEnding",jt=an}else if(!(en[1].type==="linePrefix"||en[1].type==="blockQuotePrefix"||en[1].type==="blockQuotePrefixWhitespace"||en[1].type==="blockQuoteMarker"||en[1].type==="listItemIndent"))break}on&&(!jt||on<jt)&&(Mt._spread=!0),Mt.end=Object.assign({},jt?Z[jt][1].start:Ke[1].end),Z.splice(jt||$e,0,["exit",Mt,Ke[2]]),$e++,we++}if(Ke[1].type==="listItemPrefix"){const an={type:"listItem",_spread:!1,start:Object.assign({},Ke[1].start),end:void 0};Mt=an,Z.splice($e,0,["enter",an,Ke[2]]),$e++,we++,on=void 0,Zt=!0}}}return Z[le][1]._spread=ot,we}function o(Z,le){return we;function we($e){c.call(this,Z($e),$e),le&&le.call(this,$e)}}function a(){this.stack.push({type:"fragment",children:[]})}function c(Z,le,we){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([le,we||void 0]),Z.position={start:Jr(le.start),end:void 0}}function u(Z){return le;function le(we){Z&&Z.call(this,we),f.call(this,we)}}function f(Z,le){const we=this.stack.pop(),$e=this.tokenStack.pop();if($e)$e[0].type!==Z.type&&(le?le.call(this,Z,$e[0]):($e[1]||F0).call(this,Z,$e[0]));else throw new Error("Cannot close `"+Z.type+"` ("+ea({start:Z.start,end:Z.end})+"): it’s not open");we.position.end=Jr(Z.end)}function p(){return Bp(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(Z){if(this.data.expectingFirstListItemValue){const le=this.stack[this.stack.length-2];le.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function v(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.lang=Z}function b(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.meta=Z}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z.replace(/(\r?\n|\r)$/g,"")}function C(Z){const le=this.resume(),we=this.stack[this.stack.length-1];we.label=le,we.identifier=Xn(this.sliceSerialize(Z)).toLowerCase()}function j(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.title=Z}function O(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.url=Z}function T(Z){const le=this.stack[this.stack.length-1];if(!le.depth){const we=this.sliceSerialize(Z).length;le.depth=we}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function M(Z){const le=this.stack[this.stack.length-1];le.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function B(Z){const we=this.stack[this.stack.length-1].children;let $e=we[we.length-1];(!$e||$e.type!=="text")&&($e=tt(),$e.position={start:Jr(Z.start),end:void 0},we.push($e)),this.stack.push($e)}function L(Z){const le=this.stack.pop();le.value+=this.sliceSerialize(Z),le.position.end=Jr(Z.end)}function Q(Z){const le=this.stack[this.stack.length-1];if(this.data.atHardBreak){const we=le.children[le.children.length-1];we.position.end=Jr(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(le.type)&&(B.call(this,Z),L.call(this,Z))}function Y(){this.data.atHardBreak=!0}function he(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z}function K(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z}function W(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z}function ne(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=le,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function re(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=le,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function J(Z){const le=this.sliceSerialize(Z),we=this.stack[this.stack.length-2];we.label=OD(le),we.identifier=Xn(le).toLowerCase()}function ce(){const Z=this.stack[this.stack.length-1],le=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const $e=Z.children;we.children=$e}else we.alt=le}function A(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.url=Z}function D(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.title=Z}function G(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function _e(Z){const le=this.resume(),we=this.stack[this.stack.length-1];we.label=le,we.identifier=Xn(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function me(Z){this.data.characterReferenceType=Z.type}function ye(Z){const le=this.sliceSerialize(Z),we=this.data.characterReferenceType;let $e;we?($e=dk(le,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$e=Vp(le);const qe=this.stack[this.stack.length-1];qe.value+=$e}function Ne(Z){const le=this.stack.pop();le.position.end=Jr(Z.end)}function pe(Z){L.call(this,Z);const le=this.stack[this.stack.length-1];le.url=this.sliceSerialize(Z)}function Be(Z){L.call(this,Z);const le=this.stack[this.stack.length-1];le.url="mailto:"+this.sliceSerialize(Z)}function st(){return{type:"blockquote",children:[]}}function bt(){return{type:"code",lang:null,meta:null,value:""}}function Qn(){return{type:"inlineCode",value:""}}function Zn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function er(){return{type:"emphasis",children:[]}}function ee(){return{type:"heading",depth:0,children:[]}}function De(){return{type:"break"}}function te(){return{type:"html",value:""}}function ge(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function be(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function Fe(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Se(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function tt(){return{type:"text",value:""}}function nt(){return{type:"thematicBreak"}}}function Jr(e){return{line:e.line,column:e.column,offset:e.offset}}function wk(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?wk(e,r):MD(e,r)}}function MD(e,t){let n;for(n in t)if(bk.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 F0(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ea({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ea({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ea({start:t.start,end:t.end})+") is still open")}function zD(e){const t=this;t.parser=n;function n(r){return ID(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function FD(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 $D(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
107
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(o)}s=o===-2,r.push(a)}return r.join("")}function ND(e){const r={constructs:uk([jD,...(e||{}).extensions||[]]),content:s(qI),defined:[],document:s(KI),flow:s(uD),lazy:{},string:s(fD),text:s(pD)};return r;function s(o){return a;function a(c){return ED(r,o,c)}}}function AD(e){for(;!mk(e););return e}const z0=/[\0\t\n\r]/g;function RD(){let e=1,t="",n=!0,r;return s;function s(o,a,c){const u=[];let f,p,g,y,v;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(z0.lastIndex=g,f=z0.exec(o),y=f&&f.index!==void 0?f.index:o.length,v=o.charCodeAt(y),!f){t=o.slice(g);break}if(v===10&&g===y&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),g<y&&(u.push(o.slice(g,y)),e+=y-g),v){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}g=y+1}return c&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const PD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function OD(e){return e.replace(PD,LD)}function LD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return dk(n.slice(o?2:1),o?16:10)}return Vp(n)||e}const bk={}.hasOwnProperty;function ID(e,t,n){return typeof t!="string"&&(n=t,t=void 0),DD(n)(AD(ND(n).document().write(RD()(e,t,!0))))}function DD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(je),autolinkProtocol:U,autolinkEmail:U,atxHeading:o(ee),blockQuote:o(tt),characterEscape:U,characterReference:U,codeFenced:o(Ot),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(Ot,a),codeText:o(Zt,a),codeTextData:U,data:U,codeFlowValue:U,definition:o(Rn),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(er),hardBreakEscape:o(Me),hardBreakTrailing:o(Me),htmlFlow:o(te,a),htmlFlowData:U,htmlText:o(te,a),htmlTextData:U,image:o(ge),label:a,link:o(je),listItem:o($e),listItemValue:y,listOrdered:o(be,g),listUnordered:o(be),paragraph:o(Se),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(ee),strong:o(Qe),thematicBreak:o(rt)},exit:{atxHeading:u(),atxHeadingSequence:T,autolink:u(),autolinkEmail:me,autolinkProtocol:_e,blockQuote:u(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:Ne,characterReferenceMarkerNumeric:Ne,characterReferenceValue:fe,characterReference:Ae,codeFenced:u(k),codeFencedFence:w,codeFencedFenceInfo:v,codeFencedFenceMeta:b,codeFlowValue:L,codeIndented:u(S),codeText:u(W),codeTextData:L,data:L,definition:u(),definitionDestinationString:O,definitionLabelString:C,definitionTitleString:j,emphasis:u(),hardBreakEscape:u(Y),hardBreakTrailing:u(Y),htmlFlow:u(he),htmlFlowData:L,htmlText:u(K),htmlTextData:L,image:u(re),label:ce,labelText:J,lineEnding:Q,link:u(ne),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ve,resourceDestinationString:A,resourceTitleString:D,resource:G,setextHeading:u(V),setextHeadingLineSequence:M,setextHeadingText:N,strong:u(),thematicBreak:u()}};wk(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let le={type:"root",children:[]};const we={stack:[le],tokenStack:[],config:t,enter:c,exit:f,buffer:a,resume:p,data:n},Ue=[];let qe=-1;for(;++qe<Z.length;)if(Z[qe][1].type==="listOrdered"||Z[qe][1].type==="listUnordered")if(Z[qe][0]==="enter")Ue.push(qe);else{const ot=Ue.pop();qe=s(Z,ot,qe)}for(qe=-1;++qe<Z.length;){const ot=t[Z[qe][0]];bk.call(ot,Z[qe][1].type)&&ot[Z[qe][1].type].call(Object.assign({sliceSerialize:Z[qe][2].sliceSerialize},we),Z[qe][1])}if(we.tokenStack.length>0){const ot=we.tokenStack[we.tokenStack.length-1];(ot[1]||F0).call(we,void 0,ot[0])}for(le.position={start:Jr(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:Jr(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<t.transforms.length;)le=t.transforms[qe](le)||le;return le}function s(Z,le,we){let Ue=le-1,qe=-1,ot=!1,Mt,St,an,en;for(;++Ue<=we;){const Ke=Z[Ue];switch(Ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ke[0]==="enter"?qe++:qe--,en=void 0;break}case"lineEndingBlank":{Ke[0]==="enter"&&(Mt&&!en&&!qe&&!an&&(an=Ue),en=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:en=void 0}if(!qe&&Ke[0]==="enter"&&Ke[1].type==="listItemPrefix"||qe===-1&&Ke[0]==="exit"&&(Ke[1].type==="listUnordered"||Ke[1].type==="listOrdered")){if(Mt){let ln=Ue;for(St=void 0;ln--;){const tn=Z[ln];if(tn[1].type==="lineEnding"||tn[1].type==="lineEndingBlank"){if(tn[0]==="exit")continue;St&&(Z[St][1].type="lineEndingBlank",ot=!0),tn[1].type="lineEnding",St=ln}else if(!(tn[1].type==="linePrefix"||tn[1].type==="blockQuotePrefix"||tn[1].type==="blockQuotePrefixWhitespace"||tn[1].type==="blockQuoteMarker"||tn[1].type==="listItemIndent"))break}an&&(!St||an<St)&&(Mt._spread=!0),Mt.end=Object.assign({},St?Z[St][1].start:Ke[1].end),Z.splice(St||Ue,0,["exit",Mt,Ke[2]]),Ue++,we++}if(Ke[1].type==="listItemPrefix"){const ln={type:"listItem",_spread:!1,start:Object.assign({},Ke[1].start),end:void 0};Mt=ln,Z.splice(Ue,0,["enter",ln,Ke[2]]),Ue++,we++,an=void 0,en=!0}}}return Z[le][1]._spread=ot,we}function o(Z,le){return we;function we(Ue){c.call(this,Z(Ue),Ue),le&&le.call(this,Ue)}}function a(){this.stack.push({type:"fragment",children:[]})}function c(Z,le,we){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([le,we||void 0]),Z.position={start:Jr(le.start),end:void 0}}function u(Z){return le;function le(we){Z&&Z.call(this,we),f.call(this,we)}}function f(Z,le){const we=this.stack.pop(),Ue=this.tokenStack.pop();if(Ue)Ue[0].type!==Z.type&&(le?le.call(this,Z,Ue[0]):(Ue[1]||F0).call(this,Z,Ue[0]));else throw new Error("Cannot close `"+Z.type+"` ("+ea({start:Z.start,end:Z.end})+"): it’s not open");we.position.end=Jr(Z.end)}function p(){return Bp(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(Z){if(this.data.expectingFirstListItemValue){const le=this.stack[this.stack.length-2];le.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function v(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.lang=Z}function b(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.meta=Z}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z.replace(/(\r?\n|\r)$/g,"")}function C(Z){const le=this.resume(),we=this.stack[this.stack.length-1];we.label=le,we.identifier=Qn(this.sliceSerialize(Z)).toLowerCase()}function j(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.title=Z}function O(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.url=Z}function T(Z){const le=this.stack[this.stack.length-1];if(!le.depth){const we=this.sliceSerialize(Z).length;le.depth=we}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function M(Z){const le=this.stack[this.stack.length-1];le.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function U(Z){const we=this.stack[this.stack.length-1].children;let Ue=we[we.length-1];(!Ue||Ue.type!=="text")&&(Ue=nt(),Ue.position={start:Jr(Z.start),end:void 0},we.push(Ue)),this.stack.push(Ue)}function L(Z){const le=this.stack.pop();le.value+=this.sliceSerialize(Z),le.position.end=Jr(Z.end)}function Q(Z){const le=this.stack[this.stack.length-1];if(this.data.atHardBreak){const we=le.children[le.children.length-1];we.position.end=Jr(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(le.type)&&(U.call(this,Z),L.call(this,Z))}function Y(){this.data.atHardBreak=!0}function he(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z}function K(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z}function W(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.value=Z}function ne(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=le,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function re(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=le,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function J(Z){const le=this.sliceSerialize(Z),we=this.stack[this.stack.length-2];we.label=OD(le),we.identifier=Qn(le).toLowerCase()}function ce(){const Z=this.stack[this.stack.length-1],le=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const Ue=Z.children;we.children=Ue}else we.alt=le}function A(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.url=Z}function D(){const Z=this.resume(),le=this.stack[this.stack.length-1];le.title=Z}function G(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function ve(Z){const le=this.resume(),we=this.stack[this.stack.length-1];we.label=le,we.identifier=Qn(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function Ne(Z){this.data.characterReferenceType=Z.type}function fe(Z){const le=this.sliceSerialize(Z),we=this.data.characterReferenceType;let Ue;we?(Ue=dk(le,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ue=Vp(le);const qe=this.stack[this.stack.length-1];qe.value+=Ue}function Ae(Z){const le=this.stack.pop();le.position.end=Jr(Z.end)}function _e(Z){L.call(this,Z);const le=this.stack[this.stack.length-1];le.url=this.sliceSerialize(Z)}function me(Z){L.call(this,Z);const le=this.stack[this.stack.length-1];le.url="mailto:"+this.sliceSerialize(Z)}function tt(){return{type:"blockquote",children:[]}}function Ot(){return{type:"code",lang:null,meta:null,value:""}}function Zt(){return{type:"inlineCode",value:""}}function Rn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function er(){return{type:"emphasis",children:[]}}function ee(){return{type:"heading",depth:0,children:[]}}function Me(){return{type:"break"}}function te(){return{type:"html",value:""}}function ge(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function be(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function $e(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Se(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function nt(){return{type:"text",value:""}}function rt(){return{type:"thematicBreak"}}}function Jr(e){return{line:e.line,column:e.column,offset:e.offset}}function wk(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?wk(e,r):MD(e,r)}}function MD(e,t){let n;for(n in t)if(bk.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 F0(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ea({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ea({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ea({start:t.start,end:t.end})+") is still open")}function zD(e){const t=this;t.parser=n;function n(r){return ID(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function FD(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 $D(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
108
108
  `}]}function UD(e,t){const n=t.value?t.value+`
109
109
  `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function BD(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VD(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qD(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Gi(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let a,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=o+1,c+=1,e.footnoteCounts.set(r,c);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,u);const f={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,f),e.applyData(t,f)}function HD(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 KD(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function kk(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 s=e.all(t),o=s[0];o&&o.type==="text"?o.value="["+o.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function WD(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kk(e,t);const s={src:Gi(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function GD(e,t){const n={src:Gi(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 JD(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 XD(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kk(e,t);const s={href:Gi(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function YD(e,t){const n={href:Gi(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 QD(e,t,n){const r=e.all(t),s=n?ZD(n):Sk(t),o={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const p=r[c];(s||c!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
110
110
  `}),p.type==="element"&&p.tagName==="p"&&!s?a.push(...p.children):a.push(p)}const u=r[r.length-1];u&&(s||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
@@ -114,7 +114,7 @@ ${e.content}`:""}`,f=new Blob([u],{type:"text/markdown"}),p=URL.createObjectURL(
114
114
  `});++r<e.length;)r&&n.push({type:"text",value:`
115
115
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
116
116
  `}),n}function K0(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function W0(e,t){const n=C5(e,t),r=n.one(e,void 0),s=y5(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
117
- `},s),o}function P5(e,t){return e&&"run"in e?async function(n,r){const s=W0(n,{file:r,...t});await e.run(s,r)}:function(n,r){return W0(n,{file:r,...e||t})}}function G0(e){if(e)throw e}var Th,J0;function O5(){if(J0)return Th;J0=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!g)return!1;var y;for(y in f);return typeof y>"u"||e.call(f,y)},a=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 Th=function u(){var f,p,g,y,v,b,w=arguments[0],k=1,S=arguments.length,C=!1;for(typeof w=="boolean"&&(C=w,w=arguments[1]||{},k=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});k<S;++k)if(f=arguments[k],f!=null)for(p in f)g=c(w,p),y=c(f,p),w!==y&&(C&&y&&(o(y)||(v=s(y)))?(v?(v=!1,b=g&&s(g)?g:[]):b=g&&o(g)?g:{},a(w,{name:p,newValue:u(C,b,y)})):typeof y<"u"&&a(w,{name:p,newValue:y}));return w},Th}var L5=O5();const Nh=Ac(L5);function If(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 I5(){const e=[],t={run:n,use:r};return t;function n(...s){let o=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);c(null,...s);function c(u,...f){const p=e[++o];let g=-1;if(u){a(u);return}for(;++g<s.length;)(f[g]===null||f[g]===void 0)&&(f[g]=s[g]);s=f,p?D5(p,c)(...f):a(null,...f)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function D5(e,t){let n;return r;function r(...a){const c=e.length>a.length;let u;c&&a.push(s);try{u=e.apply(this,a)}catch(f){const p=f;if(c&&n)throw p;return s(p)}c||(u&&u.then&&typeof u.then=="function"?u.then(o,s):u instanceof Error?s(u):o(u))}function s(a,...c){n||(n=!0,t(a,...c))}function o(a){s(null,a)}}const ar={basename:M5,dirname:z5,extname:F5,join:$5,sep:"/"};function M5(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Pa(e);let n=0,r=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else r<0&&(o=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,c=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else a<0&&(o=!0,a=s+1),c>-1&&(e.codePointAt(s)===t.codePointAt(c--)?c<0&&(r=s):(c=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function z5(e){if(Pa(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 F5(e){Pa(e);let t=e.length,n=-1,r=0,s=-1,o=0,a;for(;t--;){const c=e.codePointAt(t);if(c===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),c===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function $5(...e){let t=-1,n;for(;++t<e.length;)Pa(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":U5(n)}function U5(e){Pa(e);const t=e.codePointAt(0)===47;let n=B5(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function B5(e,t){let n="",r=0,s=-1,o=0,a=-1,c,u;for(;++a<=e.length;){if(a<e.length)c=e.codePointAt(a);else{if(c===47)break;c=47}if(c===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),s=a,o=0;continue}}else if(n.length>0){n="",r=0,s=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,o=0}else c===46&&o>-1?o++:o=-1}return n}function Pa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const V5={cwd:q5};function q5(){return"/"}function Df(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function H5(e){if(typeof e=="string")e=new URL(e);else if(!Df(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 K5(e)}function K5(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 s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Ah=["history","path","basename","stem","extname","dirname"];class Ak{constructor(t){let n;t?Df(t)?n={path:t}:typeof t=="string"||W5(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":V5.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ah.length;){const o=Ah[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)Ah.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ar.basename(this.path):void 0}set basename(t){Ph(t,"basename"),Rh(t,"basename"),this.path=ar.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ar.dirname(this.path):void 0}set dirname(t){X0(this.basename,"dirname"),this.path=ar.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ar.extname(this.path):void 0}set extname(t){if(Rh(t,"extname"),X0(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=ar.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Df(t)&&(t=H5(t)),Ph(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ar.basename(this.path,this.extname):void 0}set stem(t){Ph(t,"stem"),Rh(t,"stem"),this.path=ar.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Qt(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Rh(e,t){if(e&&e.includes(ar.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ar.sep+"`")}function Ph(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function X0(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function W5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const G5=(function(e){const r=this.constructor.prototype,s=r[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),J5={}.hasOwnProperty;class Xp extends G5{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=I5()}copy(){const t=new Xp;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Nh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ih("data",this.frozen),this.namespace[t]=n,this):J5.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ih("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 s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Zl(t),r=this.parser||this.Parser;return Oh("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Oh("process",this.parser||this.Parser),Lh("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,a){const c=Zl(t),u=r.parse(c);r.run(u,c,function(p,g,y){if(p||!g||!y)return f(p);const v=g,b=r.stringify(v,y);Q5(b)?y.value=b:y.result=b,f(p,y)});function f(p,g){p||!g?a(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,r;return this.freeze(),Oh("processSync",this.parser||this.Parser),Lh("processSync",this.compiler||this.Compiler),this.process(t,s),Q0("processSync","process",n),r;function s(o,a){n=!0,G0(o),r=a}}run(t,n,r){Y0(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(a,c){const u=Zl(n);s.run(t,u,f);function f(p,g,y){const v=g||t;p?c(p):a?a(v):r(void 0,v,y)}}}runSync(t,n){let r=!1,s;return this.run(t,n,o),Q0("runSync","run",r),s;function o(a,c){G0(a),s=c,r=!0}}stringify(t,n){this.freeze();const r=Zl(n),s=this.compiler||this.Compiler;return Lh("stringify",s),Y0(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Ih("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(f){if(typeof f=="function")u(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...g]=f;u(p,g)}else a(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function a(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&&(s.settings=Nh(!0,s.settings,f.settings))}function c(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const g=f[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function u(f,p){let g=-1,y=-1;for(;++g<r.length;)if(r[g][0]===f){y=g;break}if(y===-1)r.push([f,...p]);else if(p.length>0){let[v,...b]=p;const w=r[y][1];If(w)&&If(v)&&(v=Nh(!0,w,v)),r[y]=[f,v,...b]}}}}const X5=new Xp().freeze();function Oh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Lh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ih(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 Y0(e){if(!If(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Q0(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Zl(e){return Y5(e)?e:new Ak(e)}function Y5(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Q5(e){return typeof e=="string"||Z5(e)}function Z5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const eM="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Z0=[],e_={allowDangerousHtml:!0},tM=/^(https?|ircs?|mailto|xmpp)$/i,nM=[{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 Yp(e){const t=rM(e),n=sM(e);return iM(t.runSync(t.parse(n),n),e)}function rM(e){const t=e.rehypePlugins||Z0,n=e.remarkPlugins||Z0,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...e_}:e_;return X5().use(zD).use(n).use(P5,r).use(t)}function sM(e){const t=e.children||"",n=new Ak;return typeof t=="string"&&(n.value=t),n}function iM(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,o=t.disallowedElements,a=t.skipHtml,c=t.unwrapDisallowed,u=t.urlTransform||oM;for(const p of nM)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+eM+p.id,void 0);return Jp(e,f),bI(e,{Fragment:h.Fragment,components:s,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function f(p,g,y){if(p.type==="raw"&&y&&typeof g=="number")return a?y.children.splice(g,1):y.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let v;for(v in jh)if(Object.hasOwn(jh,v)&&Object.hasOwn(p.properties,v)){const b=p.properties[v],w=jh[v];(w===null||w.includes(p.tagName))&&(p.properties[v]=u(String(b||""),v,p))}}if(p.type==="element"){let v=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!v&&r&&typeof g=="number"&&(v=!r(p,g,y)),v&&y&&typeof g=="number")return c&&p.children?y.children.splice(g,1,...p.children):y.children.splice(g,1),g}}}function oM(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||tM.test(e.slice(0,t))?e:""}function t_(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function aM(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function lM(e,t,n){const s=Zc((n||{}).ignore||[]),o=cM(t);let a=-1;for(;++a<o.length;)Nk(e,"text",c);function c(f,p){let g=-1,y;for(;++g<p.length;){const v=p[g],b=y?y.children:void 0;if(s(v,b?b.indexOf(v):void 0,y))return;y=v}if(y)return u(f,p)}function u(f,p){const g=p[p.length-1],y=o[a][0],v=o[a][1];let b=0;const k=g.children.indexOf(f);let S=!1,C=[];y.lastIndex=0;let j=y.exec(f.value);for(;j;){const O=j.index,T={index:j.index,input:j.input,stack:[...p,f]};let N=v(...j,T);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?y.lastIndex=O+1:(b!==O&&C.push({type:"text",value:f.value.slice(b,O)}),Array.isArray(N)?C.push(...N):N&&C.push(N),b=O+j[0].length,S=!0),!y.global)break;j=y.exec(f.value)}return S?(b<f.value.length&&C.push({type:"text",value:f.value.slice(b)}),g.children.splice(k,1,...C)):C=[f],k+C.length}}function cM(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([uM(s[0]),dM(s[1])])}return t}function uM(e){return typeof e=="string"?new RegExp(aM(e),"g"):e}function dM(e){return typeof e=="function"?e:function(){return e}}const Dh="phrasing",Mh=["autolink","link","image","label"];function hM(){return{transforms:[vM],enter:{literalAutolink:pM,literalAutolinkEmail:zh,literalAutolinkHttp:zh,literalAutolinkWww:zh},exit:{literalAutolink:xM,literalAutolinkEmail:yM,literalAutolinkHttp:mM,literalAutolinkWww:gM}}}function fM(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Dh,notInConstruct:Mh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Dh,notInConstruct:Mh},{character:":",before:"[ps]",after:"\\/",inConstruct:Dh,notInConstruct:Mh}]}}function pM(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function zh(e){this.config.enter.autolinkProtocol.call(this,e)}function mM(e){this.config.exit.autolinkProtocol.call(this,e)}function gM(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function yM(e){this.config.exit.autolinkEmail.call(this,e)}function xM(e){this.exit(e)}function vM(e){lM(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,_M],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),bM]],{ignore:["link","linkReference"]})}function _M(e,t,n,r,s){let o="";if(!Rk(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!wM(n)))return!1;const a=kM(n+r);if(!a[0])return!1;const c={type:"link",title:null,url:o+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[c,{type:"text",value:a[1]}]:c}function bM(e,t,n,r){return!Rk(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function wM(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function kM(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=t_(e,"(");let o=t_(e,")");for(;r!==-1&&s>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Rk(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ms(n)||Xc(n))&&(!t||n!==47)}Pk.peek=PM;function SM(){this.buffer()}function jM(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function EM(){this.buffer()}function CM(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function TM(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function NM(e){this.exit(e)}function AM(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function RM(e){this.exit(e)}function PM(){return"["}function Pk(e,t,n,r){const s=n.createTracker(r);let o=s.move("[^");const a=n.enter("footnoteReference"),c=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),c(),a(),o+=s.move("]"),o}function OM(){return{enter:{gfmFootnoteCallString:SM,gfmFootnoteCall:jM,gfmFootnoteDefinitionLabelString:EM,gfmFootnoteDefinition:CM},exit:{gfmFootnoteCallString:TM,gfmFootnoteCall:NM,gfmFootnoteDefinitionLabelString:AM,gfmFootnoteDefinition:RM}}}function LM(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Pk},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,o,a){const c=o.createTracker(a);let u=c.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return u+=c.move(o.safe(o.associationId(r),{before:u,after:"]"})),p(),u+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),u+=c.move((t?`
117
+ `},s),o}function P5(e,t){return e&&"run"in e?async function(n,r){const s=W0(n,{file:r,...t});await e.run(s,r)}:function(n,r){return W0(n,{file:r,...e||t})}}function G0(e){if(e)throw e}var Th,J0;function O5(){if(J0)return Th;J0=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!g)return!1;var y;for(y in f);return typeof y>"u"||e.call(f,y)},a=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 Th=function u(){var f,p,g,y,v,b,w=arguments[0],k=1,S=arguments.length,C=!1;for(typeof w=="boolean"&&(C=w,w=arguments[1]||{},k=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});k<S;++k)if(f=arguments[k],f!=null)for(p in f)g=c(w,p),y=c(f,p),w!==y&&(C&&y&&(o(y)||(v=s(y)))?(v?(v=!1,b=g&&s(g)?g:[]):b=g&&o(g)?g:{},a(w,{name:p,newValue:u(C,b,y)})):typeof y<"u"&&a(w,{name:p,newValue:y}));return w},Th}var L5=O5();const Nh=Ac(L5);function If(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 I5(){const e=[],t={run:n,use:r};return t;function n(...s){let o=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);c(null,...s);function c(u,...f){const p=e[++o];let g=-1;if(u){a(u);return}for(;++g<s.length;)(f[g]===null||f[g]===void 0)&&(f[g]=s[g]);s=f,p?D5(p,c)(...f):a(null,...f)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function D5(e,t){let n;return r;function r(...a){const c=e.length>a.length;let u;c&&a.push(s);try{u=e.apply(this,a)}catch(f){const p=f;if(c&&n)throw p;return s(p)}c||(u&&u.then&&typeof u.then=="function"?u.then(o,s):u instanceof Error?s(u):o(u))}function s(a,...c){n||(n=!0,t(a,...c))}function o(a){s(null,a)}}const ar={basename:M5,dirname:z5,extname:F5,join:$5,sep:"/"};function M5(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Pa(e);let n=0,r=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else r<0&&(o=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,c=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else a<0&&(o=!0,a=s+1),c>-1&&(e.codePointAt(s)===t.codePointAt(c--)?c<0&&(r=s):(c=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function z5(e){if(Pa(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 F5(e){Pa(e);let t=e.length,n=-1,r=0,s=-1,o=0,a;for(;t--;){const c=e.codePointAt(t);if(c===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),c===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function $5(...e){let t=-1,n;for(;++t<e.length;)Pa(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":U5(n)}function U5(e){Pa(e);const t=e.codePointAt(0)===47;let n=B5(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function B5(e,t){let n="",r=0,s=-1,o=0,a=-1,c,u;for(;++a<=e.length;){if(a<e.length)c=e.codePointAt(a);else{if(c===47)break;c=47}if(c===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),s=a,o=0;continue}}else if(n.length>0){n="",r=0,s=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,o=0}else c===46&&o>-1?o++:o=-1}return n}function Pa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const V5={cwd:q5};function q5(){return"/"}function Df(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function H5(e){if(typeof e=="string")e=new URL(e);else if(!Df(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 K5(e)}function K5(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 s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Ah=["history","path","basename","stem","extname","dirname"];class Ak{constructor(t){let n;t?Df(t)?n={path:t}:typeof t=="string"||W5(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":V5.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ah.length;){const o=Ah[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)Ah.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ar.basename(this.path):void 0}set basename(t){Ph(t,"basename"),Rh(t,"basename"),this.path=ar.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ar.dirname(this.path):void 0}set dirname(t){X0(this.basename,"dirname"),this.path=ar.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ar.extname(this.path):void 0}set extname(t){if(Rh(t,"extname"),X0(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=ar.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Df(t)&&(t=H5(t)),Ph(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ar.basename(this.path,this.extname):void 0}set stem(t){Ph(t,"stem"),Rh(t,"stem"),this.path=ar.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Qt(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Rh(e,t){if(e&&e.includes(ar.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ar.sep+"`")}function Ph(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function X0(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function W5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const G5=(function(e){const r=this.constructor.prototype,s=r[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),J5={}.hasOwnProperty;class Xp extends G5{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=I5()}copy(){const t=new Xp;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Nh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ih("data",this.frozen),this.namespace[t]=n,this):J5.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ih("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 s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Zl(t),r=this.parser||this.Parser;return Oh("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Oh("process",this.parser||this.Parser),Lh("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,a){const c=Zl(t),u=r.parse(c);r.run(u,c,function(p,g,y){if(p||!g||!y)return f(p);const v=g,b=r.stringify(v,y);Q5(b)?y.value=b:y.result=b,f(p,y)});function f(p,g){p||!g?a(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,r;return this.freeze(),Oh("processSync",this.parser||this.Parser),Lh("processSync",this.compiler||this.Compiler),this.process(t,s),Q0("processSync","process",n),r;function s(o,a){n=!0,G0(o),r=a}}run(t,n,r){Y0(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(a,c){const u=Zl(n);s.run(t,u,f);function f(p,g,y){const v=g||t;p?c(p):a?a(v):r(void 0,v,y)}}}runSync(t,n){let r=!1,s;return this.run(t,n,o),Q0("runSync","run",r),s;function o(a,c){G0(a),s=c,r=!0}}stringify(t,n){this.freeze();const r=Zl(n),s=this.compiler||this.Compiler;return Lh("stringify",s),Y0(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Ih("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(f){if(typeof f=="function")u(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...g]=f;u(p,g)}else a(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function a(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&&(s.settings=Nh(!0,s.settings,f.settings))}function c(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const g=f[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function u(f,p){let g=-1,y=-1;for(;++g<r.length;)if(r[g][0]===f){y=g;break}if(y===-1)r.push([f,...p]);else if(p.length>0){let[v,...b]=p;const w=r[y][1];If(w)&&If(v)&&(v=Nh(!0,w,v)),r[y]=[f,v,...b]}}}}const X5=new Xp().freeze();function Oh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Lh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ih(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 Y0(e){if(!If(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Q0(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Zl(e){return Y5(e)?e:new Ak(e)}function Y5(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Q5(e){return typeof e=="string"||Z5(e)}function Z5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const eM="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Z0=[],e_={allowDangerousHtml:!0},tM=/^(https?|ircs?|mailto|xmpp)$/i,nM=[{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 Yp(e){const t=rM(e),n=sM(e);return iM(t.runSync(t.parse(n),n),e)}function rM(e){const t=e.rehypePlugins||Z0,n=e.remarkPlugins||Z0,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...e_}:e_;return X5().use(zD).use(n).use(P5,r).use(t)}function sM(e){const t=e.children||"",n=new Ak;return typeof t=="string"&&(n.value=t),n}function iM(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,o=t.disallowedElements,a=t.skipHtml,c=t.unwrapDisallowed,u=t.urlTransform||oM;for(const p of nM)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+eM+p.id,void 0);return Jp(e,f),bI(e,{Fragment:h.Fragment,components:s,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function f(p,g,y){if(p.type==="raw"&&y&&typeof g=="number")return a?y.children.splice(g,1):y.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let v;for(v in jh)if(Object.hasOwn(jh,v)&&Object.hasOwn(p.properties,v)){const b=p.properties[v],w=jh[v];(w===null||w.includes(p.tagName))&&(p.properties[v]=u(String(b||""),v,p))}}if(p.type==="element"){let v=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!v&&r&&typeof g=="number"&&(v=!r(p,g,y)),v&&y&&typeof g=="number")return c&&p.children?y.children.splice(g,1,...p.children):y.children.splice(g,1),g}}}function oM(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||tM.test(e.slice(0,t))?e:""}function t_(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function aM(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function lM(e,t,n){const s=Zc((n||{}).ignore||[]),o=cM(t);let a=-1;for(;++a<o.length;)Nk(e,"text",c);function c(f,p){let g=-1,y;for(;++g<p.length;){const v=p[g],b=y?y.children:void 0;if(s(v,b?b.indexOf(v):void 0,y))return;y=v}if(y)return u(f,p)}function u(f,p){const g=p[p.length-1],y=o[a][0],v=o[a][1];let b=0;const k=g.children.indexOf(f);let S=!1,C=[];y.lastIndex=0;let j=y.exec(f.value);for(;j;){const O=j.index,T={index:j.index,input:j.input,stack:[...p,f]};let N=v(...j,T);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?y.lastIndex=O+1:(b!==O&&C.push({type:"text",value:f.value.slice(b,O)}),Array.isArray(N)?C.push(...N):N&&C.push(N),b=O+j[0].length,S=!0),!y.global)break;j=y.exec(f.value)}return S?(b<f.value.length&&C.push({type:"text",value:f.value.slice(b)}),g.children.splice(k,1,...C)):C=[f],k+C.length}}function cM(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([uM(s[0]),dM(s[1])])}return t}function uM(e){return typeof e=="string"?new RegExp(aM(e),"g"):e}function dM(e){return typeof e=="function"?e:function(){return e}}const Dh="phrasing",Mh=["autolink","link","image","label"];function hM(){return{transforms:[vM],enter:{literalAutolink:pM,literalAutolinkEmail:zh,literalAutolinkHttp:zh,literalAutolinkWww:zh},exit:{literalAutolink:xM,literalAutolinkEmail:yM,literalAutolinkHttp:mM,literalAutolinkWww:gM}}}function fM(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Dh,notInConstruct:Mh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Dh,notInConstruct:Mh},{character:":",before:"[ps]",after:"\\/",inConstruct:Dh,notInConstruct:Mh}]}}function pM(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function zh(e){this.config.enter.autolinkProtocol.call(this,e)}function mM(e){this.config.exit.autolinkProtocol.call(this,e)}function gM(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function yM(e){this.config.exit.autolinkEmail.call(this,e)}function xM(e){this.exit(e)}function vM(e){lM(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,_M],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),bM]],{ignore:["link","linkReference"]})}function _M(e,t,n,r,s){let o="";if(!Rk(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!wM(n)))return!1;const a=kM(n+r);if(!a[0])return!1;const c={type:"link",title:null,url:o+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[c,{type:"text",value:a[1]}]:c}function bM(e,t,n,r){return!Rk(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function wM(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function kM(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=t_(e,"(");let o=t_(e,")");for(;r!==-1&&s>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Rk(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ms(n)||Xc(n))&&(!t||n!==47)}Pk.peek=PM;function SM(){this.buffer()}function jM(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function EM(){this.buffer()}function CM(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function TM(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function NM(e){this.exit(e)}function AM(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function RM(e){this.exit(e)}function PM(){return"["}function Pk(e,t,n,r){const s=n.createTracker(r);let o=s.move("[^");const a=n.enter("footnoteReference"),c=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),c(),a(),o+=s.move("]"),o}function OM(){return{enter:{gfmFootnoteCallString:SM,gfmFootnoteCall:jM,gfmFootnoteDefinitionLabelString:EM,gfmFootnoteDefinition:CM},exit:{gfmFootnoteCallString:TM,gfmFootnoteCall:NM,gfmFootnoteDefinitionLabelString:AM,gfmFootnoteDefinition:RM}}}function LM(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Pk},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,o,a){const c=o.createTracker(a);let u=c.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return u+=c.move(o.safe(o.associationId(r),{before:u,after:"]"})),p(),u+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),u+=c.move((t?`
118
118
  `:" ")+o.indentLines(o.containerFlow(r,c.current()),t?Ok:IM))),f(),u}}function IM(e,t,n){return t===0?e:Ok(e,t,n)}function Ok(e,t,n){return(n?"":" ")+e}const DM=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Lk.peek=UM;function MM(){return{canContainEols:["delete"],enter:{strikethrough:FM},exit:{strikethrough:$M}}}function zM(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:DM}],handlers:{delete:Lk}}}function FM(e){this.enter({type:"delete",children:[]},e)}function $M(e){this.exit(e)}function Lk(e,t,n,r){const s=n.createTracker(r),o=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),o(),a}function UM(){return"~"}function BM(e){return e.length}function VM(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||BM,o=[],a=[],c=[],u=[];let f=0,p=-1;for(;++p<e.length;){const w=[],k=[];let S=-1;for(e[p].length>f&&(f=e[p].length);++S<e[p].length;){const C=qM(e[p][S]);if(n.alignDelimiters!==!1){const j=s(C);k[S]=j,(u[S]===void 0||j>u[S])&&(u[S]=j)}w.push(C)}a[p]=w,c[p]=k}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<f;)o[g]=n_(r[g]);else{const w=n_(r);for(;++g<f;)o[g]=w}g=-1;const y=[],v=[];for(;++g<f;){const w=o[g];let k="",S="";w===99?(k=":",S=":"):w===108?k=":":w===114&&(S=":");let C=n.alignDelimiters===!1?1:Math.max(1,u[g]-k.length-S.length);const j=k+"-".repeat(C)+S;n.alignDelimiters!==!1&&(C=k.length+C+S.length,C>u[g]&&(u[g]=C),v[g]=C),y[g]=j}a.splice(1,0,y),c.splice(1,0,v),p=-1;const b=[];for(;++p<a.length;){const w=a[p],k=c[p];g=-1;const S=[];for(;++g<f;){const C=w[g]||"";let j="",O="";if(n.alignDelimiters!==!1){const T=u[g]-(k[g]||0),N=o[g];N===114?j=" ".repeat(T):N===99?T%2?(j=" ".repeat(T/2+.5),O=" ".repeat(T/2-.5)):(j=" ".repeat(T/2),O=j):O=" ".repeat(T)}n.delimiterStart!==!1&&!g&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||g)&&S.push(" "),n.alignDelimiters!==!1&&S.push(j),S.push(C),n.alignDelimiters!==!1&&S.push(O),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||g!==f-1)&&S.push("|")}b.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return b.join(`
119
119
  `)}function qM(e){return e==null?"":String(e)}function n_(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function HM(e,t,n,r){const s=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),KM);return s(),a}function KM(e,t,n){return">"+(n?"":" ")+e}function WM(e,t){return r_(e,t.inConstruct,!0)&&!r_(e,t.notInConstruct,!1)}function r_(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function s_(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
120
120
  `&&WM(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
@@ -129,9 +129,9 @@ ${e.content}`:""}`,f=new Blob([u],{type:"text/markdown"}),p=URL.createObjectURL(
129
129
  `))+1))}const a="#".repeat(s),c=n.enter("headingAtx"),u=n.enter("phrasing");o.move(a+" ");let f=n.containerPhrasing(e,{before:"# ",after:`
130
130
  `,...o.current()});return/^[\t ]/.test(f)&&(f=va(f.charCodeAt(0))+f.slice(1)),f=f?a+" "+f:a,n.options.closeAtx&&(f+=" "+a),u(),c(),f}Dk.peek=s3;function Dk(e){return e.value||""}function s3(){return"<"}Mk.peek=i3;function Mk(e,t,n,r){const s=Qp(n),o=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let c=n.enter("label");const u=n.createTracker(r);let f=u.move("![");return f+=u.move(n.safe(e.alt,{before:f,after:"]",...u.current()})),f+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(c=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":")",...u.current()}))),c(),e.title&&(c=n.enter(`title${o}`),f+=u.move(" "+s),f+=u.move(n.safe(e.title,{before:f,after:s,...u.current()})),f+=u.move(s),c()),f+=u.move(")"),a(),f}function i3(){return"!"}zk.peek=o3;function zk(e,t,n,r){const s=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const c=n.createTracker(r);let u=c.move("![");const f=n.safe(e.alt,{before:u,after:"]",...c.current()});u+=c.move(f+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const g=n.safe(n.associationId(e),{before:u,after:"]",...c.current()});return a(),n.stack=p,o(),s==="full"||!f||f!==g?u+=c.move(g+"]"):s==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function o3(){return"!"}Fk.peek=a3;function Fk(e,t,n){let r=e.value||"",s="`",o=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],c=n.compilePattern(a);let u;if(a.atBreak)for(;u=c.exec(r);){let f=u.index;r.charCodeAt(f)===10&&r.charCodeAt(f-1)===13&&f--,r=r.slice(0,f)+" "+r.slice(u.index+1)}}return s+r+s}function a3(){return"`"}function $k(e,t){const n=Bp(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Uk.peek=l3;function Uk(e,t,n,r){const s=Qp(n),o=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let c,u;if($k(e,n)){const p=n.stack;n.stack=[],c=n.enter("autolink");let g=a.move("<");return g+=a.move(n.containerPhrasing(e,{before:g,after:">",...a.current()})),g+=a.move(">"),c(),n.stack=p,g}c=n.enter("link"),u=n.enter("label");let f=a.move("[");return f+=a.move(n.containerPhrasing(e,{before:f,after:"](",...a.current()})),f+=a.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),f+=a.move("<"),f+=a.move(n.safe(e.url,{before:f,after:">",...a.current()})),f+=a.move(">")):(u=n.enter("destinationRaw"),f+=a.move(n.safe(e.url,{before:f,after:e.title?" ":")",...a.current()}))),u(),e.title&&(u=n.enter(`title${o}`),f+=a.move(" "+s),f+=a.move(n.safe(e.title,{before:f,after:s,...a.current()})),f+=a.move(s),u()),f+=a.move(")"),c(),f}function l3(e,t,n){return $k(e,n)?"<":"["}Bk.peek=c3;function Bk(e,t,n,r){const s=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const c=n.createTracker(r);let u=c.move("[");const f=n.containerPhrasing(e,{before:u,after:"]",...c.current()});u+=c.move(f+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const g=n.safe(n.associationId(e),{before:u,after:"]",...c.current()});return a(),n.stack=p,o(),s==="full"||!f||f!==g?u+=c.move(g+"]"):s==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function c3(){return"["}function Zp(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function u3(e){const t=Zp(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function d3(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Vk(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function h3(e,t,n,r){const s=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?d3(n):Zp(n);const c=e.ordered?a==="."?")":".":u3(n);let u=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),Vk(n)===a&&p){let g=-1;for(;++g<e.children.length;){const y=e.children[g];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(a=c),n.bulletCurrent=a;const f=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,s(),f}function f3(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function p3(e,t,n,r){const s=f3(n);let o=n.bulletCurrent||Zp(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let a=o.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const c=n.createTracker(r);c.move(o+" ".repeat(a-o.length)),c.shift(a);const u=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,c.current()),p);return u(),f;function p(g,y,v){return y?(v?"":" ".repeat(a))+g:(v?o:o+" ".repeat(a-o.length))+g}}function m3(e,t,n,r){const s=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),s(),a}const g3=Zc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function y3(e,t,n,r){return(e.children.some(function(a){return g3(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function x3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}qk.peek=v3;function qk(e,t,n,r){const s=x3(n),o=n.enter("strong"),a=n.createTracker(r),c=a.move(s+s);let u=a.move(n.containerPhrasing(e,{after:s,before:c,...a.current()}));const f=u.charCodeAt(0),p=Nc(r.before.charCodeAt(r.before.length-1),f,s);p.inside&&(u=va(f)+u.slice(1));const g=u.charCodeAt(u.length-1),y=Nc(r.after.charCodeAt(0),g,s);y.inside&&(u=u.slice(0,-1)+va(g));const v=a.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:p.outside},c+u+v}function v3(e,t,n){return n.options.strong||"*"}function _3(e,t,n,r){return n.safe(e.value,r)}function b3(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function w3(e,t,n){const r=(Vk(n)+(n.options.ruleSpaces?" ":"")).repeat(b3(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Hk={blockquote:HM,break:s_,code:YM,definition:ZM,emphasis:Ik,hardBreak:s_,heading:r3,html:Dk,image:Mk,imageReference:zk,inlineCode:Fk,link:Uk,linkReference:Bk,list:h3,listItem:p3,paragraph:m3,root:y3,strong:qk,text:_3,thematicBreak:w3};function k3(){return{enter:{table:S3,tableData:i_,tableHeader:i_,tableRow:E3},exit:{codeText:C3,table:j3,tableData:Fh,tableHeader:Fh,tableRow:Fh}}}function S3(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function j3(e){this.exit(e),this.data.inTable=void 0}function E3(e){this.enter({type:"tableRow",children:[]},e)}function Fh(e){this.exit(e)}function i_(e){this.enter({type:"tableCell",children:[]},e)}function C3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,T3));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function T3(e,t){return t==="|"?t:e}function N3(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
131
131
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:a,tableCell:u,tableRow:c}};function a(v,b,w,k){return f(p(v,w,k),v.align)}function c(v,b,w,k){const S=g(v,w,k),C=f([S]);return C.slice(0,C.indexOf(`
132
- `))}function u(v,b,w,k){const S=w.enter("tableCell"),C=w.enter("phrasing"),j=w.containerPhrasing(v,{...k,before:o,after:o});return C(),S(),j}function f(v,b){return VM(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function p(v,b,w){const k=v.children;let S=-1;const C=[],j=b.enter("table");for(;++S<k.length;)C[S]=g(k[S],b,w);return j(),C}function g(v,b,w){const k=v.children;let S=-1;const C=[],j=b.enter("tableRow");for(;++S<k.length;)C[S]=u(k[S],v,b,w);return j(),C}function y(v,b,w){let k=Hk.inlineCode(v,b,w);return w.stack.includes("tableCell")&&(k=k.replace(/\|/g,"\\$&")),k}}function A3(){return{exit:{taskListCheckValueChecked:o_,taskListCheckValueUnchecked:o_,paragraph:P3}}}function R3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:O3}}}function o_(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function P3(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let o=-1,a;for(;++o<s.length;){const c=s[o];if(c.type==="paragraph"){a=c;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function O3(e,t,n,r){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);o&&c.move(a);let u=Hk.listItem(e,t,n,{...r,...c.current()});return o&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),u;function f(p){return p+a}}function L3(){return[hM(),OM(),MM(),k3(),A3()]}function I3(e){return{extensions:[fM(),LM(e),zM(),N3(e),R3()]}}const D3={tokenize:B3,partial:!0},Kk={tokenize:V3,partial:!0},Wk={tokenize:q3,partial:!0},Gk={tokenize:H3,partial:!0},M3={tokenize:K3,partial:!0},Jk={name:"wwwAutolink",tokenize:$3,previous:Yk},Xk={name:"protocolAutolink",tokenize:U3,previous:Qk},Tr={name:"emailAutolink",tokenize:F3,previous:Zk},dr={};function z3(){return{text:dr}}let _s=48;for(;_s<123;)dr[_s]=Tr,_s++,_s===58?_s=65:_s===91&&(_s=97);dr[43]=Tr;dr[45]=Tr;dr[46]=Tr;dr[95]=Tr;dr[72]=[Tr,Xk];dr[104]=[Tr,Xk];dr[87]=[Tr,Jk];dr[119]=[Tr,Jk];function F3(e,t,n){const r=this;let s,o;return a;function a(g){return!Mf(g)||!Zk.call(r,r.previous)||em(r.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(g))}function c(g){return Mf(g)?(e.consume(g),c):g===64?(e.consume(g),u):n(g)}function u(g){return g===46?e.check(M3,p,f)(g):g===45||g===95||Yt(g)?(o=!0,e.consume(g),u):p(g)}function f(g){return e.consume(g),s=!0,u}function p(g){return o&&s&&rn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function $3(e,t,n){const r=this;return s;function s(a){return a!==87&&a!==119||!Yk.call(r,r.previous)||em(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(D3,e.attempt(Kk,e.attempt(Wk,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function U3(e,t,n){const r=this;let s="",o=!1;return a;function a(g){return(g===72||g===104)&&Qk.call(r,r.previous)&&!em(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(g),e.consume(g),c):n(g)}function c(g){if(rn(g)&&s.length<5)return s+=String.fromCodePoint(g),e.consume(g),c;if(g===58){const y=s.toLowerCase();if(y==="http"||y==="https")return e.consume(g),u}return n(g)}function u(g){return g===47?(e.consume(g),o?f:(o=!0,u)):n(g)}function f(g){return g===null||Ec(g)||it(g)||Ms(g)||Xc(g)?n(g):e.attempt(Kk,e.attempt(Wk,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function B3(e,t,n){let r=0;return s;function s(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),s):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function V3(e,t,n){let r,s,o;return a;function a(f){return f===46||f===95?e.check(Gk,u,c)(f):f===null||it(f)||Ms(f)||f!==45&&Xc(f)?u(f):(o=!0,e.consume(f),a)}function c(f){return f===95?r=!0:(s=r,r=void 0),e.consume(f),a}function u(f){return s||r||!o?n(f):t(f)}}function q3(e,t){let n=0,r=0;return s;function s(a){return a===40?(n++,e.consume(a),s):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(Gk,t,o)(a):a===null||it(a)||Ms(a)?t(a):(e.consume(a),s)}function o(a){return a===41&&r++,e.consume(a),s}}function H3(e,t,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),o):c===93?(e.consume(c),s):c===60||c===null||it(c)||Ms(c)?t(c):n(c)}function s(c){return c===null||c===40||c===91||it(c)||Ms(c)?t(c):r(c)}function o(c){return rn(c)?a(c):n(c)}function a(c){return c===59?(e.consume(c),r):rn(c)?(e.consume(c),a):n(c)}}function K3(e,t,n){return r;function r(o){return e.consume(o),s}function s(o){return Yt(o)?n(o):t(o)}}function Yk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||it(e)}function Qk(e){return!rn(e)}function Zk(e){return!(e===47||Mf(e))}function Mf(e){return e===43||e===45||e===46||e===95||Yt(e)}function em(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const W3={tokenize:tz,partial:!0};function G3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Q3,continuation:{tokenize:Z3},exit:ez}},text:{91:{name:"gfmFootnoteCall",tokenize:Y3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:J3,resolveTo:X3}}}}function J3(e,t,n){const r=this;let s=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const u=r.events[s][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return c;function c(u){if(!a||!a._balanced)return n(u);const f=Xn(r.sliceSerialize({start:a.end,end:r.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function X3(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function Y3(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return c;function c(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),u}function u(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(g){if(o>999||g===93&&!a||g===null||g===91||it(g))return n(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return s.includes(Xn(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return it(g)||(a=!0),o++,e.consume(g),g===92?p:f}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,f):f(g)}}function Q3(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,c;return u;function u(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(b)}function p(b){if(a>999||b===93&&!c||b===null||b===91||it(b))return n(b);if(b===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return o=Xn(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return it(b)||(c=!0),a++,e.consume(b),b===92?g:p}function g(b){return b===91||b===92||b===93?(e.consume(b),a++,p):p(b)}function y(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),s.includes(o)||s.push(o),Je(e,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return t(b)}}function Z3(e,t,n){return e.check(Ra,t,e.attempt(W3,t,n))}function ez(e){e.exit("gfmFootnoteDefinition")}function tz(e,t,n){const r=this;return Je(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function nz(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,c){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let f=u;for(;f--;)if(a[f][0]==="exit"&&a[f][1].type==="strikethroughSequenceTemporary"&&a[f][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[f][1].end.offset-a[f][1].start.offset){a[u][1].type="strikethroughSequence",a[f][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[f][1].start),end:Object.assign({},a[u][1].end)},g={type:"strikethroughText",start:Object.assign({},a[f][1].end),end:Object.assign({},a[u][1].start)},y=[["enter",p,c],["enter",a[f][1],c],["exit",a[f][1],c],["enter",g,c]],v=c.parser.constructs.insideSpan.null;v&&Cn(y,y.length,0,Yc(v,a.slice(f+1,u),c)),Cn(y,y.length,0,[["exit",g,c],["enter",a[u][1],c],["exit",a[u][1],c],["exit",p,c]]),Cn(a,f-1,u-f+3,y),u=f+y.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function o(a,c,u){const f=this.previous,p=this.events;let g=0;return y;function y(b){return f===126&&p[p.length-1][1].type!=="characterEscape"?u(b):(a.enter("strikethroughSequenceTemporary"),v(b))}function v(b){const w=Ui(f);if(b===126)return g>1?u(b):(a.consume(b),g++,v);if(g<2&&!n)return u(b);const k=a.exit("strikethroughSequenceTemporary"),S=Ui(b);return k._open=!S||S===2&&!!w,k._close=!w||w===2&&!!S,c(b)}}}class rz{constructor(){this.map=[]}add(t,n,r){sz(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const o of s)t.push(o);s=r.pop()}this.map.length=0}}function sz(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function iz(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function oz(){return{flow:{null:{name:"table",tokenize:az,resolveAll:lz}}}}function az(e,t,n){const r=this;let s=0,o=0,a;return c;function c(L){let Q=r.events.length-1;for(;Q>-1;){const K=r.events[Q][1].type;if(K==="lineEnding"||K==="linePrefix")Q--;else break}const Y=Q>-1?r.events[Q][1].type:null,he=Y==="tableHead"||Y==="tableRow"?N:u;return he===N&&r.parser.lazy[r.now().line]?n(L):he(L)}function u(L){return e.enter("tableHead"),e.enter("tableRow"),f(L)}function f(L){return L===124||(a=!0,o+=1),p(L)}function p(L){return L===null?n(L):Pe(L)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),v):n(L):Ge(L)?Je(e,p,"whitespace")(L):(o+=1,a&&(a=!1,s+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||it(L)?(e.exit("data"),p(L)):(e.consume(L),L===92?y:g)}function y(L){return L===92||L===124?(e.consume(L),g):g(L)}function v(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(e.enter("tableDelimiterRow"),a=!1,Ge(L)?Je(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):b(L))}function b(L){return L===45||L===58?k(L):L===124?(a=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),w):T(L)}function w(L){return Ge(L)?Je(e,k,"whitespace")(L):k(L)}function k(L){return L===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),S):L===45?(o+=1,S(L)):L===null||Pe(L)?O(L):T(L)}function S(L){return L===45?(e.enter("tableDelimiterFiller"),C(L)):T(L)}function C(L){return L===45?(e.consume(L),C):L===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),j):(e.exit("tableDelimiterFiller"),j(L))}function j(L){return Ge(L)?Je(e,O,"whitespace")(L):O(L)}function O(L){return L===124?b(L):L===null||Pe(L)?!a||s!==o?T(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):T(L)}function T(L){return n(L)}function N(L){return e.enter("tableRow"),M(L)}function M(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),M):L===null||Pe(L)?(e.exit("tableRow"),t(L)):Ge(L)?Je(e,M,"whitespace")(L):(e.enter("data"),V(L))}function V(L){return L===null||L===124||it(L)?(e.exit("data"),M(L)):(e.consume(L),L===92?B:V)}function B(L){return L===92||L===124?(e.consume(L),V):V(L)}}function lz(e,t){let n=-1,r=!0,s=0,o=[0,0,0,0],a=[0,0,0,0],c=!1,u=0,f,p,g;const y=new rz;for(;++n<e.length;){const v=e[n],b=v[1];v[0]==="enter"?b.type==="tableHead"?(c=!1,u!==0&&(a_(y,t,u,f,p),p=void 0,u=0),f={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},y.add(n,0,[["enter",f,t]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(r=!0,g=void 0,o=[0,0,0,0],a=[0,n+1,0,0],c&&(c=!1,p={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},y.add(n,0,[["enter",p,t]])),s=b.type==="tableDelimiterRow"?2:p?3:1):s&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],g=ec(y,t,o,s,void 0,g),o=[0,0,0,0]),a[2]=n)):b.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],g=ec(y,t,o,s,void 0,g)),o=a,a=[o[1],n,0,0])):b.type==="tableHead"?(c=!0,u=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(u=n,o[1]!==0?(a[0]=a[1],g=ec(y,t,o,s,n,g)):a[1]!==0&&(g=ec(y,t,a,s,n,g)),s=0):s&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&a_(y,t,u,f,p),y.consume(t.events),n=-1;++n<t.events.length;){const v=t.events[n];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=iz(t.events,n))}return e}function ec(e,t,n,r,s,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(o.end=Object.assign({},ji(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const u=ji(t.events,n[1]);if(o={type:a,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const f=ji(t.events,n[2]),p=ji(t.events,n[3]),g={type:c,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),r!==2){const y=t.events[n[2]],v=t.events[n[3]];if(y[1].end=Object.assign({},v[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,w=n[3]-n[2]-1;e.add(b,w,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return s!==void 0&&(o.end=Object.assign({},ji(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function a_(e,t,n,r,s){const o=[],a=ji(t.events,n);s&&(s.end=Object.assign({},a),o.push(["exit",s,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function ji(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const cz={name:"tasklistCheck",tokenize:dz};function uz(){return{text:{91:cz}}}function dz(e,t,n){const r=this;return s;function s(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),o)}function o(u){return it(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(u)}function c(u){return Pe(u)?t(u):Ge(u)?e.check({tokenize:hz},t,n)(u):n(u)}}function hz(e,t,n){return Je(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function fz(e){return uk([z3(),G3(),nz(e),oz(),uz()])}const pz={};function mz(e){const t=this,n=e||pz,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(fz(n)),o.push(L3()),a.push(I3(n))}function gz({message:e}){const{t}=et(),n=e.role==="user",r={p:({node:s,...o})=>h.jsx("p",{className:"mb-2 last:mb-0",...o}),a:({node:s,...o})=>h.jsx("a",{className:"text-primary hover:underline",...o}),ul:({node:s,...o})=>h.jsx("ul",{className:"list-disc ml-4 mb-2",...o}),ol:({node:s,...o})=>h.jsx("ol",{className:"list-decimal ml-4 mb-2",...o}),blockquote:({node:s,...o})=>h.jsx("blockquote",{className:"border-l-2 border-border/50 pl-3 text-fg/70 italic mb-2",...o}),table:({node:s,...o})=>h.jsx("table",{className:"w-full text-xs border-collapse my-2",...o}),th:({node:s,...o})=>h.jsx("th",{className:"border border-border/20 bg-surface/50 px-2 py-1 text-left font-semibold",...o}),td:({node:s,...o})=>h.jsx("td",{className:"border border-border/20 px-2 py-1 align-top",...o}),code:({node:s,inline:o,className:a,...c})=>h.jsx("code",{className:o?"bg-black/20 rounded px-1 py-0.5 font-mono text-xs":"block bg-black/30 rounded-lg p-3 font-mono text-xs leading-relaxed overflow-x-auto",...c}),pre:({node:s,...o})=>h.jsx("pre",{className:"my-2",...o})};return h.jsx("div",{className:`flex w-full ${n?"justify-end":"justify-start"}`,children:h.jsxs("div",{className:`flex gap-3 max-w-[85%] ${n?"flex-row-reverse":"flex-row"}`,children:[h.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0 ${n?"bg-primary text-white":"bg-gradient-to-br from-indigo-500 to-purple-600 text-white shadow-lg glow-primary"}`,children:n?h.jsx(Pc,{size:16}):h.jsx(hj,{size:16})}),h.jsxs("div",{className:`flex flex-col ${n?"items-end":"items-start"}`,children:[h.jsx("div",{className:`px-5 py-3.5 rounded-2xl text-sm leading-relaxed shadow-sm ${n?"bg-primary/15 text-fg rounded-tr-none":"bg-surface/70 backdrop-blur-md text-fg rounded-tl-none"}`,children:h.jsx("div",{className:"markdown-body",children:h.jsx(Yp,{remarkPlugins:[mz],components:r,children:e.content})})}),h.jsx("span",{className:"text-[10px] text-fg/30 mt-1 px-1",children:new Date(e.created_at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]})]})})}function yz({sessionId:e,onContextUpdate:t,onNewSession:n,onSessionCreated:r}){const{t:s}=et(),[o,a]=R.useState([]),[c,u]=R.useState(""),[f,p]=R.useState(!1),[g,y]=R.useState(!1),v=R.useRef(null),b=R.useRef(null),w=R.useRef(!0),k=R.useRef(null);R.useEffect(()=>{e?C(e):(a([]),t([]))},[e,t]),R.useEffect(()=>{w.current&&v.current&&v.current.scrollIntoView({behavior:"smooth"})},[o,g]);const S=()=>{const T=b.current;if(!T)return;const N=T.scrollHeight-T.scrollTop-T.clientHeight;w.current=N<64},C=async T=>{try{const{data:{session:N}}=await ae.auth.getSession();if(!N)return;const M=await Xe.get(`/api/chat/sessions/${T}/messages`,{headers:{"x-user-id":N.user.id}});if(M.data.success){a(M.data.messages);const V=M.data.messages[M.data.messages.length-1];V&&V.role==="assistant"&&V.context_sources&&t(V.context_sources)}}catch(N){console.error("Failed to fetch messages",N)}},j=async T=>{if(T?.preventDefault(),!c.trim()||f)return;const N=c.trim();u(""),k.current&&(k.current.style.height="auto");const{data:{session:M}}=await ae.auth.getSession();if(!M)return;const V=M.user.id;p(!0),y(!0);try{let B=e;if(!B){const Y=await Xe.post("/api/chat/sessions",{},{headers:{"x-user-id":V}});if(Y.data.success)B=Y.data.session.id,r(B);else throw new Error("Failed to create session")}const L={id:"temp-"+Date.now(),role:"user",content:N,created_at:new Date().toISOString()};a(Y=>[...Y,L]);const Q=await Xe.post("/api/chat/message",{sessionId:B,content:N},{headers:{"x-user-id":V}});if(Q.data.success){const Y=Q.data.message;a(he=>[...he,Y]),Y.context_sources&&t(Y.context_sources)}}catch(B){console.error("Message failed",B),a(L=>[...L,{id:"err-"+Date.now(),role:"assistant",content:s("chat.error_message"),created_at:new Date().toISOString()}])}finally{p(!1),y(!1)}},O=T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),j())};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{ref:b,onScroll:S,className:"flex-1 overflow-y-auto p-5 space-y-6 scrollbar-on-hover",children:[o.length===0?h.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center opacity-70",children:[h.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-2xl flex items-center justify-center mb-4 text-primary animate-pulse",children:h.jsx(Fj,{size:32})}),h.jsx("h3",{className:"text-xl font-bold mb-2",children:s("chat.title")}),h.jsx("p",{className:"text-sm max-w-md mx-auto mb-8",children:s("chat.desc")}),h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 max-w-lg w-full",children:[s("chat.suggestions.react"),s("chat.suggestions.ai"),s("chat.suggestions.finance"),s("chat.suggestions.performance")].map((T,N)=>h.jsx("button",{onClick:()=>u(T),className:"text-left p-3 text-xs bg-surface/30 hover:bg-surface/50 border border-border/30 rounded-xl transition-all hover:scale-[1.02]",children:T},N))})]}):h.jsxs(h.Fragment,{children:[o.map((T,N)=>h.jsx(gz,{message:T},T.id||N)),g&&h.jsx(Ue.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex justify-start w-full",children:h.jsxs("div",{className:"bg-surface/30 border border-border/20 rounded-xl px-4 py-3 flex items-center gap-3",children:[h.jsxs("div",{className:"flex gap-1",children:[h.jsx("span",{className:"w-1.5 h-1.5 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0s"}}),h.jsx("span",{className:"w-1.5 h-1.5 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),h.jsx("span",{className:"w-1.5 h-1.5 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),h.jsx("span",{className:"text-xs text-fg/50 font-mono",children:s("chat.thinking")})]})})]}),h.jsx("div",{ref:v})]}),h.jsx("div",{className:"p-4 bg-surface/20 border-t border-border backdrop-blur-md",children:h.jsx("form",{onSubmit:j,className:"relative max-w-4xl mx-auto",children:h.jsxs("div",{className:"relative flex items-end gap-2 bg-surface/55 border border-border rounded-xl px-2 py-2 shadow-sm focus-within:ring-2 focus-within:ring-primary/30 focus-within:border-primary/30 transition-all",children:[h.jsx("textarea",{ref:k,value:c,onChange:T=>{u(T.target.value),T.target.style.height="auto",T.target.style.height=T.target.scrollHeight+"px"},onKeyDown:O,placeholder:s("chat.placeholder"),rows:1,className:"w-full bg-transparent border-none focus:ring-0 focus:outline-none py-2 pl-2 text-fg resize-none min-h-[24px] max-h-[200px] placeholder:text-fg/40",disabled:f}),h.jsx("button",{type:"submit",disabled:!c.trim()||f,className:"p-2 mb-0.5 bg-primary text-white rounded-xl shadow-lg hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-all shrink-0",children:f?h.jsx(_a,{size:18,className:"animate-spin"}):h.jsx(Mj,{size:18})})]})})})]})}function xz({sources:e,onClose:t}){const{t:n}=et();return!e||e.length===0?null:h.jsxs(Ue.div,{initial:{opacity:0,x:20,width:0},animate:{opacity:1,x:0,width:300},exit:{opacity:0,x:20,width:0},className:"bg-surface/25 backdrop-blur-xl rounded-xl border border-border overflow-hidden flex flex-col",children:[h.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between bg-surface/15",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-fg/80",children:[h.jsx(p_,{size:16,className:"text-secondary"}),h.jsx("span",{children:n("chat.relevant_context")})]}),h.jsx("button",{onClick:t,className:"p-1 hover:bg-surface rounded-md text-fg/40 hover:text-fg transition-colors",children:h.jsx(Tn,{size:14})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:e.map((r,s)=>h.jsxs("div",{className:"p-3 bg-surface/20 hover:bg-surface/35 border border-border rounded-xl transition-all group",children:[h.jsxs("div",{className:"flex justify-between items-start mb-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"flex items-center justify-center w-4 h-4 bg-primary/10 text-primary text-[10px] font-bold rounded",children:s+1}),h.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded border ${r.score>=80?"bg-yellow-500/10 text-yellow-500 border-yellow-500/20":"bg-blue-500/10 text-blue-400 border-blue-500/20"}`,children:n("chat.match_score",{score:r.score})})]}),h.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100 text-fg/40 hover:text-primary transition-opacity focus-visible:ring-2 focus-visible:ring-primary/40 rounded",children:h.jsx(Bi,{size:12})})]}),h.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-fg/90 block mb-1 hover:text-primary transition-colors line-clamp-2",children:r.title}),h.jsx("p",{className:"text-[10px] text-fg/50 line-clamp-3 leading-relaxed",children:r.summary})]},s))}),h.jsx("div",{className:"p-3 border-t border-border bg-surface/20 text-[10px] text-center text-fg/30",children:n("chat.rag_attribution",{count:e.length})})]})}function vz(){const[e,t]=R.useState(null),[n,r]=R.useState([]),[s,o]=R.useState(!0);return h.jsxs("div",{className:"flex h-full gap-4 overflow-hidden",children:[h.jsx(KL,{activeSessionId:e,onSelectSession:t}),h.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-surface/60 rounded-xl overflow-hidden border border-border relative",children:h.jsx(yz,{sessionId:e,onContextUpdate:a=>{r(a),a.length>0&&o(!0)},onNewSession:()=>t(null),onSessionCreated:a=>t(a)})}),s&&h.jsx(xz,{sources:n,onClose:()=>o(!1)})]})}function _z({isOpen:e,onClose:t}){const{t:n}=et(),[r,s]=R.useState(""),[o,a]=R.useState(!0);R.useEffect(()=>{e&&c()},[e]);const c=async()=>{a(!0);try{const f=await(await fetch("/CHANGELOG.md")).text();s(f)}catch(u){console.error("Failed to load changelog:",u),s(`# ${n("common.error")}
132
+ `))}function u(v,b,w,k){const S=w.enter("tableCell"),C=w.enter("phrasing"),j=w.containerPhrasing(v,{...k,before:o,after:o});return C(),S(),j}function f(v,b){return VM(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function p(v,b,w){const k=v.children;let S=-1;const C=[],j=b.enter("table");for(;++S<k.length;)C[S]=g(k[S],b,w);return j(),C}function g(v,b,w){const k=v.children;let S=-1;const C=[],j=b.enter("tableRow");for(;++S<k.length;)C[S]=u(k[S],v,b,w);return j(),C}function y(v,b,w){let k=Hk.inlineCode(v,b,w);return w.stack.includes("tableCell")&&(k=k.replace(/\|/g,"\\$&")),k}}function A3(){return{exit:{taskListCheckValueChecked:o_,taskListCheckValueUnchecked:o_,paragraph:P3}}}function R3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:O3}}}function o_(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function P3(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let o=-1,a;for(;++o<s.length;){const c=s[o];if(c.type==="paragraph"){a=c;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function O3(e,t,n,r){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);o&&c.move(a);let u=Hk.listItem(e,t,n,{...r,...c.current()});return o&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),u;function f(p){return p+a}}function L3(){return[hM(),OM(),MM(),k3(),A3()]}function I3(e){return{extensions:[fM(),LM(e),zM(),N3(e),R3()]}}const D3={tokenize:B3,partial:!0},Kk={tokenize:V3,partial:!0},Wk={tokenize:q3,partial:!0},Gk={tokenize:H3,partial:!0},M3={tokenize:K3,partial:!0},Jk={name:"wwwAutolink",tokenize:$3,previous:Yk},Xk={name:"protocolAutolink",tokenize:U3,previous:Qk},Tr={name:"emailAutolink",tokenize:F3,previous:Zk},dr={};function z3(){return{text:dr}}let _s=48;for(;_s<123;)dr[_s]=Tr,_s++,_s===58?_s=65:_s===91&&(_s=97);dr[43]=Tr;dr[45]=Tr;dr[46]=Tr;dr[95]=Tr;dr[72]=[Tr,Xk];dr[104]=[Tr,Xk];dr[87]=[Tr,Jk];dr[119]=[Tr,Jk];function F3(e,t,n){const r=this;let s,o;return a;function a(g){return!Mf(g)||!Zk.call(r,r.previous)||em(r.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(g))}function c(g){return Mf(g)?(e.consume(g),c):g===64?(e.consume(g),u):n(g)}function u(g){return g===46?e.check(M3,p,f)(g):g===45||g===95||Yt(g)?(o=!0,e.consume(g),u):p(g)}function f(g){return e.consume(g),s=!0,u}function p(g){return o&&s&&sn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function $3(e,t,n){const r=this;return s;function s(a){return a!==87&&a!==119||!Yk.call(r,r.previous)||em(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(D3,e.attempt(Kk,e.attempt(Wk,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function U3(e,t,n){const r=this;let s="",o=!1;return a;function a(g){return(g===72||g===104)&&Qk.call(r,r.previous)&&!em(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(g),e.consume(g),c):n(g)}function c(g){if(sn(g)&&s.length<5)return s+=String.fromCodePoint(g),e.consume(g),c;if(g===58){const y=s.toLowerCase();if(y==="http"||y==="https")return e.consume(g),u}return n(g)}function u(g){return g===47?(e.consume(g),o?f:(o=!0,u)):n(g)}function f(g){return g===null||Ec(g)||it(g)||Ms(g)||Xc(g)?n(g):e.attempt(Kk,e.attempt(Wk,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function B3(e,t,n){let r=0;return s;function s(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),s):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function V3(e,t,n){let r,s,o;return a;function a(f){return f===46||f===95?e.check(Gk,u,c)(f):f===null||it(f)||Ms(f)||f!==45&&Xc(f)?u(f):(o=!0,e.consume(f),a)}function c(f){return f===95?r=!0:(s=r,r=void 0),e.consume(f),a}function u(f){return s||r||!o?n(f):t(f)}}function q3(e,t){let n=0,r=0;return s;function s(a){return a===40?(n++,e.consume(a),s):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(Gk,t,o)(a):a===null||it(a)||Ms(a)?t(a):(e.consume(a),s)}function o(a){return a===41&&r++,e.consume(a),s}}function H3(e,t,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),o):c===93?(e.consume(c),s):c===60||c===null||it(c)||Ms(c)?t(c):n(c)}function s(c){return c===null||c===40||c===91||it(c)||Ms(c)?t(c):r(c)}function o(c){return sn(c)?a(c):n(c)}function a(c){return c===59?(e.consume(c),r):sn(c)?(e.consume(c),a):n(c)}}function K3(e,t,n){return r;function r(o){return e.consume(o),s}function s(o){return Yt(o)?n(o):t(o)}}function Yk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||it(e)}function Qk(e){return!sn(e)}function Zk(e){return!(e===47||Mf(e))}function Mf(e){return e===43||e===45||e===46||e===95||Yt(e)}function em(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const W3={tokenize:tz,partial:!0};function G3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Q3,continuation:{tokenize:Z3},exit:ez}},text:{91:{name:"gfmFootnoteCall",tokenize:Y3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:J3,resolveTo:X3}}}}function J3(e,t,n){const r=this;let s=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const u=r.events[s][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return c;function c(u){if(!a||!a._balanced)return n(u);const f=Qn(r.sliceSerialize({start:a.end,end:r.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function X3(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function Y3(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return c;function c(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),u}function u(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(g){if(o>999||g===93&&!a||g===null||g===91||it(g))return n(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return s.includes(Qn(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return it(g)||(a=!0),o++,e.consume(g),g===92?p:f}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,f):f(g)}}function Q3(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,c;return u;function u(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(b)}function p(b){if(a>999||b===93&&!c||b===null||b===91||it(b))return n(b);if(b===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return o=Qn(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return it(b)||(c=!0),a++,e.consume(b),b===92?g:p}function g(b){return b===91||b===92||b===93?(e.consume(b),a++,p):p(b)}function y(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),s.includes(o)||s.push(o),Xe(e,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return t(b)}}function Z3(e,t,n){return e.check(Ra,t,e.attempt(W3,t,n))}function ez(e){e.exit("gfmFootnoteDefinition")}function tz(e,t,n){const r=this;return Xe(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function nz(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,c){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let f=u;for(;f--;)if(a[f][0]==="exit"&&a[f][1].type==="strikethroughSequenceTemporary"&&a[f][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[f][1].end.offset-a[f][1].start.offset){a[u][1].type="strikethroughSequence",a[f][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[f][1].start),end:Object.assign({},a[u][1].end)},g={type:"strikethroughText",start:Object.assign({},a[f][1].end),end:Object.assign({},a[u][1].start)},y=[["enter",p,c],["enter",a[f][1],c],["exit",a[f][1],c],["enter",g,c]],v=c.parser.constructs.insideSpan.null;v&&Tn(y,y.length,0,Yc(v,a.slice(f+1,u),c)),Tn(y,y.length,0,[["exit",g,c],["enter",a[u][1],c],["exit",a[u][1],c],["exit",p,c]]),Tn(a,f-1,u-f+3,y),u=f+y.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function o(a,c,u){const f=this.previous,p=this.events;let g=0;return y;function y(b){return f===126&&p[p.length-1][1].type!=="characterEscape"?u(b):(a.enter("strikethroughSequenceTemporary"),v(b))}function v(b){const w=Ui(f);if(b===126)return g>1?u(b):(a.consume(b),g++,v);if(g<2&&!n)return u(b);const k=a.exit("strikethroughSequenceTemporary"),S=Ui(b);return k._open=!S||S===2&&!!w,k._close=!w||w===2&&!!S,c(b)}}}class rz{constructor(){this.map=[]}add(t,n,r){sz(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const o of s)t.push(o);s=r.pop()}this.map.length=0}}function sz(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function iz(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function oz(){return{flow:{null:{name:"table",tokenize:az,resolveAll:lz}}}}function az(e,t,n){const r=this;let s=0,o=0,a;return c;function c(L){let Q=r.events.length-1;for(;Q>-1;){const K=r.events[Q][1].type;if(K==="lineEnding"||K==="linePrefix")Q--;else break}const Y=Q>-1?r.events[Q][1].type:null,he=Y==="tableHead"||Y==="tableRow"?N:u;return he===N&&r.parser.lazy[r.now().line]?n(L):he(L)}function u(L){return e.enter("tableHead"),e.enter("tableRow"),f(L)}function f(L){return L===124||(a=!0,o+=1),p(L)}function p(L){return L===null?n(L):Oe(L)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),v):n(L):Ge(L)?Xe(e,p,"whitespace")(L):(o+=1,a&&(a=!1,s+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||it(L)?(e.exit("data"),p(L)):(e.consume(L),L===92?y:g)}function y(L){return L===92||L===124?(e.consume(L),g):g(L)}function v(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(e.enter("tableDelimiterRow"),a=!1,Ge(L)?Xe(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):b(L))}function b(L){return L===45||L===58?k(L):L===124?(a=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),w):T(L)}function w(L){return Ge(L)?Xe(e,k,"whitespace")(L):k(L)}function k(L){return L===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),S):L===45?(o+=1,S(L)):L===null||Oe(L)?O(L):T(L)}function S(L){return L===45?(e.enter("tableDelimiterFiller"),C(L)):T(L)}function C(L){return L===45?(e.consume(L),C):L===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),j):(e.exit("tableDelimiterFiller"),j(L))}function j(L){return Ge(L)?Xe(e,O,"whitespace")(L):O(L)}function O(L){return L===124?b(L):L===null||Oe(L)?!a||s!==o?T(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):T(L)}function T(L){return n(L)}function N(L){return e.enter("tableRow"),M(L)}function M(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),M):L===null||Oe(L)?(e.exit("tableRow"),t(L)):Ge(L)?Xe(e,M,"whitespace")(L):(e.enter("data"),V(L))}function V(L){return L===null||L===124||it(L)?(e.exit("data"),M(L)):(e.consume(L),L===92?U:V)}function U(L){return L===92||L===124?(e.consume(L),V):V(L)}}function lz(e,t){let n=-1,r=!0,s=0,o=[0,0,0,0],a=[0,0,0,0],c=!1,u=0,f,p,g;const y=new rz;for(;++n<e.length;){const v=e[n],b=v[1];v[0]==="enter"?b.type==="tableHead"?(c=!1,u!==0&&(a_(y,t,u,f,p),p=void 0,u=0),f={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},y.add(n,0,[["enter",f,t]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(r=!0,g=void 0,o=[0,0,0,0],a=[0,n+1,0,0],c&&(c=!1,p={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},y.add(n,0,[["enter",p,t]])),s=b.type==="tableDelimiterRow"?2:p?3:1):s&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],g=ec(y,t,o,s,void 0,g),o=[0,0,0,0]),a[2]=n)):b.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],g=ec(y,t,o,s,void 0,g)),o=a,a=[o[1],n,0,0])):b.type==="tableHead"?(c=!0,u=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(u=n,o[1]!==0?(a[0]=a[1],g=ec(y,t,o,s,n,g)):a[1]!==0&&(g=ec(y,t,a,s,n,g)),s=0):s&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&a_(y,t,u,f,p),y.consume(t.events),n=-1;++n<t.events.length;){const v=t.events[n];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=iz(t.events,n))}return e}function ec(e,t,n,r,s,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(o.end=Object.assign({},ji(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const u=ji(t.events,n[1]);if(o={type:a,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const f=ji(t.events,n[2]),p=ji(t.events,n[3]),g={type:c,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),r!==2){const y=t.events[n[2]],v=t.events[n[3]];if(y[1].end=Object.assign({},v[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,w=n[3]-n[2]-1;e.add(b,w,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return s!==void 0&&(o.end=Object.assign({},ji(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function a_(e,t,n,r,s){const o=[],a=ji(t.events,n);s&&(s.end=Object.assign({},a),o.push(["exit",s,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function ji(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const cz={name:"tasklistCheck",tokenize:dz};function uz(){return{text:{91:cz}}}function dz(e,t,n){const r=this;return s;function s(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),o)}function o(u){return it(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(u)}function c(u){return Oe(u)?t(u):Ge(u)?e.check({tokenize:hz},t,n)(u):n(u)}}function hz(e,t,n){return Xe(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function fz(e){return uk([z3(),G3(),nz(e),oz(),uz()])}const pz={};function mz(e){const t=this,n=e||pz,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(fz(n)),o.push(L3()),a.push(I3(n))}function gz({message:e}){const{t}=et(),n=e.role==="user",r={p:({node:s,...o})=>h.jsx("p",{className:"mb-2 last:mb-0",...o}),a:({node:s,...o})=>h.jsx("a",{className:"text-primary hover:underline",...o}),ul:({node:s,...o})=>h.jsx("ul",{className:"list-disc ml-4 mb-2",...o}),ol:({node:s,...o})=>h.jsx("ol",{className:"list-decimal ml-4 mb-2",...o}),blockquote:({node:s,...o})=>h.jsx("blockquote",{className:"border-l-2 border-border/50 pl-3 text-fg/70 italic mb-2",...o}),table:({node:s,...o})=>h.jsx("table",{className:"w-full text-xs border-collapse my-2",...o}),th:({node:s,...o})=>h.jsx("th",{className:"border border-border/20 bg-surface/50 px-2 py-1 text-left font-semibold",...o}),td:({node:s,...o})=>h.jsx("td",{className:"border border-border/20 px-2 py-1 align-top",...o}),code:({node:s,inline:o,className:a,...c})=>h.jsx("code",{className:o?"bg-black/20 rounded px-1 py-0.5 font-mono text-xs":"block bg-black/30 rounded-lg p-3 font-mono text-xs leading-relaxed overflow-x-auto",...c}),pre:({node:s,...o})=>h.jsx("pre",{className:"my-2",...o})};return h.jsx("div",{className:`flex w-full ${n?"justify-end":"justify-start"}`,children:h.jsxs("div",{className:`flex gap-3 max-w-[85%] ${n?"flex-row-reverse":"flex-row"}`,children:[h.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0 ${n?"bg-primary text-white":"bg-gradient-to-br from-indigo-500 to-purple-600 text-white shadow-lg glow-primary"}`,children:n?h.jsx(Pc,{size:16}):h.jsx(hj,{size:16})}),h.jsxs("div",{className:`flex flex-col ${n?"items-end":"items-start"}`,children:[h.jsx("div",{className:`px-5 py-3.5 rounded-2xl text-sm leading-relaxed shadow-sm ${n?"bg-primary/15 text-fg rounded-tr-none":"bg-surface/70 backdrop-blur-md text-fg rounded-tl-none"}`,children:h.jsx("div",{className:"markdown-body",children:h.jsx(Yp,{remarkPlugins:[mz],components:r,children:e.content})})}),h.jsx("span",{className:"text-[10px] text-fg/30 mt-1 px-1",children:new Date(e.created_at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]})]})})}function yz({sessionId:e,onContextUpdate:t,onNewSession:n,onSessionCreated:r}){const{t:s}=et(),[o,a]=R.useState([]),[c,u]=R.useState(""),[f,p]=R.useState(!1),[g,y]=R.useState(!1),v=R.useRef(null),b=R.useRef(null),w=R.useRef(!0),k=R.useRef(null);R.useEffect(()=>{e?C(e):(a([]),t([]))},[e,t]),R.useEffect(()=>{w.current&&v.current&&v.current.scrollIntoView({behavior:"smooth"})},[o,g]);const S=()=>{const T=b.current;if(!T)return;const N=T.scrollHeight-T.scrollTop-T.clientHeight;w.current=N<64},C=async T=>{try{const{data:{session:N}}=await ae.auth.getSession();if(!N)return;const M=await Je.get(`/api/chat/sessions/${T}/messages`,{headers:{"x-user-id":N.user.id}});if(M.data.success){a(M.data.messages);const V=M.data.messages[M.data.messages.length-1];V&&V.role==="assistant"&&V.context_sources&&t(V.context_sources)}}catch(N){console.error("Failed to fetch messages",N)}},j=async T=>{if(T?.preventDefault(),!c.trim()||f)return;const N=c.trim();u(""),k.current&&(k.current.style.height="auto");const{data:{session:M}}=await ae.auth.getSession();if(!M)return;const V=M.user.id;p(!0),y(!0);try{let U=e;if(!U){const Y=await Je.post("/api/chat/sessions",{},{headers:{"x-user-id":V}});if(Y.data.success)U=Y.data.session.id,r(U);else throw new Error("Failed to create session")}const L={id:"temp-"+Date.now(),role:"user",content:N,created_at:new Date().toISOString()};a(Y=>[...Y,L]);const Q=await Je.post("/api/chat/message",{sessionId:U,content:N},{headers:{"x-user-id":V}});if(Q.data.success){const Y=Q.data.message;a(he=>[...he,Y]),Y.context_sources&&t(Y.context_sources)}}catch(U){console.error("Message failed",U),a(L=>[...L,{id:"err-"+Date.now(),role:"assistant",content:s("chat.error_message"),created_at:new Date().toISOString()}])}finally{p(!1),y(!1)}},O=T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),j())};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{ref:b,onScroll:S,className:"flex-1 overflow-y-auto p-5 space-y-6 scrollbar-on-hover",children:[o.length===0?h.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center opacity-70",children:[h.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-2xl flex items-center justify-center mb-4 text-primary animate-pulse",children:h.jsx(Fj,{size:32})}),h.jsx("h3",{className:"text-xl font-bold mb-2",children:s("chat.title")}),h.jsx("p",{className:"text-sm max-w-md mx-auto mb-8",children:s("chat.desc")}),h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 max-w-lg w-full",children:[s("chat.suggestions.react"),s("chat.suggestions.ai"),s("chat.suggestions.finance"),s("chat.suggestions.performance")].map((T,N)=>h.jsx("button",{onClick:()=>u(T),className:"text-left p-3 text-xs bg-surface/30 hover:bg-surface/50 border border-border/30 rounded-xl transition-all hover:scale-[1.02]",children:T},N))})]}):h.jsxs(h.Fragment,{children:[o.map((T,N)=>h.jsx(gz,{message:T},T.id||N)),g&&h.jsx(Be.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex justify-start w-full",children:h.jsxs("div",{className:"bg-surface/30 border border-border/20 rounded-xl px-4 py-3 flex items-center gap-3",children:[h.jsxs("div",{className:"flex gap-1",children:[h.jsx("span",{className:"w-1.5 h-1.5 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0s"}}),h.jsx("span",{className:"w-1.5 h-1.5 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),h.jsx("span",{className:"w-1.5 h-1.5 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),h.jsx("span",{className:"text-xs text-fg/50 font-mono",children:s("chat.thinking")})]})})]}),h.jsx("div",{ref:v})]}),h.jsx("div",{className:"p-4 bg-surface/20 border-t border-border backdrop-blur-md",children:h.jsx("form",{onSubmit:j,className:"relative max-w-4xl mx-auto",children:h.jsxs("div",{className:"relative flex items-end gap-2 bg-surface/55 border border-border rounded-xl px-2 py-2 shadow-sm focus-within:ring-2 focus-within:ring-primary/30 focus-within:border-primary/30 transition-all",children:[h.jsx("textarea",{ref:k,value:c,onChange:T=>{u(T.target.value),T.target.style.height="auto",T.target.style.height=T.target.scrollHeight+"px"},onKeyDown:O,placeholder:s("chat.placeholder"),rows:1,className:"w-full bg-transparent border-none focus:ring-0 focus:outline-none py-2 pl-2 text-fg resize-none min-h-[24px] max-h-[200px] placeholder:text-fg/40",disabled:f}),h.jsx("button",{type:"submit",disabled:!c.trim()||f,className:"p-2 mb-0.5 bg-primary text-white rounded-xl shadow-lg hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-all shrink-0",children:f?h.jsx(_a,{size:18,className:"animate-spin"}):h.jsx(Mj,{size:18})})]})})})]})}function xz({sources:e,onClose:t}){const{t:n}=et();return!e||e.length===0?null:h.jsxs(Be.div,{initial:{opacity:0,x:20,width:0},animate:{opacity:1,x:0,width:300},exit:{opacity:0,x:20,width:0},className:"bg-surface/25 backdrop-blur-xl rounded-xl border border-border overflow-hidden flex flex-col",children:[h.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between bg-surface/15",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-fg/80",children:[h.jsx(p_,{size:16,className:"text-secondary"}),h.jsx("span",{children:n("chat.relevant_context")})]}),h.jsx("button",{onClick:t,className:"p-1 hover:bg-surface rounded-md text-fg/40 hover:text-fg transition-colors",children:h.jsx(Nn,{size:14})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:e.map((r,s)=>h.jsxs("div",{className:"p-3 bg-surface/20 hover:bg-surface/35 border border-border rounded-xl transition-all group",children:[h.jsxs("div",{className:"flex justify-between items-start mb-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"flex items-center justify-center w-4 h-4 bg-primary/10 text-primary text-[10px] font-bold rounded",children:s+1}),h.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded border ${r.score>=80?"bg-yellow-500/10 text-yellow-500 border-yellow-500/20":"bg-blue-500/10 text-blue-400 border-blue-500/20"}`,children:n("chat.match_score",{score:r.score})})]}),h.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100 text-fg/40 hover:text-primary transition-opacity focus-visible:ring-2 focus-visible:ring-primary/40 rounded",children:h.jsx(Bi,{size:12})})]}),h.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-fg/90 block mb-1 hover:text-primary transition-colors line-clamp-2",children:r.title}),h.jsx("p",{className:"text-[10px] text-fg/50 line-clamp-3 leading-relaxed",children:r.summary})]},s))}),h.jsx("div",{className:"p-3 border-t border-border bg-surface/20 text-[10px] text-center text-fg/30",children:n("chat.rag_attribution",{count:e.length})})]})}function vz(){const[e,t]=R.useState(null),[n,r]=R.useState([]),[s,o]=R.useState(!0);return h.jsxs("div",{className:"flex h-full gap-4 overflow-hidden",children:[h.jsx(KL,{activeSessionId:e,onSelectSession:t}),h.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-surface/60 rounded-xl overflow-hidden border border-border relative",children:h.jsx(yz,{sessionId:e,onContextUpdate:a=>{r(a),a.length>0&&o(!0)},onNewSession:()=>t(null),onSessionCreated:a=>t(a)})}),s&&h.jsx(xz,{sources:n,onClose:()=>o(!1)})]})}function _z({isOpen:e,onClose:t}){const{t:n}=et(),[r,s]=R.useState(""),[o,a]=R.useState(!0);R.useEffect(()=>{e&&c()},[e]);const c=async()=>{a(!0);try{const f=await(await fetch("/CHANGELOG.md")).text();s(f)}catch(u){console.error("Failed to load changelog:",u),s(`# ${n("common.error")}
133
133
 
134
- ${n("shell.changelog_error")}`)}finally{a(!1)}};return h.jsx(Ot,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx(Ue.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50"}),h.jsx(Ue.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:h.jsxs("div",{className:"glass w-full max-w-3xl max-h-[80vh] overflow-hidden pointer-events-auto shadow-2xl",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(p_,{size:24,className:"text-primary"}),h.jsx("h2",{className:"text-xl font-bold",children:n("shell.release_notes")})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(Tn,{size:20,className:"text-fg/60"})})]}),h.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar max-h-[calc(80vh-88px)]",children:o?h.jsx("div",{className:"flex items-center justify-center py-12",children:h.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-primary border-t-transparent"})}):h.jsx(Yp,{components:{h1:({children:u})=>h.jsx("h1",{className:"text-2xl font-bold text-fg mb-6 mt-0",children:u}),h2:({children:u})=>h.jsx("h2",{className:"text-xl font-bold text-fg mt-8 mb-3 pb-2 border-b border-border first:mt-0",children:u}),h3:({children:u})=>h.jsx("h3",{className:"text-lg font-bold text-primary mt-6 mb-2",children:u}),p:({children:u})=>h.jsx("p",{className:"text-sm text-fg/70 mb-3 leading-relaxed",children:u}),ul:({children:u})=>h.jsx("ul",{className:"list-none space-y-1 mb-4 ml-0",children:u}),li:({children:u})=>h.jsx("li",{className:"text-sm text-fg/80 ml-4 mb-1 before:content-['•'] before:mr-2 before:text-primary",children:u}),a:({href:u,children:f})=>h.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 underline transition-colors",children:f}),code:({children:u})=>h.jsx("code",{className:"bg-surface/50 text-accent px-1.5 py-0.5 rounded text-xs font-mono border border-border",children:u}),strong:({children:u})=>h.jsx("strong",{className:"font-bold text-fg",children:u})},children:r})})]})})]})})}function bz({asset:e,onClose:t}){const{t:n}=et(),r=()=>{e.content&&navigator.clipboard.writeText(e.content)},s=()=>{if(!e.content)return;const o=new Blob([e.content],{type:"text/markdown"}),a=URL.createObjectURL(o),c=document.createElement("a");c.href=a,c.download=`${e.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(a)};return h.jsx(Ot,{children:e&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-md",children:h.jsxs(Ue.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg rounded-3xl shadow-2xl w-full max-w-4xl max-h-[85vh] flex flex-col overflow-hidden border border-border",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-surface/50",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("div",{className:"p-3 rounded-2xl bg-primary/10 text-primary shadow-inner",children:e.type==="audio"?h.jsx(Bh,{className:"w-6 h-6"}):h.jsx(Ii,{className:"w-6 h-6"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-black italic tracking-tighter uppercase text-xl text-fg",children:e.title}),h.jsxs("p",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest mt-0.5",children:[new Date(e.created_at).toLocaleString([],{dateStyle:"medium",timeStyle:"short"})," • ",n("discovery.sources_count",{count:e.metadata?.source_signal_count||0})]})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:r,className:"p-2.5 text-fg/40 hover:text-primary hover:bg-primary/10 rounded-xl transition-all",title:"Copy Content",children:h.jsx(zf,{className:"w-5 h-5"})}),h.jsx("button",{onClick:s,className:"p-2.5 text-fg/40 hover:text-primary hover:bg-primary/10 rounded-xl transition-all",title:"Download File",children:h.jsx($h,{className:"w-5 h-5"})}),h.jsx("div",{className:"w-px h-8 bg-border mx-2"}),h.jsx("button",{onClick:t,className:"p-2.5 text-fg/40 hover:text-error hover:bg-error/10 rounded-xl transition-all",children:h.jsx(Tn,{className:"w-6 h-6"})})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-8 bg-bg custom-scrollbar",children:e.status&&e.status!=="completed"?h.jsxs("div",{className:"flex flex-col items-center justify-center h-80 gap-6",children:[h.jsxs("div",{className:"relative",children:[h.jsx("div",{className:"absolute inset-0 bg-primary/20 rounded-full blur-xl animate-pulse"}),h.jsx(Pt,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),h.jsxs("div",{className:"text-center space-y-2",children:[h.jsx("h4",{className:"text-xl font-black italic tracking-tighter uppercase text-fg",children:e.status==="processing"?n("transmute.generating_asset"):n("transmute.queued_desktop")}),h.jsx("p",{className:"text-xs text-fg/40 font-mono uppercase tracking-widest max-w-xs mx-auto",children:n("transmute.desktop_processing")})]})]}):e.type==="markdown"?h.jsx("div",{className:"prose prose-invert prose-headings:font-black prose-headings:italic prose-headings:tracking-tighter prose-headings:uppercase prose-p:text-fg/80 prose-li:text-fg/80 prose-strong:text-primary max-w-none",children:h.jsx(Yp,{children:e.content||""})}):e.type==="audio"?h.jsxs("div",{className:"flex flex-col items-center justify-center h-80 gap-8",children:[h.jsx("div",{className:"w-24 h-24 rounded-3xl bg-primary/10 flex items-center justify-center animate-pulse shadow-xl border border-primary/20",children:h.jsx(Bh,{className:"w-10 h-10 text-primary"})}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-xs text-fg/40 font-mono uppercase tracking-widest mb-6",children:n("transmute.unsupported_type")}),h.jsxs("audio",{controls:!0,className:"w-80 h-12 rounded-xl bg-surface border border-border",children:[h.jsx("source",{src:e.content||"",type:"audio/mpeg"}),"Your browser does not support the audio element."]})]})]}):h.jsx("div",{className:"text-fg/20 text-center py-20 font-mono italic",children:"Unsupported asset type"})})]})})})}function l_({engine:e,onClose:t,onSave:n,onDelete:r}){const{t:s}=et(),{showToast:o}=Jc(),[a,c]=R.useState({title:"",type:"newsletter",status:"active",config:{schedule:"",min_score:70,categories:[],custom_prompt:"",max_signals:10,execution_mode:"local"}}),[u,f]=R.useState(!1);R.useEffect(()=>{e&&c({title:e.title,type:e.type,status:e.status,config:{schedule:e.config.schedule||"",min_score:e.config.filters?.min_score||70,categories:Array.isArray(e.config.category)?e.config.category:e.config.category?[e.config.category]:[],custom_prompt:e.config.custom_prompt||"",max_signals:e.config.max_signals||10,execution_mode:e.config.execution_mode||"local"}})},[e]);const p=async()=>{try{const v={title:a.title,type:a.type,status:a.status,config:{schedule:a.config.schedule,filters:{min_score:a.config.min_score,category:a.config.category},custom_prompt:a.config.custom_prompt,max_signals:a.config.max_signals,execution_mode:a.config.execution_mode}};if(e){const{data:b,error:w}=await ae.from("engines").update(v).eq("id",e.id).select().single();if(w)throw w;n(b),o("Engine updated successfully","success")}else{const{data:{user:b}}=await ae.auth.getUser();if(!b)throw new Error("Not authenticated");const{data:w,error:k}=await ae.from("engines").insert({...v,user_id:b.id}).select().single();if(k)throw k;n(w),o("Engine created successfully","success")}t()}catch(v){console.error("Save error:",v),o(v.message||"Failed to save engine","error")}},g=async()=>{if(!(!e||!r))try{const{error:v}=await ae.from("engines").delete().eq("id",e.id);if(v)throw v;r(e.id),o("Engine deleted","success"),t()}catch(v){o(v.message||"Failed to delete engine","error")}},y=()=>{f(!1),t()};return!e&&!t?null:h.jsx(Ot,{children:h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:h.jsxs(Ue.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg rounded-3xl shadow-2xl w-full max-w-2xl max-h-[85vh] flex flex-col overflow-hidden border border-border",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-surface/50",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-xl font-black italic tracking-tighter uppercase text-fg",children:s(e?"transmute.edit_engine":"transmute.create_engine")}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-[0.2em]",children:s("transmute.configure_pipeline")})]}),h.jsx("button",{onClick:y,className:"p-2 text-fg/40 hover:text-error hover:bg-error/10 rounded-xl transition-all",children:h.jsx(Tn,{className:"w-6 h-6"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-8 space-y-8 custom-scrollbar",children:[h.jsxs("div",{className:"space-y-6",children:[h.jsx(_r,{label:s("transmute.engine_name"),children:h.jsx("input",{type:"text",value:a.title,onChange:v=>c({...a,title:v.target.value}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg placeholder:text-fg/20 focus:border-primary/50 outline-none transition-all text-sm",placeholder:"e.g., Daily Tech Brief"})}),h.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[h.jsx(_r,{label:s("transmute.type"),children:h.jsxs("select",{value:a.type,onChange:v=>c({...a,type:v.target.value}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm appearance-none cursor-pointer",children:[h.jsx("option",{value:"newsletter",children:s("transmute.newsletter")}),h.jsx("option",{value:"thread",children:s("transmute.thread")}),h.jsx("option",{value:"audio",children:"Audio Brief"}),h.jsx("option",{value:"report",children:"Report"})]})}),h.jsx(_r,{label:s("transmute.status"),children:h.jsxs("select",{value:a.status,onChange:v=>c({...a,status:v.target.value}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm appearance-none cursor-pointer",children:[h.jsx("option",{value:"active",children:s("common.status_active")}),h.jsx("option",{value:"paused",children:s("common.status_paused")}),h.jsx("option",{value:"draft",children:"Draft"})]})})]}),h.jsxs(_r,{label:s("transmute.execution_env"),children:[h.jsxs("select",{value:a.config.execution_mode,onChange:v=>c({...a,config:{...a.config,execution_mode:v.target.value}}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm appearance-none cursor-pointer",children:[h.jsx("option",{value:"local",children:s("transmute.local_llm")}),h.jsx("option",{value:"desktop",children:s("transmute.desktop_swarm")})]}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono uppercase mt-2 leading-relaxed",children:a.config.execution_mode==="desktop"?s("transmute.env_desc_desktop"):s("transmute.env_desc_local")})]})]}),h.jsxs("div",{className:"space-y-6 pt-6 border-t border-border/10",children:[h.jsx("h4",{className:"text-xs font-bold uppercase tracking-[0.2em] text-primary/60",children:"Signal Filters"}),h.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[h.jsx(_r,{label:s("transmute.min_score"),children:h.jsx("input",{type:"number",min:"0",max:"100",value:a.config.min_score,onChange:v=>c({...a,config:{...a.config,min_score:parseInt(v.target.value)||0}}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm"})}),h.jsx(_r,{label:s("transmute.max_signals"),children:h.jsx("input",{type:"number",min:"1",max:"50",value:a.config.max_signals,onChange:v=>c({...a,config:{...a.config,max_signals:parseInt(v.target.value)||10}}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm"})})]}),h.jsxs(_r,{label:s("transmute.category_filter"),children:[h.jsxs("select",{multiple:!0,value:a.config.categories,onChange:v=>{const b=Array.from(v.target.selectedOptions,w=>w.value);c({...a,config:{...a.config,categories:b}})},className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm min-h-[120px] custom-scrollbar",children:[h.jsx("option",{value:"AI & ML",children:"AI & ML"}),h.jsx("option",{value:"Technology",children:"Technology"}),h.jsx("option",{value:"Business",children:"Business"}),h.jsx("option",{value:"Finance",children:"Finance"}),h.jsx("option",{value:"Science",children:"Science"}),h.jsx("option",{value:"Politics",children:"Politics"})]}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono mt-2",children:s("transmute.multi_select_hint")})]})]}),h.jsx("div",{className:"pt-6 border-t border-border/10",children:h.jsxs(_r,{label:`${s("transmute.schedule")} (${s("common.optional")})`,children:[h.jsx("input",{type:"text",value:a.config.schedule,onChange:v=>c({...a,config:{...a.config,schedule:v.target.value}}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg placeholder:text-fg/20 focus:border-primary/50 outline-none transition-all text-sm",placeholder:"e.g., Daily @ 9am, Manual"}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono mt-2",children:s("transmute.schedule_hint")})]})}),h.jsx("div",{className:"pt-6 border-t border-border/10",children:h.jsx(_r,{label:s("transmute.prompt_override"),children:h.jsx("textarea",{value:a.config.custom_prompt,onChange:v=>c({...a,config:{...a.config,custom_prompt:v.target.value}}),rows:5,className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg placeholder:text-fg/20 focus:border-primary/50 outline-none transition-all text-sm resize-none custom-scrollbar",placeholder:s("transmute.prompt_placeholder")})})})]}),h.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-border bg-surface/50",children:[e&&r?u?h.jsxs("div",{className:"flex items-center gap-4 bg-error/5 border border-error/20 px-4 py-2 rounded-2xl animate-in fade-in slide-in-from-left-2 transition-all",children:[h.jsx("span",{className:"text-xs text-error font-bold uppercase tracking-widest",children:s("transmute.delete_confirm")}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:g,className:"px-4 py-2 bg-error text-white text-[10px] font-bold uppercase tracking-widest rounded-xl hover:bg-error/80 transition-all shadow-lg shadow-error/20",children:s("transmute.confirm")}),h.jsx("button",{onClick:()=>f(!1),className:"px-4 py-2 bg-surface border border-border text-fg/40 text-[10px] font-bold uppercase tracking-widest rounded-xl hover:bg-bg transition-all",children:s("common.cancel")})]})]}):h.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-2 px-6 py-3 text-error/60 hover:text-error hover:bg-error/10 rounded-2xl transition-all font-bold text-xs uppercase tracking-widest",children:[h.jsx(Bf,{className:"w-5 h-5"}),s("common.delete")]}):h.jsx("div",{}),h.jsxs("div",{className:"flex gap-4",children:[h.jsx("button",{onClick:y,className:"px-6 py-3 text-fg/40 font-bold text-xs uppercase tracking-widest hover:text-fg hover:bg-surface rounded-2xl transition-all",children:s("common.cancel")}),h.jsxs("button",{onClick:p,className:"flex items-center gap-2 px-8 py-3 bg-gradient-to-r from-primary to-accent text-white rounded-2xl font-bold text-xs uppercase tracking-widest hover:scale-105 active:scale-95 transition-all shadow-lg glow-primary",children:[h.jsx(wr,{className:"w-5 h-5"}),s("common.save")]})]})]})]})})})}function _r({label:e,children:t}){return h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-fg/30 ml-1",children:e}),t]})}const wz=({engine:e,onRun:t,onEdit:n,onToggle:r,onViewBrief:s,isLoading:o})=>{const{t:a}=et(),c=!!e.config.tag,u={newsletter:c?h.jsx(Ff,{className:"w-5 h-5 text-blue-500"}):h.jsx(Ii,{className:"w-5 h-5 text-emerald-500"}),thread:h.jsx(Vt,{className:"w-5 h-5 text-blue-500"}),audio:h.jsx(Bh,{className:"w-5 h-5 text-purple-500"}),report:h.jsx(cc,{className:"w-5 h-5 text-orange-500"})};return h.jsxs(Ue.div,{layout:!0,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`p-5 rounded-2xl border transition-all hover:shadow-lg group ${e.status==="active"?"bg-surface border-border shadow-sm":"bg-surface/30 border-dashed border-border opacity-70"}`,children:[h.jsxs("div",{className:"flex justify-between items-start mb-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2 rounded-xl bg-bg border border-border/10",children:u[e.type]||h.jsx(Ii,{className:"w-5 h-5"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-bold text-fg tracking-tight",children:e.title}),h.jsxs("p",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest",children:[c?a("transmute.topic"):a(`transmute.${e.type}`,e.type)," ",a("transmute.pipeline")]})]})]}),h.jsxs("div",{className:"flex gap-1",children:[h.jsx("button",{onClick:()=>r(e.id,e.status),className:"p-1.5 rounded-lg hover:bg-bg text-fg/40 hover:text-fg transition-colors",children:e.status==="active"?h.jsx(Lj,{className:"w-4 h-4"}):h.jsx(Qy,{className:"w-4 h-4"})}),h.jsx("button",{onClick:()=>s(e.id),title:a("transmute.view_json"),className:"p-1.5 rounded-lg hover:bg-bg text-fg/40 hover:text-fg transition-colors",children:h.jsx(y_,{className:"w-4 h-4"})}),h.jsx("button",{onClick:()=>n(e.id),className:"p-1.5 rounded-lg hover:bg-bg text-fg/40 hover:text-fg transition-colors",children:h.jsx(cc,{className:"w-4 h-4"})})]})]}),h.jsxs("div",{className:"space-y-2 mb-4",children:[h.jsxs("div",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest flex justify-between",children:[h.jsx("span",{children:a("transmute.last_run")}),h.jsx("span",{className:"text-fg/60",children:e.last_run_at?new Date(e.last_run_at).toLocaleDateString(a("common.locale_code")):a("transmute.never")})]}),h.jsxs("div",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest flex justify-between",children:[h.jsx("span",{children:a("transmute.schedule")}),h.jsx("span",{className:"text-fg/60",children:e.config.schedule||a("transmute.manual")})]})]}),h.jsxs("button",{onClick:()=>t(e.id),disabled:o||e.status!=="active",className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-xl bg-gradient-to-r from-primary to-primary/80 text-white font-bold shadow-lg glow-primary hover:scale-[1.02] active:scale-95 disabled:opacity-50 disabled:hover:scale-100 transition-all text-sm uppercase tracking-widest",children:[o?h.jsx(Pt,{className:"w-4 h-4 animate-spin"}):h.jsx(Qy,{className:"w-4 h-4"}),a(o?"transmute.running":"transmute.run_engine")]})]})};function kz(){const{t:e}=et(),[t,n]=R.useState([]),[r,s]=R.useState(!0),[o,a]=R.useState(new Set),[c,u]=R.useState(null),[f,p]=R.useState(null),[g,y]=R.useState(!1),[v,b]=R.useState(null),[w,k]=R.useState(!1),[S,C]=R.useState(!1),{showToast:j}=Jc();R.useEffect(()=>{(async()=>T())();const W=ae.channel("asset-updates").on("postgres_changes",{event:"UPDATE",schema:"public",table:"assets"},ne=>{const re=ne.new;u(J=>J?.id===re.id?re:J),re.status==="completed"&&ne.old.status!=="completed"&&j(e("transmute.asset_ready",{title:re.title}),"success")}).subscribe();return()=>{ae.removeChannel(W)}},[]);const O=async()=>{if(!S)try{C(!0),j(e("transmute.scanning"),"info");const{data:{session:K}}=await ae.auth.getSession(),W=Os(),ne={"Content-Type":"application/json","x-user-id":K?.user?.id||""};if(K?.access_token&&(ne.Authorization=`Bearer ${K.access_token}`),W&&(ne["x-supabase-url"]=W.url,ne["x-supabase-key"]=W.anonKey),!(await fetch("/api/engines/ensure-defaults",{method:"POST",headers:ne})).ok)throw new Error("Failed to generate engines");j(e("transmute.discovery_complete"),"success"),await T()}catch(K){console.error("Failed to generate engines:",K),j(e("transmute.discovery_failed"),"error")}finally{C(!1)}},T=async()=>{try{s(!0);const{data:{user:K}}=await ae.auth.getUser();if(!K)return;const{data:W,error:ne}=await ae.from("engines").select("*").eq("user_id",K.id).order("created_at",{ascending:!1});if(ne)throw ne;n(W)}catch(K){console.error("Error fetching engines:",K),j(e("transmute.load_failed"),"error")}finally{s(!1)}},N=async K=>{if(!o.has(K))try{a(D=>new Set(D).add(K)),j(e("transmute.starting_run"),"info");const{data:{session:W}}=await ae.auth.getSession(),ne=W?.access_token,re=Os(),J={"Content-Type":"application/json","x-user-id":W?.user?.id||""};ne&&(J.Authorization=`Bearer ${ne}`),re&&(J["x-supabase-url"]=re.url,J["x-supabase-key"]=re.anonKey);const ce=await fetch(`/api/engines/${K}/run`,{method:"POST",headers:J});if(!ce.ok){const D=await ce.json();throw new Error(D.error||"Run failed")}const A=await ce.json();A.status==="completed"?j(e("transmute.run_complete",{title:A.title}),"success"):j(e("transmute.run_started_desktop",{id:A.id}),"info"),u(A),n(D=>D.map(G=>G.id===K?{...G,last_run_at:new Date().toISOString()}:G))}catch(W){console.error("Engine run error:",W),j(W.message||e("transmute.run_failed"),"error")}finally{a(W=>{const ne=new Set(W);return ne.delete(K),ne})}},M=async K=>{try{y(!0);const{data:{session:W}}=await ae.auth.getSession(),ne=Os(),re={"Content-Type":"application/json","x-user-id":W?.user?.id||""};W?.access_token&&(re.Authorization=`Bearer ${W.access_token}`),ne&&(re["x-supabase-url"]=ne.url,re["x-supabase-key"]=ne.anonKey);const J=await fetch(`/api/engines/${K}/brief`,{headers:re});if(!J.ok)throw new Error("Failed to fetch brief");const ce=await J.json();p(ce)}catch{j(e("transmute.brief_failed"),"error")}finally{y(!1)}},V=async(K,W)=>{const ne=W==="active"?"paused":"active";n(re=>re.map(J=>J.id===K?{...J,status:ne}:J));try{const{error:re}=await ae.from("engines").update({status:ne}).eq("id",K);if(re)throw re;j(e("transmute.status_updated",{status:ne}),"success")}catch{n(J=>J.map(ce=>ce.id===K?{...ce,status:W}:ce)),j(e("common.error"),"error")}},B=()=>{k(!0)},L=K=>{const W=t.find(ne=>ne.id===K);W&&b(W)},Q=K=>{n(W=>W.find(re=>re.id===K.id)?W.map(re=>re.id===K.id?K:re):[K,...W])},Y=K=>{n(W=>W.filter(ne=>ne.id!==K))},he=()=>{b(null),k(!1)};return h.jsxs("div",{className:"h-full flex flex-col bg-bg",children:[h.jsx("div",{className:"flex-none p-6 border-b border-border bg-bg/50 backdrop-blur-sm z-10 sticky top-0",children:h.jsxs("div",{className:"flex justify-between items-center max-w-7xl mx-auto w-full",children:[h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-black italic tracking-tighter bg-clip-text text-transparent bg-gradient-to-r from-primary to-accent",children:e("transmute.title")}),h.jsx("p",{className:"text-xs text-fg/40 font-mono uppercase tracking-widest mt-1",children:e("transmute.desc")})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs("button",{onClick:O,disabled:S,className:"flex items-center gap-2 px-4 py-2.5 bg-primary/10 text-primary border border-primary/20 rounded-xl font-bold text-xs uppercase tracking-widest hover:bg-primary/20 transition-all disabled:opacity-50",children:[S?h.jsx(Pt,{className:"w-4 h-4 animate-spin"}):h.jsx(Vt,{className:"w-4 h-4"}),e("transmute.generate_engines")]}),h.jsxs("button",{onClick:B,className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white rounded-xl font-bold text-xs uppercase tracking-widest hover:scale-105 transition-all shadow-lg glow-primary",children:[h.jsx($f,{className:"w-4 h-4"}),e("transmute.new_engine")]})]})]})}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:h.jsx("div",{className:"max-w-7xl mx-auto w-full",children:r?h.jsx("div",{className:"flex items-center justify-center h-64",children:h.jsx(Pt,{className:"w-8 h-8 animate-spin text-purple-500"})}):t.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center h-96 text-center",children:[h.jsx("div",{className:"w-16 h-16 rounded-3xl bg-surface border border-border flex items-center justify-center mb-6 shadow-xl",children:h.jsx(Vt,{className:"w-8 h-8 text-fg/20"})}),h.jsx("h3",{className:"text-xl font-black italic tracking-tighter uppercase text-fg",children:e("transmute.no_engines")}),h.jsx("p",{className:"text-xs text-fg/40 font-mono tracking-widest uppercase max-w-sm mt-2 mb-8",children:e("transmute.no_engines_desc")}),h.jsx("button",{onClick:B,className:"px-8 py-3 rounded-xl border border-border bg-surface hover:bg-bg text-xs font-bold uppercase tracking-widest transition-all shadow-sm",children:e("transmute.create_engine")})]}):h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:h.jsx(Ot,{children:t.map(K=>h.jsx(wz,{engine:K,onRun:N,onEdit:L,onToggle:V,onViewBrief:M,isLoading:o.has(K.id)},K.id))})})})}),h.jsx(Ot,{children:f&&h.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-black/60 backdrop-blur-md",children:h.jsxs(Ue.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg rounded-3xl shadow-2xl w-full max-w-4xl max-h-[85vh] flex flex-col overflow-hidden border border-border",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-surface/50",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("div",{className:"p-3 rounded-2xl bg-primary/10 text-primary",children:h.jsx(y_,{className:"w-6 h-6"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-black italic tracking-tighter uppercase text-lg text-fg",children:e("transmute.view_json")}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest",children:e("transmute.json_contract")})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(f,null,2)),j(e("transmute.copied_json"),"info")},className:"p-2 text-fg/40 hover:text-primary hover:bg-primary/10 rounded-xl transition-all",children:h.jsx(zf,{className:"w-4 h-4"})}),h.jsx("button",{onClick:()=>p(null),className:"p-2 text-fg/40 hover:text-error hover:bg-error/10 rounded-xl transition-all",children:h.jsx(Tn,{className:"w-5 h-5"})})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/30 font-mono text-sm custom-scrollbar",children:h.jsx("pre",{className:"text-primary leading-relaxed",children:JSON.stringify(f,null,2)})}),h.jsx("div",{className:"p-4 border-t border-border bg-surface/50 text-[9px] text-fg/30 font-mono uppercase tracking-[0.2em] text-center",children:e("transmute.json_footer")})]})})}),g&&h.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/20 backdrop-blur-sm",children:h.jsx(Pt,{className:"w-10 h-10 animate-spin text-white"})}),h.jsx(bz,{asset:c,onClose:()=>u(null)}),v&&h.jsx(l_,{engine:v,onClose:he,onSave:Q,onDelete:Y}),w&&h.jsx(l_,{engine:null,onClose:he,onSave:Q})]})}class Sz{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 s=this.getAudioContext(),o=s.createOscillator(),a=s.createGain();o.connect(a),a.connect(s.destination),o.frequency.value=t,o.type="sine",a.gain.setValueAtTime(r,s.currentTime),a.gain.exponentialRampToValueAtTime(.01,s.currentTime+n),o.start(s.currentTime),o.stop(s.currentTime+n)}catch(s){console.warn("[Sound] Failed to play tone:",s)}}playSequence(t,n=.3){if(!this.enabled)return;let r=0;t.forEach(s=>{setTimeout(()=>{this.playTone(s.freq,s.duration,n)},r),r+=s.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 Uo=new Sz;function jz(){const{t:e}=et(),[t,n]=R.useState([]),[r,s]=R.useState([]),[o,a]=R.useState("discovery"),[c,u]=R.useState(!1),[f,p]=R.useState(null),[g,y]=R.useState(!0),[v,b]=R.useState(!x0),[w,k]=R.useState(!0),[S,C]=R.useState(!1),[j,O]=R.useState(!1),[T,N]=R.useState(null),[M,V]=R.useState(!1),[B,L]=R.useState(!1),[Q,Y]=R.useState(!1),[he,K]=R.useState(!0),[W,ne]=R.useState(()=>localStorage.getItem("theme")||"dark"),[re,J]=R.useState(null),ce=R.useRef(null);R.useMemo(()=>{const me=r.length;let ye=0,Ne=0,pe=null;for(const bt of r){ye+=bt.score,bt.score>Ne&&(Ne=bt.score);const Qn=new Date(bt.date);(!pe||Qn>new Date(pe.date))&&(pe=bt)}const Be=me?Math.round(ye/me):0,st=pe?new Date(pe.date):null;return{total:me,average:Be,top:Ne,latestTimestamp:st,latestTitle:pe?.title??pe?.category??null}},[r]),R.useEffect(()=>{(async()=>{if(!x0){b(!0),y(!1);return}try{const{data:Ne,error:pe}=await ae.from("init_state").select("is_initialized").single();pe?(console.warn("[App] Init check error (might be fresh DB):",pe),pe.code==="42P01"&&k(!1)):k(Ne.is_initialized>0);const{data:{session:Be}}=await ae.auth.getSession();p(Be?.user??null)}catch(Ne){console.error("[App] Status check failed:",Ne)}finally{y(!1)}})();const{data:{subscription:ye}}=ae.auth.onAuthStateChange((Ne,pe)=>{p(pe?.user??null)});return()=>ye.unsubscribe()},[]),R.useEffect(()=>{document.documentElement.setAttribute("data-theme",W),localStorage.setItem("theme",W)},[W]);const[A,D]=R.useState({});R.useEffect(()=>{(async()=>{if(!f)return;const{data:ye}=await ae.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",f.id).maybeSingle();ye&&D(ye)})()},[f,M]),R.useEffect(()=>{if(!f)return;(async()=>{const{data:Ne}=await ae.from("alchemy_settings").select("sound_enabled").eq("user_id",f.id).maybeSingle();if(Ne){const pe=Ne.sound_enabled??!0;K(pe),Uo.setEnabled(pe)}})();const ye=ae.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${f.id}`},Ne=>{const pe=Ne.new;pe.agent_state==="Mining"&&!B&&(L(!0),Y(!0),he&&Uo.syncStart()),pe.agent_state==="Signal"&&he&&Uo.signalFound(),pe.agent_state==="Completed"&&(L(!1),he&&(pe.metadata?.errors>0?Uo.error():Uo.syncComplete()),setTimeout(()=>{Y(!1)},5e3),G())}).subscribe();return()=>{ae.removeChannel(ye)}},[f,B,he]),R.useEffect(()=>{const me=new EventSource("/events");return me.onmessage=ye=>{const Ne=JSON.parse(ye.data);Ne.type==="history"?n(pe=>[...Ne.data,...pe].slice(0,100)):n(pe=>[Ne,...pe].slice(0,100))},G(),()=>me.close()},[f]),R.useEffect(()=>{ce.current&&ce.current.scrollIntoView({behavior:"smooth"})},[t]);const G=async()=>{try{if(f){const{data:ye,error:Ne}=await ae.from("signals").select("*").order("created_at",{ascending:!1});if(!Ne&&ye){s(ye.map(pe=>({id:pe.id,title:pe.title,score:pe.score,summary:pe.summary,date:pe.created_at,category:pe.category,entities:pe.entities})));return}}const me=await Xe.get("/api/signals");s(me.data)}catch(me){console.error("Failed to fetch signals",me)}},P=async()=>{u(!0);try{await Xe.post("/api/mine"),G()}catch(me){console.error("Mining failed:",me)}finally{u(!1)}},_e=(me,ye)=>{me==="logs"?(J(ye),a("logs")):a(me)};return g?h.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:h.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):v?h.jsx(Vw,{onComplete:()=>b(!1)}):f?h.jsx(yL,{children:h.jsx(bL,{children:h.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[h.jsxs(Ue.aside,{animate:{width:S?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[h.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${S?"justify-center":""}`,children:[h.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:h.jsx(Vt,{className:"text-white fill-current",size:24})}),!S&&h.jsx(Ue.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),h.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[h.jsx(vi,{active:o==="discovery",onClick:()=>a("discovery"),icon:h.jsx(Tj,{size:20}),label:e("tabs.discovery"),collapsed:S}),h.jsx(vi,{active:o==="chat",onClick:()=>a("chat"),icon:h.jsx(Uh,{size:20}),label:e("tabs.chat"),collapsed:S}),h.jsx(vi,{active:o==="transmute",onClick:()=>a("transmute"),icon:h.jsx(Vt,{size:20}),label:e("tabs.transmute"),collapsed:S}),h.jsx(vi,{active:o==="engine",onClick:()=>a("engine"),icon:h.jsx(cc,{size:20}),label:e("common.settings"),collapsed:S}),h.jsx(vi,{active:o==="logs",onClick:()=>a("logs"),icon:h.jsx(uc,{size:20}),label:e("tabs.logs"),collapsed:S}),h.jsx(vi,{active:o==="account",onClick:()=>a("account"),icon:h.jsx(Pc,{size:20}),label:e("common.account"),collapsed:S})]}),h.jsx("div",{className:"px-3 pb-2 border-t border-white/5 pt-4 mt-2 relative z-[100]",children:h.jsx("div",{className:S?"flex justify-center":"px-1",children:h.jsx(Op,{collapsed:S,position:"top"})})}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("button",{onClick:()=>ne(W==="dark"?"light":"dark"),className:`w-full flex items-center ${S?"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:S?e(W==="dark"?"shell.switch_light":"shell.switch_dark"):"",children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:W==="dark"?h.jsx(Uj,{size:18}):h.jsx(Oj,{size:18})}),!S&&h.jsx(Ue.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:e(W==="dark"?"common.light_mode":"common.dark_mode")})]})}),h.jsxs("div",{className:"px-3 pb-3",children:[h.jsx("button",{onClick:()=>C(!S),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 ${S?"justify-center":"gap-3"}`,children:S?h.jsx(vj,{size:20}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:h.jsx(xj,{size:20})}),h.jsx("span",{children:e("common.collapse")})]})}),h.jsxs("button",{onClick:()=>O(!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:e("shell.view_changelog"),children:[!S&&h.jsxs(h.Fragment,{children:[h.jsx(qh,{size:12,className:"group-hover:text-primary transition-colors"}),h.jsxs("span",{children:["v","1.0.71"]})]}),S&&h.jsx(qh,{size:14,className:"group-hover:text-primary transition-colors"})]})]})]}),h.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-bold",children:e("tabs.discovery")}),h.jsx("p",{className:"text-sm text-fg/50",children:e("setup.welcome_desc")})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("button",{onClick:()=>V(!0),className:"px-6 py-3 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[h.jsx(cc,{size:16}),h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("span",{children:e("discovery.sync_settings")}),h.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:A.sync_start_date?`${e("discovery.from")}: ${new Date(A.sync_start_date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:A.last_sync_checkpoint?`${e("discovery.checkpoint")}: ${new Date(A.last_sync_checkpoint).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:e("discovery.all_time")})]})]}),h.jsxs("button",{onClick:P,disabled:B,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:[h.jsx(_a,{size:18,className:B?"animate-spin":""}),e(B?"discovery.syncing":"discovery.sync_history")]})]})]}),h.jsx(HL,{onOpenUrl:me=>window.open(me,"_blank","noopener,noreferrer"),onSync:P,isSyncing:c,onCopyText:me=>{navigator.clipboard.writeText(me)}})]}),o==="chat"&&h.jsx(vz,{}),o==="transmute"&&h.jsx(kz,{}),o==="engine"&&h.jsx(_L,{}),o==="account"&&h.jsx(CL,{}),o==="logs"&&h.jsx(ML,{initialState:re}),h.jsx(kL,{isExpanded:Q,onToggle:()=>Y(!Q),onNavigate:_e,liftUp:o==="chat"})]}),h.jsx(RL,{signal:T,onClose:()=>N(null)}),h.jsx(PL,{isOpen:M,onClose:()=>V(!1)}),h.jsx(_z,{isOpen:j,onClose:()=>O(!1)})]})})}):h.jsx(fL,{onAuthSuccess:()=>G(),isInitialized:w})}function vi({active:e,icon:t,label:n,onClick:r,collapsed:s}){return h.jsx("button",{onClick:r,title:s?n:"",className:`w-full flex items-center ${s?"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:s?ra.cloneElement(t,{className:e?"text-primary":""}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:ra.cloneElement(t,{className:e?"text-primary":""})}),h.jsx(Ue.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function Ez(){Xe.interceptors.request.use(async e=>{try{const{data:{session:t}}=await ae.auth.getSession();t?.access_token&&(e.headers.Authorization=`Bearer ${t.access_token}`);const n=Os();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})}const{slice:Cz,forEach:Tz}=[];function Nz(e){return Tz.call(Cz.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}function Az(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(e))}const c_=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Rz=function(e,t){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},s=encodeURIComponent(t);let o=`${e}=${s}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!c_.test(r.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${r.domain}`}if(r.path){if(!c_.test(r.path))throw new TypeError("option path is invalid");o+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(o+="; HttpOnly"),r.secure&&(o+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(o+="; Partitioned"),o},u_={create(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+n*60*1e3)),r&&(s.domain=r),document.cookie=Rz(e,t,s)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let s=n[r];for(;s.charAt(0)===" ";)s=s.substring(1,s.length);if(s.indexOf(t)===0)return s.substring(t.length,s.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var Pz={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return u_.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:s,cookieOptions:o}=t;n&&typeof document<"u"&&u_.create(n,e,r,s,o)}},Oz={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const o=r.substring(1).split("&");for(let a=0;a<o.length;a++){const c=o[a].indexOf("=");c>0&&o[a].substring(0,c)===t&&(n=o[a].substring(c+1))}}return n}},Lz={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window<"u"){const{hash:s}=window.location;if(s&&s.length>2){const o=s.substring(1);if(t){const a=o.split("&");for(let c=0;c<a.length;c++){const u=a[c].indexOf("=");u>0&&a[c].substring(0,u)===t&&(r=a[c].substring(u+1))}}if(r)return r;if(!r&&n>-1){const a=s.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?a[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return r}};let _i=null;const d_=()=>{if(_i!==null)return _i;try{if(_i=typeof window<"u"&&window.localStorage!==null,!_i)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{_i=!1}return _i};var Iz={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&d_())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&d_()&&window.localStorage.setItem(n,e)}};let bi=null;const h_=()=>{if(bi!==null)return bi;try{if(bi=typeof window<"u"&&window.sessionStorage!==null,!bi)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{bi=!1}return bi};var Dz={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&h_())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&h_()&&window.sessionStorage.setItem(n,e)}},Mz={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:s}=navigator;if(n)for(let o=0;o<n.length;o++)t.push(n[o]);r&&t.push(r),s&&t.push(s)}return t.length>0?t:void 0}},zz={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},Fz={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?n[typeof t=="number"?t:0]?.replace("/",""):void 0}},$z={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};let e1=!1;try{document.cookie,e1=!0}catch{}const t1=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];e1||t1.splice(1,1);const Uz=()=>({order:t1,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class n1{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=Nz(n,this.options||{},Uz()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=s=>s.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(Pz),this.addDetector(Oz),this.addDetector(Iz),this.addDetector(Dz),this.addDetector(Mz),this.addDetector(zz),this.addDetector(Fz),this.addDetector($z),this.addDetector(Lz)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return t.forEach(r=>{if(this.detectors[r]){let s=this.detectors[r].lookup(this.options);s&&typeof s=="string"&&(s=[s]),s&&(n=n.concat(s))}}),n=n.filter(r=>r!=null&&!Az(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}n1.type="languageDetector";const Bz={save:"Save",cancel:"Cancel",loading:"Loading...",error:"Error",success:"Success",settings:"Settings",search:"Search",back:"Back",all:"All",delete:"Delete",update:"Update",edit:"Edit",close:"Close",complete:"Complete",skip:"Skip",begin:"Begin",connection:"Connection",setup:"Setup",project:"Project",account:"Account",logout:"Logout",welcome:"Welcome",dark_mode:"Dark Mode",light_mode:"Light Mode",collapse:"Collapse",just_now:"Just now",enabled:"Enabled",disabled:"Disabled",quick:"Quick (5)",balanced:"Balanced (50)",thorough:"Thorough (200)",resetting:"Resetting...",saving:"Saving...",locale_code:"en-US",categories:{ai_ml:"AI & ML",business:"Business",politics:"Politics",technology:"Technology",finance:"Finance",crypto:"Crypto",science:"Science",other:"Other"}},Vz={discovery:"Discovery",chat:"Chat",transmute:"Transmute",logs:"System Logs",history:"History"},qz={welcome_title:"Assemble Your Engine",welcome_desc:"Alchemy requires a Supabase essence to store signal fragments and intelligence patterns.",requirements:"Requirements:",project_url:"Supabase Project URL",anon_key:"Anon Public API Key",db_password:"Database Password",project_url_placeholder:"https://xxx.supabase.co or project-id",anon_key_placeholder:"eyJ...",project_id_placeholder:"abcdefghijklm",access_token_placeholder:"sbp_...",begin_init:"BEGIN INITIALIZATION",connect_essence:"CONNECT ESSENCE",credentials_title:"Essence Coordinates",credentials_desc:"Link the alchemist engine to your cloud database",validating:"Validating Link",resonance:"Synchronizing Resonance...",init_schema:"Initialize Schema",schema_desc:"Run database migrations to set up required tables and functions.",project_id:"Project ID",access_token:"Access Token",run_migrations:"RUN MIGRATIONS",running_migrations:"Running Migrations",take_minute:"This may take a minute...",engine_aligned:"Engine Aligned",restarting:"Restarting Alchemist Subsystems...",forge_project:"Forge Project at Supabase",project_id_help:"Found in Supabase Dashboard → Project Settings → General",access_token_help:"Generate at",access_token_link:"supabase.com/dashboard/account/tokens",project_id_required:"Project ID is required",access_token_required:"Access token is required",migration_failed_logs:"Migration failed. Check logs for details.",stream_error:"Failed to read migration stream",back:"BACK",retry:"RETRY"},Hz={title_init:"INITIALIZE MASTER",title_join:"JOIN THE CIRCLE",title_mystic:"MYSTIC ACCESS",title_login:"ALCHEMIST LOGIN",desc_init:"Forge the prime alchemist account",desc_mystic_email:"Enter your essence email",desc_mystic_code:"Transmute the sacred code",desc_login:"Transmute your data into intelligence",first_name:"First Name",last_name:"Last Name",first_name_placeholder:"Zosimos",last_name_placeholder:"Panopolis",email_address:"Email Address",email_placeholder:"alchemist@example.com",complexity_key:"Complexity Key",password_placeholder:"••••••••",init_account:"INITIALIZE ACCOUNT",send_code:"SEND CODE",unseal_engine:"UNSEAL ENGINE",verify_code:"VERIFY CODE",change_email:"Change email address",sign_in_code:"Sign in with Code",sign_in_password:"Sign in with Password",already_alchemist:"Already an Alchemist?",new_to_alchemy:"New to Alchemy?",login_instead:"Login instead",create_account:"Create an account",session_failed:"Failed to create session",invalid_code:"Invalid code"},Kz={filters:"Filters",category:"Category",intelligence_score:"Intelligence Score",no_signals_in_category:"No signals in {{category}} yet.",no_categories:"No categories yet.",discovery_hint:"Signals will be organized here once discovered.",loading_signals:"Loading signals...",dismiss_hint:"Dismiss (Not Interested)",signal_count_one:"{{count}} signal",signal_count_other:"{{count}} signals",time_min_ago:"{{count}}m ago",time_hour_ago:"{{count}}h ago",time_day_ago:"{{count}}d ago",add_note_title:"Add Note",target:"Target",note_placeholder:"Enter your thoughts, ideas, or action items regarding this signal...",save_note:"Save Note",view_all_sources:"View all sources",source_count_one:"{{count}} source",source_count_other:"{{count}} sources",source_found_in:"Found in {{count}} different sources",high_confidence:"High confidence - found in {{count}} sources",new_signals:"New Signals",smart_summary:"Smart Summary",entities:"Entities",sources:"Sources",last_sync:"Last Sync",syncnow:"Sync Now",all_time:"All time",checkpoint:"Checkpoint",from:"From",score_high:"HIGH",score_medium:"MEDIUM",score_low:"LOW",sources_count:"{{count}} sources",open_source:"Open",add_note:"Note",boost_topic:"Boost Topic",boosted:"Boosted",dismissed:"Dismissed",remove_favourite:"Remove from favourites",add_favourite:"Add to favourites",sync_history:"Sync History",syncing:"Syncing...",sync_settings:"Sync Settings",discovered:"Discovered",original_source:"Original Source",ai_summary:"AI Summary",full_content:"Full Content",copied:"Copied!",open_link:"Open",detail_title:"Signal Details",sync_from:"Sync From (Optional)",urls_per_sync:"URLs per Sync",sync_from_hint:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward.",reset_checkpoint:"Reset Checkpoint",reset_checkpoint_hint:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date',sync_info:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.',save_settings:"Save Settings",sync_saved:"Sync settings saved successfully",checkpoint_reset:"Checkpoint reset successfully",login_to_save:"Please log in to save settings",login_to_reset:"Please log in to reset checkpoint",status_updated:"Engine status updated to {{status}}",asset_ready:'Asset "{{title}}" is ready!',scanning:"Scanning for new categories and topics...",discovery_complete:"Engine discovery complete!",discovery_failed:"Discovery failed. Check settings.",welcome_title:"Welcome to Alchemist!",welcome_desc:"Connect your browser history to start discovering signals. We'll automatically analyze your visited pages to find mentions of AI, tech, and more.",auto_detect_sync:"Auto-detect & Sync",privacy_first:"Privacy First",offline_first:"Offline First",load_failed:"Failed to load engines",starting_run:"Starting engine run...",run_complete:"Engine run complete! Created: {{title}}",run_started_desktop:"Engine run started on Desktop. Tracking as: {{id}}",run_failed:"Failed to run engine",brief_failed:"Failed to generate production brief",topic:"Topic",pipeline:"Pipeline"},Wz={history:"History",ask_anything:"Ask anything about your browsing history...",sources:"Sources",processing:"Processing your query...",new_chat:"New Chat",no_messages:"No messages yet. Start a conversation!",no_history:"No chat history yet.",title:"Ask Alchemist",desc:"I can help you recall information, summarize topics, and find insights from your browsing history.",thinking:"Exploring memory...",placeholder:"Ask about your history...",error_message:"Sorry, I encountered an error processing your request.",relevant_context:"Relevant Context",match_score:"{{score}}% Match",rag_attribution:"Alchemist used these {{count}} signals to answer",suggestions:{react:"What have I read about React recently?",ai:"Summarize the latest AI news I visited.",finance:"Do I have any notes on Finance?",performance:"Find articles about 'Performance'"}},Gz={engines:"Alchemist Engines",assets:"Generated Assets",newsletter:"Newsletter",thread:"Thread",audio:"Audio",report:"Report",title:"Transmute Engine",desc:"Active Generation Pipelines & Assets",generate:"Generate",processing_desktop:"Processing on Desktop...",ensure_defaults:"Ensure Default Engines",create_engine:"Create Engine",no_assets:"No assets generated yet.",generate_engines:"Generate Engines",new_engine:"New Engine",no_engines:"No Engines Configured",no_engines_desc:"Create your first pipeline to automatically turn signals into newsletters, threads, or audio briefs.",run_engine:"Run Engine",running:"Running...",last_run:"Last Run",never:"Never",schedule:"Schedule",manual:"Manual",topic:"Topic",pipeline:"Pipeline",pause:"Pause",resume:"Resume",view_json:"View Production Brief JSON",json_contract:"Stateless & Self-Contained Contract",json_desc:"This JSON contains the full context (Signals + User Persona) required for the Desktop Studio.",generating_asset:"Generating Asset...",queued_desktop:"Queued for Desktop...",desktop_processing:"The RealTimeX Desktop app is processing this request. This modal will update automatically once finished.",unsupported_type:"Unsupported asset type",edit_engine:"Edit Engine",engine_name:"Engine Name",type:"Type",status:"Status",execution_env:"Execution Environment",local_llm:"Local (Alchemy LLM)",desktop_swarm:"RealTimeX Desktop (Agent Swarm)",env_desc_desktop:"Delegates heavy tasks like Audio/Video to the desktop app.",env_desc_local:"Runs simple Markdown tasks directly in Alchemy.",min_score:"Min Score",max_signals:"Max Signals",category_filter:"Category Filter (multi-select)",multi_select_hint:"Hold Cmd/Ctrl to select multiple categories",schedule_hint:"Note: Scheduling is not yet automated",prompt_override:"Custom Prompt Override (optional)",prompt_placeholder:"Override the default prompt for this engine type...",delete_confirm:"Really delete?",confirm:"Confirm",copied_json:"JSON copied to clipboard",json_footer:"This JSON contains the full context (Signals + User Persona) required for the Desktop Studio."},Jz={title:"Account Configuration",desc:"Manage your Alchemist profile and essence links.",profile:"Profile",security:"Security",supabase:"Supabase",first_name:"First Name",last_name:"Last Name",email_locked:"Email Address (Locked)",sound_effects:"Sound Effects",sound_desc:"Enable audio feedback for sync events and signal discoveries.",sign_out:"Sign Out",logout_desc:"End your current session and return to the login screen.",preserve_profile:"Preserve Profile",security_title:"Update Entropy Key",new_password:"New Password",confirm_password:"Confirm Password",password_mismatch:"Complexity keys do not match.",password_too_short:"Entropy too low. Minimum 8 characters.",password_rotate_success:"Key rotation successful.",rotate_key:"Rotate Key",essence_resonance:"Essence Resonance",byok_desc:"Bring Your Own Keys (BYOK) for intelligence persistence.",established_link:"Established Link",env_notice:"Active from environment variables. UI override enabled.",realign_link:"Realign Link",sever_link:"Sever Link",sever_confirm:"Sever connection to this essence? This will reset local resonance.",anon_secret_fragment:"Anon Secret Fragment",no_resonance:"No Essence Resonance",no_resonance_desc:"The Alchemist requires a cloud core to store intelligence fragments.",initiate_link:"Initiate Link",test_connection:"Test Connection"},Xz={title:"System Logs",desc:"Detailed history of sync runs, sources, and URL processing",blacklist_suggestion:"Potential Blacklist",blacklist_desc:"Candidates for blocking",recent_errors:"Recent Errors",errors_desc:"Failed URL processes",total_signals:"Total Signals",signals_desc:"Successfully mined",blacklist_modal_title:"Blacklist Suggestions",blacklist_modal_desc:"Review domains suggested for blacklisting based on low scores.",no_suggestions:"No suggestions right now",quality_good:"Your signal quality looks good!",signals_count:"{{count}} signals",avg_score:"Avg Score: {{score}}",low_quality:"Consistently Low Quality",repetitive:"Repetitive Pattern",blacklist_domain:"Blacklist Domain",errors_modal_title:"Recent Errors",errors_modal_desc:"Log of recent failures and issues.",no_recent_errors:"No recent errors found.",signals_modal_title:"Found Signals",signals_modal_desc:"Browse and manage your mined signals history.",search_placeholder:"Search signals...",any_score:"Any Score",high_score:"High (80%+)",medium_score:"Medium (50-79%)",low_score:"Low (<50%)",all_categories:"All Categories",page_x:"Page {{page}}"},Yz={title:"Alchemist Engine",live:"LIVE",clear:"Clear",idle:"Idle. Awaiting signal mining events...",run_completed:"Mining Run Completed",signals:"Signals",urls:"URLs",skipped:"Skipped",failed_to_process:"{{count}} URLs failed to process",view_logs:"View Logs",hide_details:"Hide Details",view_details:"View Details",engine_log:"Live Engine Log",stop_sync:"Stop Sync",state_reading:"Reading",state_thinking:"Thinking",state_signal:"Signal",state_skipped:"Skipped",state_error:"Error",state_completed:"Completed",msg_reading:"Reading content from: {{url}}",msg_thinking:"Analyzing relevance of: {{title}}",msg_found_signal:"Found signal: {{summary}} ({{score}}%)",msg_low_signal:"Low signal stored for review ({{score}}%): {{title}}",msg_failed:"Analysis failed for {{title}}: {{error}}",msg_sync_completed:"Sync completed: {{signals}} signals found, {{skipped}} skipped, {{errors}} errors"},Qz={switch_light:"Switch to Light Mode",switch_dark:"Switch to Dark Mode",view_changelog:"View Changelog",release_notes:"Release Notes",changelog_error:"Failed to load changelog."},Zz={title:"Signal Pulse",mining:"Mining",standing_by:"Standing by",idle:"Idle",tracked:"Signals tracked",avg_score:"Average score",top_signal:"Top signal",latest:"Latest",awaiting:"Awaiting mining",no_signals:"No signals yet"},eF={title:"Intelligence Engine",subtitle:"Fine-tune the Alchemist's cognitive parameters and provider links.",configuration:"AI Configuration",test_connection:"Test Connection",save_config:"Save Configuration",llm_provider:"LLM Provider",embedding_provider:"Embedding Provider",sdk_connected:"SDK Connected",sdk_not_available:"SDK Not Available",provider:"Provider",intelligence_model:"Intelligence Model",embedding_model:"Embedding Model",loading_providers:"Loading providers...",sdk_info_success:"✓ Using RealTimeX configured provider",sdk_info_fail:"⚠️ RealTimeX SDK not detected. Configure in RealTimeX Desktop.",embedding_info_success:"✓ Embeddings are generated using your RealTimeX configured provider",embedding_info_fail:"⚠️ RealTimeX SDK not detected. Configure providers in RealTimeX Desktop.",persona_title:"Persona Memory",save_memory:"Save Memory",interests_title:"Active Interests",interests_priority:"High Priority",interests_desc:"The Alchemist prioritizes content matching these topics. Updated automatically based on Favorites & Boosts.",interests_placeholder:"e.g. User focuses on React performance, Rust backend systems, and AI Agent architecture...",antipatterns_title:"Anti-Patterns",antipatterns_priority:"Avoid",antipatterns_desc:"The Alchemist filters out or scores down content matching these patterns. Updated via Dismissals.",antipatterns_placeholder:"e.g. Dislikes marketing fluff, generic listicles, and crypto hype...",browser_sources:"Browser History Sources",save_browser:"Save Browser Sources",blacklist_title:"Blacklist Domains",blacklist_desc:"URLs containing these patterns will be skipped during mining. Enter one pattern per line.",blacklist_label:"Domain Patterns (one per line)",blacklist_placeholder:`google.com/search
134
+ ${n("shell.changelog_error")}`)}finally{a(!1)}};return h.jsx(Pt,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx(Be.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50"}),h.jsx(Be.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:h.jsxs("div",{className:"glass w-full max-w-3xl max-h-[80vh] overflow-hidden pointer-events-auto shadow-2xl",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(p_,{size:24,className:"text-primary"}),h.jsx("h2",{className:"text-xl font-bold",children:n("shell.release_notes")})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(Nn,{size:20,className:"text-fg/60"})})]}),h.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar max-h-[calc(80vh-88px)]",children:o?h.jsx("div",{className:"flex items-center justify-center py-12",children:h.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-primary border-t-transparent"})}):h.jsx(Yp,{components:{h1:({children:u})=>h.jsx("h1",{className:"text-2xl font-bold text-fg mb-6 mt-0",children:u}),h2:({children:u})=>h.jsx("h2",{className:"text-xl font-bold text-fg mt-8 mb-3 pb-2 border-b border-border first:mt-0",children:u}),h3:({children:u})=>h.jsx("h3",{className:"text-lg font-bold text-primary mt-6 mb-2",children:u}),p:({children:u})=>h.jsx("p",{className:"text-sm text-fg/70 mb-3 leading-relaxed",children:u}),ul:({children:u})=>h.jsx("ul",{className:"list-none space-y-1 mb-4 ml-0",children:u}),li:({children:u})=>h.jsx("li",{className:"text-sm text-fg/80 ml-4 mb-1 before:content-['•'] before:mr-2 before:text-primary",children:u}),a:({href:u,children:f})=>h.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 underline transition-colors",children:f}),code:({children:u})=>h.jsx("code",{className:"bg-surface/50 text-accent px-1.5 py-0.5 rounded text-xs font-mono border border-border",children:u}),strong:({children:u})=>h.jsx("strong",{className:"font-bold text-fg",children:u})},children:r})})]})})]})})}function bz({asset:e,onClose:t}){const{t:n}=et(),r=()=>{e.content&&navigator.clipboard.writeText(e.content)},s=()=>{if(!e.content)return;const o=new Blob([e.content],{type:"text/markdown"}),a=URL.createObjectURL(o),c=document.createElement("a");c.href=a,c.download=`${e.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(a)};return h.jsx(Pt,{children:e&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-md",children:h.jsxs(Be.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg rounded-3xl shadow-2xl w-full max-w-4xl max-h-[85vh] flex flex-col overflow-hidden border border-border",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-surface/50",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("div",{className:"p-3 rounded-2xl bg-primary/10 text-primary shadow-inner",children:e.type==="audio"?h.jsx(Bh,{className:"w-6 h-6"}):h.jsx(Ii,{className:"w-6 h-6"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-black italic tracking-tighter uppercase text-xl text-fg",children:e.title}),h.jsxs("p",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest mt-0.5",children:[new Date(e.created_at).toLocaleString([],{dateStyle:"medium",timeStyle:"short"})," • ",n("discovery.sources_count",{count:e.metadata?.source_signal_count||0})]})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:r,className:"p-2.5 text-fg/40 hover:text-primary hover:bg-primary/10 rounded-xl transition-all",title:"Copy Content",children:h.jsx(zf,{className:"w-5 h-5"})}),h.jsx("button",{onClick:s,className:"p-2.5 text-fg/40 hover:text-primary hover:bg-primary/10 rounded-xl transition-all",title:"Download File",children:h.jsx($h,{className:"w-5 h-5"})}),h.jsx("div",{className:"w-px h-8 bg-border mx-2"}),h.jsx("button",{onClick:t,className:"p-2.5 text-fg/40 hover:text-error hover:bg-error/10 rounded-xl transition-all",children:h.jsx(Nn,{className:"w-6 h-6"})})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-8 bg-bg custom-scrollbar",children:e.status&&e.status!=="completed"?h.jsxs("div",{className:"flex flex-col items-center justify-center h-80 gap-6",children:[h.jsxs("div",{className:"relative",children:[h.jsx("div",{className:"absolute inset-0 bg-primary/20 rounded-full blur-xl animate-pulse"}),h.jsx(Rt,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),h.jsxs("div",{className:"text-center space-y-2",children:[h.jsx("h4",{className:"text-xl font-black italic tracking-tighter uppercase text-fg",children:e.status==="processing"?n("transmute.generating_asset"):n("transmute.queued_desktop")}),h.jsx("p",{className:"text-xs text-fg/40 font-mono uppercase tracking-widest max-w-xs mx-auto",children:n("transmute.desktop_processing")})]})]}):e.type==="markdown"?h.jsx("div",{className:"prose prose-invert prose-headings:font-black prose-headings:italic prose-headings:tracking-tighter prose-headings:uppercase prose-p:text-fg/80 prose-li:text-fg/80 prose-strong:text-primary max-w-none",children:h.jsx(Yp,{children:e.content||""})}):e.type==="audio"?h.jsxs("div",{className:"flex flex-col items-center justify-center h-80 gap-8",children:[h.jsx("div",{className:"w-24 h-24 rounded-3xl bg-primary/10 flex items-center justify-center animate-pulse shadow-xl border border-primary/20",children:h.jsx(Bh,{className:"w-10 h-10 text-primary"})}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-xs text-fg/40 font-mono uppercase tracking-widest mb-6",children:n("transmute.unsupported_type")}),h.jsxs("audio",{controls:!0,className:"w-80 h-12 rounded-xl bg-surface border border-border",children:[h.jsx("source",{src:e.content||"",type:"audio/mpeg"}),"Your browser does not support the audio element."]})]})]}):h.jsx("div",{className:"text-fg/20 text-center py-20 font-mono italic",children:"Unsupported asset type"})})]})})})}function l_({engine:e,onClose:t,onSave:n,onDelete:r}){const{t:s}=et(),{showToast:o}=Jc(),[a,c]=R.useState({title:"",type:"newsletter",status:"active",config:{schedule:"",min_score:70,categories:[],custom_prompt:"",max_signals:10,execution_mode:"local"}}),[u,f]=R.useState(!1);R.useEffect(()=>{e&&c({title:e.title,type:e.type,status:e.status,config:{schedule:e.config.schedule||"",min_score:e.config.filters?.min_score||70,categories:Array.isArray(e.config.category)?e.config.category:e.config.category?[e.config.category]:[],custom_prompt:e.config.custom_prompt||"",max_signals:e.config.max_signals||10,execution_mode:e.config.execution_mode||"local"}})},[e]);const p=async()=>{try{const v={title:a.title,type:a.type,status:a.status,config:{schedule:a.config.schedule,filters:{min_score:a.config.min_score,category:a.config.category},custom_prompt:a.config.custom_prompt,max_signals:a.config.max_signals,execution_mode:a.config.execution_mode}};if(e){const{data:b,error:w}=await ae.from("engines").update(v).eq("id",e.id).select().single();if(w)throw w;n(b),o("Engine updated successfully","success")}else{const{data:{user:b}}=await ae.auth.getUser();if(!b)throw new Error("Not authenticated");const{data:w,error:k}=await ae.from("engines").insert({...v,user_id:b.id}).select().single();if(k)throw k;n(w),o("Engine created successfully","success")}t()}catch(v){console.error("Save error:",v),o(v.message||"Failed to save engine","error")}},g=async()=>{if(!(!e||!r))try{const{error:v}=await ae.from("engines").delete().eq("id",e.id);if(v)throw v;r(e.id),o("Engine deleted","success"),t()}catch(v){o(v.message||"Failed to delete engine","error")}},y=()=>{f(!1),t()};return!e&&!t?null:h.jsx(Pt,{children:h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:h.jsxs(Be.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg rounded-3xl shadow-2xl w-full max-w-2xl max-h-[85vh] flex flex-col overflow-hidden border border-border",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-surface/50",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-xl font-black italic tracking-tighter uppercase text-fg",children:s(e?"transmute.edit_engine":"transmute.create_engine")}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-[0.2em]",children:s("transmute.configure_pipeline")})]}),h.jsx("button",{onClick:y,className:"p-2 text-fg/40 hover:text-error hover:bg-error/10 rounded-xl transition-all",children:h.jsx(Nn,{className:"w-6 h-6"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-8 space-y-8 custom-scrollbar",children:[h.jsxs("div",{className:"space-y-6",children:[h.jsx(_r,{label:s("transmute.engine_name"),children:h.jsx("input",{type:"text",value:a.title,onChange:v=>c({...a,title:v.target.value}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg placeholder:text-fg/20 focus:border-primary/50 outline-none transition-all text-sm",placeholder:"e.g., Daily Tech Brief"})}),h.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[h.jsx(_r,{label:s("transmute.type"),children:h.jsxs("select",{value:a.type,onChange:v=>c({...a,type:v.target.value}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm appearance-none cursor-pointer",children:[h.jsx("option",{value:"newsletter",children:s("transmute.newsletter")}),h.jsx("option",{value:"thread",children:s("transmute.thread")}),h.jsx("option",{value:"audio",children:"Audio Brief"}),h.jsx("option",{value:"report",children:"Report"})]})}),h.jsx(_r,{label:s("transmute.status"),children:h.jsxs("select",{value:a.status,onChange:v=>c({...a,status:v.target.value}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm appearance-none cursor-pointer",children:[h.jsx("option",{value:"active",children:s("common.status_active")}),h.jsx("option",{value:"paused",children:s("common.status_paused")}),h.jsx("option",{value:"draft",children:"Draft"})]})})]}),h.jsxs(_r,{label:s("transmute.execution_env"),children:[h.jsxs("select",{value:a.config.execution_mode,onChange:v=>c({...a,config:{...a.config,execution_mode:v.target.value}}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm appearance-none cursor-pointer",children:[h.jsx("option",{value:"local",children:s("transmute.local_llm")}),h.jsx("option",{value:"desktop",children:s("transmute.desktop_swarm")})]}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono uppercase mt-2 leading-relaxed",children:a.config.execution_mode==="desktop"?s("transmute.env_desc_desktop"):s("transmute.env_desc_local")})]})]}),h.jsxs("div",{className:"space-y-6 pt-6 border-t border-border/10",children:[h.jsx("h4",{className:"text-xs font-bold uppercase tracking-[0.2em] text-primary/60",children:"Signal Filters"}),h.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[h.jsx(_r,{label:s("transmute.min_score"),children:h.jsx("input",{type:"number",min:"0",max:"100",value:a.config.min_score,onChange:v=>c({...a,config:{...a.config,min_score:parseInt(v.target.value)||0}}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm"})}),h.jsx(_r,{label:s("transmute.max_signals"),children:h.jsx("input",{type:"number",min:"1",max:"50",value:a.config.max_signals,onChange:v=>c({...a,config:{...a.config,max_signals:parseInt(v.target.value)||10}}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm"})})]}),h.jsxs(_r,{label:s("transmute.category_filter"),children:[h.jsxs("select",{multiple:!0,value:a.config.categories,onChange:v=>{const b=Array.from(v.target.selectedOptions,w=>w.value);c({...a,config:{...a.config,categories:b}})},className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg focus:border-primary/50 outline-none transition-all text-sm min-h-[120px] custom-scrollbar",children:[h.jsx("option",{value:"AI & ML",children:"AI & ML"}),h.jsx("option",{value:"Technology",children:"Technology"}),h.jsx("option",{value:"Business",children:"Business"}),h.jsx("option",{value:"Finance",children:"Finance"}),h.jsx("option",{value:"Science",children:"Science"}),h.jsx("option",{value:"Politics",children:"Politics"})]}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono mt-2",children:s("transmute.multi_select_hint")})]})]}),h.jsx("div",{className:"pt-6 border-t border-border/10",children:h.jsxs(_r,{label:`${s("transmute.schedule")} (${s("common.optional")})`,children:[h.jsx("input",{type:"text",value:a.config.schedule,onChange:v=>c({...a,config:{...a.config,schedule:v.target.value}}),className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg placeholder:text-fg/20 focus:border-primary/50 outline-none transition-all text-sm",placeholder:"e.g., Daily @ 9am, Manual"}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono mt-2",children:s("transmute.schedule_hint")})]})}),h.jsx("div",{className:"pt-6 border-t border-border/10",children:h.jsx(_r,{label:s("transmute.prompt_override"),children:h.jsx("textarea",{value:a.config.custom_prompt,onChange:v=>c({...a,config:{...a.config,custom_prompt:v.target.value}}),rows:5,className:"w-full px-4 py-3 rounded-xl border border-border bg-surface text-fg placeholder:text-fg/20 focus:border-primary/50 outline-none transition-all text-sm resize-none custom-scrollbar",placeholder:s("transmute.prompt_placeholder")})})})]}),h.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-border bg-surface/50",children:[e&&r?u?h.jsxs("div",{className:"flex items-center gap-4 bg-error/5 border border-error/20 px-4 py-2 rounded-2xl animate-in fade-in slide-in-from-left-2 transition-all",children:[h.jsx("span",{className:"text-xs text-error font-bold uppercase tracking-widest",children:s("transmute.delete_confirm")}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:g,className:"px-4 py-2 bg-error text-white text-[10px] font-bold uppercase tracking-widest rounded-xl hover:bg-error/80 transition-all shadow-lg shadow-error/20",children:s("transmute.confirm")}),h.jsx("button",{onClick:()=>f(!1),className:"px-4 py-2 bg-surface border border-border text-fg/40 text-[10px] font-bold uppercase tracking-widest rounded-xl hover:bg-bg transition-all",children:s("common.cancel")})]})]}):h.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-2 px-6 py-3 text-error/60 hover:text-error hover:bg-error/10 rounded-2xl transition-all font-bold text-xs uppercase tracking-widest",children:[h.jsx(Bf,{className:"w-5 h-5"}),s("common.delete")]}):h.jsx("div",{}),h.jsxs("div",{className:"flex gap-4",children:[h.jsx("button",{onClick:y,className:"px-6 py-3 text-fg/40 font-bold text-xs uppercase tracking-widest hover:text-fg hover:bg-surface rounded-2xl transition-all",children:s("common.cancel")}),h.jsxs("button",{onClick:p,className:"flex items-center gap-2 px-8 py-3 bg-gradient-to-r from-primary to-accent text-white rounded-2xl font-bold text-xs uppercase tracking-widest hover:scale-105 active:scale-95 transition-all shadow-lg glow-primary",children:[h.jsx(wr,{className:"w-5 h-5"}),s("common.save")]})]})]})]})})})}function _r({label:e,children:t}){return h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-fg/30 ml-1",children:e}),t]})}const wz=({engine:e,onRun:t,onEdit:n,onToggle:r,onViewBrief:s,isLoading:o})=>{const{t:a}=et(),c=!!e.config.tag,u={newsletter:c?h.jsx(Ff,{className:"w-5 h-5 text-blue-500"}):h.jsx(Ii,{className:"w-5 h-5 text-emerald-500"}),thread:h.jsx(Vt,{className:"w-5 h-5 text-blue-500"}),audio:h.jsx(Bh,{className:"w-5 h-5 text-purple-500"}),report:h.jsx(cc,{className:"w-5 h-5 text-orange-500"})};return h.jsxs(Be.div,{layout:!0,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`p-5 rounded-2xl border transition-all hover:shadow-lg group ${e.status==="active"?"bg-surface border-border shadow-sm":"bg-surface/30 border-dashed border-border opacity-70"}`,children:[h.jsxs("div",{className:"flex justify-between items-start mb-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2 rounded-xl bg-bg border border-border/10",children:u[e.type]||h.jsx(Ii,{className:"w-5 h-5"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-bold text-fg tracking-tight",children:e.title}),h.jsxs("p",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest",children:[c?a("transmute.topic"):a(`transmute.${e.type}`,e.type)," ",a("transmute.pipeline")]})]})]}),h.jsxs("div",{className:"flex gap-1",children:[h.jsx("button",{onClick:()=>r(e.id,e.status),className:"p-1.5 rounded-lg hover:bg-bg text-fg/40 hover:text-fg transition-colors",children:e.status==="active"?h.jsx(Lj,{className:"w-4 h-4"}):h.jsx(Qy,{className:"w-4 h-4"})}),h.jsx("button",{onClick:()=>s(e.id),title:a("transmute.view_json"),className:"p-1.5 rounded-lg hover:bg-bg text-fg/40 hover:text-fg transition-colors",children:h.jsx(y_,{className:"w-4 h-4"})}),h.jsx("button",{onClick:()=>n(e.id),className:"p-1.5 rounded-lg hover:bg-bg text-fg/40 hover:text-fg transition-colors",children:h.jsx(cc,{className:"w-4 h-4"})})]})]}),h.jsxs("div",{className:"space-y-2 mb-4",children:[h.jsxs("div",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest flex justify-between",children:[h.jsx("span",{children:a("transmute.last_run")}),h.jsx("span",{className:"text-fg/60",children:e.last_run_at?new Date(e.last_run_at).toLocaleDateString(a("common.locale_code")):a("transmute.never")})]}),h.jsxs("div",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest flex justify-between",children:[h.jsx("span",{children:a("transmute.schedule")}),h.jsx("span",{className:"text-fg/60",children:e.config.schedule||a("transmute.manual")})]})]}),h.jsxs("button",{onClick:()=>t(e.id),disabled:o||e.status!=="active",className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-xl bg-gradient-to-r from-primary to-primary/80 text-white font-bold shadow-lg glow-primary hover:scale-[1.02] active:scale-95 disabled:opacity-50 disabled:hover:scale-100 transition-all text-sm uppercase tracking-widest",children:[o?h.jsx(Rt,{className:"w-4 h-4 animate-spin"}):h.jsx(Qy,{className:"w-4 h-4"}),a(o?"transmute.running":"transmute.run_engine")]})]})};function kz(){const{t:e}=et(),[t,n]=R.useState([]),[r,s]=R.useState(!0),[o,a]=R.useState(new Set),[c,u]=R.useState(null),[f,p]=R.useState(null),[g,y]=R.useState(!1),[v,b]=R.useState(null),[w,k]=R.useState(!1),[S,C]=R.useState(!1),{showToast:j}=Jc();R.useEffect(()=>{(async()=>T())();const W=ae.channel("asset-updates").on("postgres_changes",{event:"UPDATE",schema:"public",table:"assets"},ne=>{const re=ne.new;u(J=>J?.id===re.id?re:J),re.status==="completed"&&ne.old.status!=="completed"&&j(e("transmute.asset_ready",{title:re.title}),"success")}).subscribe();return()=>{ae.removeChannel(W)}},[]);const O=async()=>{if(!S)try{C(!0),j(e("transmute.scanning"),"info");const{data:{session:K}}=await ae.auth.getSession(),W=Os(),ne={"Content-Type":"application/json","x-user-id":K?.user?.id||""};if(K?.access_token&&(ne.Authorization=`Bearer ${K.access_token}`),W&&(ne["x-supabase-url"]=W.url,ne["x-supabase-key"]=W.anonKey),!(await fetch("/api/engines/ensure-defaults",{method:"POST",headers:ne})).ok)throw new Error("Failed to generate engines");j(e("transmute.discovery_complete"),"success"),await T()}catch(K){console.error("Failed to generate engines:",K),j(e("transmute.discovery_failed"),"error")}finally{C(!1)}},T=async()=>{try{s(!0);const{data:{user:K}}=await ae.auth.getUser();if(!K)return;const{data:W,error:ne}=await ae.from("engines").select("*").eq("user_id",K.id).order("created_at",{ascending:!1});if(ne)throw ne;n(W)}catch(K){console.error("Error fetching engines:",K),j(e("transmute.load_failed"),"error")}finally{s(!1)}},N=async K=>{if(!o.has(K))try{a(D=>new Set(D).add(K)),j(e("transmute.starting_run"),"info");const{data:{session:W}}=await ae.auth.getSession(),ne=W?.access_token,re=Os(),J={"Content-Type":"application/json","x-user-id":W?.user?.id||""};ne&&(J.Authorization=`Bearer ${ne}`),re&&(J["x-supabase-url"]=re.url,J["x-supabase-key"]=re.anonKey);const ce=await fetch(`/api/engines/${K}/run`,{method:"POST",headers:J});if(!ce.ok){const D=await ce.json();throw new Error(D.error||"Run failed")}const A=await ce.json();A.status==="completed"?j(e("transmute.run_complete",{title:A.title}),"success"):j(e("transmute.run_started_desktop",{id:A.id}),"info"),u(A),n(D=>D.map(G=>G.id===K?{...G,last_run_at:new Date().toISOString()}:G))}catch(W){console.error("Engine run error:",W),j(W.message||e("transmute.run_failed"),"error")}finally{a(W=>{const ne=new Set(W);return ne.delete(K),ne})}},M=async K=>{try{y(!0);const{data:{session:W}}=await ae.auth.getSession(),ne=Os(),re={"Content-Type":"application/json","x-user-id":W?.user?.id||""};W?.access_token&&(re.Authorization=`Bearer ${W.access_token}`),ne&&(re["x-supabase-url"]=ne.url,re["x-supabase-key"]=ne.anonKey);const J=await fetch(`/api/engines/${K}/brief`,{headers:re});if(!J.ok)throw new Error("Failed to fetch brief");const ce=await J.json();p(ce)}catch{j(e("transmute.brief_failed"),"error")}finally{y(!1)}},V=async(K,W)=>{const ne=W==="active"?"paused":"active";n(re=>re.map(J=>J.id===K?{...J,status:ne}:J));try{const{error:re}=await ae.from("engines").update({status:ne}).eq("id",K);if(re)throw re;j(e("transmute.status_updated",{status:ne}),"success")}catch{n(J=>J.map(ce=>ce.id===K?{...ce,status:W}:ce)),j(e("common.error"),"error")}},U=()=>{k(!0)},L=K=>{const W=t.find(ne=>ne.id===K);W&&b(W)},Q=K=>{n(W=>W.find(re=>re.id===K.id)?W.map(re=>re.id===K.id?K:re):[K,...W])},Y=K=>{n(W=>W.filter(ne=>ne.id!==K))},he=()=>{b(null),k(!1)};return h.jsxs("div",{className:"h-full flex flex-col bg-bg",children:[h.jsx("div",{className:"flex-none p-6 border-b border-border bg-bg/50 backdrop-blur-sm z-10 sticky top-0",children:h.jsxs("div",{className:"flex justify-between items-center max-w-7xl mx-auto w-full",children:[h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-black italic tracking-tighter bg-clip-text text-transparent bg-gradient-to-r from-primary to-accent",children:e("transmute.title")}),h.jsx("p",{className:"text-xs text-fg/40 font-mono uppercase tracking-widest mt-1",children:e("transmute.desc")})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs("button",{onClick:O,disabled:S,className:"flex items-center gap-2 px-4 py-2.5 bg-primary/10 text-primary border border-primary/20 rounded-xl font-bold text-xs uppercase tracking-widest hover:bg-primary/20 transition-all disabled:opacity-50",children:[S?h.jsx(Rt,{className:"w-4 h-4 animate-spin"}):h.jsx(Vt,{className:"w-4 h-4"}),e("transmute.generate_engines")]}),h.jsxs("button",{onClick:U,className:"flex items-center gap-2 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white rounded-xl font-bold text-xs uppercase tracking-widest hover:scale-105 transition-all shadow-lg glow-primary",children:[h.jsx($f,{className:"w-4 h-4"}),e("transmute.new_engine")]})]})]})}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:h.jsx("div",{className:"max-w-7xl mx-auto w-full",children:r?h.jsx("div",{className:"flex items-center justify-center h-64",children:h.jsx(Rt,{className:"w-8 h-8 animate-spin text-purple-500"})}):t.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center h-96 text-center",children:[h.jsx("div",{className:"w-16 h-16 rounded-3xl bg-surface border border-border flex items-center justify-center mb-6 shadow-xl",children:h.jsx(Vt,{className:"w-8 h-8 text-fg/20"})}),h.jsx("h3",{className:"text-xl font-black italic tracking-tighter uppercase text-fg",children:e("transmute.no_engines")}),h.jsx("p",{className:"text-xs text-fg/40 font-mono tracking-widest uppercase max-w-sm mt-2 mb-8",children:e("transmute.no_engines_desc")}),h.jsx("button",{onClick:U,className:"px-8 py-3 rounded-xl border border-border bg-surface hover:bg-bg text-xs font-bold uppercase tracking-widest transition-all shadow-sm",children:e("transmute.create_engine")})]}):h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:h.jsx(Pt,{children:t.map(K=>h.jsx(wz,{engine:K,onRun:N,onEdit:L,onToggle:V,onViewBrief:M,isLoading:o.has(K.id)},K.id))})})})}),h.jsx(Pt,{children:f&&h.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-black/60 backdrop-blur-md",children:h.jsxs(Be.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg rounded-3xl shadow-2xl w-full max-w-4xl max-h-[85vh] flex flex-col overflow-hidden border border-border",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border bg-surface/50",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("div",{className:"p-3 rounded-2xl bg-primary/10 text-primary",children:h.jsx(y_,{className:"w-6 h-6"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-black italic tracking-tighter uppercase text-lg text-fg",children:e("transmute.view_json")}),h.jsx("p",{className:"text-[10px] text-fg/40 font-mono uppercase tracking-widest",children:e("transmute.json_contract")})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(f,null,2)),j(e("transmute.copied_json"),"info")},className:"p-2 text-fg/40 hover:text-primary hover:bg-primary/10 rounded-xl transition-all",children:h.jsx(zf,{className:"w-4 h-4"})}),h.jsx("button",{onClick:()=>p(null),className:"p-2 text-fg/40 hover:text-error hover:bg-error/10 rounded-xl transition-all",children:h.jsx(Nn,{className:"w-5 h-5"})})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/30 font-mono text-sm custom-scrollbar",children:h.jsx("pre",{className:"text-primary leading-relaxed",children:JSON.stringify(f,null,2)})}),h.jsx("div",{className:"p-4 border-t border-border bg-surface/50 text-[9px] text-fg/30 font-mono uppercase tracking-[0.2em] text-center",children:e("transmute.json_footer")})]})})}),g&&h.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/20 backdrop-blur-sm",children:h.jsx(Rt,{className:"w-10 h-10 animate-spin text-white"})}),h.jsx(bz,{asset:c,onClose:()=>u(null)}),v&&h.jsx(l_,{engine:v,onClose:he,onSave:Q,onDelete:Y}),w&&h.jsx(l_,{engine:null,onClose:he,onSave:Q})]})}class Sz{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 s=this.getAudioContext(),o=s.createOscillator(),a=s.createGain();o.connect(a),a.connect(s.destination),o.frequency.value=t,o.type="sine",a.gain.setValueAtTime(r,s.currentTime),a.gain.exponentialRampToValueAtTime(.01,s.currentTime+n),o.start(s.currentTime),o.stop(s.currentTime+n)}catch(s){console.warn("[Sound] Failed to play tone:",s)}}playSequence(t,n=.3){if(!this.enabled)return;let r=0;t.forEach(s=>{setTimeout(()=>{this.playTone(s.freq,s.duration,n)},r),r+=s.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 Uo=new Sz;function jz(){const{t:e}=et(),[t,n]=R.useState([]),[r,s]=R.useState([]),[o,a]=R.useState("discovery"),[c,u]=R.useState(!1),[f,p]=R.useState(null),[g,y]=R.useState(!0),[v,b]=R.useState(!x0),[w,k]=R.useState(!0),[S,C]=R.useState(!1),[j,O]=R.useState(!1),[T,N]=R.useState(null),[M,V]=R.useState(!1),[U,L]=R.useState(!1),[Q,Y]=R.useState(!1),[he,K]=R.useState(!0),[W,ne]=R.useState(()=>localStorage.getItem("theme")||"dark"),[re,J]=R.useState(null),ce=R.useRef(null);R.useMemo(()=>{const fe=r.length;let Ae=0,_e=0,me=null;for(const Zt of r){Ae+=Zt.score,Zt.score>_e&&(_e=Zt.score);const Rn=new Date(Zt.date);(!me||Rn>new Date(me.date))&&(me=Zt)}const tt=fe?Math.round(Ae/fe):0,Ot=me?new Date(me.date):null;return{total:fe,average:tt,top:_e,latestTimestamp:Ot,latestTitle:me?.title??me?.category??null}},[r]),R.useEffect(()=>{(async()=>{if(!x0){b(!0),y(!1);return}try{const{data:_e,error:me}=await ae.from("init_state").select("is_initialized").single();me?(console.warn("[App] Init check error (might be fresh DB):",me),me.code==="42P01"&&k(!1)):k(_e.is_initialized>0);const{data:{session:tt}}=await ae.auth.getSession();p(tt?.user??null)}catch(_e){console.error("[App] Status check failed:",_e)}finally{y(!1)}})();const{data:{subscription:Ae}}=ae.auth.onAuthStateChange((_e,me)=>{p(me?.user??null)});return()=>Ae.unsubscribe()},[]),R.useEffect(()=>{document.documentElement.setAttribute("data-theme",W),localStorage.setItem("theme",W)},[W]);const[A,D]=R.useState({});R.useEffect(()=>{(async()=>{if(!f)return;const{data:Ae}=await ae.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",f.id).maybeSingle();Ae&&D(Ae)})()},[f,M]),R.useEffect(()=>{if(!f)return;(async()=>{const{data:_e}=await ae.from("alchemy_settings").select("sound_enabled").eq("user_id",f.id).maybeSingle();if(_e){const me=_e.sound_enabled??!0;K(me),Uo.setEnabled(me)}})();const Ae=ae.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${f.id}`},_e=>{const me=_e.new;["Completed","Stopped","Failed"].includes(me.agent_state)||me.metadata?.is_completion?(L(!1),he&&(me.metadata?.errors>0||me.agent_state==="Failed"?Uo.error():me.agent_state==="Completed"&&Uo.syncComplete()),me.agent_state==="Completed"&&setTimeout(()=>{Y(!1)},5e3),G()):(U||L(!0),me.agent_state==="Mining"&&!U&&(Y(!0),he&&Uo.syncStart()),me.agent_state==="Signal"&&he&&Uo.signalFound())}).subscribe();return()=>{ae.removeChannel(Ae)}},[f,U,he]),R.useEffect(()=>{const fe=new EventSource("/events");return fe.onmessage=Ae=>{const _e=JSON.parse(Ae.data);_e.type==="history"?n(me=>[..._e.data,...me].slice(0,100)):n(me=>[_e,...me].slice(0,100))},G(),()=>fe.close()},[f]),R.useEffect(()=>{ce.current&&ce.current.scrollIntoView({behavior:"smooth"})},[t]);const G=async()=>{try{if(f){const{data:Ae,error:_e}=await ae.from("signals").select("*").order("created_at",{ascending:!1});if(!_e&&Ae){s(Ae.map(me=>({id:me.id,title:me.title,score:me.score,summary:me.summary,date:me.created_at,category:me.category,entities:me.entities})));return}}const fe=await Je.get("/api/signals");s(fe.data)}catch(fe){console.error("Failed to fetch signals",fe)}},P=async()=>{u(!0);try{await Je.post("/api/mine"),G()}catch(fe){console.error("Mining failed:",fe)}finally{u(!1)}},ve=async()=>{try{await Je.post("/api/mine/stop")}catch(fe){console.error("[App] Failed to stop sync:",fe)}},Ne=(fe,Ae)=>{fe==="logs"?(J(Ae),a("logs")):a(fe)};return g?h.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:h.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):v?h.jsx(Vw,{onComplete:()=>b(!1)}):f?h.jsx(yL,{children:h.jsx(bL,{children:h.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[h.jsxs(Be.aside,{animate:{width:S?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[h.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${S?"justify-center":""}`,children:[h.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:h.jsx(Vt,{className:"text-white fill-current",size:24})}),!S&&h.jsx(Be.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),h.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[h.jsx(vi,{active:o==="discovery",onClick:()=>a("discovery"),icon:h.jsx(Tj,{size:20}),label:e("tabs.discovery"),collapsed:S}),h.jsx(vi,{active:o==="chat",onClick:()=>a("chat"),icon:h.jsx(Uh,{size:20}),label:e("tabs.chat"),collapsed:S}),h.jsx(vi,{active:o==="transmute",onClick:()=>a("transmute"),icon:h.jsx(Vt,{size:20}),label:e("tabs.transmute"),collapsed:S}),h.jsx(vi,{active:o==="engine",onClick:()=>a("engine"),icon:h.jsx(cc,{size:20}),label:e("common.settings"),collapsed:S}),h.jsx(vi,{active:o==="logs",onClick:()=>a("logs"),icon:h.jsx(uc,{size:20}),label:e("tabs.logs"),collapsed:S}),h.jsx(vi,{active:o==="account",onClick:()=>a("account"),icon:h.jsx(Pc,{size:20}),label:e("common.account"),collapsed:S})]}),h.jsx("div",{className:"px-3 pb-2 border-t border-white/5 pt-4 mt-2 relative z-[100]",children:h.jsx("div",{className:S?"flex justify-center":"px-1",children:h.jsx(Op,{collapsed:S,position:"top"})})}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("button",{onClick:()=>ne(W==="dark"?"light":"dark"),className:`w-full flex items-center ${S?"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:S?e(W==="dark"?"shell.switch_light":"shell.switch_dark"):"",children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:W==="dark"?h.jsx(Uj,{size:18}):h.jsx(Oj,{size:18})}),!S&&h.jsx(Be.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:e(W==="dark"?"common.light_mode":"common.dark_mode")})]})}),h.jsxs("div",{className:"px-3 pb-3",children:[h.jsx("button",{onClick:()=>C(!S),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 ${S?"justify-center":"gap-3"}`,children:S?h.jsx(vj,{size:20}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:h.jsx(xj,{size:20})}),h.jsx("span",{children:e("common.collapse")})]})}),h.jsxs("button",{onClick:()=>O(!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:e("shell.view_changelog"),children:[!S&&h.jsxs(h.Fragment,{children:[h.jsx(qh,{size:12,className:"group-hover:text-primary transition-colors"}),h.jsxs("span",{children:["v","1.0.72"]})]}),S&&h.jsx(qh,{size:14,className:"group-hover:text-primary transition-colors"})]})]})]}),h.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-bold",children:e("tabs.discovery")}),h.jsx("p",{className:"text-sm text-fg/50",children:e("setup.welcome_desc")})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("button",{onClick:()=>V(!0),className:"px-6 py-3 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[h.jsx(cc,{size:16}),h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("span",{children:e("discovery.sync_settings")}),h.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:A.sync_start_date?`${e("discovery.from")}: ${new Date(A.sync_start_date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:A.last_sync_checkpoint?`${e("discovery.checkpoint")}: ${new Date(A.last_sync_checkpoint).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:e("discovery.all_time")})]})]}),h.jsxs("button",{onClick:P,disabled:U,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-105 active:scale-95 transition-all flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",children:[h.jsx(_a,{size:18,className:U?"animate-spin":""}),e(U?"discovery.syncing":"discovery.sync_history")]})]})]}),h.jsx(HL,{onOpenUrl:fe=>window.open(fe,"_blank","noopener,noreferrer"),onSync:P,isSyncing:U,onCopyText:fe=>{navigator.clipboard.writeText(fe)}})]}),o==="chat"&&h.jsx(vz,{}),o==="transmute"&&h.jsx(kz,{}),o==="engine"&&h.jsx(_L,{}),o==="account"&&h.jsx(CL,{}),o==="logs"&&h.jsx(ML,{initialState:re}),h.jsx(kL,{isExpanded:Q,onToggle:()=>Y(!Q),onNavigate:Ne,liftUp:o==="chat",isSyncing:U,onStop:ve})]}),h.jsx(RL,{signal:T,onClose:()=>N(null)}),h.jsx(PL,{isOpen:M,onClose:()=>V(!1)}),h.jsx(_z,{isOpen:j,onClose:()=>O(!1)})]})})}):h.jsx(fL,{onAuthSuccess:()=>G(),isInitialized:w})}function vi({active:e,icon:t,label:n,onClick:r,collapsed:s}){return h.jsx("button",{onClick:r,title:s?n:"",className:`w-full flex items-center ${s?"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:s?ra.cloneElement(t,{className:e?"text-primary":""}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:ra.cloneElement(t,{className:e?"text-primary":""})}),h.jsx(Be.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function Ez(){Je.interceptors.request.use(async e=>{try{const{data:{session:t}}=await ae.auth.getSession();t?.access_token&&(e.headers.Authorization=`Bearer ${t.access_token}`);const n=Os();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})}const{slice:Cz,forEach:Tz}=[];function Nz(e){return Tz.call(Cz.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}function Az(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(e))}const c_=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Rz=function(e,t){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},s=encodeURIComponent(t);let o=`${e}=${s}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!c_.test(r.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${r.domain}`}if(r.path){if(!c_.test(r.path))throw new TypeError("option path is invalid");o+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(o+="; HttpOnly"),r.secure&&(o+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(o+="; Partitioned"),o},u_={create(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+n*60*1e3)),r&&(s.domain=r),document.cookie=Rz(e,t,s)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let s=n[r];for(;s.charAt(0)===" ";)s=s.substring(1,s.length);if(s.indexOf(t)===0)return s.substring(t.length,s.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var Pz={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return u_.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:s,cookieOptions:o}=t;n&&typeof document<"u"&&u_.create(n,e,r,s,o)}},Oz={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const o=r.substring(1).split("&");for(let a=0;a<o.length;a++){const c=o[a].indexOf("=");c>0&&o[a].substring(0,c)===t&&(n=o[a].substring(c+1))}}return n}},Lz={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window<"u"){const{hash:s}=window.location;if(s&&s.length>2){const o=s.substring(1);if(t){const a=o.split("&");for(let c=0;c<a.length;c++){const u=a[c].indexOf("=");u>0&&a[c].substring(0,u)===t&&(r=a[c].substring(u+1))}}if(r)return r;if(!r&&n>-1){const a=s.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?a[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return r}};let _i=null;const d_=()=>{if(_i!==null)return _i;try{if(_i=typeof window<"u"&&window.localStorage!==null,!_i)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{_i=!1}return _i};var Iz={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&d_())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&d_()&&window.localStorage.setItem(n,e)}};let bi=null;const h_=()=>{if(bi!==null)return bi;try{if(bi=typeof window<"u"&&window.sessionStorage!==null,!bi)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{bi=!1}return bi};var Dz={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&h_())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&h_()&&window.sessionStorage.setItem(n,e)}},Mz={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:s}=navigator;if(n)for(let o=0;o<n.length;o++)t.push(n[o]);r&&t.push(r),s&&t.push(s)}return t.length>0?t:void 0}},zz={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},Fz={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?n[typeof t=="number"?t:0]?.replace("/",""):void 0}},$z={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};let e1=!1;try{document.cookie,e1=!0}catch{}const t1=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];e1||t1.splice(1,1);const Uz=()=>({order:t1,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class n1{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=Nz(n,this.options||{},Uz()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=s=>s.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(Pz),this.addDetector(Oz),this.addDetector(Iz),this.addDetector(Dz),this.addDetector(Mz),this.addDetector(zz),this.addDetector(Fz),this.addDetector($z),this.addDetector(Lz)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return t.forEach(r=>{if(this.detectors[r]){let s=this.detectors[r].lookup(this.options);s&&typeof s=="string"&&(s=[s]),s&&(n=n.concat(s))}}),n=n.filter(r=>r!=null&&!Az(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}n1.type="languageDetector";const Bz={save:"Save",cancel:"Cancel",loading:"Loading...",error:"Error",success:"Success",settings:"Settings",search:"Search",back:"Back",all:"All",delete:"Delete",update:"Update",edit:"Edit",close:"Close",complete:"Complete",skip:"Skip",begin:"Begin",connection:"Connection",setup:"Setup",project:"Project",account:"Account",logout:"Logout",welcome:"Welcome",dark_mode:"Dark Mode",light_mode:"Light Mode",collapse:"Collapse",just_now:"Just now",enabled:"Enabled",disabled:"Disabled",quick:"Quick (5)",balanced:"Balanced (50)",thorough:"Thorough (200)",resetting:"Resetting...",saving:"Saving...",locale_code:"en-US",categories:{ai_ml:"AI & ML",business:"Business",politics:"Politics",technology:"Technology",finance:"Finance",crypto:"Crypto",science:"Science",other:"Other"}},Vz={discovery:"Discovery",chat:"Chat",transmute:"Transmute",logs:"System Logs",history:"History"},qz={welcome_title:"Assemble Your Engine",welcome_desc:"Alchemy requires a Supabase essence to store signal fragments and intelligence patterns.",requirements:"Requirements:",project_url:"Supabase Project URL",anon_key:"Anon Public API Key",db_password:"Database Password",project_url_placeholder:"https://xxx.supabase.co or project-id",anon_key_placeholder:"eyJ...",project_id_placeholder:"abcdefghijklm",access_token_placeholder:"sbp_...",begin_init:"BEGIN INITIALIZATION",connect_essence:"CONNECT ESSENCE",credentials_title:"Essence Coordinates",credentials_desc:"Link the alchemist engine to your cloud database",validating:"Validating Link",resonance:"Synchronizing Resonance...",init_schema:"Initialize Schema",schema_desc:"Run database migrations to set up required tables and functions.",project_id:"Project ID",access_token:"Access Token",run_migrations:"RUN MIGRATIONS",running_migrations:"Running Migrations",take_minute:"This may take a minute...",engine_aligned:"Engine Aligned",restarting:"Restarting Alchemist Subsystems...",forge_project:"Forge Project at Supabase",project_id_help:"Found in Supabase Dashboard → Project Settings → General",access_token_help:"Generate at",access_token_link:"supabase.com/dashboard/account/tokens",project_id_required:"Project ID is required",access_token_required:"Access token is required",migration_failed_logs:"Migration failed. Check logs for details.",stream_error:"Failed to read migration stream",back:"BACK",retry:"RETRY"},Hz={title_init:"INITIALIZE MASTER",title_join:"JOIN THE CIRCLE",title_mystic:"MYSTIC ACCESS",title_login:"ALCHEMIST LOGIN",desc_init:"Forge the prime alchemist account",desc_mystic_email:"Enter your essence email",desc_mystic_code:"Transmute the sacred code",desc_login:"Transmute your data into intelligence",first_name:"First Name",last_name:"Last Name",first_name_placeholder:"Zosimos",last_name_placeholder:"Panopolis",email_address:"Email Address",email_placeholder:"alchemist@example.com",complexity_key:"Complexity Key",password_placeholder:"••••••••",init_account:"INITIALIZE ACCOUNT",send_code:"SEND CODE",unseal_engine:"UNSEAL ENGINE",verify_code:"VERIFY CODE",change_email:"Change email address",sign_in_code:"Sign in with Code",sign_in_password:"Sign in with Password",already_alchemist:"Already an Alchemist?",new_to_alchemy:"New to Alchemy?",login_instead:"Login instead",create_account:"Create an account",session_failed:"Failed to create session",invalid_code:"Invalid code"},Kz={filters:"Filters",category:"Category",intelligence_score:"Intelligence Score",no_signals_in_category:"No signals in {{category}} yet.",no_categories:"No categories yet.",discovery_hint:"Signals will be organized here once discovered.",loading_signals:"Loading signals...",dismiss_hint:"Dismiss (Not Interested)",signal_count_one:"{{count}} signal",signal_count_other:"{{count}} signals",time_min_ago:"{{count}}m ago",time_hour_ago:"{{count}}h ago",time_day_ago:"{{count}}d ago",add_note_title:"Add Note",target:"Target",note_placeholder:"Enter your thoughts, ideas, or action items regarding this signal...",save_note:"Save Note",view_all_sources:"View all sources",source_count_one:"{{count}} source",source_count_other:"{{count}} sources",source_found_in:"Found in {{count}} different sources",high_confidence:"High confidence - found in {{count}} sources",new_signals:"New Signals",smart_summary:"Smart Summary",entities:"Entities",sources:"Sources",last_sync:"Last Sync",syncnow:"Sync Now",all_time:"All time",checkpoint:"Checkpoint",from:"From",score_high:"HIGH",score_medium:"MEDIUM",score_low:"LOW",sources_count:"{{count}} sources",open_source:"Open",add_note:"Note",boost_topic:"Boost Topic",boosted:"Boosted",dismissed:"Dismissed",remove_favourite:"Remove from favourites",add_favourite:"Add to favourites",sync_history:"Sync History",syncing:"Syncing...",sync_settings:"Sync Settings",discovered:"Discovered",original_source:"Original Source",ai_summary:"AI Summary",full_content:"Full Content",copied:"Copied!",open_link:"Open",detail_title:"Signal Details",sync_from:"Sync From (Optional)",urls_per_sync:"URLs per Sync",sync_from_hint:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward.",reset_checkpoint:"Reset Checkpoint",reset_checkpoint_hint:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date',sync_info:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.',save_settings:"Save Settings",sync_saved:"Sync settings saved successfully",checkpoint_reset:"Checkpoint reset successfully",login_to_save:"Please log in to save settings",login_to_reset:"Please log in to reset checkpoint",status_updated:"Engine status updated to {{status}}",asset_ready:'Asset "{{title}}" is ready!',scanning:"Scanning for new categories and topics...",discovery_complete:"Engine discovery complete!",discovery_failed:"Discovery failed. Check settings.",welcome_title:"Welcome to Alchemist!",welcome_desc:"Connect your browser history to start discovering signals. We'll automatically analyze your visited pages to find mentions of AI, tech, and more.",auto_detect_sync:"Auto-detect & Sync",privacy_first:"Privacy First",offline_first:"Offline First",load_failed:"Failed to load engines",starting_run:"Starting engine run...",run_complete:"Engine run complete! Created: {{title}}",run_started_desktop:"Engine run started on Desktop. Tracking as: {{id}}",run_failed:"Failed to run engine",brief_failed:"Failed to generate production brief",topic:"Topic",pipeline:"Pipeline"},Wz={history:"History",ask_anything:"Ask anything about your browsing history...",sources:"Sources",processing:"Processing your query...",new_chat:"New Chat",no_messages:"No messages yet. Start a conversation!",no_history:"No chat history yet.",title:"Ask Alchemist",desc:"I can help you recall information, summarize topics, and find insights from your browsing history.",thinking:"Exploring memory...",placeholder:"Ask about your history...",error_message:"Sorry, I encountered an error processing your request.",relevant_context:"Relevant Context",match_score:"{{score}}% Match",rag_attribution:"Alchemist used these {{count}} signals to answer",suggestions:{react:"What have I read about React recently?",ai:"Summarize the latest AI news I visited.",finance:"Do I have any notes on Finance?",performance:"Find articles about 'Performance'"}},Gz={engines:"Alchemist Engines",assets:"Generated Assets",newsletter:"Newsletter",thread:"Thread",audio:"Audio",report:"Report",title:"Transmute Engine",desc:"Active Generation Pipelines & Assets",generate:"Generate",processing_desktop:"Processing on Desktop...",ensure_defaults:"Ensure Default Engines",create_engine:"Create Engine",no_assets:"No assets generated yet.",generate_engines:"Generate Engines",new_engine:"New Engine",no_engines:"No Engines Configured",no_engines_desc:"Create your first pipeline to automatically turn signals into newsletters, threads, or audio briefs.",run_engine:"Run Engine",running:"Running...",last_run:"Last Run",never:"Never",schedule:"Schedule",manual:"Manual",topic:"Topic",pipeline:"Pipeline",pause:"Pause",resume:"Resume",view_json:"View Production Brief JSON",json_contract:"Stateless & Self-Contained Contract",json_desc:"This JSON contains the full context (Signals + User Persona) required for the Desktop Studio.",generating_asset:"Generating Asset...",queued_desktop:"Queued for Desktop...",desktop_processing:"The RealTimeX Desktop app is processing this request. This modal will update automatically once finished.",unsupported_type:"Unsupported asset type",edit_engine:"Edit Engine",engine_name:"Engine Name",type:"Type",status:"Status",execution_env:"Execution Environment",local_llm:"Local (Alchemy LLM)",desktop_swarm:"RealTimeX Desktop (Agent Swarm)",env_desc_desktop:"Delegates heavy tasks like Audio/Video to the desktop app.",env_desc_local:"Runs simple Markdown tasks directly in Alchemy.",min_score:"Min Score",max_signals:"Max Signals",category_filter:"Category Filter (multi-select)",multi_select_hint:"Hold Cmd/Ctrl to select multiple categories",schedule_hint:"Note: Scheduling is not yet automated",prompt_override:"Custom Prompt Override (optional)",prompt_placeholder:"Override the default prompt for this engine type...",delete_confirm:"Really delete?",confirm:"Confirm",copied_json:"JSON copied to clipboard",json_footer:"This JSON contains the full context (Signals + User Persona) required for the Desktop Studio."},Jz={title:"Account Configuration",desc:"Manage your Alchemist profile and essence links.",profile:"Profile",security:"Security",supabase:"Supabase",first_name:"First Name",last_name:"Last Name",email_locked:"Email Address (Locked)",sound_effects:"Sound Effects",sound_desc:"Enable audio feedback for sync events and signal discoveries.",sign_out:"Sign Out",logout_desc:"End your current session and return to the login screen.",preserve_profile:"Preserve Profile",security_title:"Update Entropy Key",new_password:"New Password",confirm_password:"Confirm Password",password_mismatch:"Complexity keys do not match.",password_too_short:"Entropy too low. Minimum 8 characters.",password_rotate_success:"Key rotation successful.",rotate_key:"Rotate Key",essence_resonance:"Essence Resonance",byok_desc:"Bring Your Own Keys (BYOK) for intelligence persistence.",established_link:"Established Link",env_notice:"Active from environment variables. UI override enabled.",realign_link:"Realign Link",sever_link:"Sever Link",sever_confirm:"Sever connection to this essence? This will reset local resonance.",anon_secret_fragment:"Anon Secret Fragment",no_resonance:"No Essence Resonance",no_resonance_desc:"The Alchemist requires a cloud core to store intelligence fragments.",initiate_link:"Initiate Link",test_connection:"Test Connection"},Xz={title:"System Logs",desc:"Detailed history of sync runs, sources, and URL processing",blacklist_suggestion:"Potential Blacklist",blacklist_desc:"Candidates for blocking",recent_errors:"Recent Errors",errors_desc:"Failed URL processes",total_signals:"Total Signals",signals_desc:"Successfully mined",blacklist_modal_title:"Blacklist Suggestions",blacklist_modal_desc:"Review domains suggested for blacklisting based on low scores.",no_suggestions:"No suggestions right now",quality_good:"Your signal quality looks good!",signals_count:"{{count}} signals",avg_score:"Avg Score: {{score}}",low_quality:"Consistently Low Quality",repetitive:"Repetitive Pattern",blacklist_domain:"Blacklist Domain",errors_modal_title:"Recent Errors",errors_modal_desc:"Log of recent failures and issues.",no_recent_errors:"No recent errors found.",signals_modal_title:"Found Signals",signals_modal_desc:"Browse and manage your mined signals history.",search_placeholder:"Search signals...",any_score:"Any Score",high_score:"High (80%+)",medium_score:"Medium (50-79%)",low_score:"Low (<50%)",all_categories:"All Categories",page_x:"Page {{page}}"},Yz={title:"Alchemist Engine",live:"LIVE",clear:"Clear",idle:"Idle. Awaiting signal mining events...",run_completed:"Mining Run Completed",signals:"Signals",urls:"URLs",skipped:"Skipped",failed_to_process:"{{count}} URLs failed to process",view_logs:"View Logs",hide_details:"Hide Details",view_details:"View Details",engine_log:"Live Engine Log",stop_sync:"Stop Sync",state_reading:"Reading",state_thinking:"Thinking",state_signal:"Signal",state_skipped:"Skipped",state_error:"Error",state_completed:"Completed",msg_reading:"Reading content from: {{url}}",msg_thinking:"Analyzing relevance of: {{title}}",msg_found_signal:"Found signal: {{summary}} ({{score}}%)",msg_low_signal:"Low signal stored for review ({{score}}%): {{title}}",msg_failed:"Analysis failed for {{title}}: {{error}}",msg_sync_completed:"Sync completed: {{signals}} signals found, {{skipped}} skipped, {{errors}} errors"},Qz={switch_light:"Switch to Light Mode",switch_dark:"Switch to Dark Mode",view_changelog:"View Changelog",release_notes:"Release Notes",changelog_error:"Failed to load changelog."},Zz={title:"Signal Pulse",mining:"Mining",standing_by:"Standing by",idle:"Idle",tracked:"Signals tracked",avg_score:"Average score",top_signal:"Top signal",latest:"Latest",awaiting:"Awaiting mining",no_signals:"No signals yet"},eF={title:"Intelligence Engine",subtitle:"Fine-tune the Alchemist's cognitive parameters and provider links.",configuration:"AI Configuration",test_connection:"Test Connection",save_config:"Save Configuration",llm_provider:"LLM Provider",embedding_provider:"Embedding Provider",sdk_connected:"SDK Connected",sdk_not_available:"SDK Not Available",provider:"Provider",intelligence_model:"Intelligence Model",embedding_model:"Embedding Model",loading_providers:"Loading providers...",sdk_info_success:"✓ Using RealTimeX configured provider",sdk_info_fail:"⚠️ RealTimeX SDK not detected. Configure in RealTimeX Desktop.",embedding_info_success:"✓ Embeddings are generated using your RealTimeX configured provider",embedding_info_fail:"⚠️ RealTimeX SDK not detected. Configure providers in RealTimeX Desktop.",persona_title:"Persona Memory",save_memory:"Save Memory",interests_title:"Active Interests",interests_priority:"High Priority",interests_desc:"The Alchemist prioritizes content matching these topics. Updated automatically based on Favorites & Boosts.",interests_placeholder:"e.g. User focuses on React performance, Rust backend systems, and AI Agent architecture...",antipatterns_title:"Anti-Patterns",antipatterns_priority:"Avoid",antipatterns_desc:"The Alchemist filters out or scores down content matching these patterns. Updated via Dismissals.",antipatterns_placeholder:"e.g. Dislikes marketing fluff, generic listicles, and crypto hype...",browser_sources:"Browser History Sources",save_browser:"Save Browser Sources",blacklist_title:"Blacklist Domains",blacklist_desc:"URLs containing these patterns will be skipped during mining. Enter one pattern per line.",blacklist_label:"Domain Patterns (one per line)",blacklist_placeholder:`google.com/search
135
135
  localhost:
136
136
  127.0.0.1
137
137
  facebook.com
@@ -167,4 +167,4 @@ localhost:
167
167
  facebook.com
168
168
  twitter.com
169
169
  instagram.com
170
- linkedin.com/feed`,blacklist_examples:"Ví dụ: google.com/search, localhost:, facebook.com, twitter.com",save_blacklist:"Lưu Danh sách đen",blocked_tags_title:"Thẻ bị Chặn",blocked_tags_desc:"Các tín hiệu có các thẻ này sẽ bị loại khỏi quá trình tạo danh mục động và bản tin. Nhập một thẻ mỗi dòng.",blocked_tags_label:"Thẻ (cách nhau bằng dấu chấm phẩy)",blocked_tags_placeholder:"login; signup; footer; navigation",blocked_tags_info:"Bạn có toàn quyền kiểm soát. Các thẻ này sẽ thay thế hoàn toàn các giá trị mặc định của hệ thống.",save_blocked_tags:"Lưu Thẻ bị Chặn",save_error_login:"Vui lòng đăng nhập để lưu cài đặt",save_error_persona:"Vui lòng đăng nhập để lưu cá nhân",save_success_llm:"Đã lưu cài đặt LLM thành công",save_success_browser:"Đã lưu nguồn trình duyệt thành công",save_success_blacklist:"Đã cập nhật danh sách đen thành công",save_success_tags:"Đã cập nhật các thẻ bị chặn thành công",save_success_persona:"Đã cập nhật cá nhân thành công",test_success:"Kết nối thành công! {{model}}",test_fail:"Kết nối thất bại: {{message}}",auto_detect_title:"Tự động phát hiện trình duyệt",scan_system:"Quét hệ thống",scanning:"Đang quét...",auto_detected:"Đã tự động phát hiện",custom:"Tùy chỉnh",add_source:"Thêm nguồn",already_added:"Đã thêm rồi",not_found:"Không tìm thấy trên hệ thống này",add_custom_path:"Thêm đường dẫn tùy chỉnh",custom_path_placeholder:"/duong/dan/den/trinh/duyet/History",add_custom_source:"Thêm nguồn tùy chỉnh",validating:"Đang xác thực...",configured_sources:"Nguồn đã cấu hình ({{count}})",enabled:"Đã bật",disabled:"Đã tắt",invalid_path:"Đường dẫn không hợp lệ: {{error}}",validation_failed:"Xác thực đường dẫn thất bại",discovered_sources:"Đã phát hiện {{count}} nguồn trình duyệt",no_sources_found:"Không tìm thấy nguồn trình duyệt nào",auto_discover_sources:"Tự động phát hiện nguồn",auto_discover_hint:"Tự động tìm đường dẫn lịch sử cho tất cả hồ sơ trình duyệt."},y$={common:s$,tabs:i$,setup:o$,auth:a$,discovery:l$,chat:c$,transmute:u$,account:d$,logs:h$,terminal:f$,shell:p$,stats:m$,engine:g$};sn.use(n1).use(_R).init({resources:{en:{translation:tF},fr:{translation:mF},es:{translation:NF},ko:{translation:VF},ja:{translation:r$},vi:{translation:y$}},supportedLngs:["en","fr","es","ko","ja","vi"],fallbackLng:"en",load:"languageOnly",interpolation:{escapeValue:!1},detection:{order:["querystring","localStorage","navigator"],caches:["localStorage"],lookupLocalStorage:"i18nextLng"}});Ez();oj.createRoot(document.getElementById("root")).render(h.jsx(ra.StrictMode,{children:h.jsx(jz,{})}));
170
+ linkedin.com/feed`,blacklist_examples:"Ví dụ: google.com/search, localhost:, facebook.com, twitter.com",save_blacklist:"Lưu Danh sách đen",blocked_tags_title:"Thẻ bị Chặn",blocked_tags_desc:"Các tín hiệu có các thẻ này sẽ bị loại khỏi quá trình tạo danh mục động và bản tin. Nhập một thẻ mỗi dòng.",blocked_tags_label:"Thẻ (cách nhau bằng dấu chấm phẩy)",blocked_tags_placeholder:"login; signup; footer; navigation",blocked_tags_info:"Bạn có toàn quyền kiểm soát. Các thẻ này sẽ thay thế hoàn toàn các giá trị mặc định của hệ thống.",save_blocked_tags:"Lưu Thẻ bị Chặn",save_error_login:"Vui lòng đăng nhập để lưu cài đặt",save_error_persona:"Vui lòng đăng nhập để lưu cá nhân",save_success_llm:"Đã lưu cài đặt LLM thành công",save_success_browser:"Đã lưu nguồn trình duyệt thành công",save_success_blacklist:"Đã cập nhật danh sách đen thành công",save_success_tags:"Đã cập nhật các thẻ bị chặn thành công",save_success_persona:"Đã cập nhật cá nhân thành công",test_success:"Kết nối thành công! {{model}}",test_fail:"Kết nối thất bại: {{message}}",auto_detect_title:"Tự động phát hiện trình duyệt",scan_system:"Quét hệ thống",scanning:"Đang quét...",auto_detected:"Đã tự động phát hiện",custom:"Tùy chỉnh",add_source:"Thêm nguồn",already_added:"Đã thêm rồi",not_found:"Không tìm thấy trên hệ thống này",add_custom_path:"Thêm đường dẫn tùy chỉnh",custom_path_placeholder:"/duong/dan/den/trinh/duyet/History",add_custom_source:"Thêm nguồn tùy chỉnh",validating:"Đang xác thực...",configured_sources:"Nguồn đã cấu hình ({{count}})",enabled:"Đã bật",disabled:"Đã tắt",invalid_path:"Đường dẫn không hợp lệ: {{error}}",validation_failed:"Xác thực đường dẫn thất bại",discovered_sources:"Đã phát hiện {{count}} nguồn trình duyệt",no_sources_found:"Không tìm thấy nguồn trình duyệt nào",auto_discover_sources:"Tự động phát hiện nguồn",auto_discover_hint:"Tự động tìm đường dẫn lịch sử cho tất cả hồ sơ trình duyệt."},y$={common:s$,tabs:i$,setup:o$,auth:a$,discovery:l$,chat:c$,transmute:u$,account:d$,logs:h$,terminal:f$,shell:p$,stats:m$,engine:g$};on.use(n1).use(_R).init({resources:{en:{translation:tF},fr:{translation:mF},es:{translation:NF},ko:{translation:VF},ja:{translation:r$},vi:{translation:y$}},supportedLngs:["en","fr","es","ko","ja","vi"],fallbackLng:"en",load:"languageOnly",interpolation:{escapeValue:!1},detection:{order:["querystring","localStorage","navigator"],caches:["localStorage"],lookupLocalStorage:"i18nextLng"}});Ez();oj.createRoot(document.getElementById("root")).render(h.jsx(ra.StrictMode,{children:h.jsx(jz,{})}));