@amd-gaia/agent-ui 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,565 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();var ba=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function io(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yh={exports:{}},so={},Xh={exports:{}},Ee={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var kl=Symbol.for("react.element"),kv=Symbol.for("react.portal"),wv=Symbol.for("react.fragment"),bv=Symbol.for("react.strict_mode"),jv=Symbol.for("react.profiler"),Sv=Symbol.for("react.provider"),Nv=Symbol.for("react.context"),Cv=Symbol.for("react.forward_ref"),_v=Symbol.for("react.suspense"),Ev=Symbol.for("react.memo"),Tv=Symbol.for("react.lazy"),vf=Symbol.iterator;function zv(e){return e===null||typeof e!="object"?null:(e=vf&&e[vf]||e["@@iterator"],typeof e=="function"?e:null)}var Jh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Zh=Object.assign,ep={};function as(e,t,n){this.props=e,this.context=t,this.refs=ep,this.updater=n||Jh}as.prototype.isReactComponent={};as.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};as.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function tp(){}tp.prototype=as.prototype;function Lu(e,t,n){this.props=e,this.context=t,this.refs=ep,this.updater=n||Jh}var Au=Lu.prototype=new tp;Au.constructor=Lu;Zh(Au,as.prototype);Au.isPureReactComponent=!0;var kf=Array.isArray,np=Object.prototype.hasOwnProperty,Du={current:null},rp={key:!0,ref:!0,__self:!0,__source:!0};function ip(e,t,n){var r,i={},l=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(l=""+t.key),t)np.call(t,r)&&!rp.hasOwnProperty(r)&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var c=Array(o),u=0;u<o;u++)c[u]=arguments[u+2];i.children=c}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return{$$typeof:kl,type:e,key:l,ref:a,props:i,_owner:Du.current}}function Lv(e,t){return{$$typeof:kl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Iu(e){return typeof e=="object"&&e!==null&&e.$$typeof===kl}function Av(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var wf=/\/+/g;function Lo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Av(""+e.key):t.toString(36)}function aa(e,t,n,r,i){var l=typeof e;(l==="undefined"||l==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(l){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case kl:case kv:a=!0}}if(a)return a=e,i=i(a),e=r===""?"."+Lo(a,0):r,kf(i)?(n="",e!=null&&(n=e.replace(wf,"$&/")+"/"),aa(i,t,n,"",function(u){return u})):i!=null&&(Iu(i)&&(i=Lv(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(wf,"$&/")+"/")+e)),t.push(i)),1;if(a=0,r=r===""?".":r+":",kf(e))for(var o=0;o<e.length;o++){l=e[o];var c=r+Lo(l,o);a+=aa(l,t,n,c,i)}else if(c=zv(e),typeof c=="function")for(e=c.call(e),o=0;!(l=e.next()).done;)l=l.value,c=r+Lo(l,o++),a+=aa(l,t,n,c,i);else if(l==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Ml(e,t,n){if(e==null)return e;var r=[],i=0;return aa(e,r,"","",function(l){return t.call(n,l,i++)}),r}function Dv(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ut={current:null},oa={transition:null},Iv={ReactCurrentDispatcher:Ut,ReactCurrentBatchConfig:oa,ReactCurrentOwner:Du};function sp(){throw Error("act(...) is not supported in production builds of React.")}Ee.Children={map:Ml,forEach:function(e,t,n){Ml(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ml(e,function(){t++}),t},toArray:function(e){return Ml(e,function(t){return t})||[]},only:function(e){if(!Iu(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ee.Component=as;Ee.Fragment=wv;Ee.Profiler=jv;Ee.PureComponent=Lu;Ee.StrictMode=bv;Ee.Suspense=_v;Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Iv;Ee.act=sp;Ee.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Zh({},e.props),i=e.key,l=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(l=t.ref,a=Du.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(c in t)np.call(t,c)&&!rp.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&o!==void 0?o[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){o=Array(c);for(var u=0;u<c;u++)o[u]=arguments[u+2];r.children=o}return{$$typeof:kl,type:e.type,key:i,ref:l,props:r,_owner:a}};Ee.createContext=function(e){return e={$$typeof:Nv,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Sv,_context:e},e.Consumer=e};Ee.createElement=ip;Ee.createFactory=function(e){var t=ip.bind(null,e);return t.type=e,t};Ee.createRef=function(){return{current:null}};Ee.forwardRef=function(e){return{$$typeof:Cv,render:e}};Ee.isValidElement=Iu;Ee.lazy=function(e){return{$$typeof:Tv,_payload:{_status:-1,_result:e},_init:Dv}};Ee.memo=function(e,t){return{$$typeof:Ev,type:e,compare:t===void 0?null:t}};Ee.startTransition=function(e){var t=oa.transition;oa.transition={};try{e()}finally{oa.transition=t}};Ee.unstable_act=sp;Ee.useCallback=function(e,t){return Ut.current.useCallback(e,t)};Ee.useContext=function(e){return Ut.current.useContext(e)};Ee.useDebugValue=function(){};Ee.useDeferredValue=function(e){return Ut.current.useDeferredValue(e)};Ee.useEffect=function(e,t){return Ut.current.useEffect(e,t)};Ee.useId=function(){return Ut.current.useId()};Ee.useImperativeHandle=function(e,t,n){return Ut.current.useImperativeHandle(e,t,n)};Ee.useInsertionEffect=function(e,t){return Ut.current.useInsertionEffect(e,t)};Ee.useLayoutEffect=function(e,t){return Ut.current.useLayoutEffect(e,t)};Ee.useMemo=function(e,t){return Ut.current.useMemo(e,t)};Ee.useReducer=function(e,t,n){return Ut.current.useReducer(e,t,n)};Ee.useRef=function(e){return Ut.current.useRef(e)};Ee.useState=function(e){return Ut.current.useState(e)};Ee.useSyncExternalStore=function(e,t,n){return Ut.current.useSyncExternalStore(e,t,n)};Ee.useTransition=function(){return Ut.current.useTransition()};Ee.version="18.3.1";Xh.exports=Ee;var p=Xh.exports;const Ki=io(p);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Pv=p,Mv=Symbol.for("react.element"),Rv=Symbol.for("react.fragment"),$v=Object.prototype.hasOwnProperty,Fv=Pv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ov={key:!0,ref:!0,__self:!0,__source:!0};function lp(e,t,n){var r,i={},l=null,a=null;n!==void 0&&(l=""+n),t.key!==void 0&&(l=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)$v.call(t,r)&&!Ov.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Mv,type:e,key:l,ref:a,props:i,_owner:Fv.current}}so.Fragment=Rv;so.jsx=lp;so.jsxs=lp;Yh.exports=so;var s=Yh.exports,wc={},ap={exports:{}},on={},op={exports:{}},cp={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(T,I){var b=T.length;T.push(I);e:for(;0<b;){var X=b-1>>>1,H=T[X];if(0<i(H,I))T[X]=I,T[b]=H,b=X;else break e}}function n(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var I=T[0],b=T.pop();if(b!==I){T[0]=b;e:for(var X=0,H=T.length,S=H>>>1;X<S;){var ie=2*(X+1)-1,ye=T[ie],ae=ie+1,be=T[ae];if(0>i(ye,b))ae<H&&0>i(be,ye)?(T[X]=be,T[ae]=b,X=ae):(T[X]=ye,T[ie]=b,X=ie);else if(ae<H&&0>i(be,b))T[X]=be,T[ae]=b,X=ae;else break e}}return I}function i(T,I){var b=T.sortIndex-I.sortIndex;return b!==0?b:T.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var c=[],u=[],d=1,f=null,h=3,m=!1,g=!1,k=!1,v=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,w=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(T){for(var I=n(u);I!==null;){if(I.callback===null)r(u);else if(I.startTime<=T)r(u),I.sortIndex=I.expirationTime,t(c,I);else break;I=n(u)}}function z(T){if(k=!1,j(T),!g)if(n(c)!==null)g=!0,le(D);else{var I=n(u);I!==null&&fe(z,I.startTime-T)}}function D(T,I){g=!1,k&&(k=!1,x(C),C=-1),m=!0;var b=h;try{for(j(I),f=n(c);f!==null&&(!(f.expirationTime>I)||T&&!U());){var X=f.callback;if(typeof X=="function"){f.callback=null,h=f.priorityLevel;var H=X(f.expirationTime<=I);I=e.unstable_now(),typeof H=="function"?f.callback=H:f===n(c)&&r(c),j(I)}else r(c);f=n(c)}if(f!==null)var S=!0;else{var ie=n(u);ie!==null&&fe(z,ie.startTime-I),S=!1}return S}finally{f=null,h=b,m=!1}}var _=!1,A=null,C=-1,R=5,N=-1;function U(){return!(e.unstable_now()-N<R)}function O(){if(A!==null){var T=e.unstable_now();N=T;var I=!0;try{I=A(!0,T)}finally{I?re():(_=!1,A=null)}}else _=!1}var re;if(typeof w=="function")re=function(){w(O)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,te=oe.port2;oe.port1.onmessage=O,re=function(){te.postMessage(null)}}else re=function(){v(O,0)};function le(T){A=T,_||(_=!0,re())}function fe(T,I){C=v(function(){T(e.unstable_now())},I)}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(T){T.callback=null},e.unstable_continueExecution=function(){g||m||(g=!0,le(D))},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(T){switch(h){case 1:case 2:case 3:var I=3;break;default:I=h}var b=h;h=I;try{return T()}finally{h=b}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(T,I){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var b=h;h=T;try{return I()}finally{h=b}},e.unstable_scheduleCallback=function(T,I,b){var X=e.unstable_now();switch(typeof b=="object"&&b!==null?(b=b.delay,b=typeof b=="number"&&0<b?X+b:X):b=X,T){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=b+H,T={id:d++,callback:I,priorityLevel:T,startTime:b,expirationTime:H,sortIndex:-1},b>X?(T.sortIndex=b,t(u,T),n(c)===null&&T===n(u)&&(k?(x(C),C=-1):k=!0,fe(z,b-X))):(T.sortIndex=H,t(c,T),g||m||(g=!0,le(D))),T},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(T){var I=h;return function(){var b=h;h=I;try{return T.apply(this,arguments)}finally{h=b}}}})(cp);op.exports=cp;var Uv=op.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Bv=p,an=Uv;function W(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var up=new Set,Zs={};function mi(e,t){Yi(e,t),Yi(e+"Capture",t)}function Yi(e,t){for(Zs[e]=t,e=0;e<t.length;e++)up.add(t[e])}var tr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bc=Object.prototype.hasOwnProperty,Hv=/^[: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]*$/,bf={},jf={};function Vv(e){return bc.call(jf,e)?!0:bc.call(bf,e)?!1:Hv.test(e)?jf[e]=!0:(bf[e]=!0,!1)}function Wv(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Gv(e,t,n,r){if(t===null||typeof t>"u"||Wv(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Bt(e,t,n,r,i,l,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=a}var _t={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){_t[e]=new Bt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];_t[t]=new Bt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){_t[e]=new Bt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){_t[e]=new Bt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){_t[e]=new Bt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){_t[e]=new Bt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){_t[e]=new Bt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){_t[e]=new Bt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){_t[e]=new Bt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Pu=/[\-:]([a-z])/g;function Mu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Pu,Mu);_t[t]=new Bt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Pu,Mu);_t[t]=new Bt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Pu,Mu);_t[t]=new Bt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){_t[e]=new Bt(e,1,!1,e.toLowerCase(),null,!1,!1)});_t.xlinkHref=new Bt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){_t[e]=new Bt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ru(e,t,n,r){var i=_t.hasOwnProperty(t)?_t[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Gv(t,n,i,r)&&(n=null),r||i===null?Vv(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var lr=Bv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Rl=Symbol.for("react.element"),_i=Symbol.for("react.portal"),Ei=Symbol.for("react.fragment"),$u=Symbol.for("react.strict_mode"),jc=Symbol.for("react.profiler"),dp=Symbol.for("react.provider"),fp=Symbol.for("react.context"),Fu=Symbol.for("react.forward_ref"),Sc=Symbol.for("react.suspense"),Nc=Symbol.for("react.suspense_list"),Ou=Symbol.for("react.memo"),_r=Symbol.for("react.lazy"),mp=Symbol.for("react.offscreen"),Sf=Symbol.iterator;function bs(e){return e===null||typeof e!="object"?null:(e=Sf&&e[Sf]||e["@@iterator"],typeof e=="function"?e:null)}var tt=Object.assign,Ao;function Ds(e){if(Ao===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ao=t&&t[1]||""}return`
34
+ `+Ao+e}var Do=!1;function Io(e,t){if(!e||Do)return"";Do=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
35
+ `),l=r.stack.split(`
36
+ `),a=i.length-1,o=l.length-1;1<=a&&0<=o&&i[a]!==l[o];)o--;for(;1<=a&&0<=o;a--,o--)if(i[a]!==l[o]){if(a!==1||o!==1)do if(a--,o--,0>o||i[a]!==l[o]){var c=`
37
+ `+i[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=o);break}}}finally{Do=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ds(e):""}function qv(e){switch(e.tag){case 5:return Ds(e.type);case 16:return Ds("Lazy");case 13:return Ds("Suspense");case 19:return Ds("SuspenseList");case 0:case 2:case 15:return e=Io(e.type,!1),e;case 11:return e=Io(e.type.render,!1),e;case 1:return e=Io(e.type,!0),e;default:return""}}function Cc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ei:return"Fragment";case _i:return"Portal";case jc:return"Profiler";case $u:return"StrictMode";case Sc:return"Suspense";case Nc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case fp:return(e.displayName||"Context")+".Consumer";case dp:return(e._context.displayName||"Context")+".Provider";case Fu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ou:return t=e.displayName||null,t!==null?t:Cc(e.type)||"Memo";case _r:t=e._payload,e=e._init;try{return Cc(e(t))}catch{}}return null}function Qv(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Cc(t);case 8:return t===$u?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ur(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function hp(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Kv(e){var t=hp(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,l.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $l(e){e._valueTracker||(e._valueTracker=Kv(e))}function pp(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=hp(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ja(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function _c(e,t){var n=t.checked;return tt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Nf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ur(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function gp(e,t){t=t.checked,t!=null&&Ru(e,"checked",t,!1)}function Ec(e,t){gp(e,t);var n=Ur(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Tc(e,t.type,n):t.hasOwnProperty("defaultValue")&&Tc(e,t.type,Ur(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Cf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Tc(e,t,n){(t!=="number"||ja(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Is=Array.isArray;function Oi(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ur(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function zc(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(W(91));return tt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function _f(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(W(92));if(Is(n)){if(1<n.length)throw Error(W(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ur(n)}}function yp(e,t){var n=Ur(t.value),r=Ur(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Ef(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function xp(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Lc(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?xp(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Fl,vp=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Fl=Fl||document.createElement("div"),Fl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Fl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function el(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $s={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},Yv=["Webkit","ms","Moz","O"];Object.keys($s).forEach(function(e){Yv.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),$s[t]=$s[e]})});function kp(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||$s.hasOwnProperty(e)&&$s[e]?(""+t).trim():t+"px"}function wp(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=kp(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Xv=tt({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 Ac(e,t){if(t){if(Xv[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(W(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(W(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(W(61))}if(t.style!=null&&typeof t.style!="object")throw Error(W(62))}}function Dc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ic=null;function Uu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pc=null,Ui=null,Bi=null;function Tf(e){if(e=jl(e)){if(typeof Pc!="function")throw Error(W(280));var t=e.stateNode;t&&(t=uo(t),Pc(e.stateNode,e.type,t))}}function bp(e){Ui?Bi?Bi.push(e):Bi=[e]:Ui=e}function jp(){if(Ui){var e=Ui,t=Bi;if(Bi=Ui=null,Tf(e),t)for(e=0;e<t.length;e++)Tf(t[e])}}function Sp(e,t){return e(t)}function Np(){}var Po=!1;function Cp(e,t,n){if(Po)return e(t,n);Po=!0;try{return Sp(e,t,n)}finally{Po=!1,(Ui!==null||Bi!==null)&&(Np(),jp())}}function tl(e,t){var n=e.stateNode;if(n===null)return null;var r=uo(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(W(231,t,typeof n));return n}var Mc=!1;if(tr)try{var js={};Object.defineProperty(js,"passive",{get:function(){Mc=!0}}),window.addEventListener("test",js,js),window.removeEventListener("test",js,js)}catch{Mc=!1}function Jv(e,t,n,r,i,l,a,o,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var Fs=!1,Sa=null,Na=!1,Rc=null,Zv={onError:function(e){Fs=!0,Sa=e}};function e1(e,t,n,r,i,l,a,o,c){Fs=!1,Sa=null,Jv.apply(Zv,arguments)}function t1(e,t,n,r,i,l,a,o,c){if(e1.apply(this,arguments),Fs){if(Fs){var u=Sa;Fs=!1,Sa=null}else throw Error(W(198));Na||(Na=!0,Rc=u)}}function hi(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function _p(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function zf(e){if(hi(e)!==e)throw Error(W(188))}function n1(e){var t=e.alternate;if(!t){if(t=hi(e),t===null)throw Error(W(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var l=i.alternate;if(l===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===l.child){for(l=i.child;l;){if(l===n)return zf(i),e;if(l===r)return zf(i),t;l=l.sibling}throw Error(W(188))}if(n.return!==r.return)n=i,r=l;else{for(var a=!1,o=i.child;o;){if(o===n){a=!0,n=i,r=l;break}if(o===r){a=!0,r=i,n=l;break}o=o.sibling}if(!a){for(o=l.child;o;){if(o===n){a=!0,n=l,r=i;break}if(o===r){a=!0,r=l,n=i;break}o=o.sibling}if(!a)throw Error(W(189))}}if(n.alternate!==r)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?e:t}function Ep(e){return e=n1(e),e!==null?Tp(e):null}function Tp(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Tp(e);if(t!==null)return t;e=e.sibling}return null}var zp=an.unstable_scheduleCallback,Lf=an.unstable_cancelCallback,r1=an.unstable_shouldYield,i1=an.unstable_requestPaint,st=an.unstable_now,s1=an.unstable_getCurrentPriorityLevel,Bu=an.unstable_ImmediatePriority,Lp=an.unstable_UserBlockingPriority,Ca=an.unstable_NormalPriority,l1=an.unstable_LowPriority,Ap=an.unstable_IdlePriority,lo=null,Bn=null;function a1(e){if(Bn&&typeof Bn.onCommitFiberRoot=="function")try{Bn.onCommitFiberRoot(lo,e,void 0,(e.current.flags&128)===128)}catch{}}var An=Math.clz32?Math.clz32:u1,o1=Math.log,c1=Math.LN2;function u1(e){return e>>>=0,e===0?32:31-(o1(e)/c1|0)|0}var Ol=64,Ul=4194304;function Ps(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function _a(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,l=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~i;o!==0?r=Ps(o):(l&=a,l!==0&&(r=Ps(l)))}else a=n&~i,a!==0?r=Ps(a):l!==0&&(r=Ps(l));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,l=t&-t,i>=l||i===16&&(l&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-An(t),i=1<<n,r|=e[n],t&=~i;return r}function d1(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function f1(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,l=e.pendingLanes;0<l;){var a=31-An(l),o=1<<a,c=i[a];c===-1?(!(o&n)||o&r)&&(i[a]=d1(o,t)):c<=t&&(e.expiredLanes|=o),l&=~o}}function $c(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Dp(){var e=Ol;return Ol<<=1,!(Ol&4194240)&&(Ol=64),e}function Mo(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function wl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-An(t),e[t]=n}function m1(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-An(n),l=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~l}}function Hu(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-An(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var $e=0;function Ip(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Pp,Vu,Mp,Rp,$p,Fc=!1,Bl=[],Dr=null,Ir=null,Pr=null,nl=new Map,rl=new Map,Tr=[],h1="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 Af(e,t){switch(e){case"focusin":case"focusout":Dr=null;break;case"dragenter":case"dragleave":Ir=null;break;case"mouseover":case"mouseout":Pr=null;break;case"pointerover":case"pointerout":nl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":rl.delete(t.pointerId)}}function Ss(e,t,n,r,i,l){return e===null||e.nativeEvent!==l?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:l,targetContainers:[i]},t!==null&&(t=jl(t),t!==null&&Vu(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function p1(e,t,n,r,i){switch(t){case"focusin":return Dr=Ss(Dr,e,t,n,r,i),!0;case"dragenter":return Ir=Ss(Ir,e,t,n,r,i),!0;case"mouseover":return Pr=Ss(Pr,e,t,n,r,i),!0;case"pointerover":var l=i.pointerId;return nl.set(l,Ss(nl.get(l)||null,e,t,n,r,i)),!0;case"gotpointercapture":return l=i.pointerId,rl.set(l,Ss(rl.get(l)||null,e,t,n,r,i)),!0}return!1}function Fp(e){var t=Xr(e.target);if(t!==null){var n=hi(t);if(n!==null){if(t=n.tag,t===13){if(t=_p(n),t!==null){e.blockedOn=t,$p(e.priority,function(){Mp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ca(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Oc(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ic=r,n.target.dispatchEvent(r),Ic=null}else return t=jl(n),t!==null&&Vu(t),e.blockedOn=n,!1;t.shift()}return!0}function Df(e,t,n){ca(e)&&n.delete(t)}function g1(){Fc=!1,Dr!==null&&ca(Dr)&&(Dr=null),Ir!==null&&ca(Ir)&&(Ir=null),Pr!==null&&ca(Pr)&&(Pr=null),nl.forEach(Df),rl.forEach(Df)}function Ns(e,t){e.blockedOn===t&&(e.blockedOn=null,Fc||(Fc=!0,an.unstable_scheduleCallback(an.unstable_NormalPriority,g1)))}function il(e){function t(i){return Ns(i,e)}if(0<Bl.length){Ns(Bl[0],e);for(var n=1;n<Bl.length;n++){var r=Bl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Dr!==null&&Ns(Dr,e),Ir!==null&&Ns(Ir,e),Pr!==null&&Ns(Pr,e),nl.forEach(t),rl.forEach(t),n=0;n<Tr.length;n++)r=Tr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Tr.length&&(n=Tr[0],n.blockedOn===null);)Fp(n),n.blockedOn===null&&Tr.shift()}var Hi=lr.ReactCurrentBatchConfig,Ea=!0;function y1(e,t,n,r){var i=$e,l=Hi.transition;Hi.transition=null;try{$e=1,Wu(e,t,n,r)}finally{$e=i,Hi.transition=l}}function x1(e,t,n,r){var i=$e,l=Hi.transition;Hi.transition=null;try{$e=4,Wu(e,t,n,r)}finally{$e=i,Hi.transition=l}}function Wu(e,t,n,r){if(Ea){var i=Oc(e,t,n,r);if(i===null)Go(e,t,r,Ta,n),Af(e,r);else if(p1(i,e,t,n,r))r.stopPropagation();else if(Af(e,r),t&4&&-1<h1.indexOf(e)){for(;i!==null;){var l=jl(i);if(l!==null&&Pp(l),l=Oc(e,t,n,r),l===null&&Go(e,t,r,Ta,n),l===i)break;i=l}i!==null&&r.stopPropagation()}else Go(e,t,r,null,n)}}var Ta=null;function Oc(e,t,n,r){if(Ta=null,e=Uu(r),e=Xr(e),e!==null)if(t=hi(e),t===null)e=null;else if(n=t.tag,n===13){if(e=_p(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ta=e,null}function Op(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(s1()){case Bu:return 1;case Lp:return 4;case Ca:case l1:return 16;case Ap:return 536870912;default:return 16}default:return 16}}var Lr=null,Gu=null,ua=null;function Up(){if(ua)return ua;var e,t=Gu,n=t.length,r,i="value"in Lr?Lr.value:Lr.textContent,l=i.length;for(e=0;e<n&&t[e]===i[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===i[l-r];r++);return ua=i.slice(e,1<r?1-r:void 0)}function da(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Hl(){return!0}function If(){return!1}function cn(e){function t(n,r,i,l,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=l,this.target=a,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(l):l[o]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?Hl:If,this.isPropagationStopped=If,this}return tt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Hl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Hl)},persist:function(){},isPersistent:Hl}),t}var os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qu=cn(os),bl=tt({},os,{view:0,detail:0}),v1=cn(bl),Ro,$o,Cs,ao=tt({},bl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Cs&&(Cs&&e.type==="mousemove"?(Ro=e.screenX-Cs.screenX,$o=e.screenY-Cs.screenY):$o=Ro=0,Cs=e),Ro)},movementY:function(e){return"movementY"in e?e.movementY:$o}}),Pf=cn(ao),k1=tt({},ao,{dataTransfer:0}),w1=cn(k1),b1=tt({},bl,{relatedTarget:0}),Fo=cn(b1),j1=tt({},os,{animationName:0,elapsedTime:0,pseudoElement:0}),S1=cn(j1),N1=tt({},os,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),C1=cn(N1),_1=tt({},os,{data:0}),Mf=cn(_1),E1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},T1={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"},z1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function L1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=z1[e])?!!t[e]:!1}function Qu(){return L1}var A1=tt({},bl,{key:function(e){if(e.key){var t=E1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=da(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?T1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qu,charCode:function(e){return e.type==="keypress"?da(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?da(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),D1=cn(A1),I1=tt({},ao,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rf=cn(I1),P1=tt({},bl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qu}),M1=cn(P1),R1=tt({},os,{propertyName:0,elapsedTime:0,pseudoElement:0}),$1=cn(R1),F1=tt({},ao,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),O1=cn(F1),U1=[9,13,27,32],Ku=tr&&"CompositionEvent"in window,Os=null;tr&&"documentMode"in document&&(Os=document.documentMode);var B1=tr&&"TextEvent"in window&&!Os,Bp=tr&&(!Ku||Os&&8<Os&&11>=Os),$f=" ",Ff=!1;function Hp(e,t){switch(e){case"keyup":return U1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ti=!1;function H1(e,t){switch(e){case"compositionend":return Vp(t);case"keypress":return t.which!==32?null:(Ff=!0,$f);case"textInput":return e=t.data,e===$f&&Ff?null:e;default:return null}}function V1(e,t){if(Ti)return e==="compositionend"||!Ku&&Hp(e,t)?(e=Up(),ua=Gu=Lr=null,Ti=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Bp&&t.locale!=="ko"?null:t.data;default:return null}}var W1={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 Of(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!W1[e.type]:t==="textarea"}function Wp(e,t,n,r){bp(r),t=za(t,"onChange"),0<t.length&&(n=new qu("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Us=null,sl=null;function G1(e){ng(e,0)}function oo(e){var t=Ai(e);if(pp(t))return e}function q1(e,t){if(e==="change")return t}var Gp=!1;if(tr){var Oo;if(tr){var Uo="oninput"in document;if(!Uo){var Uf=document.createElement("div");Uf.setAttribute("oninput","return;"),Uo=typeof Uf.oninput=="function"}Oo=Uo}else Oo=!1;Gp=Oo&&(!document.documentMode||9<document.documentMode)}function Bf(){Us&&(Us.detachEvent("onpropertychange",qp),sl=Us=null)}function qp(e){if(e.propertyName==="value"&&oo(sl)){var t=[];Wp(t,sl,e,Uu(e)),Cp(G1,t)}}function Q1(e,t,n){e==="focusin"?(Bf(),Us=t,sl=n,Us.attachEvent("onpropertychange",qp)):e==="focusout"&&Bf()}function K1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return oo(sl)}function Y1(e,t){if(e==="click")return oo(t)}function X1(e,t){if(e==="input"||e==="change")return oo(t)}function J1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Pn=typeof Object.is=="function"?Object.is:J1;function ll(e,t){if(Pn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!bc.call(t,i)||!Pn(e[i],t[i]))return!1}return!0}function Hf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vf(e,t){var n=Hf(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Hf(n)}}function Qp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Kp(){for(var e=window,t=ja();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ja(e.document)}return t}function Yu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Z1(e){var t=Kp(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Qp(n.ownerDocument.documentElement,n)){if(r!==null&&Yu(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,l=Math.min(r.start,i);r=r.end===void 0?l:Math.min(r.end,i),!e.extend&&l>r&&(i=r,r=l,l=i),i=Vf(n,l);var a=Vf(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var ek=tr&&"documentMode"in document&&11>=document.documentMode,zi=null,Uc=null,Bs=null,Bc=!1;function Wf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bc||zi==null||zi!==ja(r)||(r=zi,"selectionStart"in r&&Yu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Bs&&ll(Bs,r)||(Bs=r,r=za(Uc,"onSelect"),0<r.length&&(t=new qu("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=zi)))}function Vl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Li={animationend:Vl("Animation","AnimationEnd"),animationiteration:Vl("Animation","AnimationIteration"),animationstart:Vl("Animation","AnimationStart"),transitionend:Vl("Transition","TransitionEnd")},Bo={},Yp={};tr&&(Yp=document.createElement("div").style,"AnimationEvent"in window||(delete Li.animationend.animation,delete Li.animationiteration.animation,delete Li.animationstart.animation),"TransitionEvent"in window||delete Li.transitionend.transition);function co(e){if(Bo[e])return Bo[e];if(!Li[e])return e;var t=Li[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Yp)return Bo[e]=t[n];return e}var Xp=co("animationend"),Jp=co("animationiteration"),Zp=co("animationstart"),eg=co("transitionend"),tg=new Map,Gf="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 Hr(e,t){tg.set(e,t),mi(t,[e])}for(var Ho=0;Ho<Gf.length;Ho++){var Vo=Gf[Ho],tk=Vo.toLowerCase(),nk=Vo[0].toUpperCase()+Vo.slice(1);Hr(tk,"on"+nk)}Hr(Xp,"onAnimationEnd");Hr(Jp,"onAnimationIteration");Hr(Zp,"onAnimationStart");Hr("dblclick","onDoubleClick");Hr("focusin","onFocus");Hr("focusout","onBlur");Hr(eg,"onTransitionEnd");Yi("onMouseEnter",["mouseout","mouseover"]);Yi("onMouseLeave",["mouseout","mouseover"]);Yi("onPointerEnter",["pointerout","pointerover"]);Yi("onPointerLeave",["pointerout","pointerover"]);mi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));mi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));mi("onBeforeInput",["compositionend","keypress","textInput","paste"]);mi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));mi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));mi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ms="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(" "),rk=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ms));function qf(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,t1(r,t,void 0,e),e.currentTarget=null}function ng(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var l=void 0;if(t)for(var a=r.length-1;0<=a;a--){var o=r[a],c=o.instance,u=o.currentTarget;if(o=o.listener,c!==l&&i.isPropagationStopped())break e;qf(i,o,u),l=c}else for(a=0;a<r.length;a++){if(o=r[a],c=o.instance,u=o.currentTarget,o=o.listener,c!==l&&i.isPropagationStopped())break e;qf(i,o,u),l=c}}}if(Na)throw e=Rc,Na=!1,Rc=null,e}function Ve(e,t){var n=t[qc];n===void 0&&(n=t[qc]=new Set);var r=e+"__bubble";n.has(r)||(rg(t,e,2,!1),n.add(r))}function Wo(e,t,n){var r=0;t&&(r|=4),rg(n,e,r,t)}var Wl="_reactListening"+Math.random().toString(36).slice(2);function al(e){if(!e[Wl]){e[Wl]=!0,up.forEach(function(n){n!=="selectionchange"&&(rk.has(n)||Wo(n,!1,e),Wo(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Wl]||(t[Wl]=!0,Wo("selectionchange",!1,t))}}function rg(e,t,n,r){switch(Op(t)){case 1:var i=y1;break;case 4:i=x1;break;default:i=Wu}n=i.bind(null,t,n,e),i=void 0,!Mc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Go(e,t,n,r,i){var l=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;if(o===i||o.nodeType===8&&o.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;a=a.return}for(;o!==null;){if(a=Xr(o),a===null)return;if(c=a.tag,c===5||c===6){r=l=a;continue e}o=o.parentNode}}r=r.return}Cp(function(){var u=l,d=Uu(n),f=[];e:{var h=tg.get(e);if(h!==void 0){var m=qu,g=e;switch(e){case"keypress":if(da(n)===0)break e;case"keydown":case"keyup":m=D1;break;case"focusin":g="focus",m=Fo;break;case"focusout":g="blur",m=Fo;break;case"beforeblur":case"afterblur":m=Fo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=Pf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=w1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=M1;break;case Xp:case Jp:case Zp:m=S1;break;case eg:m=$1;break;case"scroll":m=v1;break;case"wheel":m=O1;break;case"copy":case"cut":case"paste":m=C1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Rf}var k=(t&4)!==0,v=!k&&e==="scroll",x=k?h!==null?h+"Capture":null:h;k=[];for(var w=u,j;w!==null;){j=w;var z=j.stateNode;if(j.tag===5&&z!==null&&(j=z,x!==null&&(z=tl(w,x),z!=null&&k.push(ol(w,z,j)))),v)break;w=w.return}0<k.length&&(h=new m(h,g,null,n,d),f.push({event:h,listeners:k}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",h&&n!==Ic&&(g=n.relatedTarget||n.fromElement)&&(Xr(g)||g[nr]))break e;if((m||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,m?(g=n.relatedTarget||n.toElement,m=u,g=g?Xr(g):null,g!==null&&(v=hi(g),g!==v||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=u),m!==g)){if(k=Pf,z="onMouseLeave",x="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(k=Rf,z="onPointerLeave",x="onPointerEnter",w="pointer"),v=m==null?h:Ai(m),j=g==null?h:Ai(g),h=new k(z,w+"leave",m,n,d),h.target=v,h.relatedTarget=j,z=null,Xr(d)===u&&(k=new k(x,w+"enter",g,n,d),k.target=j,k.relatedTarget=v,z=k),v=z,m&&g)t:{for(k=m,x=g,w=0,j=k;j;j=vi(j))w++;for(j=0,z=x;z;z=vi(z))j++;for(;0<w-j;)k=vi(k),w--;for(;0<j-w;)x=vi(x),j--;for(;w--;){if(k===x||x!==null&&k===x.alternate)break t;k=vi(k),x=vi(x)}k=null}else k=null;m!==null&&Qf(f,h,m,k,!1),g!==null&&v!==null&&Qf(f,v,g,k,!0)}}e:{if(h=u?Ai(u):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var D=q1;else if(Of(h))if(Gp)D=X1;else{D=K1;var _=Q1}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(D=Y1);if(D&&(D=D(e,u))){Wp(f,D,n,d);break e}_&&_(e,h,u),e==="focusout"&&(_=h._wrapperState)&&_.controlled&&h.type==="number"&&Tc(h,"number",h.value)}switch(_=u?Ai(u):window,e){case"focusin":(Of(_)||_.contentEditable==="true")&&(zi=_,Uc=u,Bs=null);break;case"focusout":Bs=Uc=zi=null;break;case"mousedown":Bc=!0;break;case"contextmenu":case"mouseup":case"dragend":Bc=!1,Wf(f,n,d);break;case"selectionchange":if(ek)break;case"keydown":case"keyup":Wf(f,n,d)}var A;if(Ku)e:{switch(e){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else Ti?Hp(e,n)&&(C="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(C="onCompositionStart");C&&(Bp&&n.locale!=="ko"&&(Ti||C!=="onCompositionStart"?C==="onCompositionEnd"&&Ti&&(A=Up()):(Lr=d,Gu="value"in Lr?Lr.value:Lr.textContent,Ti=!0)),_=za(u,C),0<_.length&&(C=new Mf(C,e,null,n,d),f.push({event:C,listeners:_}),A?C.data=A:(A=Vp(n),A!==null&&(C.data=A)))),(A=B1?H1(e,n):V1(e,n))&&(u=za(u,"onBeforeInput"),0<u.length&&(d=new Mf("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=A))}ng(f,t)})}function ol(e,t,n){return{instance:e,listener:t,currentTarget:n}}function za(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,l=i.stateNode;i.tag===5&&l!==null&&(i=l,l=tl(e,n),l!=null&&r.unshift(ol(e,l,i)),l=tl(e,t),l!=null&&r.push(ol(e,l,i))),e=e.return}return r}function vi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Qf(e,t,n,r,i){for(var l=t._reactName,a=[];n!==null&&n!==r;){var o=n,c=o.alternate,u=o.stateNode;if(c!==null&&c===r)break;o.tag===5&&u!==null&&(o=u,i?(c=tl(n,l),c!=null&&a.unshift(ol(n,c,o))):i||(c=tl(n,l),c!=null&&a.push(ol(n,c,o)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var ik=/\r\n?/g,sk=/\u0000|\uFFFD/g;function Kf(e){return(typeof e=="string"?e:""+e).replace(ik,`
38
+ `).replace(sk,"")}function Gl(e,t,n){if(t=Kf(t),Kf(e)!==t&&n)throw Error(W(425))}function La(){}var Hc=null,Vc=null;function Wc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Gc=typeof setTimeout=="function"?setTimeout:void 0,lk=typeof clearTimeout=="function"?clearTimeout:void 0,Yf=typeof Promise=="function"?Promise:void 0,ak=typeof queueMicrotask=="function"?queueMicrotask:typeof Yf<"u"?function(e){return Yf.resolve(null).then(e).catch(ok)}:Gc;function ok(e){setTimeout(function(){throw e})}function qo(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),il(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);il(t)}function Mr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Xf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var cs=Math.random().toString(36).slice(2),Un="__reactFiber$"+cs,cl="__reactProps$"+cs,nr="__reactContainer$"+cs,qc="__reactEvents$"+cs,ck="__reactListeners$"+cs,uk="__reactHandles$"+cs;function Xr(e){var t=e[Un];if(t)return t;for(var n=e.parentNode;n;){if(t=n[nr]||n[Un]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Xf(e);e!==null;){if(n=e[Un])return n;e=Xf(e)}return t}e=n,n=e.parentNode}return null}function jl(e){return e=e[Un]||e[nr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ai(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(W(33))}function uo(e){return e[cl]||null}var Qc=[],Di=-1;function Vr(e){return{current:e}}function We(e){0>Di||(e.current=Qc[Di],Qc[Di]=null,Di--)}function He(e,t){Di++,Qc[Di]=e.current,e.current=t}var Br={},Dt=Vr(Br),Qt=Vr(!1),ri=Br;function Xi(e,t){var n=e.type.contextTypes;if(!n)return Br;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},l;for(l in n)i[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Kt(e){return e=e.childContextTypes,e!=null}function Aa(){We(Qt),We(Dt)}function Jf(e,t,n){if(Dt.current!==Br)throw Error(W(168));He(Dt,t),He(Qt,n)}function ig(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(W(108,Qv(e)||"Unknown",i));return tt({},n,r)}function Da(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Br,ri=Dt.current,He(Dt,e),He(Qt,Qt.current),!0}function Zf(e,t,n){var r=e.stateNode;if(!r)throw Error(W(169));n?(e=ig(e,t,ri),r.__reactInternalMemoizedMergedChildContext=e,We(Qt),We(Dt),He(Dt,e)):We(Qt),He(Qt,n)}var Kn=null,fo=!1,Qo=!1;function sg(e){Kn===null?Kn=[e]:Kn.push(e)}function dk(e){fo=!0,sg(e)}function Wr(){if(!Qo&&Kn!==null){Qo=!0;var e=0,t=$e;try{var n=Kn;for($e=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Kn=null,fo=!1}catch(i){throw Kn!==null&&(Kn=Kn.slice(e+1)),zp(Bu,Wr),i}finally{$e=t,Qo=!1}}return null}var Ii=[],Pi=0,Ia=null,Pa=0,dn=[],fn=0,ii=null,Xn=1,Jn="";function Qr(e,t){Ii[Pi++]=Pa,Ii[Pi++]=Ia,Ia=e,Pa=t}function lg(e,t,n){dn[fn++]=Xn,dn[fn++]=Jn,dn[fn++]=ii,ii=e;var r=Xn;e=Jn;var i=32-An(r)-1;r&=~(1<<i),n+=1;var l=32-An(t)+i;if(30<l){var a=i-i%5;l=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Xn=1<<32-An(t)+i|n<<i|r,Jn=l+e}else Xn=1<<l|n<<i|r,Jn=e}function Xu(e){e.return!==null&&(Qr(e,1),lg(e,1,0))}function Ju(e){for(;e===Ia;)Ia=Ii[--Pi],Ii[Pi]=null,Pa=Ii[--Pi],Ii[Pi]=null;for(;e===ii;)ii=dn[--fn],dn[fn]=null,Jn=dn[--fn],dn[fn]=null,Xn=dn[--fn],dn[fn]=null}var sn=null,rn=null,Ye=!1,Tn=null;function ag(e,t){var n=hn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function em(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,sn=e,rn=Mr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,sn=e,rn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ii!==null?{id:Xn,overflow:Jn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=hn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,sn=e,rn=null,!0):!1;default:return!1}}function Kc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Yc(e){if(Ye){var t=rn;if(t){var n=t;if(!em(e,t)){if(Kc(e))throw Error(W(418));t=Mr(n.nextSibling);var r=sn;t&&em(e,t)?ag(r,n):(e.flags=e.flags&-4097|2,Ye=!1,sn=e)}}else{if(Kc(e))throw Error(W(418));e.flags=e.flags&-4097|2,Ye=!1,sn=e}}}function tm(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;sn=e}function ql(e){if(e!==sn)return!1;if(!Ye)return tm(e),Ye=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Wc(e.type,e.memoizedProps)),t&&(t=rn)){if(Kc(e))throw og(),Error(W(418));for(;t;)ag(e,t),t=Mr(t.nextSibling)}if(tm(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(W(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){rn=Mr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}rn=null}}else rn=sn?Mr(e.stateNode.nextSibling):null;return!0}function og(){for(var e=rn;e;)e=Mr(e.nextSibling)}function Ji(){rn=sn=null,Ye=!1}function Zu(e){Tn===null?Tn=[e]:Tn.push(e)}var fk=lr.ReactCurrentBatchConfig;function _s(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(W(309));var r=n.stateNode}if(!r)throw Error(W(147,e));var i=r,l=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===l?t.ref:(t=function(a){var o=i.refs;a===null?delete o[l]:o[l]=a},t._stringRef=l,t)}if(typeof e!="string")throw Error(W(284));if(!n._owner)throw Error(W(290,e))}return e}function Ql(e,t){throw e=Object.prototype.toString.call(t),Error(W(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function nm(e){var t=e._init;return t(e._payload)}function cg(e){function t(x,w){if(e){var j=x.deletions;j===null?(x.deletions=[w],x.flags|=16):j.push(w)}}function n(x,w){if(!e)return null;for(;w!==null;)t(x,w),w=w.sibling;return null}function r(x,w){for(x=new Map;w!==null;)w.key!==null?x.set(w.key,w):x.set(w.index,w),w=w.sibling;return x}function i(x,w){return x=Or(x,w),x.index=0,x.sibling=null,x}function l(x,w,j){return x.index=j,e?(j=x.alternate,j!==null?(j=j.index,j<w?(x.flags|=2,w):j):(x.flags|=2,w)):(x.flags|=1048576,w)}function a(x){return e&&x.alternate===null&&(x.flags|=2),x}function o(x,w,j,z){return w===null||w.tag!==6?(w=tc(j,x.mode,z),w.return=x,w):(w=i(w,j),w.return=x,w)}function c(x,w,j,z){var D=j.type;return D===Ei?d(x,w,j.props.children,z,j.key):w!==null&&(w.elementType===D||typeof D=="object"&&D!==null&&D.$$typeof===_r&&nm(D)===w.type)?(z=i(w,j.props),z.ref=_s(x,w,j),z.return=x,z):(z=xa(j.type,j.key,j.props,null,x.mode,z),z.ref=_s(x,w,j),z.return=x,z)}function u(x,w,j,z){return w===null||w.tag!==4||w.stateNode.containerInfo!==j.containerInfo||w.stateNode.implementation!==j.implementation?(w=nc(j,x.mode,z),w.return=x,w):(w=i(w,j.children||[]),w.return=x,w)}function d(x,w,j,z,D){return w===null||w.tag!==7?(w=ni(j,x.mode,z,D),w.return=x,w):(w=i(w,j),w.return=x,w)}function f(x,w,j){if(typeof w=="string"&&w!==""||typeof w=="number")return w=tc(""+w,x.mode,j),w.return=x,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Rl:return j=xa(w.type,w.key,w.props,null,x.mode,j),j.ref=_s(x,null,w),j.return=x,j;case _i:return w=nc(w,x.mode,j),w.return=x,w;case _r:var z=w._init;return f(x,z(w._payload),j)}if(Is(w)||bs(w))return w=ni(w,x.mode,j,null),w.return=x,w;Ql(x,w)}return null}function h(x,w,j,z){var D=w!==null?w.key:null;if(typeof j=="string"&&j!==""||typeof j=="number")return D!==null?null:o(x,w,""+j,z);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Rl:return j.key===D?c(x,w,j,z):null;case _i:return j.key===D?u(x,w,j,z):null;case _r:return D=j._init,h(x,w,D(j._payload),z)}if(Is(j)||bs(j))return D!==null?null:d(x,w,j,z,null);Ql(x,j)}return null}function m(x,w,j,z,D){if(typeof z=="string"&&z!==""||typeof z=="number")return x=x.get(j)||null,o(w,x,""+z,D);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case Rl:return x=x.get(z.key===null?j:z.key)||null,c(w,x,z,D);case _i:return x=x.get(z.key===null?j:z.key)||null,u(w,x,z,D);case _r:var _=z._init;return m(x,w,j,_(z._payload),D)}if(Is(z)||bs(z))return x=x.get(j)||null,d(w,x,z,D,null);Ql(w,z)}return null}function g(x,w,j,z){for(var D=null,_=null,A=w,C=w=0,R=null;A!==null&&C<j.length;C++){A.index>C?(R=A,A=null):R=A.sibling;var N=h(x,A,j[C],z);if(N===null){A===null&&(A=R);break}e&&A&&N.alternate===null&&t(x,A),w=l(N,w,C),_===null?D=N:_.sibling=N,_=N,A=R}if(C===j.length)return n(x,A),Ye&&Qr(x,C),D;if(A===null){for(;C<j.length;C++)A=f(x,j[C],z),A!==null&&(w=l(A,w,C),_===null?D=A:_.sibling=A,_=A);return Ye&&Qr(x,C),D}for(A=r(x,A);C<j.length;C++)R=m(A,x,C,j[C],z),R!==null&&(e&&R.alternate!==null&&A.delete(R.key===null?C:R.key),w=l(R,w,C),_===null?D=R:_.sibling=R,_=R);return e&&A.forEach(function(U){return t(x,U)}),Ye&&Qr(x,C),D}function k(x,w,j,z){var D=bs(j);if(typeof D!="function")throw Error(W(150));if(j=D.call(j),j==null)throw Error(W(151));for(var _=D=null,A=w,C=w=0,R=null,N=j.next();A!==null&&!N.done;C++,N=j.next()){A.index>C?(R=A,A=null):R=A.sibling;var U=h(x,A,N.value,z);if(U===null){A===null&&(A=R);break}e&&A&&U.alternate===null&&t(x,A),w=l(U,w,C),_===null?D=U:_.sibling=U,_=U,A=R}if(N.done)return n(x,A),Ye&&Qr(x,C),D;if(A===null){for(;!N.done;C++,N=j.next())N=f(x,N.value,z),N!==null&&(w=l(N,w,C),_===null?D=N:_.sibling=N,_=N);return Ye&&Qr(x,C),D}for(A=r(x,A);!N.done;C++,N=j.next())N=m(A,x,C,N.value,z),N!==null&&(e&&N.alternate!==null&&A.delete(N.key===null?C:N.key),w=l(N,w,C),_===null?D=N:_.sibling=N,_=N);return e&&A.forEach(function(O){return t(x,O)}),Ye&&Qr(x,C),D}function v(x,w,j,z){if(typeof j=="object"&&j!==null&&j.type===Ei&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case Rl:e:{for(var D=j.key,_=w;_!==null;){if(_.key===D){if(D=j.type,D===Ei){if(_.tag===7){n(x,_.sibling),w=i(_,j.props.children),w.return=x,x=w;break e}}else if(_.elementType===D||typeof D=="object"&&D!==null&&D.$$typeof===_r&&nm(D)===_.type){n(x,_.sibling),w=i(_,j.props),w.ref=_s(x,_,j),w.return=x,x=w;break e}n(x,_);break}else t(x,_);_=_.sibling}j.type===Ei?(w=ni(j.props.children,x.mode,z,j.key),w.return=x,x=w):(z=xa(j.type,j.key,j.props,null,x.mode,z),z.ref=_s(x,w,j),z.return=x,x=z)}return a(x);case _i:e:{for(_=j.key;w!==null;){if(w.key===_)if(w.tag===4&&w.stateNode.containerInfo===j.containerInfo&&w.stateNode.implementation===j.implementation){n(x,w.sibling),w=i(w,j.children||[]),w.return=x,x=w;break e}else{n(x,w);break}else t(x,w);w=w.sibling}w=nc(j,x.mode,z),w.return=x,x=w}return a(x);case _r:return _=j._init,v(x,w,_(j._payload),z)}if(Is(j))return g(x,w,j,z);if(bs(j))return k(x,w,j,z);Ql(x,j)}return typeof j=="string"&&j!==""||typeof j=="number"?(j=""+j,w!==null&&w.tag===6?(n(x,w.sibling),w=i(w,j),w.return=x,x=w):(n(x,w),w=tc(j,x.mode,z),w.return=x,x=w),a(x)):n(x,w)}return v}var Zi=cg(!0),ug=cg(!1),Ma=Vr(null),Ra=null,Mi=null,ed=null;function td(){ed=Mi=Ra=null}function nd(e){var t=Ma.current;We(Ma),e._currentValue=t}function Xc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Vi(e,t){Ra=e,ed=Mi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qt=!0),e.firstContext=null)}function yn(e){var t=e._currentValue;if(ed!==e)if(e={context:e,memoizedValue:t,next:null},Mi===null){if(Ra===null)throw Error(W(308));Mi=e,Ra.dependencies={lanes:0,firstContext:e}}else Mi=Mi.next=e;return t}var Jr=null;function rd(e){Jr===null?Jr=[e]:Jr.push(e)}function dg(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,rd(t)):(n.next=i.next,i.next=n),t.interleaved=n,rr(e,r)}function rr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Er=!1;function id(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function er(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Rr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,De&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,rr(e,n)}return i=r.interleaved,i===null?(t.next=t,rd(r)):(t.next=i.next,i.next=t),r.interleaved=t,rr(e,n)}function fa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hu(e,n)}}function rm(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?i=l=a:l=l.next=a,n=n.next}while(n!==null);l===null?i=l=t:l=l.next=t}else i=l=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:l,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function $a(e,t,n,r){var i=e.updateQueue;Er=!1;var l=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var c=o,u=c.next;c.next=null,a===null?l=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(l!==null){var f=i.baseState;a=0,d=u=c=null,o=l;do{var h=o.lane,m=o.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:m,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var g=e,k=o;switch(h=t,m=n,k.tag){case 1:if(g=k.payload,typeof g=="function"){f=g.call(m,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=k.payload,h=typeof g=="function"?g.call(m,f,h):g,h==null)break e;f=tt({},f,h);break e;case 2:Er=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[o]:h.push(o))}else m={eventTime:m,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=m,c=f):d=d.next=m,a|=h;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;h=o,o=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do a|=i.lane,i=i.next;while(i!==t)}else l===null&&(i.shared.lanes=0);li|=a,e.lanes=a,e.memoizedState=f}}function im(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(W(191,i));i.call(r)}}}var Sl={},Hn=Vr(Sl),ul=Vr(Sl),dl=Vr(Sl);function Zr(e){if(e===Sl)throw Error(W(174));return e}function sd(e,t){switch(He(dl,t),He(ul,e),He(Hn,Sl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Lc(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Lc(t,e)}We(Hn),He(Hn,t)}function es(){We(Hn),We(ul),We(dl)}function mg(e){Zr(dl.current);var t=Zr(Hn.current),n=Lc(t,e.type);t!==n&&(He(ul,e),He(Hn,n))}function ld(e){ul.current===e&&(We(Hn),We(ul))}var Je=Vr(0);function Fa(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ko=[];function ad(){for(var e=0;e<Ko.length;e++)Ko[e]._workInProgressVersionPrimary=null;Ko.length=0}var ma=lr.ReactCurrentDispatcher,Yo=lr.ReactCurrentBatchConfig,si=0,et=null,ft=null,xt=null,Oa=!1,Hs=!1,fl=0,mk=0;function Tt(){throw Error(W(321))}function od(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Pn(e[n],t[n]))return!1;return!0}function cd(e,t,n,r,i,l){if(si=l,et=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ma.current=e===null||e.memoizedState===null?yk:xk,e=n(r,i),Hs){l=0;do{if(Hs=!1,fl=0,25<=l)throw Error(W(301));l+=1,xt=ft=null,t.updateQueue=null,ma.current=vk,e=n(r,i)}while(Hs)}if(ma.current=Ua,t=ft!==null&&ft.next!==null,si=0,xt=ft=et=null,Oa=!1,t)throw Error(W(300));return e}function ud(){var e=fl!==0;return fl=0,e}function Fn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xt===null?et.memoizedState=xt=e:xt=xt.next=e,xt}function xn(){if(ft===null){var e=et.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var t=xt===null?et.memoizedState:xt.next;if(t!==null)xt=t,ft=e;else{if(e===null)throw Error(W(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},xt===null?et.memoizedState=xt=e:xt=xt.next=e}return xt}function ml(e,t){return typeof t=="function"?t(e):t}function Xo(e){var t=xn(),n=t.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=e;var r=ft,i=r.baseQueue,l=n.pending;if(l!==null){if(i!==null){var a=i.next;i.next=l.next,l.next=a}r.baseQueue=i=l,n.pending=null}if(i!==null){l=i.next,r=r.baseState;var o=a=null,c=null,u=l;do{var d=u.lane;if((si&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(o=c=f,a=r):c=c.next=f,et.lanes|=d,li|=d}u=u.next}while(u!==null&&u!==l);c===null?a=r:c.next=o,Pn(r,t.memoizedState)||(qt=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do l=i.lane,et.lanes|=l,li|=l,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Jo(e){var t=xn(),n=t.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,l=t.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do l=e(l,a.action),a=a.next;while(a!==i);Pn(l,t.memoizedState)||(qt=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,r]}function hg(){}function pg(e,t){var n=et,r=xn(),i=t(),l=!Pn(r.memoizedState,i);if(l&&(r.memoizedState=i,qt=!0),r=r.queue,dd(xg.bind(null,n,r,e),[e]),r.getSnapshot!==t||l||xt!==null&&xt.memoizedState.tag&1){if(n.flags|=2048,hl(9,yg.bind(null,n,r,i,t),void 0,null),vt===null)throw Error(W(349));si&30||gg(n,t,i)}return i}function gg(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function yg(e,t,n,r){t.value=n,t.getSnapshot=r,vg(t)&&kg(e)}function xg(e,t,n){return n(function(){vg(t)&&kg(e)})}function vg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Pn(e,n)}catch{return!0}}function kg(e){var t=rr(e,1);t!==null&&Dn(t,e,1,-1)}function sm(e){var t=Fn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ml,lastRenderedState:e},t.queue=e,e=e.dispatch=gk.bind(null,et,e),[t.memoizedState,e]}function hl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function wg(){return xn().memoizedState}function ha(e,t,n,r){var i=Fn();et.flags|=e,i.memoizedState=hl(1|t,n,void 0,r===void 0?null:r)}function mo(e,t,n,r){var i=xn();r=r===void 0?null:r;var l=void 0;if(ft!==null){var a=ft.memoizedState;if(l=a.destroy,r!==null&&od(r,a.deps)){i.memoizedState=hl(t,n,l,r);return}}et.flags|=e,i.memoizedState=hl(1|t,n,l,r)}function lm(e,t){return ha(8390656,8,e,t)}function dd(e,t){return mo(2048,8,e,t)}function bg(e,t){return mo(4,2,e,t)}function jg(e,t){return mo(4,4,e,t)}function Sg(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ng(e,t,n){return n=n!=null?n.concat([e]):null,mo(4,4,Sg.bind(null,t,e),n)}function fd(){}function Cg(e,t){var n=xn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&od(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function _g(e,t){var n=xn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&od(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Eg(e,t,n){return si&21?(Pn(n,t)||(n=Dp(),et.lanes|=n,li|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,qt=!0),e.memoizedState=n)}function hk(e,t){var n=$e;$e=n!==0&&4>n?n:4,e(!0);var r=Yo.transition;Yo.transition={};try{e(!1),t()}finally{$e=n,Yo.transition=r}}function Tg(){return xn().memoizedState}function pk(e,t,n){var r=Fr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},zg(e))Lg(t,n);else if(n=dg(e,t,n,r),n!==null){var i=Ot();Dn(n,e,r,i),Ag(n,t,r)}}function gk(e,t,n){var r=Fr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(zg(e))Lg(t,i);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var a=t.lastRenderedState,o=l(a,n);if(i.hasEagerState=!0,i.eagerState=o,Pn(o,a)){var c=t.interleaved;c===null?(i.next=i,rd(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=dg(e,t,i,r),n!==null&&(i=Ot(),Dn(n,e,r,i),Ag(n,t,r))}}function zg(e){var t=e.alternate;return e===et||t!==null&&t===et}function Lg(e,t){Hs=Oa=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ag(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hu(e,n)}}var Ua={readContext:yn,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useInsertionEffect:Tt,useLayoutEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useMutableSource:Tt,useSyncExternalStore:Tt,useId:Tt,unstable_isNewReconciler:!1},yk={readContext:yn,useCallback:function(e,t){return Fn().memoizedState=[e,t===void 0?null:t],e},useContext:yn,useEffect:lm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ha(4194308,4,Sg.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ha(4194308,4,e,t)},useInsertionEffect:function(e,t){return ha(4,2,e,t)},useMemo:function(e,t){var n=Fn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Fn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=pk.bind(null,et,e),[r.memoizedState,e]},useRef:function(e){var t=Fn();return e={current:e},t.memoizedState=e},useState:sm,useDebugValue:fd,useDeferredValue:function(e){return Fn().memoizedState=e},useTransition:function(){var e=sm(!1),t=e[0];return e=hk.bind(null,e[1]),Fn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=et,i=Fn();if(Ye){if(n===void 0)throw Error(W(407));n=n()}else{if(n=t(),vt===null)throw Error(W(349));si&30||gg(r,t,n)}i.memoizedState=n;var l={value:n,getSnapshot:t};return i.queue=l,lm(xg.bind(null,r,l,e),[e]),r.flags|=2048,hl(9,yg.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=Fn(),t=vt.identifierPrefix;if(Ye){var n=Jn,r=Xn;n=(r&~(1<<32-An(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=fl++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=mk++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},xk={readContext:yn,useCallback:Cg,useContext:yn,useEffect:dd,useImperativeHandle:Ng,useInsertionEffect:bg,useLayoutEffect:jg,useMemo:_g,useReducer:Xo,useRef:wg,useState:function(){return Xo(ml)},useDebugValue:fd,useDeferredValue:function(e){var t=xn();return Eg(t,ft.memoizedState,e)},useTransition:function(){var e=Xo(ml)[0],t=xn().memoizedState;return[e,t]},useMutableSource:hg,useSyncExternalStore:pg,useId:Tg,unstable_isNewReconciler:!1},vk={readContext:yn,useCallback:Cg,useContext:yn,useEffect:dd,useImperativeHandle:Ng,useInsertionEffect:bg,useLayoutEffect:jg,useMemo:_g,useReducer:Jo,useRef:wg,useState:function(){return Jo(ml)},useDebugValue:fd,useDeferredValue:function(e){var t=xn();return ft===null?t.memoizedState=e:Eg(t,ft.memoizedState,e)},useTransition:function(){var e=Jo(ml)[0],t=xn().memoizedState;return[e,t]},useMutableSource:hg,useSyncExternalStore:pg,useId:Tg,unstable_isNewReconciler:!1};function _n(e,t){if(e&&e.defaultProps){t=tt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Jc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:tt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ho={isMounted:function(e){return(e=e._reactInternals)?hi(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ot(),i=Fr(e),l=er(r,i);l.payload=t,n!=null&&(l.callback=n),t=Rr(e,l,i),t!==null&&(Dn(t,e,i,r),fa(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ot(),i=Fr(e),l=er(r,i);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=Rr(e,l,i),t!==null&&(Dn(t,e,i,r),fa(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ot(),r=Fr(e),i=er(n,r);i.tag=2,t!=null&&(i.callback=t),t=Rr(e,i,r),t!==null&&(Dn(t,e,r,n),fa(t,e,r))}};function am(e,t,n,r,i,l,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,l,a):t.prototype&&t.prototype.isPureReactComponent?!ll(n,r)||!ll(i,l):!0}function Dg(e,t,n){var r=!1,i=Br,l=t.contextType;return typeof l=="object"&&l!==null?l=yn(l):(i=Kt(t)?ri:Dt.current,r=t.contextTypes,l=(r=r!=null)?Xi(e,i):Br),t=new t(n,l),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ho,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=l),t}function om(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ho.enqueueReplaceState(t,t.state,null)}function Zc(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},id(e);var l=t.contextType;typeof l=="object"&&l!==null?i.context=yn(l):(l=Kt(t)?ri:Dt.current,i.context=Xi(e,l)),i.state=e.memoizedState,l=t.getDerivedStateFromProps,typeof l=="function"&&(Jc(e,t,l,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&ho.enqueueReplaceState(i,i.state,null),$a(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function ts(e,t){try{var n="",r=t;do n+=qv(r),r=r.return;while(r);var i=n}catch(l){i=`
39
+ Error generating stack: `+l.message+`
40
+ `+l.stack}return{value:e,source:t,stack:i,digest:null}}function Zo(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function eu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var kk=typeof WeakMap=="function"?WeakMap:Map;function Ig(e,t,n){n=er(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ha||(Ha=!0,uu=r),eu(e,t)},n}function Pg(e,t,n){n=er(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){eu(e,t)}}var l=e.stateNode;return l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){eu(e,t),typeof r!="function"&&($r===null?$r=new Set([this]):$r.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function cm(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new kk;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Ik.bind(null,e,t,n),t.then(e,e))}function um(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function dm(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=er(-1,1),t.tag=2,Rr(n,t,1))),n.lanes|=1),e)}var wk=lr.ReactCurrentOwner,qt=!1;function $t(e,t,n,r){t.child=e===null?ug(t,null,n,r):Zi(t,e.child,n,r)}function fm(e,t,n,r,i){n=n.render;var l=t.ref;return Vi(t,i),r=cd(e,t,n,r,l,i),n=ud(),e!==null&&!qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ir(e,t,i)):(Ye&&n&&Xu(t),t.flags|=1,$t(e,t,r,i),t.child)}function mm(e,t,n,r,i){if(e===null){var l=n.type;return typeof l=="function"&&!kd(l)&&l.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=l,Mg(e,t,l,r,i)):(e=xa(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!(e.lanes&i)){var a=l.memoizedProps;if(n=n.compare,n=n!==null?n:ll,n(a,r)&&e.ref===t.ref)return ir(e,t,i)}return t.flags|=1,e=Or(l,r),e.ref=t.ref,e.return=t,t.child=e}function Mg(e,t,n,r,i){if(e!==null){var l=e.memoizedProps;if(ll(l,r)&&e.ref===t.ref)if(qt=!1,t.pendingProps=r=l,(e.lanes&i)!==0)e.flags&131072&&(qt=!0);else return t.lanes=e.lanes,ir(e,t,i)}return tu(e,t,n,r,i)}function Rg(e,t,n){var r=t.pendingProps,i=r.children,l=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},He($i,nn),nn|=n;else{if(!(n&1073741824))return e=l!==null?l.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,He($i,nn),nn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=l!==null?l.baseLanes:n,He($i,nn),nn|=r}else l!==null?(r=l.baseLanes|n,t.memoizedState=null):r=n,He($i,nn),nn|=r;return $t(e,t,i,n),t.child}function $g(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function tu(e,t,n,r,i){var l=Kt(n)?ri:Dt.current;return l=Xi(t,l),Vi(t,i),n=cd(e,t,n,r,l,i),r=ud(),e!==null&&!qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ir(e,t,i)):(Ye&&r&&Xu(t),t.flags|=1,$t(e,t,n,i),t.child)}function hm(e,t,n,r,i){if(Kt(n)){var l=!0;Da(t)}else l=!1;if(Vi(t,i),t.stateNode===null)pa(e,t),Dg(t,n,r),Zc(t,n,r,i),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var c=a.context,u=n.contextType;typeof u=="object"&&u!==null?u=yn(u):(u=Kt(n)?ri:Dt.current,u=Xi(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||c!==u)&&om(t,a,r,u),Er=!1;var h=t.memoizedState;a.state=h,$a(t,r,a,i),c=t.memoizedState,o!==r||h!==c||Qt.current||Er?(typeof d=="function"&&(Jc(t,n,d,r),c=t.memoizedState),(o=Er||am(t,n,o,r,h,c,u))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=u,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,fg(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:_n(t.type,o),a.props=u,f=t.pendingProps,h=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=yn(c):(c=Kt(n)?ri:Dt.current,c=Xi(t,c));var m=n.getDerivedStateFromProps;(d=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==f||h!==c)&&om(t,a,r,c),Er=!1,h=t.memoizedState,a.state=h,$a(t,r,a,i);var g=t.memoizedState;o!==f||h!==g||Qt.current||Er?(typeof m=="function"&&(Jc(t,n,m,r),g=t.memoizedState),(u=Er||am(t,n,u,r,h,g,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,g,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,g,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),a.props=r,a.state=g,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return nu(e,t,n,r,l,i)}function nu(e,t,n,r,i,l){$g(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return i&&Zf(t,n,!1),ir(e,t,l);r=t.stateNode,wk.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Zi(t,e.child,null,l),t.child=Zi(t,null,o,l)):$t(e,t,o,l),t.memoizedState=r.state,i&&Zf(t,n,!0),t.child}function Fg(e){var t=e.stateNode;t.pendingContext?Jf(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Jf(e,t.context,!1),sd(e,t.containerInfo)}function pm(e,t,n,r,i){return Ji(),Zu(i),t.flags|=256,$t(e,t,n,r),t.child}var ru={dehydrated:null,treeContext:null,retryLane:0};function iu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Og(e,t,n){var r=t.pendingProps,i=Je.current,l=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(i&2)!==0),o?(l=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),He(Je,i&1),e===null)return Yc(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,l?(r=t.mode,l=t.child,a={mode:"hidden",children:a},!(r&1)&&l!==null?(l.childLanes=0,l.pendingProps=a):l=yo(a,r,0,null),e=ni(e,r,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=iu(n),t.memoizedState=ru,e):md(t,a));if(i=e.memoizedState,i!==null&&(o=i.dehydrated,o!==null))return bk(e,t,a,r,o,i,n);if(l){l=r.fallback,a=t.mode,i=e.child,o=i.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Or(i,c),r.subtreeFlags=i.subtreeFlags&14680064),o!==null?l=Or(o,l):(l=ni(l,a,n,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,r=l,l=t.child,a=e.child.memoizedState,a=a===null?iu(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},l.memoizedState=a,l.childLanes=e.childLanes&~n,t.memoizedState=ru,r}return l=e.child,e=l.sibling,r=Or(l,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function md(e,t){return t=yo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Kl(e,t,n,r){return r!==null&&Zu(r),Zi(t,e.child,null,n),e=md(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function bk(e,t,n,r,i,l,a){if(n)return t.flags&256?(t.flags&=-257,r=Zo(Error(W(422))),Kl(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(l=r.fallback,i=t.mode,r=yo({mode:"visible",children:r.children},i,0,null),l=ni(l,i,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,t.mode&1&&Zi(t,e.child,null,a),t.child.memoizedState=iu(a),t.memoizedState=ru,l);if(!(t.mode&1))return Kl(e,t,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var o=r.dgst;return r=o,l=Error(W(419)),r=Zo(l,r,void 0),Kl(e,t,a,r)}if(o=(a&e.childLanes)!==0,qt||o){if(r=vt,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==l.retryLane&&(l.retryLane=i,rr(e,i),Dn(r,e,i,-1))}return vd(),r=Zo(Error(W(421))),Kl(e,t,a,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Pk.bind(null,e),i._reactRetry=t,null):(e=l.treeContext,rn=Mr(i.nextSibling),sn=t,Ye=!0,Tn=null,e!==null&&(dn[fn++]=Xn,dn[fn++]=Jn,dn[fn++]=ii,Xn=e.id,Jn=e.overflow,ii=t),t=md(t,r.children),t.flags|=4096,t)}function gm(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xc(e.return,t,n)}function ec(e,t,n,r,i){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=r,l.tail=n,l.tailMode=i)}function Ug(e,t,n){var r=t.pendingProps,i=r.revealOrder,l=r.tail;if($t(e,t,r.children,n),r=Je.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gm(e,n,t);else if(e.tag===19)gm(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(He(Je,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Fa(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ec(t,!1,i,n,l);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Fa(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ec(t,!0,n,null,l);break;case"together":ec(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function pa(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ir(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),li|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(W(153));if(t.child!==null){for(e=t.child,n=Or(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Or(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jk(e,t,n){switch(t.tag){case 3:Fg(t),Ji();break;case 5:mg(t);break;case 1:Kt(t.type)&&Da(t);break;case 4:sd(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;He(Ma,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(He(Je,Je.current&1),t.flags|=128,null):n&t.child.childLanes?Og(e,t,n):(He(Je,Je.current&1),e=ir(e,t,n),e!==null?e.sibling:null);He(Je,Je.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ug(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),He(Je,Je.current),r)break;return null;case 22:case 23:return t.lanes=0,Rg(e,t,n)}return ir(e,t,n)}var Bg,su,Hg,Vg;Bg=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};su=function(){};Hg=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Zr(Hn.current);var l=null;switch(n){case"input":i=_c(e,i),r=_c(e,r),l=[];break;case"select":i=tt({},i,{value:void 0}),r=tt({},r,{value:void 0}),l=[];break;case"textarea":i=zc(e,i),r=zc(e,r),l=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=La)}Ac(n,r);var a;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var o=i[u];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Zs.hasOwnProperty(u)?l||(l=[]):(l=l||[]).push(u,null));for(u in r){var c=r[u];if(o=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&c!==o&&(c!=null||o!=null))if(u==="style")if(o){for(a in o)!o.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&o[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(l||(l=[]),l.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,o=o?o.__html:void 0,c!=null&&o!==c&&(l=l||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(l=l||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Zs.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Ve("scroll",e),l||o===c||(l=[])):(l=l||[]).push(u,c))}n&&(l=l||[]).push("style",n);var u=l;(t.updateQueue=u)&&(t.flags|=4)}};Vg=function(e,t,n,r){n!==r&&(t.flags|=4)};function Es(e,t){if(!Ye)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function zt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Sk(e,t,n){var r=t.pendingProps;switch(Ju(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zt(t),null;case 1:return Kt(t.type)&&Aa(),zt(t),null;case 3:return r=t.stateNode,es(),We(Qt),We(Dt),ad(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ql(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Tn!==null&&(mu(Tn),Tn=null))),su(e,t),zt(t),null;case 5:ld(t);var i=Zr(dl.current);if(n=t.type,e!==null&&t.stateNode!=null)Hg(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(W(166));return zt(t),null}if(e=Zr(Hn.current),ql(t)){r=t.stateNode,n=t.type;var l=t.memoizedProps;switch(r[Un]=t,r[cl]=l,e=(t.mode&1)!==0,n){case"dialog":Ve("cancel",r),Ve("close",r);break;case"iframe":case"object":case"embed":Ve("load",r);break;case"video":case"audio":for(i=0;i<Ms.length;i++)Ve(Ms[i],r);break;case"source":Ve("error",r);break;case"img":case"image":case"link":Ve("error",r),Ve("load",r);break;case"details":Ve("toggle",r);break;case"input":Nf(r,l),Ve("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!l.multiple},Ve("invalid",r);break;case"textarea":_f(r,l),Ve("invalid",r)}Ac(n,l),i=null;for(var a in l)if(l.hasOwnProperty(a)){var o=l[a];a==="children"?typeof o=="string"?r.textContent!==o&&(l.suppressHydrationWarning!==!0&&Gl(r.textContent,o,e),i=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(l.suppressHydrationWarning!==!0&&Gl(r.textContent,o,e),i=["children",""+o]):Zs.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&Ve("scroll",r)}switch(n){case"input":$l(r),Cf(r,l,!0);break;case"textarea":$l(r),Ef(r);break;case"select":case"option":break;default:typeof l.onClick=="function"&&(r.onclick=La)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=xp(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Un]=t,e[cl]=r,Bg(e,t,!1,!1),t.stateNode=e;e:{switch(a=Dc(n,r),n){case"dialog":Ve("cancel",e),Ve("close",e),i=r;break;case"iframe":case"object":case"embed":Ve("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ms.length;i++)Ve(Ms[i],e);i=r;break;case"source":Ve("error",e),i=r;break;case"img":case"image":case"link":Ve("error",e),Ve("load",e),i=r;break;case"details":Ve("toggle",e),i=r;break;case"input":Nf(e,r),i=_c(e,r),Ve("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=tt({},r,{value:void 0}),Ve("invalid",e);break;case"textarea":_f(e,r),i=zc(e,r),Ve("invalid",e);break;default:i=r}Ac(n,i),o=i;for(l in o)if(o.hasOwnProperty(l)){var c=o[l];l==="style"?wp(e,c):l==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&vp(e,c)):l==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&el(e,c):typeof c=="number"&&el(e,""+c):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(Zs.hasOwnProperty(l)?c!=null&&l==="onScroll"&&Ve("scroll",e):c!=null&&Ru(e,l,c,a))}switch(n){case"input":$l(e),Cf(e,r,!1);break;case"textarea":$l(e),Ef(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ur(r.value));break;case"select":e.multiple=!!r.multiple,l=r.value,l!=null?Oi(e,!!r.multiple,l,!1):r.defaultValue!=null&&Oi(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=La)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return zt(t),null;case 6:if(e&&t.stateNode!=null)Vg(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(W(166));if(n=Zr(dl.current),Zr(Hn.current),ql(t)){if(r=t.stateNode,n=t.memoizedProps,r[Un]=t,(l=r.nodeValue!==n)&&(e=sn,e!==null))switch(e.tag){case 3:Gl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Gl(r.nodeValue,n,(e.mode&1)!==0)}l&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Un]=t,t.stateNode=r}return zt(t),null;case 13:if(We(Je),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ye&&rn!==null&&t.mode&1&&!(t.flags&128))og(),Ji(),t.flags|=98560,l=!1;else if(l=ql(t),r!==null&&r.dehydrated!==null){if(e===null){if(!l)throw Error(W(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(W(317));l[Un]=t}else Ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zt(t),l=!1}else Tn!==null&&(mu(Tn),Tn=null),l=!0;if(!l)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Je.current&1?ht===0&&(ht=3):vd())),t.updateQueue!==null&&(t.flags|=4),zt(t),null);case 4:return es(),su(e,t),e===null&&al(t.stateNode.containerInfo),zt(t),null;case 10:return nd(t.type._context),zt(t),null;case 17:return Kt(t.type)&&Aa(),zt(t),null;case 19:if(We(Je),l=t.memoizedState,l===null)return zt(t),null;if(r=(t.flags&128)!==0,a=l.rendering,a===null)if(r)Es(l,!1);else{if(ht!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Fa(e),a!==null){for(t.flags|=128,Es(l,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)l=n,e=r,l.flags&=14680066,a=l.alternate,a===null?(l.childLanes=0,l.lanes=e,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=a.childLanes,l.lanes=a.lanes,l.child=a.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=a.memoizedProps,l.memoizedState=a.memoizedState,l.updateQueue=a.updateQueue,l.type=a.type,e=a.dependencies,l.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return He(Je,Je.current&1|2),t.child}e=e.sibling}l.tail!==null&&st()>ns&&(t.flags|=128,r=!0,Es(l,!1),t.lanes=4194304)}else{if(!r)if(e=Fa(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Es(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!Ye)return zt(t),null}else 2*st()-l.renderingStartTime>ns&&n!==1073741824&&(t.flags|=128,r=!0,Es(l,!1),t.lanes=4194304);l.isBackwards?(a.sibling=t.child,t.child=a):(n=l.last,n!==null?n.sibling=a:t.child=a,l.last=a)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=st(),t.sibling=null,n=Je.current,He(Je,r?n&1|2:n&1),t):(zt(t),null);case 22:case 23:return xd(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?nn&1073741824&&(zt(t),t.subtreeFlags&6&&(t.flags|=8192)):zt(t),null;case 24:return null;case 25:return null}throw Error(W(156,t.tag))}function Nk(e,t){switch(Ju(t),t.tag){case 1:return Kt(t.type)&&Aa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return es(),We(Qt),We(Dt),ad(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ld(t),null;case 13:if(We(Je),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(W(340));Ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return We(Je),null;case 4:return es(),null;case 10:return nd(t.type._context),null;case 22:case 23:return xd(),null;case 24:return null;default:return null}}var Yl=!1,Lt=!1,Ck=typeof WeakSet=="function"?WeakSet:Set,ne=null;function Ri(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){rt(e,t,r)}else n.current=null}function lu(e,t,n){try{n()}catch(r){rt(e,t,r)}}var ym=!1;function _k(e,t){if(Hc=Ea,e=Kp(),Yu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var a=0,o=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(o=a+i),f!==l||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(m=f.firstChild)!==null;)h=f,f=m;for(;;){if(f===e)break t;if(h===n&&++u===i&&(o=a),h===l&&++d===r&&(c=a),(m=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=m}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Vc={focusedElem:e,selectionRange:n},Ea=!1,ne=t;ne!==null;)if(t=ne,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ne=e;else for(;ne!==null;){t=ne;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var k=g.memoizedProps,v=g.memoizedState,x=t.stateNode,w=x.getSnapshotBeforeUpdate(t.elementType===t.type?k:_n(t.type,k),v);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var j=t.stateNode.containerInfo;j.nodeType===1?j.textContent="":j.nodeType===9&&j.documentElement&&j.removeChild(j.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(z){rt(t,t.return,z)}if(e=t.sibling,e!==null){e.return=t.return,ne=e;break}ne=t.return}return g=ym,ym=!1,g}function Vs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var l=i.destroy;i.destroy=void 0,l!==void 0&&lu(t,n,l)}i=i.next}while(i!==r)}}function po(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function au(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Wg(e){var t=e.alternate;t!==null&&(e.alternate=null,Wg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Un],delete t[cl],delete t[qc],delete t[ck],delete t[uk])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Gg(e){return e.tag===5||e.tag===3||e.tag===4}function xm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ou(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=La));else if(r!==4&&(e=e.child,e!==null))for(ou(e,t,n),e=e.sibling;e!==null;)ou(e,t,n),e=e.sibling}function cu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(cu(e,t,n),e=e.sibling;e!==null;)cu(e,t,n),e=e.sibling}var Nt=null,En=!1;function br(e,t,n){for(n=n.child;n!==null;)qg(e,t,n),n=n.sibling}function qg(e,t,n){if(Bn&&typeof Bn.onCommitFiberUnmount=="function")try{Bn.onCommitFiberUnmount(lo,n)}catch{}switch(n.tag){case 5:Lt||Ri(n,t);case 6:var r=Nt,i=En;Nt=null,br(e,t,n),Nt=r,En=i,Nt!==null&&(En?(e=Nt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Nt.removeChild(n.stateNode));break;case 18:Nt!==null&&(En?(e=Nt,n=n.stateNode,e.nodeType===8?qo(e.parentNode,n):e.nodeType===1&&qo(e,n),il(e)):qo(Nt,n.stateNode));break;case 4:r=Nt,i=En,Nt=n.stateNode.containerInfo,En=!0,br(e,t,n),Nt=r,En=i;break;case 0:case 11:case 14:case 15:if(!Lt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var l=i,a=l.destroy;l=l.tag,a!==void 0&&(l&2||l&4)&&lu(n,t,a),i=i.next}while(i!==r)}br(e,t,n);break;case 1:if(!Lt&&(Ri(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){rt(n,t,o)}br(e,t,n);break;case 21:br(e,t,n);break;case 22:n.mode&1?(Lt=(r=Lt)||n.memoizedState!==null,br(e,t,n),Lt=r):br(e,t,n);break;default:br(e,t,n)}}function vm(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ck),t.forEach(function(r){var i=Mk.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Sn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var l=e,a=t,o=a;e:for(;o!==null;){switch(o.tag){case 5:Nt=o.stateNode,En=!1;break e;case 3:Nt=o.stateNode.containerInfo,En=!0;break e;case 4:Nt=o.stateNode.containerInfo,En=!0;break e}o=o.return}if(Nt===null)throw Error(W(160));qg(l,a,i),Nt=null,En=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(u){rt(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Qg(t,e),t=t.sibling}function Qg(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Sn(t,e),$n(e),r&4){try{Vs(3,e,e.return),po(3,e)}catch(k){rt(e,e.return,k)}try{Vs(5,e,e.return)}catch(k){rt(e,e.return,k)}}break;case 1:Sn(t,e),$n(e),r&512&&n!==null&&Ri(n,n.return);break;case 5:if(Sn(t,e),$n(e),r&512&&n!==null&&Ri(n,n.return),e.flags&32){var i=e.stateNode;try{el(i,"")}catch(k){rt(e,e.return,k)}}if(r&4&&(i=e.stateNode,i!=null)){var l=e.memoizedProps,a=n!==null?n.memoizedProps:l,o=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{o==="input"&&l.type==="radio"&&l.name!=null&&gp(i,l),Dc(o,a);var u=Dc(o,l);for(a=0;a<c.length;a+=2){var d=c[a],f=c[a+1];d==="style"?wp(i,f):d==="dangerouslySetInnerHTML"?vp(i,f):d==="children"?el(i,f):Ru(i,d,f,u)}switch(o){case"input":Ec(i,l);break;case"textarea":yp(i,l);break;case"select":var h=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!l.multiple;var m=l.value;m!=null?Oi(i,!!l.multiple,m,!1):h!==!!l.multiple&&(l.defaultValue!=null?Oi(i,!!l.multiple,l.defaultValue,!0):Oi(i,!!l.multiple,l.multiple?[]:"",!1))}i[cl]=l}catch(k){rt(e,e.return,k)}}break;case 6:if(Sn(t,e),$n(e),r&4){if(e.stateNode===null)throw Error(W(162));i=e.stateNode,l=e.memoizedProps;try{i.nodeValue=l}catch(k){rt(e,e.return,k)}}break;case 3:if(Sn(t,e),$n(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{il(t.containerInfo)}catch(k){rt(e,e.return,k)}break;case 4:Sn(t,e),$n(e);break;case 13:Sn(t,e),$n(e),i=e.child,i.flags&8192&&(l=i.memoizedState!==null,i.stateNode.isHidden=l,!l||i.alternate!==null&&i.alternate.memoizedState!==null||(gd=st())),r&4&&vm(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(Lt=(u=Lt)||d,Sn(t,e),Lt=u):Sn(t,e),$n(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(ne=e,d=e.child;d!==null;){for(f=ne=d;ne!==null;){switch(h=ne,m=h.child,h.tag){case 0:case 11:case 14:case 15:Vs(4,h,h.return);break;case 1:Ri(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(k){rt(r,n,k)}}break;case 5:Ri(h,h.return);break;case 22:if(h.memoizedState!==null){wm(f);continue}}m!==null?(m.return=h,ne=m):wm(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{i=f.stateNode,u?(l=i.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"):(o=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,o.style.display=kp("display",a))}catch(k){rt(e,e.return,k)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(k){rt(e,e.return,k)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Sn(t,e),$n(e),r&4&&vm(e);break;case 21:break;default:Sn(t,e),$n(e)}}function $n(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Gg(n)){var r=n;break e}n=n.return}throw Error(W(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(el(i,""),r.flags&=-33);var l=xm(e);cu(e,l,i);break;case 3:case 4:var a=r.stateNode.containerInfo,o=xm(e);ou(e,o,a);break;default:throw Error(W(161))}}catch(c){rt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ek(e,t,n){ne=e,Kg(e)}function Kg(e,t,n){for(var r=(e.mode&1)!==0;ne!==null;){var i=ne,l=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||Yl;if(!a){var o=i.alternate,c=o!==null&&o.memoizedState!==null||Lt;o=Yl;var u=Lt;if(Yl=a,(Lt=c)&&!u)for(ne=i;ne!==null;)a=ne,c=a.child,a.tag===22&&a.memoizedState!==null?bm(i):c!==null?(c.return=a,ne=c):bm(i);for(;l!==null;)ne=l,Kg(l),l=l.sibling;ne=i,Yl=o,Lt=u}km(e)}else i.subtreeFlags&8772&&l!==null?(l.return=i,ne=l):km(e)}}function km(e){for(;ne!==null;){var t=ne;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Lt||po(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Lt)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:_n(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var l=t.updateQueue;l!==null&&im(t,l,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}im(t,a,n)}break;case 5:var o=t.stateNode;if(n===null&&t.flags&4){n=o;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&il(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}Lt||t.flags&512&&au(t)}catch(h){rt(t,t.return,h)}}if(t===e){ne=null;break}if(n=t.sibling,n!==null){n.return=t.return,ne=n;break}ne=t.return}}function wm(e){for(;ne!==null;){var t=ne;if(t===e){ne=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ne=n;break}ne=t.return}}function bm(e){for(;ne!==null;){var t=ne;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{po(4,t)}catch(c){rt(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){rt(t,i,c)}}var l=t.return;try{au(t)}catch(c){rt(t,l,c)}break;case 5:var a=t.return;try{au(t)}catch(c){rt(t,a,c)}}}catch(c){rt(t,t.return,c)}if(t===e){ne=null;break}var o=t.sibling;if(o!==null){o.return=t.return,ne=o;break}ne=t.return}}var Tk=Math.ceil,Ba=lr.ReactCurrentDispatcher,hd=lr.ReactCurrentOwner,pn=lr.ReactCurrentBatchConfig,De=0,vt=null,ut=null,Ct=0,nn=0,$i=Vr(0),ht=0,pl=null,li=0,go=0,pd=0,Ws=null,Gt=null,gd=0,ns=1/0,Qn=null,Ha=!1,uu=null,$r=null,Xl=!1,Ar=null,Va=0,Gs=0,du=null,ga=-1,ya=0;function Ot(){return De&6?st():ga!==-1?ga:ga=st()}function Fr(e){return e.mode&1?De&2&&Ct!==0?Ct&-Ct:fk.transition!==null?(ya===0&&(ya=Dp()),ya):(e=$e,e!==0||(e=window.event,e=e===void 0?16:Op(e.type)),e):1}function Dn(e,t,n,r){if(50<Gs)throw Gs=0,du=null,Error(W(185));wl(e,n,r),(!(De&2)||e!==vt)&&(e===vt&&(!(De&2)&&(go|=n),ht===4&&zr(e,Ct)),Yt(e,r),n===1&&De===0&&!(t.mode&1)&&(ns=st()+500,fo&&Wr()))}function Yt(e,t){var n=e.callbackNode;f1(e,t);var r=_a(e,e===vt?Ct:0);if(r===0)n!==null&&Lf(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Lf(n),t===1)e.tag===0?dk(jm.bind(null,e)):sg(jm.bind(null,e)),ak(function(){!(De&6)&&Wr()}),n=null;else{switch(Ip(r)){case 1:n=Bu;break;case 4:n=Lp;break;case 16:n=Ca;break;case 536870912:n=Ap;break;default:n=Ca}n=ry(n,Yg.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Yg(e,t){if(ga=-1,ya=0,De&6)throw Error(W(327));var n=e.callbackNode;if(Wi()&&e.callbackNode!==n)return null;var r=_a(e,e===vt?Ct:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Wa(e,r);else{t=r;var i=De;De|=2;var l=Jg();(vt!==e||Ct!==t)&&(Qn=null,ns=st()+500,ti(e,t));do try{Ak();break}catch(o){Xg(e,o)}while(!0);td(),Ba.current=l,De=i,ut!==null?t=0:(vt=null,Ct=0,t=ht)}if(t!==0){if(t===2&&(i=$c(e),i!==0&&(r=i,t=fu(e,i))),t===1)throw n=pl,ti(e,0),zr(e,r),Yt(e,st()),n;if(t===6)zr(e,r);else{if(i=e.current.alternate,!(r&30)&&!zk(i)&&(t=Wa(e,r),t===2&&(l=$c(e),l!==0&&(r=l,t=fu(e,l))),t===1))throw n=pl,ti(e,0),zr(e,r),Yt(e,st()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(W(345));case 2:Kr(e,Gt,Qn);break;case 3:if(zr(e,r),(r&130023424)===r&&(t=gd+500-st(),10<t)){if(_a(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Ot(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Gc(Kr.bind(null,e,Gt,Qn),t);break}Kr(e,Gt,Qn);break;case 4:if(zr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var a=31-An(r);l=1<<a,a=t[a],a>i&&(i=a),r&=~l}if(r=i,r=st()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Tk(r/1960))-r,10<r){e.timeoutHandle=Gc(Kr.bind(null,e,Gt,Qn),r);break}Kr(e,Gt,Qn);break;case 5:Kr(e,Gt,Qn);break;default:throw Error(W(329))}}}return Yt(e,st()),e.callbackNode===n?Yg.bind(null,e):null}function fu(e,t){var n=Ws;return e.current.memoizedState.isDehydrated&&(ti(e,t).flags|=256),e=Wa(e,t),e!==2&&(t=Gt,Gt=n,t!==null&&mu(t)),e}function mu(e){Gt===null?Gt=e:Gt.push.apply(Gt,e)}function zk(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],l=i.getSnapshot;i=i.value;try{if(!Pn(l(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zr(e,t){for(t&=~pd,t&=~go,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-An(t),r=1<<n;e[n]=-1,t&=~r}}function jm(e){if(De&6)throw Error(W(327));Wi();var t=_a(e,0);if(!(t&1))return Yt(e,st()),null;var n=Wa(e,t);if(e.tag!==0&&n===2){var r=$c(e);r!==0&&(t=r,n=fu(e,r))}if(n===1)throw n=pl,ti(e,0),zr(e,t),Yt(e,st()),n;if(n===6)throw Error(W(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Kr(e,Gt,Qn),Yt(e,st()),null}function yd(e,t){var n=De;De|=1;try{return e(t)}finally{De=n,De===0&&(ns=st()+500,fo&&Wr())}}function ai(e){Ar!==null&&Ar.tag===0&&!(De&6)&&Wi();var t=De;De|=1;var n=pn.transition,r=$e;try{if(pn.transition=null,$e=1,e)return e()}finally{$e=r,pn.transition=n,De=t,!(De&6)&&Wr()}}function xd(){nn=$i.current,We($i)}function ti(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,lk(n)),ut!==null)for(n=ut.return;n!==null;){var r=n;switch(Ju(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Aa();break;case 3:es(),We(Qt),We(Dt),ad();break;case 5:ld(r);break;case 4:es();break;case 13:We(Je);break;case 19:We(Je);break;case 10:nd(r.type._context);break;case 22:case 23:xd()}n=n.return}if(vt=e,ut=e=Or(e.current,null),Ct=nn=t,ht=0,pl=null,pd=go=li=0,Gt=Ws=null,Jr!==null){for(t=0;t<Jr.length;t++)if(n=Jr[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,l=n.pending;if(l!==null){var a=l.next;l.next=i,r.next=a}n.pending=r}Jr=null}return e}function Xg(e,t){do{var n=ut;try{if(td(),ma.current=Ua,Oa){for(var r=et.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Oa=!1}if(si=0,xt=ft=et=null,Hs=!1,fl=0,hd.current=null,n===null||n.return===null){ht=1,pl=t,ut=null;break}e:{var l=e,a=n.return,o=n,c=t;if(t=Ct,o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=o,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=um(a);if(m!==null){m.flags&=-257,dm(m,a,o,l,t),m.mode&1&&cm(l,u,t),t=m,c=u;var g=t.updateQueue;if(g===null){var k=new Set;k.add(c),t.updateQueue=k}else g.add(c);break e}else{if(!(t&1)){cm(l,u,t),vd();break e}c=Error(W(426))}}else if(Ye&&o.mode&1){var v=um(a);if(v!==null){!(v.flags&65536)&&(v.flags|=256),dm(v,a,o,l,t),Zu(ts(c,o));break e}}l=c=ts(c,o),ht!==4&&(ht=2),Ws===null?Ws=[l]:Ws.push(l),l=a;do{switch(l.tag){case 3:l.flags|=65536,t&=-t,l.lanes|=t;var x=Ig(l,c,t);rm(l,x);break e;case 1:o=c;var w=l.type,j=l.stateNode;if(!(l.flags&128)&&(typeof w.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&($r===null||!$r.has(j)))){l.flags|=65536,t&=-t,l.lanes|=t;var z=Pg(l,o,t);rm(l,z);break e}}l=l.return}while(l!==null)}ey(n)}catch(D){t=D,ut===n&&n!==null&&(ut=n=n.return);continue}break}while(!0)}function Jg(){var e=Ba.current;return Ba.current=Ua,e===null?Ua:e}function vd(){(ht===0||ht===3||ht===2)&&(ht=4),vt===null||!(li&268435455)&&!(go&268435455)||zr(vt,Ct)}function Wa(e,t){var n=De;De|=2;var r=Jg();(vt!==e||Ct!==t)&&(Qn=null,ti(e,t));do try{Lk();break}catch(i){Xg(e,i)}while(!0);if(td(),De=n,Ba.current=r,ut!==null)throw Error(W(261));return vt=null,Ct=0,ht}function Lk(){for(;ut!==null;)Zg(ut)}function Ak(){for(;ut!==null&&!r1();)Zg(ut)}function Zg(e){var t=ny(e.alternate,e,nn);e.memoizedProps=e.pendingProps,t===null?ey(e):ut=t,hd.current=null}function ey(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Nk(n,t),n!==null){n.flags&=32767,ut=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ht=6,ut=null;return}}else if(n=Sk(n,t,nn),n!==null){ut=n;return}if(t=t.sibling,t!==null){ut=t;return}ut=t=e}while(t!==null);ht===0&&(ht=5)}function Kr(e,t,n){var r=$e,i=pn.transition;try{pn.transition=null,$e=1,Dk(e,t,n,r)}finally{pn.transition=i,$e=r}return null}function Dk(e,t,n,r){do Wi();while(Ar!==null);if(De&6)throw Error(W(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(W(177));e.callbackNode=null,e.callbackPriority=0;var l=n.lanes|n.childLanes;if(m1(e,l),e===vt&&(ut=vt=null,Ct=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xl||(Xl=!0,ry(Ca,function(){return Wi(),null})),l=(n.flags&15990)!==0,n.subtreeFlags&15990||l){l=pn.transition,pn.transition=null;var a=$e;$e=1;var o=De;De|=4,hd.current=null,_k(e,n),Qg(n,e),Z1(Vc),Ea=!!Hc,Vc=Hc=null,e.current=n,Ek(n),i1(),De=o,$e=a,pn.transition=l}else e.current=n;if(Xl&&(Xl=!1,Ar=e,Va=i),l=e.pendingLanes,l===0&&($r=null),a1(n.stateNode),Yt(e,st()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ha)throw Ha=!1,e=uu,uu=null,e;return Va&1&&e.tag!==0&&Wi(),l=e.pendingLanes,l&1?e===du?Gs++:(Gs=0,du=e):Gs=0,Wr(),null}function Wi(){if(Ar!==null){var e=Ip(Va),t=pn.transition,n=$e;try{if(pn.transition=null,$e=16>e?16:e,Ar===null)var r=!1;else{if(e=Ar,Ar=null,Va=0,De&6)throw Error(W(331));var i=De;for(De|=4,ne=e.current;ne!==null;){var l=ne,a=l.child;if(ne.flags&16){var o=l.deletions;if(o!==null){for(var c=0;c<o.length;c++){var u=o[c];for(ne=u;ne!==null;){var d=ne;switch(d.tag){case 0:case 11:case 15:Vs(8,d,l)}var f=d.child;if(f!==null)f.return=d,ne=f;else for(;ne!==null;){d=ne;var h=d.sibling,m=d.return;if(Wg(d),d===u){ne=null;break}if(h!==null){h.return=m,ne=h;break}ne=m}}}var g=l.alternate;if(g!==null){var k=g.child;if(k!==null){g.child=null;do{var v=k.sibling;k.sibling=null,k=v}while(k!==null)}}ne=l}}if(l.subtreeFlags&2064&&a!==null)a.return=l,ne=a;else e:for(;ne!==null;){if(l=ne,l.flags&2048)switch(l.tag){case 0:case 11:case 15:Vs(9,l,l.return)}var x=l.sibling;if(x!==null){x.return=l.return,ne=x;break e}ne=l.return}}var w=e.current;for(ne=w;ne!==null;){a=ne;var j=a.child;if(a.subtreeFlags&2064&&j!==null)j.return=a,ne=j;else e:for(a=w;ne!==null;){if(o=ne,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:po(9,o)}}catch(D){rt(o,o.return,D)}if(o===a){ne=null;break e}var z=o.sibling;if(z!==null){z.return=o.return,ne=z;break e}ne=o.return}}if(De=i,Wr(),Bn&&typeof Bn.onPostCommitFiberRoot=="function")try{Bn.onPostCommitFiberRoot(lo,e)}catch{}r=!0}return r}finally{$e=n,pn.transition=t}}return!1}function Sm(e,t,n){t=ts(n,t),t=Ig(e,t,1),e=Rr(e,t,1),t=Ot(),e!==null&&(wl(e,1,t),Yt(e,t))}function rt(e,t,n){if(e.tag===3)Sm(e,e,n);else for(;t!==null;){if(t.tag===3){Sm(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&($r===null||!$r.has(r))){e=ts(n,e),e=Pg(t,e,1),t=Rr(t,e,1),e=Ot(),t!==null&&(wl(t,1,e),Yt(t,e));break}}t=t.return}}function Ik(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ot(),e.pingedLanes|=e.suspendedLanes&n,vt===e&&(Ct&n)===n&&(ht===4||ht===3&&(Ct&130023424)===Ct&&500>st()-gd?ti(e,0):pd|=n),Yt(e,t)}function ty(e,t){t===0&&(e.mode&1?(t=Ul,Ul<<=1,!(Ul&130023424)&&(Ul=4194304)):t=1);var n=Ot();e=rr(e,t),e!==null&&(wl(e,t,n),Yt(e,n))}function Pk(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ty(e,n)}function Mk(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(t),ty(e,n)}var ny;ny=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)qt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return qt=!1,jk(e,t,n);qt=!!(e.flags&131072)}else qt=!1,Ye&&t.flags&1048576&&lg(t,Pa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;pa(e,t),e=t.pendingProps;var i=Xi(t,Dt.current);Vi(t,n),i=cd(null,t,r,e,i,n);var l=ud();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Kt(r)?(l=!0,Da(t)):l=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,id(t),i.updater=ho,t.stateNode=i,i._reactInternals=t,Zc(t,r,e,n),t=nu(null,t,r,!0,l,n)):(t.tag=0,Ye&&l&&Xu(t),$t(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(pa(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=$k(r),e=_n(r,e),i){case 0:t=tu(null,t,r,e,n);break e;case 1:t=hm(null,t,r,e,n);break e;case 11:t=fm(null,t,r,e,n);break e;case 14:t=mm(null,t,r,_n(r.type,e),n);break e}throw Error(W(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:_n(r,i),tu(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:_n(r,i),hm(e,t,r,i,n);case 3:e:{if(Fg(t),e===null)throw Error(W(387));r=t.pendingProps,l=t.memoizedState,i=l.element,fg(e,t),$a(t,r,null,n);var a=t.memoizedState;if(r=a.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){i=ts(Error(W(423)),t),t=pm(e,t,r,n,i);break e}else if(r!==i){i=ts(Error(W(424)),t),t=pm(e,t,r,n,i);break e}else for(rn=Mr(t.stateNode.containerInfo.firstChild),sn=t,Ye=!0,Tn=null,n=ug(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ji(),r===i){t=ir(e,t,n);break e}$t(e,t,r,n)}t=t.child}return t;case 5:return mg(t),e===null&&Yc(t),r=t.type,i=t.pendingProps,l=e!==null?e.memoizedProps:null,a=i.children,Wc(r,i)?a=null:l!==null&&Wc(r,l)&&(t.flags|=32),$g(e,t),$t(e,t,a,n),t.child;case 6:return e===null&&Yc(t),null;case 13:return Og(e,t,n);case 4:return sd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Zi(t,null,r,n):$t(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:_n(r,i),fm(e,t,r,i,n);case 7:return $t(e,t,t.pendingProps,n),t.child;case 8:return $t(e,t,t.pendingProps.children,n),t.child;case 12:return $t(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,l=t.memoizedProps,a=i.value,He(Ma,r._currentValue),r._currentValue=a,l!==null)if(Pn(l.value,a)){if(l.children===i.children&&!Qt.current){t=ir(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var o=l.dependencies;if(o!==null){a=l.child;for(var c=o.firstContext;c!==null;){if(c.context===r){if(l.tag===1){c=er(-1,n&-n),c.tag=2;var u=l.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}l.lanes|=n,c=l.alternate,c!==null&&(c.lanes|=n),Xc(l.return,n,t),o.lanes|=n;break}c=c.next}}else if(l.tag===10)a=l.type===t.type?null:l.child;else if(l.tag===18){if(a=l.return,a===null)throw Error(W(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),Xc(a,n,t),a=l.sibling}else a=l.child;if(a!==null)a.return=l;else for(a=l;a!==null;){if(a===t){a=null;break}if(l=a.sibling,l!==null){l.return=a.return,a=l;break}a=a.return}l=a}$t(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Vi(t,n),i=yn(i),r=r(i),t.flags|=1,$t(e,t,r,n),t.child;case 14:return r=t.type,i=_n(r,t.pendingProps),i=_n(r.type,i),mm(e,t,r,i,n);case 15:return Mg(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:_n(r,i),pa(e,t),t.tag=1,Kt(r)?(e=!0,Da(t)):e=!1,Vi(t,n),Dg(t,r,i),Zc(t,r,i,n),nu(null,t,r,!0,e,n);case 19:return Ug(e,t,n);case 22:return Rg(e,t,n)}throw Error(W(156,t.tag))};function ry(e,t){return zp(e,t)}function Rk(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hn(e,t,n,r){return new Rk(e,t,n,r)}function kd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $k(e){if(typeof e=="function")return kd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Fu)return 11;if(e===Ou)return 14}return 2}function Or(e,t){var n=e.alternate;return n===null?(n=hn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function xa(e,t,n,r,i,l){var a=2;if(r=e,typeof e=="function")kd(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ei:return ni(n.children,i,l,t);case $u:a=8,i|=8;break;case jc:return e=hn(12,n,t,i|2),e.elementType=jc,e.lanes=l,e;case Sc:return e=hn(13,n,t,i),e.elementType=Sc,e.lanes=l,e;case Nc:return e=hn(19,n,t,i),e.elementType=Nc,e.lanes=l,e;case mp:return yo(n,i,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case dp:a=10;break e;case fp:a=9;break e;case Fu:a=11;break e;case Ou:a=14;break e;case _r:a=16,r=null;break e}throw Error(W(130,e==null?e:typeof e,""))}return t=hn(a,n,t,i),t.elementType=e,t.type=r,t.lanes=l,t}function ni(e,t,n,r){return e=hn(7,e,r,t),e.lanes=n,e}function yo(e,t,n,r){return e=hn(22,e,r,t),e.elementType=mp,e.lanes=n,e.stateNode={isHidden:!1},e}function tc(e,t,n){return e=hn(6,e,null,t),e.lanes=n,e}function nc(e,t,n){return t=hn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Fk(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mo(0),this.expirationTimes=Mo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mo(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function wd(e,t,n,r,i,l,a,o,c){return e=new Fk(e,t,n,o,c),t===1?(t=1,l===!0&&(t|=8)):t=0,l=hn(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},id(l),e}function Ok(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_i,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function iy(e){if(!e)return Br;e=e._reactInternals;e:{if(hi(e)!==e||e.tag!==1)throw Error(W(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Kt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(W(171))}if(e.tag===1){var n=e.type;if(Kt(n))return ig(e,n,t)}return t}function sy(e,t,n,r,i,l,a,o,c){return e=wd(n,r,!0,e,i,l,a,o,c),e.context=iy(null),n=e.current,r=Ot(),i=Fr(n),l=er(r,i),l.callback=t??null,Rr(n,l,i),e.current.lanes=i,wl(e,i,r),Yt(e,r),e}function xo(e,t,n,r){var i=t.current,l=Ot(),a=Fr(i);return n=iy(n),t.context===null?t.context=n:t.pendingContext=n,t=er(l,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Rr(i,t,a),e!==null&&(Dn(e,i,a,l),fa(e,i,a)),a}function Ga(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Nm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function bd(e,t){Nm(e,t),(e=e.alternate)&&Nm(e,t)}function Uk(){return null}var ly=typeof reportError=="function"?reportError:function(e){console.error(e)};function jd(e){this._internalRoot=e}vo.prototype.render=jd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(W(409));xo(e,t,null,null)};vo.prototype.unmount=jd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ai(function(){xo(null,e,null,null)}),t[nr]=null}};function vo(e){this._internalRoot=e}vo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rp();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tr.length&&t!==0&&t<Tr[n].priority;n++);Tr.splice(n,0,e),n===0&&Fp(e)}};function Sd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ko(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Cm(){}function Bk(e,t,n,r,i){if(i){if(typeof r=="function"){var l=r;r=function(){var u=Ga(a);l.call(u)}}var a=sy(t,r,e,0,null,!1,!1,"",Cm);return e._reactRootContainer=a,e[nr]=a.current,al(e.nodeType===8?e.parentNode:e),ai(),a}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var o=r;r=function(){var u=Ga(c);o.call(u)}}var c=wd(e,0,!1,null,null,!1,!1,"",Cm);return e._reactRootContainer=c,e[nr]=c.current,al(e.nodeType===8?e.parentNode:e),ai(function(){xo(t,c,n,r)}),c}function wo(e,t,n,r,i){var l=n._reactRootContainer;if(l){var a=l;if(typeof i=="function"){var o=i;i=function(){var c=Ga(a);o.call(c)}}xo(t,a,e,i)}else a=Bk(n,t,e,i,r);return Ga(a)}Pp=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ps(t.pendingLanes);n!==0&&(Hu(t,n|1),Yt(t,st()),!(De&6)&&(ns=st()+500,Wr()))}break;case 13:ai(function(){var r=rr(e,1);if(r!==null){var i=Ot();Dn(r,e,1,i)}}),bd(e,1)}};Vu=function(e){if(e.tag===13){var t=rr(e,134217728);if(t!==null){var n=Ot();Dn(t,e,134217728,n)}bd(e,134217728)}};Mp=function(e){if(e.tag===13){var t=Fr(e),n=rr(e,t);if(n!==null){var r=Ot();Dn(n,e,t,r)}bd(e,t)}};Rp=function(){return $e};$p=function(e,t){var n=$e;try{return $e=e,t()}finally{$e=n}};Pc=function(e,t,n){switch(t){case"input":if(Ec(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=uo(r);if(!i)throw Error(W(90));pp(r),Ec(r,i)}}}break;case"textarea":yp(e,n);break;case"select":t=n.value,t!=null&&Oi(e,!!n.multiple,t,!1)}};Sp=yd;Np=ai;var Hk={usingClientEntryPoint:!1,Events:[jl,Ai,uo,bp,jp,yd]},Ts={findFiberByHostInstance:Xr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Vk={bundleType:Ts.bundleType,version:Ts.version,rendererPackageName:Ts.rendererPackageName,rendererConfig:Ts.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:lr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Ep(e),e===null?null:e.stateNode},findFiberByHostInstance:Ts.findFiberByHostInstance||Uk,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 Jl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jl.isDisabled&&Jl.supportsFiber)try{lo=Jl.inject(Vk),Bn=Jl}catch{}}on.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hk;on.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Sd(t))throw Error(W(200));return Ok(e,t,null,n)};on.createRoot=function(e,t){if(!Sd(e))throw Error(W(299));var n=!1,r="",i=ly;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=wd(e,1,!1,null,null,n,!1,r,i),e[nr]=t.current,al(e.nodeType===8?e.parentNode:e),new jd(t)};on.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(W(188)):(e=Object.keys(e).join(","),Error(W(268,e)));return e=Ep(t),e=e===null?null:e.stateNode,e};on.flushSync=function(e){return ai(e)};on.hydrate=function(e,t,n){if(!ko(t))throw Error(W(200));return wo(null,e,t,!0,n)};on.hydrateRoot=function(e,t,n){if(!Sd(e))throw Error(W(405));var r=n!=null&&n.hydratedSources||null,i=!1,l="",a=ly;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=sy(t,null,e,1,n??null,i,!1,l,a),e[nr]=t.current,al(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new vo(t)};on.render=function(e,t,n){if(!ko(t))throw Error(W(200));return wo(null,e,t,!1,n)};on.unmountComponentAtNode=function(e){if(!ko(e))throw Error(W(40));return e._reactRootContainer?(ai(function(){wo(null,null,e,!1,function(){e._reactRootContainer=null,e[nr]=null})}),!0):!1};on.unstable_batchedUpdates=yd;on.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ko(n))throw Error(W(200));if(e==null||e._reactInternals===void 0)throw Error(W(38));return wo(e,t,n,!1,r)};on.version="18.3.1-next-f1338f8080-20240426";function ay(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ay)}catch(e){console.error(e)}}ay(),ap.exports=on;var Wk=ap.exports,_m=Wk;wc.createRoot=_m.createRoot,wc.hydrateRoot=_m.hydrateRoot;/**
41
+ * @license lucide-react v0.312.0 - ISC
42
+ *
43
+ * This source code is licensed under the ISC license.
44
+ * See the LICENSE file in the root directory of this source tree.
45
+ */var Gk={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"};/**
46
+ * @license lucide-react v0.312.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ */const qk=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Y=(e,t)=>{const n=p.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:l=2,absoluteStrokeWidth:a,className:o="",children:c,...u},d)=>p.createElement("svg",{ref:d,...Gk,width:i,height:i,stroke:r,strokeWidth:a?Number(l)*24/Number(i):l,className:["lucide",`lucide-${qk(e)}`,o].join(" "),...u},[...t.map(([f,h])=>p.createElement(f,h)),...Array.isArray(c)?c:[c]]));return n.displayName=`${e}`,n};/**
51
+ * @license lucide-react v0.312.0 - ISC
52
+ *
53
+ * This source code is licensed under the ISC license.
54
+ * See the LICENSE file in the root directory of this source tree.
55
+ */const kt=Y("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"}]]);/**
56
+ * @license lucide-react v0.312.0 - ISC
57
+ *
58
+ * This source code is licensed under the ISC license.
59
+ * See the LICENSE file in the root directory of this source tree.
60
+ */const gn=Y("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"}]]);/**
61
+ * @license lucide-react v0.312.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const oy=Y("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
66
+ * @license lucide-react v0.312.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const Em=Y("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
71
+ * @license lucide-react v0.312.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const cy=Y("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
76
+ * @license lucide-react v0.312.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const Qk=Y("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
81
+ * @license lucide-react v0.312.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const Tm=Y("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
86
+ * @license lucide-react v0.312.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const uy=Y("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
91
+ * @license lucide-react v0.312.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const bi=Y("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"}]]);/**
96
+ * @license lucide-react v0.312.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const qa=Y("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"}]]);/**
101
+ * @license lucide-react v0.312.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const ei=Y("Brain",[["path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z",key:"1mhkh5"}],["path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z",key:"1d6s00"}]]);/**
106
+ * @license lucide-react v0.312.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const Kk=Y("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"}]]);/**
111
+ * @license lucide-react v0.312.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const sr=Y("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
116
+ * @license lucide-react v0.312.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const ji=Y("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"}]]);/**
121
+ * @license lucide-react v0.312.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const oi=Y("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
126
+ * @license lucide-react v0.312.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const ci=Y("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
131
+ * @license lucide-react v0.312.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const Yk=Y("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
136
+ * @license lucide-react v0.312.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const us=Y("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
141
+ * @license lucide-react v0.312.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const dy=Y("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
146
+ * @license lucide-react v0.312.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const Xk=Y("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
151
+ * @license lucide-react v0.312.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const Qa=Y("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
156
+ * @license lucide-react v0.312.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const Jk=Y("Code2",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
161
+ * @license lucide-react v0.312.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const fy=Y("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
166
+ * @license lucide-react v0.312.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const Nl=Y("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"}]]);/**
171
+ * @license lucide-react v0.312.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const rs=Y("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"}]]);/**
176
+ * @license lucide-react v0.312.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const Si=Y("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"}]]);/**
181
+ * @license lucide-react v0.312.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const Zk=Y("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"}]]);/**
186
+ * @license lucide-react v0.312.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const ui=Y("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"}]]);/**
191
+ * @license lucide-react v0.312.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const Gi=Y("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"}]]);/**
196
+ * @license lucide-react v0.312.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const my=Y("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
201
+ * @license lucide-react v0.312.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const ew=Y("FilePen",[["path",{d:"M12 22h6a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v10",key:"x7tsz2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10.4 12.6a2 2 0 1 1 3 3L8 21l-4 1 1-4Z",key:"o3xyfb"}]]);/**
206
+ * @license lucide-react v0.312.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const zn=Y("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"}]]);/**
211
+ * @license lucide-react v0.312.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const hy=Y("File",[["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"}]]);/**
216
+ * @license lucide-react v0.312.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const Zn=Y("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"}]]);/**
221
+ * @license lucide-react v0.312.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const hu=Y("FolderSearch",[["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"M10.7 20H4a2 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.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.5-1.5",key:"3sg1j"}]]);/**
226
+ * @license lucide-react v0.312.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const py=Y("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
231
+ * @license lucide-react v0.312.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const zm=Y("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/**
236
+ * @license lucide-react v0.312.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const Nd=Y("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"}]]);/**
241
+ * @license lucide-react v0.312.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const tw=Y("Hammer",[["path",{d:"m15 12-8.5 8.5c-.83.83-2.17.83-3 0 0 0 0 0 0 0a2.12 2.12 0 0 1 0-3L12 9",key:"1afvon"}],["path",{d:"M17.64 15 22 10.64",key:"zsji6s"}],["path",{d:"m20.91 11.7-1.25-1.25c-.6-.6-.93-1.4-.93-2.25v-.86L16.01 4.6a5.56 5.56 0 0 0-3.94-1.64H9l.92.82A6.18 6.18 0 0 1 12 8.4v1.56l2 2h2.47l2.26 1.91",key:"lehyy1"}]]);/**
246
+ * @license lucide-react v0.312.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const gy=Y("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
251
+ * @license lucide-react v0.312.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const nw=Y("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/**
256
+ * @license lucide-react v0.312.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const rw=Y("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
261
+ * @license lucide-react v0.312.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const iw=Y("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
266
+ * @license lucide-react v0.312.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const sw=Y("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
271
+ * @license lucide-react v0.312.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const lw=Y("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
276
+ * @license lucide-react v0.312.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const yy=Y("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
281
+ * @license lucide-react v0.312.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const mt=Y("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
286
+ * @license lucide-react v0.312.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const aw=Y("Loader",[["line",{x1:"12",x2:"12",y1:"2",y2:"6",key:"gza1u7"}],["line",{x1:"12",x2:"12",y1:"18",y2:"22",key:"1qhbu9"}],["line",{x1:"4.93",x2:"7.76",y1:"4.93",y2:"7.76",key:"xae44r"}],["line",{x1:"16.24",x2:"19.07",y1:"16.24",y2:"19.07",key:"bxnmvf"}],["line",{x1:"2",x2:"6",y1:"12",y2:"12",key:"89khin"}],["line",{x1:"18",x2:"22",y1:"12",y2:"12",key:"pb8tfm"}],["line",{x1:"4.93",x2:"7.76",y1:"19.07",y2:"16.24",key:"1uxjnu"}],["line",{x1:"16.24",x2:"19.07",y1:"7.76",y2:"4.93",key:"6duxfx"}]]);/**
291
+ * @license lucide-react v0.312.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const xy=Y("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"}]]);/**
296
+ * @license lucide-react v0.312.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const vy=Y("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"}]]);/**
301
+ * @license lucide-react v0.312.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const ow=Y("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
306
+ * @license lucide-react v0.312.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const cw=Y("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
311
+ * @license lucide-react v0.312.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const pu=Y("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"}]]);/**
316
+ * @license lucide-react v0.312.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const uw=Y("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
321
+ * @license lucide-react v0.312.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const dw=Y("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
326
+ * @license lucide-react v0.312.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const fw=Y("MoreHorizontal",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
331
+ * @license lucide-react v0.312.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const mw=Y("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
336
+ * @license lucide-react v0.312.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */const hw=Y("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
341
+ * @license lucide-react v0.312.0 - ISC
342
+ *
343
+ * This source code is licensed under the ISC license.
344
+ * See the LICENSE file in the root directory of this source tree.
345
+ */const pw=Y("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
346
+ * @license lucide-react v0.312.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const gw=Y("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/**
351
+ * @license lucide-react v0.312.0 - ISC
352
+ *
353
+ * This source code is licensed under the ISC license.
354
+ * See the LICENSE file in the root directory of this source tree.
355
+ */const yw=Y("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
356
+ * @license lucide-react v0.312.0 - ISC
357
+ *
358
+ * This source code is licensed under the ISC license.
359
+ * See the LICENSE file in the root directory of this source tree.
360
+ */const xw=Y("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
361
+ * @license lucide-react v0.312.0 - ISC
362
+ *
363
+ * This source code is licensed under the ISC license.
364
+ * See the LICENSE file in the root directory of this source tree.
365
+ */const gl=Y("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
366
+ * @license lucide-react v0.312.0 - ISC
367
+ *
368
+ * This source code is licensed under the ISC license.
369
+ * See the LICENSE file in the root directory of this source tree.
370
+ */const qs=Y("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"}]]);/**
371
+ * @license lucide-react v0.312.0 - ISC
372
+ *
373
+ * This source code is licensed under the ISC license.
374
+ * See the LICENSE file in the root directory of this source tree.
375
+ */const Ln=Y("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
376
+ * @license lucide-react v0.312.0 - ISC
377
+ *
378
+ * This source code is licensed under the ISC license.
379
+ * See the LICENSE file in the root directory of this source tree.
380
+ */const vw=Y("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
381
+ * @license lucide-react v0.312.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */const kw=Y("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"}]]);/**
386
+ * @license lucide-react v0.312.0 - ISC
387
+ *
388
+ * This source code is licensed under the ISC license.
389
+ * See the LICENSE file in the root directory of this source tree.
390
+ */const Ka=Y("ShieldAlert",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
391
+ * @license lucide-react v0.312.0 - ISC
392
+ *
393
+ * This source code is licensed under the ISC license.
394
+ * See the LICENSE file in the root directory of this source tree.
395
+ */const ww=Y("ShieldOff",[["path",{d:"M19.7 14a6.9 6.9 0 0 0 .3-2V5l-8-3-3.2 1.2",key:"342pvf"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4.7 4.7 4 5v7c0 6 8 10 8 10a20.3 20.3 0 0 0 5.62-4.38",key:"p0ycf4"}]]);/**
396
+ * @license lucide-react v0.312.0 - ISC
397
+ *
398
+ * This source code is licensed under the ISC license.
399
+ * See the LICENSE file in the root directory of this source tree.
400
+ */const Yn=Y("Shield",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}]]);/**
401
+ * @license lucide-react v0.312.0 - ISC
402
+ *
403
+ * This source code is licensed under the ISC license.
404
+ * See the LICENSE file in the root directory of this source tree.
405
+ */const ky=Y("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
406
+ * @license lucide-react v0.312.0 - ISC
407
+ *
408
+ * This source code is licensed under the ISC license.
409
+ * See the LICENSE file in the root directory of this source tree.
410
+ */const bw=Y("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"}]]);/**
411
+ * @license lucide-react v0.312.0 - ISC
412
+ *
413
+ * This source code is licensed under the ISC license.
414
+ * See the LICENSE file in the root directory of this source tree.
415
+ */const jw=Y("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
416
+ * @license lucide-react v0.312.0 - ISC
417
+ *
418
+ * This source code is licensed under the ISC license.
419
+ * See the LICENSE file in the root directory of this source tree.
420
+ */const Sw=Y("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
421
+ * @license lucide-react v0.312.0 - ISC
422
+ *
423
+ * This source code is licensed under the ISC license.
424
+ * See the LICENSE file in the root directory of this source tree.
425
+ */const Lm=Y("StopCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
426
+ * @license lucide-react v0.312.0 - ISC
427
+ *
428
+ * This source code is licensed under the ISC license.
429
+ * See the LICENSE file in the root directory of this source tree.
430
+ */const Nw=Y("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"}]]);/**
431
+ * @license lucide-react v0.312.0 - ISC
432
+ *
433
+ * This source code is licensed under the ISC license.
434
+ * See the LICENSE file in the root directory of this source tree.
435
+ */const wy=Y("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
436
+ * @license lucide-react v0.312.0 - ISC
437
+ *
438
+ * This source code is licensed under the ISC license.
439
+ * See the LICENSE file in the root directory of this source tree.
440
+ */const Am=Y("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
441
+ * @license lucide-react v0.312.0 - ISC
442
+ *
443
+ * This source code is licensed under the ISC license.
444
+ * See the LICENSE file in the root directory of this source tree.
445
+ */const Ya=Y("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
446
+ * @license lucide-react v0.312.0 - ISC
447
+ *
448
+ * This source code is licensed under the ISC license.
449
+ * See the LICENSE file in the root directory of this source tree.
450
+ */const di=Y("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"}]]);/**
451
+ * @license lucide-react v0.312.0 - ISC
452
+ *
453
+ * This source code is licensed under the ISC license.
454
+ * See the LICENSE file in the root directory of this source tree.
455
+ */const Dm=Y("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
456
+ * @license lucide-react v0.312.0 - ISC
457
+ *
458
+ * This source code is licensed under the ISC license.
459
+ * See the LICENSE file in the root directory of this source tree.
460
+ */const yl=Y("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
461
+ * @license lucide-react v0.312.0 - ISC
462
+ *
463
+ * This source code is licensed under the ISC license.
464
+ * See the LICENSE file in the root directory of this source tree.
465
+ */const Cw=Y("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"}]]);/**
466
+ * @license lucide-react v0.312.0 - ISC
467
+ *
468
+ * This source code is licensed under the ISC license.
469
+ * See the LICENSE file in the root directory of this source tree.
470
+ */const _w=Y("WifiOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M8.5 16.5a5 5 0 0 1 7 0",key:"sej527"}],["path",{d:"M2 8.82a15 15 0 0 1 4.17-2.65",key:"11utq1"}],["path",{d:"M10.66 5c4.01-.36 8.14.9 11.34 3.76",key:"hxefdu"}],["path",{d:"M16.85 11.25a10 10 0 0 1 2.22 1.68",key:"q734kn"}],["path",{d:"M5 13a10 10 0 0 1 5.24-2.76",key:"piq4yl"}],["line",{x1:"12",x2:"12.01",y1:"20",y2:"20",key:"of4bc4"}]]);/**
471
+ * @license lucide-react v0.312.0 - ISC
472
+ *
473
+ * This source code is licensed under the ISC license.
474
+ * See the LICENSE file in the root directory of this source tree.
475
+ */const is=Y("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
476
+ * @license lucide-react v0.312.0 - ISC
477
+ *
478
+ * This source code is licensed under the ISC license.
479
+ * See the LICENSE file in the root directory of this source tree.
480
+ */const Ze=Y("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
481
+ * @license lucide-react v0.312.0 - ISC
482
+ *
483
+ * This source code is licensed under the ISC license.
484
+ * See the LICENSE file in the root directory of this source tree.
485
+ */const qi=Y("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Ew={},Im=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const m=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,m))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Ew?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,i,c);return c},Tw=e=>e?Im(e):Im;var by={exports:{}},jy={},Sy={exports:{}},Ny={};/**
486
+ * @license React
487
+ * use-sync-external-store-shim.production.js
488
+ *
489
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
490
+ *
491
+ * This source code is licensed under the MIT license found in the
492
+ * LICENSE file in the root directory of this source tree.
493
+ */var ss=p;function zw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Lw=typeof Object.is=="function"?Object.is:zw,Aw=ss.useState,Dw=ss.useEffect,Iw=ss.useLayoutEffect,Pw=ss.useDebugValue;function Mw(e,t){var n=t(),r=Aw({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return Iw(function(){i.value=n,i.getSnapshot=t,rc(i)&&l({inst:i})},[e,n,t]),Dw(function(){return rc(i)&&l({inst:i}),e(function(){rc(i)&&l({inst:i})})},[e]),Pw(n),n}function rc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Lw(e,n)}catch{return!0}}function Rw(e,t){return t()}var $w=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Rw:Mw;Ny.useSyncExternalStore=ss.useSyncExternalStore!==void 0?ss.useSyncExternalStore:$w;Sy.exports=Ny;var Fw=Sy.exports;/**
494
+ * @license React
495
+ * use-sync-external-store-shim/with-selector.production.js
496
+ *
497
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
498
+ *
499
+ * This source code is licensed under the MIT license found in the
500
+ * LICENSE file in the root directory of this source tree.
501
+ */var bo=p,Ow=Fw;function Uw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Bw=typeof Object.is=="function"?Object.is:Uw,Hw=Ow.useSyncExternalStore,Vw=bo.useRef,Ww=bo.useEffect,Gw=bo.useMemo,qw=bo.useDebugValue;jy.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var l=Vw(null);if(l.current===null){var a={hasValue:!1,value:null};l.current=a}else a=l.current;l=Gw(function(){function c(m){if(!u){if(u=!0,d=m,m=r(m),i!==void 0&&a.hasValue){var g=a.value;if(i(g,m))return f=g}return f=m}if(g=f,Bw(d,m))return g;var k=r(m);return i!==void 0&&i(g,k)?(d=m,g):(d=m,f=k)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,r,i]);var o=Hw(e,l[0],l[1]);return Ww(function(){a.hasValue=!0,a.value=o},[o]),qw(o),o};by.exports=jy;var Qw=by.exports;const Kw=io(Qw),Cy={},{useDebugValue:Yw}=Ki,{useSyncExternalStoreWithSelector:Xw}=Kw;let Pm=!1;const Jw=e=>e;function Zw(e,t=Jw,n){(Cy?"production":void 0)!=="production"&&n&&!Pm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Pm=!0);const r=Xw(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Yw(r),r}const Mm=e=>{(Cy?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Tw(e):e,n=(r,i)=>Zw(t,r,i);return Object.assign(n,t),n},_y=e=>e?Mm(e):Mm,Se=_y((e,t)=>({agents:[],activeAgentId:(()=>{try{return localStorage.getItem("gaia-active-agent-id")||"chat"}catch{return"chat"}})(),setAgents:n=>e({agents:n}),setActiveAgentId:n=>{try{localStorage.setItem("gaia-active-agent-id",n)}catch{}e({activeAgentId:n})},sessions:[],currentSessionId:null,pendingDeleteIds:[],setSessions:n=>e(r=>({sessions:n.filter(i=>!r.pendingDeleteIds.includes(i.id))})),setCurrentSession:n=>e({currentSessionId:n}),addSession:n=>e(r=>({sessions:[n,...r.sessions]})),removeSession:n=>e(r=>({sessions:r.sessions.filter(i=>i.id!==n),currentSessionId:r.currentSessionId===n?null:r.currentSessionId,messages:r.currentSessionId===n?[]:r.messages})),updateSessionInList:(n,r)=>e(i=>({sessions:i.sessions.map(l=>l.id===n?{...l,...r}:l)})),addPendingDelete:n=>e(r=>({pendingDeleteIds:[...r.pendingDeleteIds,n]})),removePendingDelete:n=>e(r=>({pendingDeleteIds:r.pendingDeleteIds.filter(i=>i!==n)})),messages:[],setMessages:n=>e({messages:n}),addMessage:n=>e(r=>({messages:[...r.messages,n]})),removeMessage:n=>e(r=>({messages:r.messages.filter(i=>i.id!==n)})),removeMessagesFrom:n=>e(r=>{const i=r.messages.findIndex(l=>l.id===n);return i===-1?r:{messages:r.messages.slice(0,i)}}),isStreaming:!1,streamingContent:"",setStreaming:n=>e({isStreaming:n}),appendStreamContent:n=>e(r=>({streamingContent:r.streamingContent+n})),setStreamContent:n=>e({streamingContent:n}),clearStreamContent:()=>e({streamingContent:""}),agentSteps:[],addAgentStep:n=>e(r=>({agentSteps:[...r.agentSteps.map(i=>({...i,active:!1})),n]})),updateLastAgentStep:n=>e(r=>{if(r.agentSteps.length===0)return r;const i=[...r.agentSteps];return i[i.length-1]={...i[i.length-1],...n},{agentSteps:i}}),appendThinkingContent:n=>e(r=>{if(r.agentSteps.length===0)return r;const i=[...r.agentSteps],l=i[i.length-1];return l.type!=="thinking"?r:(i[i.length-1]={...l,detail:(l.detail?l.detail+`
502
+ `:"")+n,active:!0},{agentSteps:i})}),updateLastToolStep:n=>e(r=>{if(r.agentSteps.length===0)return r;const i=[...r.agentSteps];for(let l=i.length-1;l>=0;l--)if(i[l].type==="tool")return i[l]={...i[l],...n},{agentSteps:i};return r}),clearAgentSteps:()=>e({agentSteps:[]}),documents:[],setDocuments:n=>e({documents:n}),systemStatus:null,backendConnected:!0,setSystemStatus:n=>e({systemStatus:n}),setBackendConnected:n=>e({backendConnected:n}),theme:(()=>{try{return localStorage.getItem("gaia-chat-theme")||"dark"}catch{return"dark"}})(),showDocLibrary:!1,showFileBrowser:!1,showSettings:!1,showMemoryDashboard:!1,toggleTheme:()=>e(n=>{const r=n.theme==="dark"?"light":"dark";try{localStorage.setItem("gaia-chat-theme",r)}catch{}return document.documentElement.setAttribute("data-theme",r),{theme:r}}),sidebarOpen:typeof window<"u"?window.innerWidth>768:!0,sidebarCollapsed:(()=>{try{return typeof window<"u"&&localStorage.getItem("gaia-chat-sidebar-collapsed")==="true"}catch{return!1}})(),sidebarWidth:(()=>{try{return typeof window<"u"?parseInt(localStorage.getItem("gaia-chat-sidebar-width")||"300",10):300}catch{return 300}})(),isLoadingMessages:!1,pendingPrompt:null,setShowDocLibrary:n=>e({showDocLibrary:n}),setShowFileBrowser:n=>e({showFileBrowser:n}),setShowSettings:n=>e({showSettings:n}),setShowMemoryDashboard:n=>e({showMemoryDashboard:n}),toggleSidebar:()=>e(n=>({sidebarOpen:!n.sidebarOpen})),setSidebarOpen:n=>e({sidebarOpen:n}),toggleSidebarCollapsed:()=>e(n=>{const r=!n.sidebarCollapsed;try{localStorage.setItem("gaia-chat-sidebar-collapsed",String(r))}catch{}return{sidebarCollapsed:r}}),setSidebarCollapsed:n=>{try{localStorage.setItem("gaia-chat-sidebar-collapsed",String(n))}catch{}e({sidebarCollapsed:n})},setSidebarWidth:n=>{const r=Math.max(200,Math.min(500,n));try{localStorage.setItem("gaia-chat-sidebar-width",String(r))}catch{}e({sidebarWidth:r})},setLoadingMessages:n=>e({isLoadingMessages:n}),setPendingPrompt:n=>e({pendingPrompt:n})})),e0=/^https?:\/\/(127\.0\.0\.1|localhost):\d+\/api$/,t0="http://localhost:4200/api";function Cd(){if(typeof window>"u")return"/api";if(window.location.protocol==="file:"){const e=new URLSearchParams(window.location.search).get("api");return e&&e0.test(e)?e:t0}return"/api"}const n0={api:"#4fc3f7",store:"#ce93d8",chat:"#81c784",stream:"#ffb74d",ui:"#90a4ae",doc:"#a1887f",system:"#e57373",nav:"#fff176"},r0={api:"fetch",store:"state",chat:"chat",stream:"stream",ui:"ui",doc:"docs",system:"sys",nav:"nav"},va=(()=>{try{if(localStorage.getItem("gaia-debug")==="true")return!0;if(typeof location<"u"){const e=new URLSearchParams(location.search);if(e.has("debug")||e.has("verbose"))return!0}}catch{}return!1})();function zs(){const e=new Date;return e.toLocaleTimeString("en-US",{hour12:!1})+"."+String(e.getMilliseconds()).padStart(3,"0")}function jr(e){const t=n0[e]||"#ccc",r=`%c[${r0[e]||e}]`,i=`color: ${t}; font-weight: bold;`,l="color: #888; font-weight: normal;";return{info:(a,...o)=>{if(!va)return;const c=zs();o.length>0?console.log(`${r} %c${c} %c${a}`,i,l,"color: inherit;",...o):console.log(`${r} %c${c} %c${a}`,i,l,"color: inherit;")},warn:(a,...o)=>{const c=zs();console.warn(`${r} %c${c} %c${a}`,i,l,"color: inherit;",...o)},error:(a,...o)=>{const c=zs();console.error(`${r} %c${c} %c${a}`,i,l,"color: inherit;",...o)},debug:(a,...o)=>{if(!va)return;const c=zs();console.debug(`${r} %c${c} %c${a}`,i,l,"color: #999;",...o)},timed:(a,o,...c)=>{if(!va)return;const u=Math.round(performance.now()-o),d=zs(),f=u>2e3?"color: #e57373;":u>500?"color: #ffb74d;":"color: #81c784;";c.length>0?console.log(`${r} %c${d} %c${a} %c(${u}ms)`,i,l,"color: inherit;",f,...c):console.log(`${r} %c${d} %c${a} %c(${u}ms)`,i,l,"color: inherit;",f)},time:()=>performance.now()}}const E={api:jr("api"),store:jr("store"),chat:jr("chat"),stream:jr("stream"),ui:jr("ui"),doc:jr("doc"),system:jr("system"),nav:jr("nav")};function i0(e){console.log("%c GAIA %c v"+e+" %c Local AI Desktop","background: #E23C40; color: white; font-weight: bold; padding: 4px 8px; border-radius: 4px 0 0 4px;","background: #333; color: #fff; padding: 4px 8px;","background: #1a1a1a; color: #888; padding: 4px 8px; border-radius: 0 4px 4px 0;"),console.log(va?"%cVerbose logging enabled. Categories: [fetch] [state] [chat] [stream] [ui] [docs] [sys] [nav]":'%cVerbose logging: add ?debug to URL or run localStorage.setItem("gaia-debug","true")',"color: #666; font-style: italic;")}const jo=Cd();function Ey(e,t){switch(e){case 403:return t||"Access denied.";case 404:return t||"The requested item was not found.";case 413:return t||"File too large to process.";case 500:return"Server error. Please try again.";case 502:return"Service unavailable. Is the backend running?";case 503:return t||"Service unavailable.";default:return t||`Request failed (HTTP ${e})`}}async function ge(e,t,n,r){const i=`${jo}${t}`,l=E.api.time();E.api.info(`${e} ${i}`,n!==void 0?{body:n}:"");const o={method:e,headers:{...r,...n!==void 0?{"Content-Type":"application/json"}:{}},body:n!==void 0?JSON.stringify(n):void 0};let c;try{c=await fetch(i,o)}catch(f){throw E.api.error(`${e} ${i} - network error`,f),f}if(!c.ok){const f=await c.text().catch(()=>"");E.api.error(`${e} ${i} - HTTP ${c.status}`,{errorText:f});let h=f;try{h=JSON.parse(f).detail||f}catch{}throw new Error(Ey(c.status,h))}if(!(c.headers.get("content-type")||"").includes("application/json")){E.api.timed(`${e} ${i} -> ${c.status} (no body)`,l);return}const d=await c.json();return E.api.timed(`${e} ${i} -> ${c.status}`,l,d),d}async function _d(){return ge("GET","/system/status")}async function s0(){return ge("GET","/settings")}async function l0(e){return ge("PUT","/settings",e)}async function a0(e,t){return ge("POST","/system/load-model",{model_name:e,ctx_size:t})}async function o0(e,t=!1){return ge("POST","/system/download-model",{model_name:e,force:t})}async function Ed(){return ge("GET","/agents")}async function c0(){return ge("GET","/agents/disk",void 0,{"x-gaia-ui":"1"})}const pi={"x-gaia-ui":"1"};async function u0(){return ge("GET","/connectors")}async function Ty(e){return ge("GET",`/connectors/${e}`)}async function zy(e,t){return ge("POST",`/connectors/${e}/authorize`,{scopes:t},pi)}async function Ly(e,t){return ge("POST",`/connectors/${e}/configure`,{config:t},pi)}async function Td(e){await ge("DELETE",`/connectors/${e}`,void 0,pi)}async function Ay(e){return ge("POST",`/connectors/${e}/enable`,{},pi)}async function Dy(e){return ge("POST",`/connectors/${e}/disable`,{},pi)}async function d0(){return ge("GET","/connectors/agent-mcps")}async function f0(e){return ge("GET",`/connectors/${e}/grants`)}async function m0(e,t,n){await ge("PUT",`/connectors/${e}/grants/${encodeURIComponent(t)}`,{scopes:n},pi)}async function h0(e,t){await ge("DELETE",`/connectors/${e}/grants/${encodeURIComponent(t)}`,void 0,pi)}async function p0(){return ge("GET","/sessions")}async function gu(e={}){return ge("POST","/sessions",e)}async function ic(e,t){return ge("PUT",`/sessions/${e}`,t)}async function Iy(e){return ge("DELETE",`/sessions/${e}`)}async function g0(e){return ge("PATCH",`/sessions/${e}/private`)}async function Rs(e){return ge("GET",`/sessions/${e}/messages`)}async function y0(e){return ge("GET",`/sessions/${e}/export?format=markdown`)}async function x0(e,t){return ge("DELETE",`/sessions/${e}/messages/${t}`)}async function v0(e,t){return ge("DELETE",`/sessions/${e}/messages/${t}/and-below`)}const k0=new Set(["status","step","thinking","plan","tool_start","tool_end","tool_result","tool_args","tool_confirm","agent_error","permission_request","policy_alert"]);function Py(e,t,n,r,i,l){let a;typeof n=="function"?a={onChunk:n,onAgentEvent:()=>{},onDone:()=>{},onError:h=>{E.stream.error("Unhandled stream error",h)}}:a=n;const o=new AbortController,c=E.stream.time();let u=0,d=0,f=0;return E.stream.info(`Starting SSE stream for session=${e}`,{messageLength:t.length}),fetch(`${jo}/chat/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:e,message:t,stream:!0,...l?{agent_type:l}:{}}),signal:o.signal}).then(async h=>{var x,w;if(E.stream.info(`SSE connection opened -> HTTP ${h.status}`),!h.ok){const j=await h.text().catch(()=>"");E.stream.error(`SSE connection failed: HTTP ${h.status}`,j),a.onError(new Error(`HTTP ${h.status}: ${j}`));return}const m=(x=h.body)==null?void 0:x.getReader();if(!m){E.stream.error("No response body reader available"),a.onError(new Error("No response body"));return}const g=new TextDecoder;let k="",v=!1;try{for(;;){const{done:j,value:z}=await m.read();if(j){E.stream.debug("SSE reader done (stream ended)");break}k+=g.decode(z,{stream:!0});const D=k.split(`
503
+ `);k=D.pop()||"";for(const _ of D)if(_.startsWith("data: ")){const A=_.slice(6).trim();if(!A)continue;try{const C=JSON.parse(A);C.type==="chunk"?(u++,d+=(C.content||"").length,(u<=3||u%50===0)&&E.stream.debug(`Chunk #${u} (+${(C.content||"").length} chars)`),a.onChunk(C)):C.type==="answer"?a.onChunk(C):C.type==="done"?(v=!0,E.stream.timed(`Stream complete: ${u} chunks, ${d} chars, ${f} agent events`,c),a.onDone(C)):C.type==="error"?(E.stream.error("Stream error event:",C.content),a.onError(new Error(C.content||"Unknown error"))):C.type==="agent_created"?(E.stream.info(`Agent created: ${C.agent_id}`),(w=a.onAgentCreated)==null||w.call(a,C)):k0.has(C.type)?(f++,E.stream.debug(`Agent event: ${C.type}`,C),a.onAgentEvent(C)):E.stream.warn(`Unknown SSE event type: ${C.type}`,C)}catch{E.stream.warn("Malformed SSE data, skipping",{raw:A.slice(0,100)})}}}}finally{m.releaseLock()}v||(E.stream.timed(`SSE connection closed without done event: ${u} chunks, ${f} agent events`,c),a.onDone({type:"done"}))}).catch(h=>{h.name==="AbortError"?E.stream.warn(`Stream aborted by user after ${u} chunks`):(E.stream.error("Stream fetch error",h),a.onError(h))}),o}async function w0(e,t,n,r){return ge("POST","/chat/confirm",{session_id:e,confirm_id:t,action:n,remember:r})}async function My(e,t){return ge("POST","/chat/confirm-tool",{session_id:e,approved:t})}async function b0(e){return ge("POST","/chat/cancel",{session_id:e})}async function Ni(){return ge("GET","/documents")}async function Ry(e){return ge("POST","/documents/upload-path",{filepath:e})}async function $y(e){const t=`${jo}/documents/upload`,n=E.api.time();E.api.info(`POST ${t}`,{fileName:e.name,size:e.size});const r=new FormData;r.append("file",e);let i;try{i=await fetch(t,{method:"POST",body:r})}catch(a){throw E.api.error(`POST ${t} - network error`,a),a}if(!i.ok){const a=await i.text().catch(()=>"");E.api.error(`POST ${t} - HTTP ${i.status}`,{errorText:a});let o=a;try{o=JSON.parse(a).detail||a}catch{}throw new Error(Ey(i.status,o))}const l=await i.json();return E.api.timed(`POST ${t} -> ${i.status}`,n,l),l}async function j0(e){return ge("DELETE",`/documents/${e}`)}async function S0(e){return ge("GET",`/documents/${e}/status`)}async function N0(e){return ge("POST",`/documents/${e}/cancel`)}async function Xa(e,t){return ge("POST",`/sessions/${e}/documents`,{document_id:t})}async function C0(e,t){return ge("DELETE",`/sessions/${e}/documents/${t}`)}async function _0(e){const t=e?`?path=${encodeURIComponent(e)}`:"";return ge("GET",`/files/browse${t}`)}async function E0(e,t=!0){return ge("POST","/documents/index-folder",{folder_path:e,recursive:t})}async function zd(e,t=!0){return ge("POST","/files/open",{path:e,reveal:t})}async function Rm(e){const t=`${jo}/files/upload`,n=E.api.time();E.api.info(`POST ${t}`,{fileName:e.name,size:e.size});const r=new FormData;r.append("file",e);const i=await fetch(t,{method:"POST",body:r});if(!i.ok){const a=await i.text().catch(()=>"Upload failed");throw E.api.error(`POST ${t} - HTTP ${i.status}`,{errorText:a}),new Error(`Upload failed: ${a}`)}const l=await i.json();return E.api.timed(`POST ${t} -> ${i.status}`,n,l),l}async function T0(e,t,n){const r=new URLSearchParams({query:e});return t&&r.set("file_types",t),r.set("max_results",String(n)),ge("GET",`/files/search?${r}`)}async function z0(e,t){const n=new URLSearchParams({path:e});return ge("GET",`/files/preview?${n}`)}async function L0(){return ge("POST","/tunnel/start")}async function A0(){return ge("POST","/tunnel/stop")}async function Fy(){return ge("GET","/tunnel/status")}async function D0(){return ge("GET","/mcp/status")}function Fi(e){return e.replace(/-/g,"").slice(0,7)}function I0(e,t){const n=t.replace(/^#/,"").toLowerCase();if(!n||n.length<4)return null;const r=e.find(i=>i.id.replace(/-/g,"").toLowerCase().startsWith(n));return r?r.id:null}const Oy=""+new URL("gaia-robot-NKaQnEIp.png",import.meta.url).href;function P0(e,t){e.stopPropagation(),e.preventDefault();const n=Fi(t),r=`${window.location.origin}${window.location.pathname}#${n}`;navigator.clipboard.writeText(r).then(()=>{E.ui.info(`Copied session link: ${r}`)}).catch(()=>{E.ui.warn("Clipboard write failed")})}function $m({session:e,isActive:t,isPendingDelete:n,isDeleting:r,onSelect:i,onKeyDown:l,onDelete:a,formatTime:o}){const[c,u]=p.useState(!1),d=p.useCallback(f=>{P0(f,e.id),u(!0),setTimeout(()=>u(!1),1500)},[e.id]);return s.jsxs("div",{className:`session-item ${t?"active":""} ${r?"session-deleting":""}`,onClick:()=>i(e.id),onKeyDown:f=>l(f,e.id),role:"button",tabIndex:0,"aria-label":`Open task: ${e.title}`,"aria-current":t?"true":void 0,children:[s.jsxs("span",{className:"session-title",children:[e.private&&s.jsx(my,{size:10,className:"session-private-icon","aria-label":"Private session"}),e.title]}),s.jsxs("a",{className:`session-hash ${c?"copied":""}`,href:`#${Fi(e.id)}`,onClick:d,title:c?"Copied!":`Copy link #${Fi(e.id)}`,"aria-label":`Copy link for session ${Fi(e.id)}`,children:["#",Fi(e.id)]}),s.jsx("span",{className:"session-time",children:o(e.updated_at)}),n?s.jsxs("button",{className:"session-delete confirm",onClick:f=>a(f,e.id),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&a(f,e.id)},title:"Click to confirm delete","aria-label":`Confirm delete: ${e.title}`,children:[s.jsx(di,{size:12}),s.jsx("span",{className:"confirm-label",children:"Delete?"})]}):s.jsx("button",{className:"session-delete",onClick:f=>a(f,e.id),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&a(f,e.id)},title:"Delete","aria-label":`Delete: ${e.title}`,children:s.jsx(di,{size:13})})]})}function M0({onNewTask:e,onHome:t,tunnelActive:n,tunnelLoading:r,onMobileToggle:i}){const{sessions:l,currentSessionId:a,setCurrentSession:o,removeSession:c,addSession:u,setMessages:d,theme:f,toggleTheme:h,setShowSettings:m,setShowMemoryDashboard:g,sidebarOpen:k,setSidebarOpen:v,setLoadingMessages:x,sidebarCollapsed:w,toggleSidebarCollapsed:j,sidebarWidth:z,setSidebarWidth:D,addPendingDelete:_,removePendingDelete:A}=Se(),[C,R]=p.useState(""),[N,U]=p.useState(null),[O,re]=p.useState(null),[oe,te]=p.useState(!1),[le,fe]=p.useState(null),T=p.useRef(null),I=p.useRef(null),b=p.useRef(null);p.useEffect(()=>{const M=()=>{var B;w?(j(),requestAnimationFrame(()=>{var he;return(he=I.current)==null?void 0:he.focus()})):(B=I.current)==null||B.focus()};return window.addEventListener("gaia:focus-search",M),()=>window.removeEventListener("gaia:focus-search",M)},[w,j]);const X=C?l.filter(M=>M.title.toLowerCase().includes(C.toLowerCase())):l,H=p.useMemo(()=>{if(C)return null;const M=new Date,B=new Date(M.getFullYear(),M.getMonth(),M.getDate()).getTime(),he=B-864e5,pe=B-7*864e5,ce=[{label:"Today",sessions:[]},{label:"Yesterday",sessions:[]},{label:"Previous 7 Days",sessions:[]},{label:"Older",sessions:[]}];for(const ke of X){const q=new Date(ke.updated_at).getTime();q>=B?ce[0].sessions.push(ke):q>=he?ce[1].sessions.push(ke):q>=pe?ce[2].sessions.push(ke):ce[3].sessions.push(ke)}return ce.filter(ke=>ke.sessions.length>0)},[X,C]),S=p.useCallback(async M=>{var he;if(M===a)return;const B=((he=l.find(pe=>pe.id===M))==null?void 0:he.title)||"?";E.nav.info(`Selecting session: "${B}" (${M})`),o(M),d([]),x(!0),window.innerWidth<=768&&v(!1);try{const pe=await Rs(M);if(!(Se.getState().currentSessionId===M)){E.nav.debug(`Discarding stale message load for session=${M} (user switched away)`);return}d(pe.messages||[]),E.nav.info(`Loaded ${(pe.messages||[]).length} message(s) for "${B}"`)}catch(pe){E.nav.error(`Failed to load messages for session ${M}`,pe),d([])}finally{x(!1)}},[a,l,o,d,v,x]),ie=p.useCallback(async(M,B)=>{M.stopPropagation(),M.preventDefault();const he=l.find(ce=>ce.id===B),pe=(he==null?void 0:he.title)||"?";if(N===B){E.chat.info(`Deleting session: "${pe}" (${B})`),U(null),re(B),_(B),Iy(B).then(()=>{E.chat.info(`Session deleted from backend: "${pe}"`),A(B)}).catch(ke=>{E.chat.warn(`Backend delete failed for "${pe}"`,ke),A(B)}),le!=null&&le.timer&&clearTimeout(le.timer);const ce=setTimeout(()=>{fe(null)},5e3);he&&fe({session:he,timer:ce}),setTimeout(()=>{c(B),re(null)},250);return}E.chat.debug(`Delete pending confirmation for: "${pe}" (${B})`),U(B),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>U(ce=>ce===B?null:ce),3e3)},[N,l,c,le,_,A]),ye=p.useCallback(()=>{if(!le)return;clearTimeout(le.timer);const{session:M}=le;E.chat.info(`Undo delete: re-creating "${M.title}"`),A(M.id),gu({title:M.title}).then(B=>{u(B),E.chat.info(`Undo delete: re-created "${B.title}" (new id=${B.id})`)}).catch(B=>{E.chat.warn(`Undo delete failed for "${M.title}"`,B)}),fe(null)},[le,u,A]);p.useEffect(()=>{if(!N)return;const M=()=>U(null);return window.addEventListener("click",M,{once:!0}),()=>window.removeEventListener("click",M)},[N]);const ae=p.useCallback((M,B)=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),S(B))},[S]),be=p.useRef(null),Ge=p.useCallback(M=>{M.preventDefault(),te(!0),E.ui.debug("Sidebar resize started");const B=M.clientX,he=z,pe=ke=>{const q=ke.clientX-B;D(he+q)},ce=()=>{te(!1),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",ce),document.body.style.cursor="",document.body.style.userSelect="",be.current=null,E.ui.debug("Sidebar resize ended")};be.current=ce,document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",pe),document.addEventListener("mouseup",ce)},[z,D]);p.useEffect(()=>()=>{be.current&&be.current(),b.current&&clearTimeout(b.current)},[]);const qe=M=>{const B=new Date(M),pe=new Date().getTime()-B.getTime(),ce=Math.floor(pe/6e4);if(ce<1)return"now";if(ce<60)return`${ce}m`;const ke=Math.floor(ce/60);if(ke<24)return`${ke}h`;const q=Math.floor(ke/24);return q<7?`${q}d`:B.toLocaleDateString(void 0,{month:"short",day:"numeric"})},P=typeof window<"u"&&window.innerWidth<=768?void 0:{width:w?56:z,minWidth:w?56:z};return s.jsxs("aside",{ref:T,className:`sidebar ${k?"open":""} ${w?"collapsed":""} ${oe?"resizing":""}`,style:P,role:"complementary","aria-label":"Task sidebar",children:[s.jsxs("div",{className:"sidebar-top",children:[s.jsxs("button",{className:"sidebar-brand",onClick:t,title:"Agent Hub","aria-label":"Go to Agent Hub",children:[s.jsx("div",{className:"brand-icon","aria-hidden":"true",children:s.jsx("img",{src:Oy,alt:"",width:28,height:28})}),s.jsxs("div",{className:"brand-text",children:[s.jsx("span",{className:"brand-name",children:"GAIA"}),s.jsxs("span",{className:"brand-version",children:["v","0.19.0"]}),s.jsx("span",{className:"beta-badge",children:"BETA"})]})]}),s.jsxs("div",{className:"sidebar-top-actions",children:[s.jsx("button",{className:"new-task-btn",onClick:e,title:"New Task","aria-label":"New Task",children:s.jsx(gl,{size:18})}),s.jsx("button",{className:"collapse-btn",onClick:j,title:w?"Expand sidebar":"Collapse sidebar","aria-label":w?"Expand sidebar":"Collapse sidebar",children:w?s.jsx(hw,{size:18}):s.jsx(mw,{size:18})})]})]}),s.jsxs("div",{className:"sidebar-search",children:[s.jsx(Ln,{size:14,className:"search-icon","aria-hidden":"true"}),s.jsx("input",{ref:I,type:"text",placeholder:"Search... (Ctrl+K)",value:C,onChange:M=>R(M.target.value),"aria-label":"Search tasks"})]}),s.jsxs("nav",{className:"session-list","aria-label":"Task sessions",children:[X.length===0&&s.jsx("div",{className:"empty-hint",children:C?"No results":"No tasks yet"}),H?H.map(M=>s.jsxs("div",{children:[s.jsx("div",{className:"session-group-label",children:M.label}),M.sessions.map(B=>s.jsx($m,{session:B,isActive:B.id===a,isPendingDelete:N===B.id,isDeleting:O===B.id,onSelect:S,onKeyDown:ae,onDelete:ie,formatTime:qe},B.id))]},M.label)):X.map(M=>s.jsx($m,{session:M,isActive:M.id===a,isPendingDelete:N===M.id,isDeleting:O===M.id,onSelect:S,onKeyDown:ae,onDelete:ie,formatTime:qe},M.id))]}),s.jsxs("div",{className:"sidebar-bottom",children:[s.jsxs("div",{className:"privacy-badge",children:[s.jsx("span",{className:"privacy-dot","aria-hidden":"true"}),s.jsx("span",{children:"100% Local"}),s.jsxs("span",{className:"version-badge",children:["v","0.19.0"]})]}),s.jsxs("div",{className:"sidebar-actions",children:[i&&s.jsx("button",{className:`btn-icon mobile-toggle-btn ${n?"active":""} ${r?"loading":""}`,onClick:i,disabled:r,title:n?"Stop mobile access":"Enable mobile access","aria-label":n?"Stop mobile access":"Enable mobile access",children:s.jsx(ky,{size:17})}),s.jsx("button",{className:"btn-icon",onClick:()=>g(!0),title:"Memory Dashboard","aria-label":"Memory Dashboard",children:s.jsx(ei,{size:17})}),s.jsx("button",{className:"btn-icon",onClick:()=>m(!0),title:"Settings","aria-label":"Settings",children:s.jsx(kw,{size:17})}),s.jsx("button",{className:"btn-icon",onClick:h,title:"Toggle theme","aria-label":`Switch to ${f==="dark"?"light":"dark"} theme`,children:f==="dark"?s.jsx(Nw,{size:17}):s.jsx(dw,{size:17})})]})]}),!w&&s.jsx("div",{className:"sidebar-resize-handle",onMouseDown:Ge,title:"Drag to resize sidebar","aria-hidden":"true"}),le&&s.jsxs("div",{className:"toast toast-undo",role:"status",children:["Deleted “",le.session.title,"”",s.jsx("span",{className:"toast-action",onClick:ye,children:"Undo"})]})]})}function R0(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $0=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,F0=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O0={};function Fm(e,t){return(O0.jsx?F0:$0).test(e)}const U0=/[ \t\n\f\r]/g;function B0(e){return typeof e=="object"?e.type==="text"?Om(e.value):!1:Om(e)}function Om(e){return e.replace(U0,"")===""}class Cl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Cl.prototype.normal={};Cl.prototype.property={};Cl.prototype.space=void 0;function Uy(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Cl(n,r,t)}function yu(e){return e.toLowerCase()}class Xt{constructor(t,n){this.attribute=n,this.property=t}}Xt.prototype.attribute="";Xt.prototype.booleanish=!1;Xt.prototype.boolean=!1;Xt.prototype.commaOrSpaceSeparated=!1;Xt.prototype.commaSeparated=!1;Xt.prototype.defined=!1;Xt.prototype.mustUseProperty=!1;Xt.prototype.number=!1;Xt.prototype.overloadedBoolean=!1;Xt.prototype.property="";Xt.prototype.spaceSeparated=!1;Xt.prototype.space=void 0;let H0=0;const we=gi(),ot=gi(),xu=gi(),G=gi(),Be=gi(),Qi=gi(),tn=gi();function gi(){return 2**++H0}const vu=Object.freeze(Object.defineProperty({__proto__:null,boolean:we,booleanish:ot,commaOrSpaceSeparated:tn,commaSeparated:Qi,number:G,overloadedBoolean:xu,spaceSeparated:Be},Symbol.toStringTag,{value:"Module"})),sc=Object.keys(vu);class Ld extends Xt{constructor(t,n,r,i){let l=-1;if(super(t,n),Um(this,"space",i),typeof r=="number")for(;++l<sc.length;){const a=sc[l];Um(this,sc[l],(r&vu[a])===vu[a])}}}Ld.prototype.defined=!0;function Um(e,t,n){n&&(e[t]=n)}function ds(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const l=new Ld(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[yu(r)]=r,n[yu(l.attribute)]=r}return new Cl(t,n,e.space)}const By=ds({properties:{ariaActiveDescendant:null,ariaAtomic:ot,ariaAutoComplete:null,ariaBusy:ot,ariaChecked:ot,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:Be,ariaCurrent:null,ariaDescribedBy:Be,ariaDetails:null,ariaDisabled:ot,ariaDropEffect:Be,ariaErrorMessage:null,ariaExpanded:ot,ariaFlowTo:Be,ariaGrabbed:ot,ariaHasPopup:null,ariaHidden:ot,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Be,ariaLevel:G,ariaLive:null,ariaModal:ot,ariaMultiLine:ot,ariaMultiSelectable:ot,ariaOrientation:null,ariaOwns:Be,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:ot,ariaReadOnly:ot,ariaRelevant:null,ariaRequired:ot,ariaRoleDescription:Be,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:ot,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Hy(e,t){return t in e?e[t]:t}function Vy(e,t){return Hy(e,t.toLowerCase())}const V0=ds({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Qi,acceptCharset:Be,accessKey:Be,action:null,allow:null,allowFullScreen:we,allowPaymentRequest:we,allowUserMedia:we,alt:null,as:null,async:we,autoCapitalize:null,autoComplete:Be,autoFocus:we,autoPlay:we,blocking:Be,capture:null,charSet:null,checked:we,cite:null,className:Be,cols:G,colSpan:null,content:null,contentEditable:ot,controls:we,controlsList:Be,coords:G|Qi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:we,defer:we,dir:null,dirName:null,disabled:we,download:xu,draggable:ot,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:we,formTarget:null,headers:Be,height:G,hidden:xu,high:G,href:null,hrefLang:null,htmlFor:Be,httpEquiv:Be,id:null,imageSizes:null,imageSrcSet:null,inert:we,inputMode:null,integrity:null,is:null,isMap:we,itemId:null,itemProp:Be,itemRef:Be,itemScope:we,itemType:Be,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:we,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:we,muted:we,name:null,nonce:null,noModule:we,noValidate:we,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:we,optimum:G,pattern:null,ping:Be,placeholder:null,playsInline:we,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:we,referrerPolicy:null,rel:Be,required:we,reversed:we,rows:G,rowSpan:G,sandbox:Be,scope:null,scoped:we,seamless:we,selected:we,shadowRootClonable:we,shadowRootDelegatesFocus:we,shadowRootMode:null,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:ot,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:we,useMap:null,value:ot,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Be,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:we,declare:we,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:we,noHref:we,noShade:we,noWrap:we,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:ot,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:we,disableRemotePlayback:we,prefix:null,property:null,results:G,security:null,unselectable:null},space:"html",transform:Vy}),W0=ds({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:tn,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:Be,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:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:we,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,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:Qi,g2:Qi,glyphName:Qi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:tn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,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:G,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:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Be,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tn,rev:tn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tn,requiredFeatures:tn,requiredFonts:tn,requiredFormats:tn,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:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:tn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tn,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Hy}),Wy=ds({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()}}),Gy=ds({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Vy}),qy=ds({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),G0={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"},q0=/[A-Z]/g,Bm=/-[a-z]/g,Q0=/^data[-\w.:]+$/i;function K0(e,t){const n=yu(t);let r=t,i=Xt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Q0.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Bm,X0);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Bm.test(l)){let a=l.replace(q0,Y0);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Ld}return new i(r,t)}function Y0(e){return"-"+e.toLowerCase()}function X0(e){return e.charAt(1).toUpperCase()}const J0=Uy([By,V0,Wy,Gy,qy],"html"),Ad=Uy([By,W0,Wy,Gy,qy],"svg");function Z0(e){return e.join(" ").trim()}var Dd={},Hm=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,eb=/\n/g,tb=/^\s*/,nb=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,rb=/^:\s*/,ib=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,sb=/^[;\s]*/,lb=/^\s+|\s+$/g,ab=`
504
+ `,Vm="/",Wm="*",Yr="",ob="comment",cb="declaration";function ub(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(g){var k=g.match(eb);k&&(n+=k.length);var v=g.lastIndexOf(ab);r=~v?g.length-v:r+g.length}function l(){var g={line:n,column:r};return function(k){return k.position=new a(g),u(),k}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(g){var k=new Error(t.source+":"+n+":"+r+": "+g);if(k.reason=g,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function c(g){var k=g.exec(e);if(k){var v=k[0];return i(v),e=e.slice(v.length),k}}function u(){c(tb)}function d(g){var k;for(g=g||[];k=f();)k!==!1&&g.push(k);return g}function f(){var g=l();if(!(Vm!=e.charAt(0)||Wm!=e.charAt(1))){for(var k=2;Yr!=e.charAt(k)&&(Wm!=e.charAt(k)||Vm!=e.charAt(k+1));)++k;if(k+=2,Yr===e.charAt(k-1))return o("End of comment missing");var v=e.slice(2,k-2);return r+=2,i(v),e=e.slice(k),r+=2,g({type:ob,comment:v})}}function h(){var g=l(),k=c(nb);if(k){if(f(),!c(rb))return o("property missing ':'");var v=c(ib),x=g({type:cb,property:Gm(k[0].replace(Hm,Yr)),value:v?Gm(v[0].replace(Hm,Yr)):Yr});return c(sb),x}}function m(){var g=[];d(g);for(var k;k=h();)k!==!1&&(g.push(k),d(g));return g}return u(),m()}function Gm(e){return e?e.replace(lb,Yr):Yr}var db=ub,fb=ba&&ba.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Dd,"__esModule",{value:!0});Dd.default=hb;const mb=fb(db);function hb(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,mb.default)(e),i=typeof t=="function";return r.forEach(l=>{if(l.type!=="declaration")return;const{property:a,value:o}=l;i?t(a,o,l):o&&(n=n||{},n[a]=o)}),n}var So={};Object.defineProperty(So,"__esModule",{value:!0});So.camelCase=void 0;var pb=/^--[a-zA-Z0-9_-]+$/,gb=/-([a-z])/g,yb=/^[^-]+$/,xb=/^-(webkit|moz|ms|o|khtml)-/,vb=/^-(ms)-/,kb=function(e){return!e||yb.test(e)||pb.test(e)},wb=function(e,t){return t.toUpperCase()},qm=function(e,t){return"".concat(t,"-")},bb=function(e,t){return t===void 0&&(t={}),kb(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(vb,qm):e=e.replace(xb,qm),e.replace(gb,wb))};So.camelCase=bb;var jb=ba&&ba.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Sb=jb(Dd),Nb=So;function ku(e,t){var n={};return!e||typeof e!="string"||(0,Sb.default)(e,function(r,i){r&&i&&(n[(0,Nb.camelCase)(r,t)]=i)}),n}ku.default=ku;var Cb=ku;const _b=io(Cb),Qy=Ky("end"),Id=Ky("start");function Ky(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 Eb(e){const t=Id(e),n=Qy(e);if(t&&n)return{start:t,end:n}}function Qs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Qm(e.position):"start"in e||"end"in e?Qm(e):"line"in e||"column"in e?wu(e):""}function wu(e){return Km(e&&e.line)+":"+Km(e&&e.column)}function Qm(e){return wu(e&&e.start)+"-"+wu(e&&e.end)}function Km(e){return e&&typeof e=="number"?e:1}class It extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",l={},a=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?i=t:!l.cause&&t&&(a=!0,i=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?l.ruleId=r:(l.source=r.slice(0,c),l.ruleId=r.slice(c+1))}if(!l.place&&l.ancestors&&l.ancestors){const c=l.ancestors[l.ancestors.length-1];c&&(l.place=c.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=Qs(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=a&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}It.prototype.file="";It.prototype.name="";It.prototype.reason="";It.prototype.message="";It.prototype.stack="";It.prototype.column=void 0;It.prototype.line=void 0;It.prototype.ancestors=void 0;It.prototype.cause=void 0;It.prototype.fatal=void 0;It.prototype.place=void 0;It.prototype.ruleId=void 0;It.prototype.source=void 0;const Pd={}.hasOwnProperty,Tb=new Map,zb=/[A-Z]/g,Lb=new Set(["table","tbody","thead","tfoot","tr"]),Ab=new Set(["td","th"]),Yy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Db(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=Ub(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=Ob(n,t.jsx,t.jsxs)}const i={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"?Ad:J0,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=Xy(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function Xy(e,t,n){if(t.type==="element")return Ib(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Pb(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Rb(e,t,n);if(t.type==="mdxjsEsm")return Mb(e,t);if(t.type==="root")return $b(e,t,n);if(t.type==="text")return Fb(e,t)}function Ib(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Ad,e.schema=i),e.ancestors.push(t);const l=Zy(e,t.tagName,!1),a=Bb(e,t);let o=Rd(e,t);return Lb.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!B0(c):!0})),Jy(e,a,l,t),Md(a,o),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function Pb(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)}xl(e,t.position)}function Mb(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xl(e,t.position)}function Rb(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Ad,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:Zy(e,t.name,!0),a=Hb(e,t),o=Rd(e,t);return Jy(e,a,l,t),Md(a,o),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function $b(e,t,n){const r={};return Md(r,Rd(e,t)),e.create(t,e.Fragment,r,n)}function Fb(e,t){return t.value}function Jy(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Md(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Ob(e,t,n){return r;function r(i,l,a,o){const u=Array.isArray(a.children)?n:t;return o?u(l,a,o):u(l,a)}}function Ub(e,t){return n;function n(r,i,l,a){const o=Array.isArray(l.children),c=Id(r);return t(i,l,a,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Bb(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Pd.call(t.properties,i)){const l=Vb(e,i,t.properties[i]);if(l){const[a,o]=l;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&Ab.has(t.tagName)?r=o:n[a]=o}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Hb(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const a=l.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else xl(e,t.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,l=e.evaluater.evaluateExpression(o.expression)}else xl(e,t.position);else l=r.value===null?!0:r.value;n[i]=l}return n}function Rd(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Tb;for(;++r<t.children.length;){const l=t.children[r];let a;if(e.passKeys){const c=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(c){const u=i.get(c)||0;a=c+"-"+u,i.set(c,u+1)}}const o=Xy(e,l,a);o!==void 0&&n.push(o)}return n}function Vb(e,t,n){const r=K0(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?R0(n):Z0(n)),r.property==="style"){let i=typeof n=="object"?n:Wb(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Gb(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?G0[r.property]||r.property:r.attribute,n]}}function Wb(e,t){try{return _b(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new It("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Yy+"#cannot-parse-style-attribute",i}}function Zy(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let l=-1,a;for(;++l<i.length;){const o=Fm(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(l&&o.type==="Literal"),optional:!1}:o}r=a}else r=Fm(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Pd.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);xl(e)}function xl(e,t){const n=new It("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=Yy+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Gb(e){const t={};let n;for(n in e)Pd.call(e,n)&&(t[qb(n)]=e[n]);return t}function qb(e){let t=e.replace(zb,Qb);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Qb(e){return"-"+e.toLowerCase()}const lc={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"]},Kb={};function $d(e,t){const n=Kb,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ex(e,r,i)}function ex(e,t,n){if(Yb(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 Ym(e.children,t,n)}return Array.isArray(e)?Ym(e,t,n):""}function Ym(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=ex(e[i],t,n);return r.join("")}function Yb(e){return!!(e&&typeof e=="object")}const Xm=document.createElement("i");function Fd(e){const t="&"+e+";";Xm.innerHTML=t;const n=Xm.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ln(e,t,n,r){const i=e.length;let l=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i: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);l<r.length;)a=r.slice(l,l+1e4),a.unshift(t,0),e.splice(...a),l+=1e4,t+=1e4}function mn(e,t){return e.length>0?(ln(e,e.length,0,t),e):t}const Jm={}.hasOwnProperty;function tx(e){const t={};let n=-1;for(;++n<e.length;)Xb(t,e[n]);return t}function Xb(e,t){let n;for(n in t){const i=(Jm.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let a;if(l)for(a in l){Jm.call(i,a)||(i[a]=[]);const o=l[a];Jb(i[a],Array.isArray(o)?o:o?[o]:[])}}}function Jb(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ln(e,0,0,r)}function nx(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 In(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ft=Gr(/[A-Za-z]/),At=Gr(/[\dA-Za-z]/),Zb=Gr(/[#-'*+\--9=?A-Z^-~]/);function Ja(e){return e!==null&&(e<32||e===127)}const bu=Gr(/\d/),ej=Gr(/[\dA-Fa-f]/),tj=Gr(/[!-/:-@[-`{-~]/);function de(e){return e!==null&&e<-2}function Ue(e){return e!==null&&(e<0||e===32)}function _e(e){return e===-2||e===-1||e===32}const No=Gr(new RegExp("\\p{P}|\\p{S}","u")),fi=Gr(/\s/);function Gr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function fs(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const l=e.charCodeAt(n);let a="";if(l===37&&At(e.charCodeAt(n+1))&&At(e.charCodeAt(n+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(a=String.fromCharCode(l));else if(l>55295&&l<57344){const o=e.charCodeAt(n+1);l<56320&&o>56319&&o<57344?(a=String.fromCharCode(l,o),i=1):a="�"}else a=String.fromCharCode(l);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Le(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return a;function a(c){return _e(c)?(e.enter(n),o(c)):t(c)}function o(c){return _e(c)&&l++<i?(e.consume(c),o):(e.exit(n),t(c))}}const nj={tokenize:rj};function rj(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Le(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),l(o)}function l(o){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return de(o)?(e.consume(o),e.exit("chunkText"),l):(e.consume(o),a)}}const ij={tokenize:sj},Zm={tokenize:lj};function sj(e){const t=this,n=[];let r=0,i,l,a;return o;function o(j){if(r<n.length){const z=n[r];return t.containerState=z[1],e.attempt(z[0].continuation,c,u)(j)}return u(j)}function c(j){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&w();const z=t.events.length;let D=z,_;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){_=t.events[D][1].end;break}x(r);let A=z;for(;A<t.events.length;)t.events[A][1].end={..._},A++;return ln(t.events,D+1,0,t.events.slice(z)),t.events.length=A,u(j)}return o(j)}function u(j){if(r===n.length){if(!i)return h(j);if(i.currentConstruct&&i.currentConstruct.concrete)return g(j);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Zm,d,f)(j)}function d(j){return i&&w(),x(r),h(j)}function f(j){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,g(j)}function h(j){return t.containerState={},e.attempt(Zm,m,g)(j)}function m(j){return r++,n.push([t.currentConstruct,t.containerState]),h(j)}function g(j){if(j===null){i&&w(),x(0),e.consume(j);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),k(j)}function k(j){if(j===null){v(e.exit("chunkFlow"),!0),x(0),e.consume(j);return}return de(j)?(e.consume(j),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(j),k)}function v(j,z){const D=t.sliceStream(j);if(z&&D.push(null),j.previous=l,l&&(l.next=j),l=j,i.defineSkip(j.start),i.write(D),t.parser.lazy[j.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<a&&(!i.events[_][1].end||i.events[_][1].end.offset>a))return;const A=t.events.length;let C=A,R,N;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){if(R){N=t.events[C][1].end;break}R=!0}for(x(r),_=A;_<t.events.length;)t.events[_][1].end={...N},_++;ln(t.events,C+1,0,t.events.slice(A)),t.events.length=_}}function x(j){let z=n.length;for(;z-- >j;){const D=n[z];t.containerState=D[1],D[0].exit.call(t,e)}n.length=j}function w(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function lj(e,t,n){return Le(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ls(e){if(e===null||Ue(e)||fi(e))return 1;if(No(e))return 2}function Co(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const ju={name:"attention",resolveAll:aj,tokenize:oj};function aj(e,t){let n=-1,r,i,l,a,o,c,u,d;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;c=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 f={...e[r][1].end},h={...e[n][1].start};eh(f,-c),eh(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},l={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=mn(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=mn(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",l,t]]),u=mn(u,Co(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=mn(u,[["exit",l,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=mn(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,ln(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function oj(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ls(r);let l;return a;function a(c){return l=c,e.enter("attentionSequence"),o(c)}function o(c){if(c===l)return e.consume(c),o;const u=e.exit("attentionSequence"),d=ls(c),f=!d||d===2&&i||n.includes(c),h=!i||i===2&&d||n.includes(r);return u._open=!!(l===42?f:f&&(i||!h)),u._close=!!(l===42?h:h&&(d||!f)),t(c)}}function eh(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const cj={name:"autolink",tokenize:uj};function uj(e,t,n){let r=0;return i;function i(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(m){return Ft(m)?(e.consume(m),a):m===64?n(m):u(m)}function a(m){return m===43||m===45||m===46||At(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,c):(m===43||m===45||m===46||At(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function c(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||Ja(m)?n(m):(e.consume(m),c)}function u(m){return m===64?(e.consume(m),d):Zb(m)?(e.consume(m),u):n(m)}function d(m){return At(m)?f(m):n(m)}function f(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):h(m)}function h(m){if((m===45||At(m))&&r++<63){const g=m===45?h:f;return e.consume(m),g}return n(m)}}const _l={partial:!0,tokenize:dj};function dj(e,t,n){return r;function r(l){return _e(l)?Le(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||de(l)?t(l):n(l)}}const rx={continuation:{tokenize:mj},exit:hj,name:"blockQuote",tokenize:fj};function fj(e,t,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),l}return n(a)}function l(a){return _e(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function mj(e,t,n){const r=this;return i;function i(a){return _e(a)?Le(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):l(a)}function l(a){return e.attempt(rx,t,n)(a)}}function hj(e){e.exit("blockQuote")}const ix={name:"characterEscape",tokenize:pj};function pj(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return tj(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const sx={name:"characterReference",tokenize:gj};function gj(e,t,n){const r=this;let i=0,l,a;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),l=31,a=At,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,a=ej,d):(e.enter("characterReferenceValue"),l=7,a=bu,d(f))}function d(f){if(f===59&&i){const h=e.exit("characterReferenceValue");return a===At&&!Fd(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&i++<l?(e.consume(f),d):n(f)}}const th={partial:!0,tokenize:xj},nh={concrete:!0,name:"codeFenced",tokenize:yj};function yj(e,t,n){const r=this,i={partial:!0,tokenize:D};let l=0,a=0,o;return c;function c(_){return u(_)}function u(_){const A=r.events[r.events.length-1];return l=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,o=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===o?(a++,e.consume(_),d):a<3?n(_):(e.exit("codeFencedFenceSequence"),_e(_)?Le(e,f,"whitespace")(_):f(_))}function f(_){return _===null||de(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(th,k,z)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(_))}function h(_){return _===null||de(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(_)):_e(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,m,"whitespace")(_)):_===96&&_===o?n(_):(e.consume(_),h)}function m(_){return _===null||de(_)?f(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===null||de(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(_)):_===96&&_===o?n(_):(e.consume(_),g)}function k(_){return e.attempt(i,z,v)(_)}function v(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),x}function x(_){return l>0&&_e(_)?Le(e,w,"linePrefix",l+1)(_):w(_)}function w(_){return _===null||de(_)?e.check(th,k,z)(_):(e.enter("codeFlowValue"),j(_))}function j(_){return _===null||de(_)?(e.exit("codeFlowValue"),w(_)):(e.consume(_),j)}function z(_){return e.exit("codeFenced"),t(_)}function D(_,A,C){let R=0;return N;function N(te){return _.enter("lineEnding"),_.consume(te),_.exit("lineEnding"),U}function U(te){return _.enter("codeFencedFence"),_e(te)?Le(_,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):O(te)}function O(te){return te===o?(_.enter("codeFencedFenceSequence"),re(te)):C(te)}function re(te){return te===o?(R++,_.consume(te),re):R>=a?(_.exit("codeFencedFenceSequence"),_e(te)?Le(_,oe,"whitespace")(te):oe(te)):C(te)}function oe(te){return te===null||de(te)?(_.exit("codeFencedFence"),A(te)):C(te)}}}function xj(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),l)}function l(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const ac={name:"codeIndented",tokenize:kj},vj={partial:!0,tokenize:wj};function kj(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Le(e,l,"linePrefix",5)(u)}function l(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):de(u)?e.attempt(vj,a,c)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||de(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function c(u){return e.exit("codeIndented"),t(u)}}function wj(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):de(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Le(e,l,"linePrefix",5)(a)}function l(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):de(a)?i(a):n(a)}}const bj={name:"codeText",previous:Sj,resolve:jj,tokenize:Nj};function jj(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Sj(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Nj(e,t,n){let r=0,i,l;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(l=e.enter("codeTextSequence"),i=0,d(f)):de(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||de(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(l.type="codeTextData",u(f))}}class Cj{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 i=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ls(this.left,r),l.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),Ls(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ls(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);Ls(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ls(this.left,n.reverse())}}}function Ls(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 lx(e){const t={};let n=-1,r,i,l,a,o,c,u;const d=new Cj(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,l=0,l<c.length&&c[l][1].type==="lineEndingBlank"&&(l+=2),l<c.length&&c[l][1].type==="content"))for(;++l<c.length&&c[l][1].type!=="content";)c[l][1].type==="chunkText"&&(c[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,_j(d,n)),n=t[n],u=!0);else if(r[1]._container){for(l=n,i=void 0;l--;)if(a=d.get(l),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=l);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return ln(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function _j(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const l=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,c=[],u={};let d,f,h=-1,m=n,g=0,k=0;const v=[k];for(;m;){for(;e.get(++i)[1]!==m;);l.push(i),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),f&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=m,m=m.next}for(m=n;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(k=h+1,v.push(k),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):v.pop(),h=v.length;h--;){const x=o.slice(v[h],v[h+1]),w=l.pop();c.push([w,w+x.length-1]),e.splice(w,2,x)}for(c.reverse(),h=-1;++h<c.length;)u[g+c[h][0]]=g+c[h][1],g+=c[h][1]-c[h][0]-1;return u}const Ej={resolve:zj,tokenize:Lj},Tj={partial:!0,tokenize:Aj};function zj(e){return lx(e),e}function Lj(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?l(o):de(o)?e.check(Tj,a,l)(o):(e.consume(o),i)}function l(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Aj(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Le(e,l,"linePrefix")}function l(a){if(a===null||de(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function ax(e,t,n,r,i,l,a,o,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(x){return x===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(x),e.exit(l),h):x===null||x===32||x===41||Ja(x)?n(x):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),k(x))}function h(x){return x===62?(e.enter(l),e.consume(x),e.exit(l),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===62?(e.exit("chunkString"),e.exit(o),h(x)):x===null||x===60||de(x)?n(x):(e.consume(x),x===92?g:m)}function g(x){return x===60||x===62||x===92?(e.consume(x),m):m(x)}function k(x){return!d&&(x===null||x===41||Ue(x))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(x)):d<u&&x===40?(e.consume(x),d++,k):x===41?(e.consume(x),d--,k):x===null||x===32||x===40||Ja(x)?n(x):(e.consume(x),x===92?v:k)}function v(x){return x===40||x===41||x===92?(e.consume(x),k):k(x)}}function ox(e,t,n,r,i,l){const a=this;let o=0,c;return u;function u(m){return e.enter(r),e.enter(i),e.consume(m),e.exit(i),e.enter(l),d}function d(m){return o>999||m===null||m===91||m===93&&!c||m===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(m):m===93?(e.exit(l),e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):de(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===null||m===91||m===93||de(m)||o++>999?(e.exit("chunkString"),d(m)):(e.consume(m),c||(c=!_e(m)),m===92?h:f)}function h(m){return m===91||m===92||m===93?(e.consume(m),o++,f):f(m)}}function cx(e,t,n,r,i,l){let a;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(l),u(h))}function u(h){return h===a?(e.exit(l),c(a)):h===null?n(h):de(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Le(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||de(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function Ks(e,t){let n;return r;function r(i){return de(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):_e(i)?Le(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Dj={name:"definition",tokenize:Pj},Ij={partial:!0,tokenize:Mj};function Pj(e,t,n){const r=this;let i;return l;function l(m){return e.enter("definition"),a(m)}function a(m){return ox.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return i=In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):n(m)}function c(m){return Ue(m)?Ks(e,u)(m):u(m)}function u(m){return ax(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(Ij,f,f)(m)}function f(m){return _e(m)?Le(e,h,"whitespace")(m):h(m)}function h(m){return m===null||de(m)?(e.exit("definition"),r.parser.defined.push(i),t(m)):n(m)}}function Mj(e,t,n){return r;function r(o){return Ue(o)?Ks(e,i)(o):n(o)}function i(o){return cx(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return _e(o)?Le(e,a,"whitespace")(o):a(o)}function a(o){return o===null||de(o)?t(o):n(o)}}const Rj={name:"hardBreakEscape",tokenize:$j};function $j(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return de(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const Fj={name:"headingAtx",resolve:Oj,tokenize:Uj};function Oj(e,t){let n=e.length-2,r=3,i,l;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ln(e,r,n-r+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])),e}function Uj(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),l(d)}function l(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Ue(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||de(d)?(e.exit("atxHeading"),t(d)):_e(d)?Le(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Ue(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const Bj=["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"],rh=["pre","script","style","textarea"],Hj={concrete:!0,name:"htmlFlow",resolveTo:Gj,tokenize:qj},Vj={partial:!0,tokenize:Kj},Wj={partial:!0,tokenize:Qj};function Gj(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 qj(e,t,n){const r=this;let i,l,a,o,c;return u;function u(S){return d(S)}function d(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),f}function f(S){return S===33?(e.consume(S),h):S===47?(e.consume(S),l=!0,k):S===63?(e.consume(S),i=3,r.interrupt?t:b):Ft(S)?(e.consume(S),a=String.fromCharCode(S),v):n(S)}function h(S){return S===45?(e.consume(S),i=2,m):S===91?(e.consume(S),i=5,o=0,g):Ft(S)?(e.consume(S),i=4,r.interrupt?t:b):n(S)}function m(S){return S===45?(e.consume(S),r.interrupt?t:b):n(S)}function g(S){const ie="CDATA[";return S===ie.charCodeAt(o++)?(e.consume(S),o===ie.length?r.interrupt?t:O:g):n(S)}function k(S){return Ft(S)?(e.consume(S),a=String.fromCharCode(S),v):n(S)}function v(S){if(S===null||S===47||S===62||Ue(S)){const ie=S===47,ye=a.toLowerCase();return!ie&&!l&&rh.includes(ye)?(i=1,r.interrupt?t(S):O(S)):Bj.includes(a.toLowerCase())?(i=6,ie?(e.consume(S),x):r.interrupt?t(S):O(S)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):l?w(S):j(S))}return S===45||At(S)?(e.consume(S),a+=String.fromCharCode(S),v):n(S)}function x(S){return S===62?(e.consume(S),r.interrupt?t:O):n(S)}function w(S){return _e(S)?(e.consume(S),w):N(S)}function j(S){return S===47?(e.consume(S),N):S===58||S===95||Ft(S)?(e.consume(S),z):_e(S)?(e.consume(S),j):N(S)}function z(S){return S===45||S===46||S===58||S===95||At(S)?(e.consume(S),z):D(S)}function D(S){return S===61?(e.consume(S),_):_e(S)?(e.consume(S),D):j(S)}function _(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),c=S,A):_e(S)?(e.consume(S),_):C(S)}function A(S){return S===c?(e.consume(S),c=null,R):S===null||de(S)?n(S):(e.consume(S),A)}function C(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Ue(S)?D(S):(e.consume(S),C)}function R(S){return S===47||S===62||_e(S)?j(S):n(S)}function N(S){return S===62?(e.consume(S),U):n(S)}function U(S){return S===null||de(S)?O(S):_e(S)?(e.consume(S),U):n(S)}function O(S){return S===45&&i===2?(e.consume(S),le):S===60&&i===1?(e.consume(S),fe):S===62&&i===4?(e.consume(S),X):S===63&&i===3?(e.consume(S),b):S===93&&i===5?(e.consume(S),I):de(S)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Vj,H,re)(S)):S===null||de(S)?(e.exit("htmlFlowData"),re(S)):(e.consume(S),O)}function re(S){return e.check(Wj,oe,H)(S)}function oe(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),te}function te(S){return S===null||de(S)?re(S):(e.enter("htmlFlowData"),O(S))}function le(S){return S===45?(e.consume(S),b):O(S)}function fe(S){return S===47?(e.consume(S),a="",T):O(S)}function T(S){if(S===62){const ie=a.toLowerCase();return rh.includes(ie)?(e.consume(S),X):O(S)}return Ft(S)&&a.length<8?(e.consume(S),a+=String.fromCharCode(S),T):O(S)}function I(S){return S===93?(e.consume(S),b):O(S)}function b(S){return S===62?(e.consume(S),X):S===45&&i===2?(e.consume(S),b):O(S)}function X(S){return S===null||de(S)?(e.exit("htmlFlowData"),H(S)):(e.consume(S),X)}function H(S){return e.exit("htmlFlow"),t(S)}}function Qj(e,t,n){const r=this;return i;function i(a){return de(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),l):n(a)}function l(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Kj(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(_l,t,n)}}const Yj={name:"htmlText",tokenize:Xj};function Xj(e,t,n){const r=this;let i,l,a;return o;function o(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),c}function c(b){return b===33?(e.consume(b),u):b===47?(e.consume(b),D):b===63?(e.consume(b),j):Ft(b)?(e.consume(b),C):n(b)}function u(b){return b===45?(e.consume(b),d):b===91?(e.consume(b),l=0,g):Ft(b)?(e.consume(b),w):n(b)}function d(b){return b===45?(e.consume(b),m):n(b)}function f(b){return b===null?n(b):b===45?(e.consume(b),h):de(b)?(a=f,fe(b)):(e.consume(b),f)}function h(b){return b===45?(e.consume(b),m):f(b)}function m(b){return b===62?le(b):b===45?h(b):f(b)}function g(b){const X="CDATA[";return b===X.charCodeAt(l++)?(e.consume(b),l===X.length?k:g):n(b)}function k(b){return b===null?n(b):b===93?(e.consume(b),v):de(b)?(a=k,fe(b)):(e.consume(b),k)}function v(b){return b===93?(e.consume(b),x):k(b)}function x(b){return b===62?le(b):b===93?(e.consume(b),x):k(b)}function w(b){return b===null||b===62?le(b):de(b)?(a=w,fe(b)):(e.consume(b),w)}function j(b){return b===null?n(b):b===63?(e.consume(b),z):de(b)?(a=j,fe(b)):(e.consume(b),j)}function z(b){return b===62?le(b):j(b)}function D(b){return Ft(b)?(e.consume(b),_):n(b)}function _(b){return b===45||At(b)?(e.consume(b),_):A(b)}function A(b){return de(b)?(a=A,fe(b)):_e(b)?(e.consume(b),A):le(b)}function C(b){return b===45||At(b)?(e.consume(b),C):b===47||b===62||Ue(b)?R(b):n(b)}function R(b){return b===47?(e.consume(b),le):b===58||b===95||Ft(b)?(e.consume(b),N):de(b)?(a=R,fe(b)):_e(b)?(e.consume(b),R):le(b)}function N(b){return b===45||b===46||b===58||b===95||At(b)?(e.consume(b),N):U(b)}function U(b){return b===61?(e.consume(b),O):de(b)?(a=U,fe(b)):_e(b)?(e.consume(b),U):R(b)}function O(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),i=b,re):de(b)?(a=O,fe(b)):_e(b)?(e.consume(b),O):(e.consume(b),oe)}function re(b){return b===i?(e.consume(b),i=void 0,te):b===null?n(b):de(b)?(a=re,fe(b)):(e.consume(b),re)}function oe(b){return b===null||b===34||b===39||b===60||b===61||b===96?n(b):b===47||b===62||Ue(b)?R(b):(e.consume(b),oe)}function te(b){return b===47||b===62||Ue(b)?R(b):n(b)}function le(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):n(b)}function fe(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),T}function T(b){return _e(b)?Le(e,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):I(b)}function I(b){return e.enter("htmlTextData"),a(b)}}const Od={name:"labelEnd",resolveAll:tS,resolveTo:nS,tokenize:rS},Jj={tokenize:iS},Zj={tokenize:sS},eS={tokenize:lS};function tS(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&ln(e,0,e.length,n),e}function nS(e,t){let n=e.length,r=0,i,l,a,o;for(;n--;)if(i=e[n][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const c={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[l][1].start},end:{...e[a][1].end}},d={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",c,t],["enter",u,t]],o=mn(o,e.slice(l+1,l+r+3)),o=mn(o,[["enter",d,t]]),o=mn(o,Co(t.parser.constructs.insideSpan.null,e.slice(l+r+4,a-3),t)),o=mn(o,[["exit",d,t],e[a-2],e[a-1],["exit",u,t]]),o=mn(o,e.slice(a+1)),o=mn(o,[["exit",c,t]]),ln(e,l,e.length,o),e}function rS(e,t,n){const r=this;let i=r.events.length,l,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return o;function o(h){return l?l._inactive?f(h):(a=r.parser.defined.includes(In(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):n(h)}function c(h){return h===40?e.attempt(Jj,d,a?d:f)(h):h===91?e.attempt(Zj,d,a?u:f)(h):a?d(h):f(h)}function u(h){return e.attempt(eS,d,f)(h)}function d(h){return t(h)}function f(h){return l._balanced=!0,n(h)}}function iS(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return Ue(f)?Ks(e,l)(f):l(f)}function l(f){return f===41?d(f):ax(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return Ue(f)?Ks(e,c)(f):d(f)}function o(f){return n(f)}function c(f){return f===34||f===39||f===40?cx(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return Ue(f)?Ks(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function sS(e,t,n){const r=this;return i;function i(o){return ox.call(r,e,l,a,"reference","referenceMarker","referenceString")(o)}function l(o){return r.parser.defined.includes(In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function lS(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const aS={name:"labelStartImage",resolveAll:Od.resolveAll,tokenize:oS};function oS(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),l}function l(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const cS={name:"labelStartLink",resolveAll:Od.resolveAll,tokenize:uS};function uS(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),l}function l(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const oc={name:"lineEnding",tokenize:dS};function dS(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const ka={name:"thematicBreak",tokenize:fS};function fS(e,t,n){let r=0,i;return l;function l(u){return e.enter("thematicBreak"),a(u)}function a(u){return i=u,o(u)}function o(u){return u===i?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||de(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),_e(u)?Le(e,o,"whitespace")(u):o(u))}}const Wt={continuation:{tokenize:gS},exit:xS,name:"list",tokenize:pS},mS={partial:!0,tokenize:vS},hS={partial:!0,tokenize:yS};function pS(e,t,n){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:bu(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(ka,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return n(m)}function c(m){return bu(m)&&++a<10?(e.consume(m),c):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(_l,r.interrupt?n:d,e.attempt(mS,h,f))}function d(m){return r.containerState.initialBlankLine=!0,l++,h(m)}function f(m){return _e(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),h):n(m)}function h(m){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function gS(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(_l,i,l);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(e,t,"listItemIndent",r.containerState.size+1)(o)}function l(o){return r.containerState.furtherBlankLines||!_e(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hS,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(e,e.attempt(Wt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function yS(e,t,n){const r=this;return Le(e,i,"listItemIndent",r.containerState.size+1);function i(l){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(l):n(l)}}function xS(e){e.exit(this.containerState.type)}function vS(e,t,n){const r=this;return Le(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const a=r.events[r.events.length-1];return!_e(l)&&a&&a[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const ih={name:"setextUnderline",resolveTo:kS,tokenize:wS};function kS(e,t){let n=e.length,r,i,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",a,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function wS(e,t,n){const r=this;let i;return l;function l(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),_e(u)?Le(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||de(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const bS={tokenize:jS};function jS(e){const t=this,n=e.attempt(_l,r,e.attempt(this.parser.constructs.flowInitial,i,Le(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Ej,i)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const SS={resolveAll:dx()},NS=ux("string"),CS=ux("text");function ux(e){return{resolveAll:dx(e==="text"?_S:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],l=n.attempt(i,a,o);return a;function a(d){return u(d)?l(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),l(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h<f.length;){const m=f[h];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function dx(e){return t;function t(n,r){let i=-1,l;for(;++i<=n.length;)l===void 0?n[i]&&n[i][1].type==="data"&&(l=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==l+2&&(n[l][1].end=n[i-1][1].end,n.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(n,r):n}}function _S(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],i=t.sliceStream(r);let l=i.length,a=-1,o=0,c;for(;l--;){const u=i[l];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(u===-2)c=!0,o++;else if(u!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const u={type:n===e.length||c||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?a:r.start._bufferIndex+a,_index:r.start._index+l,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const ES={42:Wt,43:Wt,45:Wt,48:Wt,49:Wt,50:Wt,51:Wt,52:Wt,53:Wt,54:Wt,55:Wt,56:Wt,57:Wt,62:rx},TS={91:Dj},zS={[-2]:ac,[-1]:ac,32:ac},LS={35:Fj,42:ka,45:[ih,ka],60:Hj,61:ih,95:ka,96:nh,126:nh},AS={38:sx,92:ix},DS={[-5]:oc,[-4]:oc,[-3]:oc,33:aS,38:sx,42:ju,60:[cj,Yj],91:cS,92:[Rj,ix],93:Od,95:ju,96:bj},IS={null:[ju,SS]},PS={null:[42,95]},MS={null:[]},RS=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:PS,contentInitial:TS,disable:MS,document:ES,flow:LS,flowInitial:zS,insideSpan:IS,string:AS,text:DS},Symbol.toStringTag,{value:"Module"}));function $S(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 i={},l=[];let a=[],o=[];const c={attempt:A(D),check:A(_),consume:w,enter:j,exit:z,interrupt:A(_,{interrupt:!0})},u={code:null,containerState:{},defineSkip:k,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:m,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&l.push(t),u;function f(U){return a=mn(a,U),v(),a[a.length-1]!==null?[]:(C(t,0),u.events=Co(l,u.events,u),u.events)}function h(U,O){return OS(m(U),O)}function m(U){return FS(a,U)}function g(){const{_bufferIndex:U,_index:O,line:re,column:oe,offset:te}=r;return{_bufferIndex:U,_index:O,line:re,column:oe,offset:te}}function k(U){i[U.line]=U.column,N()}function v(){let U;for(;r._index<a.length;){const O=a[r._index];if(typeof O=="string")for(U=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===U&&r._bufferIndex<O.length;)x(O.charCodeAt(r._bufferIndex));else x(O)}}function x(U){d=d(U)}function w(U){de(U)?(r.line++,r.column=1,r.offset+=U===-3?2:1,N()):U!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=U}function j(U,O){const re=O||{};return re.type=U,re.start=g(),u.events.push(["enter",re,u]),o.push(re),re}function z(U){const O=o.pop();return O.end=g(),u.events.push(["exit",O,u]),O}function D(U,O){C(U,O.from)}function _(U,O){O.restore()}function A(U,O){return re;function re(oe,te,le){let fe,T,I,b;return Array.isArray(oe)?H(oe):"tokenize"in oe?H([oe]):X(oe);function X(ae){return be;function be(Ge){const qe=Ge!==null&&ae[Ge],Xe=Ge!==null&&ae.null,P=[...Array.isArray(qe)?qe:qe?[qe]:[],...Array.isArray(Xe)?Xe:Xe?[Xe]:[]];return H(P)(Ge)}}function H(ae){return fe=ae,T=0,ae.length===0?le:S(ae[T])}function S(ae){return be;function be(Ge){return b=R(),I=ae,ae.partial||(u.currentConstruct=ae),ae.name&&u.parser.constructs.disable.null.includes(ae.name)?ye():ae.tokenize.call(O?Object.assign(Object.create(u),O):u,c,ie,ye)(Ge)}}function ie(ae){return U(I,b),te}function ye(ae){return b.restore(),++T<fe.length?S(fe[T]):le}}}function C(U,O){U.resolveAll&&!l.includes(U)&&l.push(U),U.resolve&&ln(u.events,O,u.events.length-O,U.resolve(u.events.slice(O),u)),U.resolveTo&&(u.events=U.resolveTo(u.events,u))}function R(){const U=g(),O=u.previous,re=u.currentConstruct,oe=u.events.length,te=Array.from(o);return{from:oe,restore:le};function le(){r=U,u.previous=O,u.currentConstruct=re,u.events.length=oe,o=te,N()}}function N(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function FS(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,l=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,l)];else{if(a=e.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}l>0&&a.push(e[i].slice(0,l))}return a}function OS(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const l=e[n];let a;if(typeof l=="string")a=l;else switch(l){case-5:{a="\r";break}case-4:{a=`
505
+ `;break}case-3:{a=`\r
506
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(l)}i=l===-2,r.push(a)}return r.join("")}function US(e){const r={constructs:tx([RS,...(e||{}).extensions||[]]),content:i(nj),defined:[],document:i(ij),flow:i(bS),lazy:{},string:i(NS),text:i(CS)};return r;function i(l){return a;function a(o){return $S(r,l,o)}}}function BS(e){for(;!lx(e););return e}const sh=/[\0\t\n\r]/g;function HS(){let e=1,t="",n=!0,r;return i;function i(l,a,o){const c=[];let u,d,f,h,m;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(a||void 0).decode(l)),f=0,t="",n&&(l.charCodeAt(0)===65279&&f++,n=void 0);f<l.length;){if(sh.lastIndex=f,u=sh.exec(l),h=u&&u.index!==void 0?u.index:l.length,m=l.charCodeAt(h),!u){t=l.slice(f);break}if(m===10&&f===h&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<h&&(c.push(l.slice(f,h)),e+=h-f),m){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return o&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const VS=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function WS(e){return e.replace(VS,GS)}function GS(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return nx(n.slice(l?2:1),l?16:10)}return Fd(n)||e}const fx={}.hasOwnProperty;function qS(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),QS(n)(BS(US(n).document().write(HS()(e,t,!0))))}function QS(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Ce),autolinkProtocol:R,autolinkEmail:R,atxHeading:l(pe),blockQuote:l(Xe),characterEscape:R,characterReference:R,codeFenced:l(P),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:l(P,a),codeText:l(M,a),codeTextData:R,data:R,codeFlowValue:R,definition:l(B),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:l(he),hardBreakEscape:l(ce),hardBreakTrailing:l(ce),htmlFlow:l(ke,a),htmlFlowData:R,htmlText:l(ke,a),htmlTextData:R,image:l(q),label:a,link:l(Ce),listItem:l(Qe),listItemValue:h,listOrdered:l(Me,f),listUnordered:l(Me),paragraph:l(je),reference:S,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:l(pe),strong:l(Fe),thematicBreak:l(Mn)},exit:{atxHeading:c(),atxHeadingSequence:D,autolink:c(),autolinkEmail:qe,autolinkProtocol:Ge,blockQuote:c(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:ye,characterReferenceMarkerNumeric:ye,characterReferenceValue:ae,characterReference:be,codeFenced:c(v),codeFencedFence:k,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:c(x),codeText:c(te),codeTextData:N,data:N,definition:c(),definitionDestinationString:z,definitionLabelString:w,definitionTitleString:j,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(re),htmlFlowData:N,htmlText:c(oe),htmlTextData:N,image:c(fe),label:I,labelText:T,lineEnding:U,link:c(le),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:b,resourceTitleString:X,resource:H,setextHeading:c(C),setextHeadingLineSequence:A,setextHeadingText:_,strong:c(),thematicBreak:c()}};mx(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(F){let K={type:"root",children:[]};const ue={stack:[K],tokenStack:[],config:t,enter:o,exit:u,buffer:a,resume:d,data:n},ve=[];let Ne=-1;for(;++Ne<F.length;)if(F[Ne][1].type==="listOrdered"||F[Ne][1].type==="listUnordered")if(F[Ne][0]==="enter")ve.push(Ne);else{const wt=ve.pop();Ne=i(F,wt,Ne)}for(Ne=-1;++Ne<F.length;){const wt=t[F[Ne][0]];fx.call(wt,F[Ne][1].type)&&wt[F[Ne][1].type].call(Object.assign({sliceSerialize:F[Ne][2].sliceSerialize},ue),F[Ne][1])}if(ue.tokenStack.length>0){const wt=ue.tokenStack[ue.tokenStack.length-1];(wt[1]||lh).call(ue,void 0,wt[0])}for(K.position={start:Sr(F.length>0?F[0][1].start:{line:1,column:1,offset:0}),end:Sr(F.length>0?F[F.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)K=t.transforms[Ne](K)||K;return K}function i(F,K,ue){let ve=K-1,Ne=-1,wt=!1,pt,Ke,Pt,Jt;for(;++ve<=ue;){const it=F[ve];switch(it[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{it[0]==="enter"?Ne++:Ne--,Jt=void 0;break}case"lineEndingBlank":{it[0]==="enter"&&(pt&&!Jt&&!Ne&&!Pt&&(Pt=ve),Jt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Jt=void 0}if(!Ne&&it[0]==="enter"&&it[1].type==="listItemPrefix"||Ne===-1&&it[0]==="exit"&&(it[1].type==="listUnordered"||it[1].type==="listOrdered")){if(pt){let Mt=ve;for(Ke=void 0;Mt--;){const bt=F[Mt];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;Ke&&(F[Ke][1].type="lineEndingBlank",wt=!0),bt[1].type="lineEnding",Ke=Mt}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}Pt&&(!Ke||Pt<Ke)&&(pt._spread=!0),pt.end=Object.assign({},Ke?F[Ke][1].start:it[1].end),F.splice(Ke||ve,0,["exit",pt,it[2]]),ve++,ue++}if(it[1].type==="listItemPrefix"){const Mt={type:"listItem",_spread:!1,start:Object.assign({},it[1].start),end:void 0};pt=Mt,F.splice(ve,0,["enter",Mt,it[2]]),ve++,ue++,Pt=void 0,Jt=!0}}}return F[K][1]._spread=wt,ue}function l(F,K){return ue;function ue(ve){o.call(this,F(ve),ve),K&&K.call(this,ve)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(F,K,ue){this.stack[this.stack.length-1].children.push(F),this.stack.push(F),this.tokenStack.push([K,ue||void 0]),F.position={start:Sr(K.start),end:void 0}}function c(F){return K;function K(ue){F&&F.call(this,ue),u.call(this,ue)}}function u(F,K){const ue=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==F.type&&(K?K.call(this,F,ve[0]):(ve[1]||lh).call(this,F,ve[0]));else throw new Error("Cannot close `"+F.type+"` ("+Qs({start:F.start,end:F.end})+"): it’s not open");ue.position.end=Sr(F.end)}function d(){return $d(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(F){if(this.data.expectingFirstListItemValue){const K=this.stack[this.stack.length-2];K.start=Number.parseInt(this.sliceSerialize(F),10),this.data.expectingFirstListItemValue=void 0}}function m(){const F=this.resume(),K=this.stack[this.stack.length-1];K.lang=F}function g(){const F=this.resume(),K=this.stack[this.stack.length-1];K.meta=F}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const F=this.resume(),K=this.stack[this.stack.length-1];K.value=F.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const F=this.resume(),K=this.stack[this.stack.length-1];K.value=F.replace(/(\r?\n|\r)$/g,"")}function w(F){const K=this.resume(),ue=this.stack[this.stack.length-1];ue.label=K,ue.identifier=In(this.sliceSerialize(F)).toLowerCase()}function j(){const F=this.resume(),K=this.stack[this.stack.length-1];K.title=F}function z(){const F=this.resume(),K=this.stack[this.stack.length-1];K.url=F}function D(F){const K=this.stack[this.stack.length-1];if(!K.depth){const ue=this.sliceSerialize(F).length;K.depth=ue}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function A(F){const K=this.stack[this.stack.length-1];K.depth=this.sliceSerialize(F).codePointAt(0)===61?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function R(F){const ue=this.stack[this.stack.length-1].children;let ve=ue[ue.length-1];(!ve||ve.type!=="text")&&(ve=Ht(),ve.position={start:Sr(F.start),end:void 0},ue.push(ve)),this.stack.push(ve)}function N(F){const K=this.stack.pop();K.value+=this.sliceSerialize(F),K.position.end=Sr(F.end)}function U(F){const K=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ue=K.children[K.children.length-1];ue.position.end=Sr(F.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(K.type)&&(R.call(this,F),N.call(this,F))}function O(){this.data.atHardBreak=!0}function re(){const F=this.resume(),K=this.stack[this.stack.length-1];K.value=F}function oe(){const F=this.resume(),K=this.stack[this.stack.length-1];K.value=F}function te(){const F=this.resume(),K=this.stack[this.stack.length-1];K.value=F}function le(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=K,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function fe(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=K,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function T(F){const K=this.sliceSerialize(F),ue=this.stack[this.stack.length-2];ue.label=WS(K),ue.identifier=In(K).toLowerCase()}function I(){const F=this.stack[this.stack.length-1],K=this.resume(),ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,ue.type==="link"){const ve=F.children;ue.children=ve}else ue.alt=K}function b(){const F=this.resume(),K=this.stack[this.stack.length-1];K.url=F}function X(){const F=this.resume(),K=this.stack[this.stack.length-1];K.title=F}function H(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function ie(F){const K=this.resume(),ue=this.stack[this.stack.length-1];ue.label=K,ue.identifier=In(this.sliceSerialize(F)).toLowerCase(),this.data.referenceType="full"}function ye(F){this.data.characterReferenceType=F.type}function ae(F){const K=this.sliceSerialize(F),ue=this.data.characterReferenceType;let ve;ue?(ve=nx(K,ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=Fd(K);const Ne=this.stack[this.stack.length-1];Ne.value+=ve}function be(F){const K=this.stack.pop();K.position.end=Sr(F.end)}function Ge(F){N.call(this,F);const K=this.stack[this.stack.length-1];K.url=this.sliceSerialize(F)}function qe(F){N.call(this,F);const K=this.stack[this.stack.length-1];K.url="mailto:"+this.sliceSerialize(F)}function Xe(){return{type:"blockquote",children:[]}}function P(){return{type:"code",lang:null,meta:null,value:""}}function M(){return{type:"inlineCode",value:""}}function B(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function he(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function ce(){return{type:"break"}}function ke(){return{type:"html",value:""}}function q(){return{type:"image",title:null,url:"",alt:null}}function Ce(){return{type:"link",title:null,url:"",children:[]}}function Me(F){return{type:"list",ordered:F.type==="listOrdered",start:null,spread:F._spread,children:[]}}function Qe(F){return{type:"listItem",spread:F._spread,checked:null,children:[]}}function je(){return{type:"paragraph",children:[]}}function Fe(){return{type:"strong",children:[]}}function Ht(){return{type:"text",value:""}}function Mn(){return{type:"thematicBreak"}}}function Sr(e){return{line:e.line,column:e.column,offset:e.offset}}function mx(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?mx(e,r):KS(e,r)}}function KS(e,t){let n;for(n in t)if(fx.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 lh(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qs({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qs({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qs({start:t.start,end:t.end})+") is still open")}function YS(e){const t=this;t.parser=n;function n(r){return qS(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function XS(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 JS(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
507
+ `}]}function ZS(e,t){const n=t.value?t.value+`
508
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function eN(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tN(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nN(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=fs(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=l+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function rN(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 iN(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function hx(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 i=e.all(t),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function sN(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return hx(e,t);const i={src:fs(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,l),e.applyData(t,l)}function lN(e,t){const n={src:fs(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 aN(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 oN(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return hx(e,t);const i={href:fs(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function cN(e,t){const n={href:fs(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 uN(e,t,n){const r=e.all(t),i=n?dN(n):px(t),l={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const d=r[o];(i||o!==0||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
509
+ `}),d.type==="element"&&d.tagName==="p"&&!i?a.push(...d.children):a.push(d)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
510
+ `});const u={type:"element",tagName:"li",properties:l,children:a};return e.patch(t,u),e.applyData(t,u)}function dN(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=px(n[r])}return t}function px(e){const t=e.spread;return t??e.children.length>1}function fN(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,l),e.applyData(t,l)}function mN(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hN(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function pN(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gN(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Id(t.children[1]),c=Qy(t.children[t.children.length-1]);o&&c&&(a.position={start:o,end:c}),i.push(a)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,l),e.applyData(t,l)}function yN(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let c=-1;const u=[];for(;++c<o;){const f=t.children[c],h={},m=a?a[c]:void 0;m&&(h.align=m);let g={type:"element",tagName:l,properties:h,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function xN(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ah=9,oh=32;function vN(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const l=[];for(;r;)l.push(ch(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return l.push(ch(t.slice(i),i>0,!1)),l.join("")}function ch(e,t,n){let r=0,i=e.length;if(t){let l=e.codePointAt(r);for(;l===ah||l===oh;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(i-1);for(;l===ah||l===oh;)i--,l=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function kN(e,t){const n={type:"text",value:vN(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function wN(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const bN={blockquote:XS,break:JS,code:ZS,delete:eN,emphasis:tN,footnoteReference:nN,heading:rN,html:iN,imageReference:sN,image:lN,inlineCode:aN,linkReference:oN,link:cN,listItem:uN,list:fN,paragraph:mN,root:hN,strong:pN,table:gN,tableCell:xN,tableRow:yN,text:kN,thematicBreak:wN,toml:Zl,yaml:Zl,definition:Zl,footnoteDefinition:Zl};function Zl(){}const gx=-1,_o=0,Ys=1,Za=2,Ud=3,Bd=4,Hd=5,Vd=6,yx=7,xx=8,uh=typeof self=="object"?self:globalThis,jN=(e,t)=>{const n=(i,l)=>(e.set(l,i),i),r=i=>{if(e.has(i))return e.get(i);const[l,a]=t[i];switch(l){case _o:case gx:return n(a,i);case Ys:{const o=n([],i);for(const c of a)o.push(r(c));return o}case Za:{const o=n({},i);for(const[c,u]of a)o[r(c)]=r(u);return o}case Ud:return n(new Date(a),i);case Bd:{const{source:o,flags:c}=a;return n(new RegExp(o,c),i)}case Hd:{const o=n(new Map,i);for(const[c,u]of a)o.set(r(c),r(u));return o}case Vd:{const o=n(new Set,i);for(const c of a)o.add(r(c));return o}case yx:{const{name:o,message:c}=a;return n(new uh[o](c),i)}case xx:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new uh[l](a),i)};return r},dh=e=>jN(new Map,e)(0),ki="",{toString:SN}={},{keys:NN}=Object,As=e=>{const t=typeof e;if(t!=="object"||!e)return[_o,t];const n=SN.call(e).slice(8,-1);switch(n){case"Array":return[Ys,ki];case"Object":return[Za,ki];case"Date":return[Ud,ki];case"RegExp":return[Bd,ki];case"Map":return[Hd,ki];case"Set":return[Vd,ki];case"DataView":return[Ys,n]}return n.includes("Array")?[Ys,n]:n.includes("Error")?[yx,n]:[Za,n]},ea=([e,t])=>e===_o&&(t==="function"||t==="symbol"),CN=(e,t,n,r)=>{const i=(a,o)=>{const c=r.push(a)-1;return n.set(o,c),c},l=a=>{if(n.has(a))return n.get(a);let[o,c]=As(a);switch(o){case _o:{let d=a;switch(c){case"bigint":o=xx,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([gx],a)}return i([o,d],a)}case Ys:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),i([c,[...h]],a)}const d=[],f=i([o,d],a);for(const h of a)d.push(l(h));return f}case Za:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(t&&"toJSON"in a)return l(a.toJSON());const d=[],f=i([o,d],a);for(const h of NN(a))(e||!ea(As(a[h])))&&d.push([l(h),l(a[h])]);return f}case Ud:return i([o,a.toISOString()],a);case Bd:{const{source:d,flags:f}=a;return i([o,{source:d,flags:f}],a)}case Hd:{const d=[],f=i([o,d],a);for(const[h,m]of a)(e||!(ea(As(h))||ea(As(m))))&&d.push([l(h),l(m)]);return f}case Vd:{const d=[],f=i([o,d],a);for(const h of a)(e||!ea(As(h)))&&d.push(l(h));return f}}const{message:u}=a;return i([o,{name:c,message:u}],a)};return l},fh=(e,{json:t,lossy:n}={})=>{const r=[];return CN(!(t||n),!!t,new Map,r)(e),r},eo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?dh(fh(e,t)):structuredClone(e):(e,t)=>dh(fh(e,t));function _N(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function EN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function TN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||_N,r=e.options.footnoteBackLabel||EN,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),h=fs(f.toLowerCase());let m=0;const g=[],k=e.footnoteCounts.get(f);for(;k!==void 0&&++m<=k;){g.length>0&&g.push({type:"text",value:" "});let w=typeof n=="string"?n:n(c,m);typeof w=="string"&&(w={type:"text",value:w}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,m),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const w=v.children[v.children.length-1];w&&w.type==="text"?w.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else d.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,x),o.push(x)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...eo(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
511
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
512
+ `}]}}const Eo=function(e){if(e==null)return DN;if(typeof e=="function")return To(e);if(typeof e=="object")return Array.isArray(e)?zN(e):LN(e);if(typeof e=="string")return AN(e);throw new Error("Expected function, string, or object as test")};function zN(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Eo(e[n]);return To(r);function r(...i){let l=-1;for(;++l<t.length;)if(t[l].apply(this,i))return!0;return!1}}function LN(e){const t=e;return To(n);function n(r){const i=r;let l;for(l in e)if(i[l]!==t[l])return!1;return!0}}function AN(e){return To(t);function t(n){return n&&n.type===e}}function To(e){return t;function t(n,r,i){return!!(IN(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function DN(){return!0}function IN(e){return e!==null&&typeof e=="object"&&"type"in e}const vx=[],PN=!0,Su=!1,MN="skip";function kx(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const l=Eo(i),a=r?-1:1;o(e,void 0,[])();function o(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const m=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(m?"<"+m+">":""))+")"})}return h;function h(){let m=vx,g,k,v;if((!t||l(c,u,d[d.length-1]||void 0))&&(m=RN(n(c,d)),m[0]===Su))return m;if("children"in c&&c.children){const x=c;if(x.children&&m[0]!==MN)for(k=(r?x.children.length:-1)+a,v=d.concat(x);k>-1&&k<x.children.length;){const w=x.children[k];if(g=o(w,k,v)(),g[0]===Su)return g;k=typeof g[1]=="number"?g[1]:k+a}}return m}}}function RN(e){return Array.isArray(e)?e:typeof e=="number"?[PN,e]:e==null?vx:[e]}function Wd(e,t,n,r){let i,l,a;typeof t=="function"&&typeof n!="function"?(l=void 0,a=t,i=n):(l=t,a=n,i=r),kx(e,l,o,i);function o(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return a(c,f,d)}}const Nu={}.hasOwnProperty,$N={};function FN(e,t){const n=t||$N,r=new Map,i=new Map,l=new Map,a={...bN,...n.handlers},o={all:u,applyData:UN,definitionById:r,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:a,one:c,options:n,patch:ON,wrap:HN};return Wd(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:i,h=String(d.identifier).toUpperCase();f.has(h)||f.set(h,d)}}),o;function c(d,f){const h=d.type,m=o.handlers[h];if(Nu.call(o.handlers,h)&&m)return m(o,d,f);if(o.options.passThrough&&o.options.passThrough.includes(h)){if("children"in d){const{children:k,...v}=d,x=eo(v);return x.children=o.all(d),x}return eo(d)}return(o.options.unknownHandler||BN)(o,d,f)}function u(d){const f=[];if("children"in d){const h=d.children;let m=-1;for(;++m<h.length;){const g=o.one(h[m],d);if(g){if(m&&h[m-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=mh(g.value)),!Array.isArray(g)&&g.type==="element")){const k=g.children[0];k&&k.type==="text"&&(k.value=mh(k.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function ON(e,t){e.position&&(t.position=Eb(e))}function UN(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,l=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&l&&Object.assign(n.properties,eo(l)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function BN(e,t){const n=t.data||{},r="value"in t&&!(Nu.call(n,"hProperties")||Nu.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function HN(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
513
+ `});++r<e.length;)r&&n.push({type:"text",value:`
514
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
515
+ `}),n}function mh(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function hh(e,t){const n=FN(e,t),r=n.one(e,void 0),i=TN(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
516
+ `},i),l}function VN(e,t){return e&&"run"in e?async function(n,r){const i=hh(n,{file:r,...t});await e.run(i,r)}:function(n,r){return hh(n,{file:r,...e||t})}}function ph(e){if(e)throw e}var wa=Object.prototype.hasOwnProperty,wx=Object.prototype.toString,gh=Object.defineProperty,yh=Object.getOwnPropertyDescriptor,xh=function(t){return typeof Array.isArray=="function"?Array.isArray(t):wx.call(t)==="[object Array]"},vh=function(t){if(!t||wx.call(t)!=="[object Object]")return!1;var n=wa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&wa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||wa.call(t,i)},kh=function(t,n){gh&&n.name==="__proto__"?gh(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},wh=function(t,n){if(n==="__proto__")if(wa.call(t,n)){if(yh)return yh(t,n).value}else return;return t[n]},WN=function e(){var t,n,r,i,l,a,o=arguments[0],c=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},c=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=wh(o,n),i=wh(t,n),o!==i&&(d&&i&&(vh(i)||(l=xh(i)))?(l?(l=!1,a=r&&xh(r)?r:[]):a=r&&vh(r)?r:{},kh(o,{name:n,newValue:e(d,a,i)})):typeof i<"u"&&kh(o,{name:n,newValue:i}));return o};const cc=io(WN);function Cu(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 GN(){const e=[],t={run:n,use:r};return t;function n(...i){let l=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(c,...u){const d=e[++l];let f=-1;if(c){a(c);return}for(;++f<i.length;)(u[f]===null||u[f]===void 0)&&(u[f]=i[f]);i=u,d?qN(d,o)(...u):a(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function qN(e,t){let n;return r;function r(...a){const o=e.length>a.length;let c;o&&a.push(i);try{c=e.apply(this,a)}catch(u){const d=u;if(o&&n)throw d;return i(d)}o||(c&&c.then&&typeof c.then=="function"?c.then(l,i):c instanceof Error?i(c):l(c))}function i(a,...o){n||(n=!0,t(a,...o))}function l(a){i(null,a)}}const On={basename:QN,dirname:KN,extname:YN,join:XN,sep:"/"};function QN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');El(e);let n=0,r=-1,i=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else a<0&&(l=!0,a=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function KN(e){if(El(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 YN(e){El(e);let t=e.length,n=-1,r=0,i=-1,l=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?i<0?i=t:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||n<0||l===0||l===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function XN(...e){let t=-1,n;for(;++t<e.length;)El(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":JN(n)}function JN(e){El(e);const t=e.codePointAt(0)===47;let n=ZN(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function ZN(e,t){let n="",r=0,i=-1,l=0,a=-1,o,c;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||l===1))if(i!==a-1&&l===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=a,l=0;continue}}else if(n.length>0){n="",r=0,i=a,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,l=0}else o===46&&l>-1?l++:l=-1}return n}function El(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const e2={cwd:t2};function t2(){return"/"}function _u(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function n2(e){if(typeof e=="string")e=new URL(e);else if(!_u(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 r2(e)}function r2(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const uc=["history","path","basename","stem","extname","dirname"];class bx{constructor(t){let n;t?_u(t)?n={path:t}:typeof t=="string"||i2(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":e2.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<uc.length;){const l=uc[r];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let i;for(i in n)uc.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?On.basename(this.path):void 0}set basename(t){fc(t,"basename"),dc(t,"basename"),this.path=On.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?On.dirname(this.path):void 0}set dirname(t){bh(this.basename,"dirname"),this.path=On.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?On.extname(this.path):void 0}set extname(t){if(dc(t,"extname"),bh(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=On.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){_u(t)&&(t=n2(t)),fc(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?On.basename(this.path,this.extname):void 0}set stem(t){fc(t,"stem"),dc(t,"stem"),this.path=On.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new It(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function dc(e,t){if(e&&e.includes(On.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+On.sep+"`")}function fc(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function bh(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function i2(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s2=function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l},l2={}.hasOwnProperty;class Gd extends s2{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=GN()}copy(){const t=new Gd;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(cc(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(pc("data",this.frozen),this.namespace[t]=n,this):l2.call(this.namespace,t)&&this.namespace[t]||void 0:t?(pc("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 i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ta(t),r=this.parser||this.Parser;return mc("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),mc("process",this.parser||this.Parser),hc("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(l,a){const o=ta(t),c=r.parse(o);r.run(c,o,function(d,f,h){if(d||!f||!h)return u(d);const m=f,g=r.stringify(m,h);c2(g)?h.value=g:h.result=g,u(d,h)});function u(d,f){d||!f?a(d):l?l(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),mc("processSync",this.parser||this.Parser),hc("processSync",this.compiler||this.Compiler),this.process(t,i),Sh("processSync","process",n),r;function i(l,a){n=!0,ph(l),r=a}}run(t,n,r){jh(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):new Promise(l);function l(a,o){const c=ta(n);i.run(t,c,u);function u(d,f,h){const m=f||t;d?o(d):a?a(m):r(void 0,m,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,l),Sh("runSync","run",r),i;function l(a,o){ph(a),i=o,r=!0}}stringify(t,n){this.freeze();const r=ta(n),i=this.compiler||this.Compiler;return hc("stringify",i),jh(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(pc("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))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");o(u.plugins),u.settings&&(i.settings=cc(!0,i.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];l(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[m,...g]=d;const k=r[h][1];Cu(k)&&Cu(m)&&(m=cc(!0,k,m)),r[h]=[u,m,...g]}}}}const a2=new Gd().freeze();function mc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function hc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function pc(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 jh(e){if(!Cu(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Sh(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ta(e){return o2(e)?e:new bx(e)}function o2(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function c2(e){return typeof e=="string"||u2(e)}function u2(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const d2="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Nh=[],Ch={allowDangerousHtml:!0},f2=/^(https?|ircs?|mailto|xmpp)$/i,m2=[{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:"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 h2(e){const t=p2(e),n=g2(e);return y2(t.runSync(t.parse(n),n),e)}function p2(e){const t=e.rehypePlugins||Nh,n=e.remarkPlugins||Nh,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ch}:Ch;return a2().use(YS).use(n).use(VN,r).use(t)}function g2(e){const t=e.children||"",n=new bx;return typeof t=="string"&&(n.value=t),n}function y2(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,l=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||x2;for(const d of m2)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+d2+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Wd(e,u),Db(e,{Fragment:s.Fragment,components:i,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let m;for(m in lc)if(Object.hasOwn(lc,m)&&Object.hasOwn(d.properties,m)){const g=d.properties[m],k=lc[m];(k===null||k.includes(d.tagName))&&(d.properties[m]=c(String(g||""),m,d))}}if(d.type==="element"){let m=n?!n.includes(d.tagName):l?l.includes(d.tagName):!1;if(!m&&r&&typeof f=="number"&&(m=!r(d,f,h)),m&&h&&typeof f=="number")return o&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function x2(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||f2.test(e.slice(0,t))?e:""}const v2=["script","iframe","object","embed","style"];function k2(e){if(!e)return"";if(e.startsWith("#")||e.startsWith("/"))return e;const t=e.indexOf(":");if(t===-1)return e;const n=e.slice(0,t).toLowerCase();return n==="https"||n==="http"||n==="mailto"?e:""}function _h(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function w2(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function b2(e,t,n){const i=Eo((n||{}).ignore||[]),l=j2(t);let a=-1;for(;++a<l.length;)kx(e,"text",o);function o(u,d){let f=-1,h;for(;++f<d.length;){const m=d[f],g=h?h.children:void 0;if(i(m,g?g.indexOf(m):void 0,h))return;h=m}if(h)return c(u,d)}function c(u,d){const f=d[d.length-1],h=l[a][0],m=l[a][1];let g=0;const v=f.children.indexOf(u);let x=!1,w=[];h.lastIndex=0;let j=h.exec(u.value);for(;j;){const z=j.index,D={index:j.index,input:j.input,stack:[...d,u]};let _=m(...j,D);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?h.lastIndex=z+1:(g!==z&&w.push({type:"text",value:u.value.slice(g,z)}),Array.isArray(_)?w.push(..._):_&&w.push(_),g=z+j[0].length,x=!0),!h.global)break;j=h.exec(u.value)}return x?(g<u.value.length&&w.push({type:"text",value:u.value.slice(g)}),f.children.splice(v,1,...w)):w=[u],v+w.length}}function j2(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 i=n[r];t.push([S2(i[0]),N2(i[1])])}return t}function S2(e){return typeof e=="string"?new RegExp(w2(e),"g"):e}function N2(e){return typeof e=="function"?e:function(){return e}}const gc="phrasing",yc=["autolink","link","image","label"];function C2(){return{transforms:[D2],enter:{literalAutolink:E2,literalAutolinkEmail:xc,literalAutolinkHttp:xc,literalAutolinkWww:xc},exit:{literalAutolink:A2,literalAutolinkEmail:L2,literalAutolinkHttp:T2,literalAutolinkWww:z2}}}function _2(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:gc,notInConstruct:yc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:gc,notInConstruct:yc},{character:":",before:"[ps]",after:"\\/",inConstruct:gc,notInConstruct:yc}]}}function E2(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function xc(e){this.config.enter.autolinkProtocol.call(this,e)}function T2(e){this.config.exit.autolinkProtocol.call(this,e)}function z2(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 L2(e){this.config.exit.autolinkEmail.call(this,e)}function A2(e){this.exit(e)}function D2(e){b2(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,I2],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),P2]],{ignore:["link","linkReference"]})}function I2(e,t,n,r,i){let l="";if(!jx(i)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!M2(n)))return!1;const a=R2(n+r);if(!a[0])return!1;const o={type:"link",title:null,url:l+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function P2(e,t,n,r){return!jx(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function M2(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 R2(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 i=_h(e,"(");let l=_h(e,")");for(;r!==-1&&i>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function jx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||fi(n)||No(n))&&(!t||n!==47)}Sx.peek=G2;function $2(){this.buffer()}function F2(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function O2(){this.buffer()}function U2(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function B2(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=In(this.sliceSerialize(e)).toLowerCase(),n.label=t}function H2(e){this.exit(e)}function V2(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=In(this.sliceSerialize(e)).toLowerCase(),n.label=t}function W2(e){this.exit(e)}function G2(){return"["}function Sx(e,t,n,r){const i=n.createTracker(r);let l=i.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return l+=i.move(n.safe(n.associationId(e),{after:"]",before:l})),o(),a(),l+=i.move("]"),l}function q2(){return{enter:{gfmFootnoteCallString:$2,gfmFootnoteCall:F2,gfmFootnoteDefinitionLabelString:O2,gfmFootnoteDefinition:U2},exit:{gfmFootnoteCallString:B2,gfmFootnoteCall:H2,gfmFootnoteDefinitionLabelString:V2,gfmFootnoteDefinition:W2}}}function Q2(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Sx},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,l,a){const o=l.createTracker(a);let c=o.move("[^");const u=l.enter("footnoteDefinition"),d=l.enter("label");return c+=o.move(l.safe(l.associationId(r),{before:c,after:"]"})),d(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?`
517
+ `:" ")+l.indentLines(l.containerFlow(r,o.current()),t?Nx:K2))),u(),c}}function K2(e,t,n){return t===0?e:Nx(e,t,n)}function Nx(e,t,n){return(n?"":" ")+e}const Y2=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Cx.peek=tC;function X2(){return{canContainEols:["delete"],enter:{strikethrough:Z2},exit:{strikethrough:eC}}}function J2(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Y2}],handlers:{delete:Cx}}}function Z2(e){this.enter({type:"delete",children:[]},e)}function eC(e){this.exit(e)}function Cx(e,t,n,r){const i=n.createTracker(r),l=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),l(),a}function tC(){return"~"}function nC(e){return e.length}function rC(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||nC,l=[],a=[],o=[],c=[];let u=0,d=-1;for(;++d<e.length;){const k=[],v=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const w=iC(e[d][x]);if(n.alignDelimiters!==!1){const j=i(w);v[x]=j,(c[x]===void 0||j>c[x])&&(c[x]=j)}k.push(w)}a[d]=k,o[d]=v}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)l[f]=Eh(r[f]);else{const k=Eh(r);for(;++f<u;)l[f]=k}f=-1;const h=[],m=[];for(;++f<u;){const k=l[f];let v="",x="";k===99?(v=":",x=":"):k===108?v=":":k===114&&(x=":");let w=n.alignDelimiters===!1?1:Math.max(1,c[f]-v.length-x.length);const j=v+"-".repeat(w)+x;n.alignDelimiters!==!1&&(w=v.length+w+x.length,w>c[f]&&(c[f]=w),m[f]=w),h[f]=j}a.splice(1,0,h),o.splice(1,0,m),d=-1;const g=[];for(;++d<a.length;){const k=a[d],v=o[d];f=-1;const x=[];for(;++f<u;){const w=k[f]||"";let j="",z="";if(n.alignDelimiters!==!1){const D=c[f]-(v[f]||0),_=l[f];_===114?j=" ".repeat(D):_===99?D%2?(j=" ".repeat(D/2+.5),z=" ".repeat(D/2-.5)):(j=" ".repeat(D/2),z=j):z=" ".repeat(D)}n.delimiterStart!==!1&&!f&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||f)&&x.push(" "),n.alignDelimiters!==!1&&x.push(j),x.push(w),n.alignDelimiters!==!1&&x.push(z),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&x.push("|")}g.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return g.join(`
518
+ `)}function iC(e){return e==null?"":String(e)}function Eh(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 sC(e,t,n,r){const i=n.enter("blockquote"),l=n.createTracker(r);l.move("> "),l.shift(2);const a=n.indentLines(n.containerFlow(e,l.current()),lC);return i(),a}function lC(e,t,n){return">"+(n?"":" ")+e}function aC(e,t){return Th(e,t.inConstruct,!0)&&!Th(e,t.notInConstruct,!1)}function Th(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 zh(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
519
+ `&&aC(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
520
+ `}function oC(e,t){const n=String(e);let r=n.indexOf(t),i=r,l=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++l>a&&(a=l):l=1,i=r+t.length,r=n.indexOf(t,i);return a}function cC(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function uC(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function dC(e,t,n,r){const i=uC(n),l=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(cC(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(l,fC);return f(),h}const o=n.createTracker(r),c=i.repeat(Math.max(oC(l,i)+1,3)),u=n.enter("codeFenced");let d=o.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=o.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=o.move(" "),d+=o.move(n.safe(e.meta,{before:d,after:`
521
+ `,encode:["`"],...o.current()})),f()}return d+=o.move(`
522
+ `),l&&(d+=o.move(l+`
523
+ `)),d+=o.move(c),u(),d}function fC(e,t,n){return(n?"":" ")+e}function qd(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function mC(e,t,n,r){const i=qd(n),l=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
524
+ `,...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),o()),a(),u}function hC(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function vl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function to(e,t,n){const r=ls(e),i=ls(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_x.peek=pC;function _x(e,t,n,r){const i=hC(n),l=n.enter("emphasis"),a=n.createTracker(r),o=a.move(i);let c=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const u=c.charCodeAt(0),d=to(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=vl(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=to(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+vl(f));const m=a.move(i);return l(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+m}function pC(e,t,n){return n.options.emphasis||"*"}function gC(e,t){let n=!1;return Wd(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Su}),!!((!e.depth||e.depth<3)&&$d(e)&&(t.options.setext||n))}function yC(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(gC(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...l.current(),before:`
525
+ `,after:`
526
+ `});return f(),d(),h+`
527
+ `+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
528
+ `))+1))}const a="#".repeat(i),o=n.enter("headingAtx"),c=n.enter("phrasing");l.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
529
+ `,...l.current()});return/^[\t ]/.test(u)&&(u=vl(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),o(),u}Ex.peek=xC;function Ex(e){return e.value||""}function xC(){return"<"}Tx.peek=vC;function Tx(e,t,n,r){const i=qd(n),l=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),o()),u+=c.move(")"),a(),u}function vC(){return"!"}zx.peek=kC;function zx(e,t,n,r){const i=e.referenceType,l=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const u=n.safe(e.alt,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,l(),i==="full"||!u||u!==f?c+=o.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function kC(){return"!"}Lx.peek=wC;function Lx(e,t,n){let r=e.value||"",i="`",l=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l<n.unsafe.length;){const a=n.unsafe[l],o=n.compilePattern(a);let c;if(a.atBreak)for(;c=o.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return i+r+i}function wC(){return"`"}function Ax(e,t){const n=$d(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))}Dx.peek=bC;function Dx(e,t,n,r){const i=qd(n),l=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,c;if(Ax(e,n)){const d=n.stack;n.stack=[],o=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),o(),n.stack=d,f}o=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${l}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),c()),u+=a.move(")"),o(),u}function bC(e,t,n){return Ax(e,n)?"<":"["}Ix.peek=jC;function Ix(e,t,n,r){const i=e.referenceType,l=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,l(),i==="full"||!u||u!==f?c+=o.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function jC(){return"["}function Qd(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 SC(e){const t=Qd(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 NC(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 Px(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 CC(e,t,n,r){const i=n.enter("list"),l=n.bulletCurrent;let a=e.ordered?NC(n):Qd(n);const o=e.ordered?a==="."?")":".":SC(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.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&&(c=!0),Px(n)===a&&d){let f=-1;for(;++f<e.children.length;){const h=e.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=o),n.bulletCurrent=a;const u=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=l,i(),u}function _C(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 EC(e,t,n,r){const i=_C(n);let l=n.bulletCurrent||Qd(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let a=l.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(l+" ".repeat(a-l.length)),o.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),d);return c(),u;function d(f,h,m){return h?(m?"":" ".repeat(a))+f:(m?l:l+" ".repeat(a-l.length))+f}}function TC(e,t,n,r){const i=n.enter("paragraph"),l=n.enter("phrasing"),a=n.containerPhrasing(e,r);return l(),i(),a}const zC=Eo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function LC(e,t,n,r){return(e.children.some(function(a){return zC(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function AC(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Mx.peek=DC;function Mx(e,t,n,r){const i=AC(n),l=n.enter("strong"),a=n.createTracker(r),o=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const u=c.charCodeAt(0),d=to(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=vl(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=to(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+vl(f));const m=a.move(i+i);return l(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+m}function DC(e,t,n){return n.options.strong||"*"}function IC(e,t,n,r){return n.safe(e.value,r)}function PC(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 MC(e,t,n){const r=(Px(n)+(n.options.ruleSpaces?" ":"")).repeat(PC(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Rx={blockquote:sC,break:zh,code:dC,definition:mC,emphasis:_x,hardBreak:zh,heading:yC,html:Ex,image:Tx,imageReference:zx,inlineCode:Lx,link:Dx,linkReference:Ix,list:CC,listItem:EC,paragraph:TC,root:LC,strong:Mx,text:IC,thematicBreak:MC};function RC(){return{enter:{table:$C,tableData:Lh,tableHeader:Lh,tableRow:OC},exit:{codeText:UC,table:FC,tableData:vc,tableHeader:vc,tableRow:vc}}}function $C(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 FC(e){this.exit(e),this.data.inTable=void 0}function OC(e){this.enter({type:"tableRow",children:[]},e)}function vc(e){this.exit(e)}function Lh(e){this.enter({type:"tableCell",children:[]},e)}function UC(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,BC));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function BC(e,t){return t==="|"?t:e}function HC(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
530
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:a,tableCell:c,tableRow:o}};function a(m,g,k,v){return u(d(m,k,v),m.align)}function o(m,g,k,v){const x=f(m,k,v),w=u([x]);return w.slice(0,w.indexOf(`
531
+ `))}function c(m,g,k,v){const x=k.enter("tableCell"),w=k.enter("phrasing"),j=k.containerPhrasing(m,{...v,before:l,after:l});return w(),x(),j}function u(m,g){return rC(m,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(m,g,k){const v=m.children;let x=-1;const w=[],j=g.enter("table");for(;++x<v.length;)w[x]=f(v[x],g,k);return j(),w}function f(m,g,k){const v=m.children;let x=-1;const w=[],j=g.enter("tableRow");for(;++x<v.length;)w[x]=c(v[x],m,g,k);return j(),w}function h(m,g,k){let v=Rx.inlineCode(m,g,k);return k.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function VC(){return{exit:{taskListCheckValueChecked:Ah,taskListCheckValueUnchecked:Ah,paragraph:GC}}}function WC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:qC}}}function Ah(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function GC(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 i=t.children;let l=-1,a;for(;++l<i.length;){const o=i[l];if(o.type==="paragraph"){a=o;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 qC(e,t,n,r){const i=e.children[0],l=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);l&&o.move(a);let c=Rx.listItem(e,t,n,{...r,...o.current()});return l&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+a}}function QC(){return[C2(),q2(),X2(),RC(),VC()]}function KC(e){return{extensions:[_2(),Q2(e),J2(),HC(e),WC()]}}const YC={tokenize:n_,partial:!0},$x={tokenize:r_,partial:!0},Fx={tokenize:i_,partial:!0},Ox={tokenize:s_,partial:!0},XC={tokenize:l_,partial:!0},Ux={name:"wwwAutolink",tokenize:e_,previous:Hx},Bx={name:"protocolAutolink",tokenize:t_,previous:Vx},ar={name:"emailAutolink",tokenize:ZC,previous:Wx},Vn={};function JC(){return{text:Vn}}let qr=48;for(;qr<123;)Vn[qr]=ar,qr++,qr===58?qr=65:qr===91&&(qr=97);Vn[43]=ar;Vn[45]=ar;Vn[46]=ar;Vn[95]=ar;Vn[72]=[ar,Bx];Vn[104]=[ar,Bx];Vn[87]=[ar,Ux];Vn[119]=[ar,Ux];function ZC(e,t,n){const r=this;let i,l;return a;function a(f){return!Eu(f)||!Wx.call(r,r.previous)||Kd(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(f))}function o(f){return Eu(f)?(e.consume(f),o):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(XC,d,u)(f):f===45||f===95||At(f)?(l=!0,e.consume(f),c):d(f)}function u(f){return e.consume(f),i=!0,c}function d(f){return l&&i&&Ft(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function e_(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!Hx.call(r,r.previous)||Kd(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(YC,e.attempt($x,e.attempt(Fx,l),n),n)(a))}function l(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function t_(e,t,n){const r=this;let i="",l=!1;return a;function a(f){return(f===72||f===104)&&Vx.call(r,r.previous)&&!Kd(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),e.consume(f),o):n(f)}function o(f){if(Ft(f)&&i.length<5)return i+=String.fromCodePoint(f),e.consume(f),o;if(f===58){const h=i.toLowerCase();if(h==="http"||h==="https")return e.consume(f),c}return n(f)}function c(f){return f===47?(e.consume(f),l?u:(l=!0,c)):n(f)}function u(f){return f===null||Ja(f)||Ue(f)||fi(f)||No(f)?n(f):e.attempt($x,e.attempt(Fx,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function n_(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),l):n(a)}function l(a){return a===null?n(a):t(a)}}function r_(e,t,n){let r,i,l;return a;function a(u){return u===46||u===95?e.check(Ox,c,o)(u):u===null||Ue(u)||fi(u)||u!==45&&No(u)?c(u):(l=!0,e.consume(u),a)}function o(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),a}function c(u){return i||r||!l?n(u):t(u)}}function i_(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?l(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(Ox,t,l)(a):a===null||Ue(a)||fi(a)?t(a):(e.consume(a),i)}function l(a){return a===41&&r++,e.consume(a),i}}function s_(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),l):o===93?(e.consume(o),i):o===60||o===null||Ue(o)||fi(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||Ue(o)||fi(o)?t(o):r(o)}function l(o){return Ft(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):Ft(o)?(e.consume(o),a):n(o)}}function l_(e,t,n){return r;function r(l){return e.consume(l),i}function i(l){return At(l)?n(l):t(l)}}function Hx(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ue(e)}function Vx(e){return!Ft(e)}function Wx(e){return!(e===47||Eu(e))}function Eu(e){return e===43||e===45||e===46||e===95||At(e)}function Kd(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 a_={tokenize:p_,partial:!0};function o_(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:f_,continuation:{tokenize:m_},exit:h_}},text:{91:{name:"gfmFootnoteCall",tokenize:d_},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:c_,resolveTo:u_}}}}function c_(e,t,n){const r=this;let i=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!a||!a._balanced)return n(c);const u=In(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!l.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function u_(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",l,t],["enter",a,t],["exit",a,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function d_(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,a;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(l>999||f===93&&!a||f===null||f===91||Ue(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(In(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Ue(f)||(a=!0),l++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),l++,u):u(f)}}function f_(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,a=0,o;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(a>999||g===93&&!o||g===null||g===91||Ue(g))return n(g);if(g===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return l=In(r.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Ue(g)||(o=!0),a++,e.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(e.consume(g),a++,d):d(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(l)||i.push(l),Le(e,m,"gfmFootnoteDefinitionWhitespace")):n(g)}function m(g){return t(g)}}function m_(e,t,n){return e.check(_l,t,e.attempt(a_,t,n))}function h_(e){e.exit("gfmFootnoteDefinition")}function p_(e,t,n){const r=this;return Le(e,i,"gfmFootnoteDefinitionIndent",5);function i(l){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(l):n(l)}}function g_(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,o){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let u=c;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[c][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[c][1].end)},f={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[c][1].start)},h=[["enter",d,o],["enter",a[u][1],o],["exit",a[u][1],o],["enter",f,o]],m=o.parser.constructs.insideSpan.null;m&&ln(h,h.length,0,Co(m,a.slice(u+1,c),o)),ln(h,h.length,0,[["exit",f,o],["enter",a[c][1],o],["exit",a[c][1],o],["exit",d,o]]),ln(a,u-1,c-u+3,h),c=u+h.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function l(a,o,c){const u=this.previous,d=this.events;let f=0;return h;function h(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(g):(a.enter("strikethroughSequenceTemporary"),m(g))}function m(g){const k=ls(u);if(g===126)return f>1?c(g):(a.consume(g),f++,m);if(f<2&&!n)return c(g);const v=a.exit("strikethroughSequenceTemporary"),x=ls(g);return v._open=!x||x===2&&!!k,v._close=!k||k===2&&!!x,o(g)}}}class y_{constructor(){this.map=[]}add(t,n,r){x_(this,t,n,r)}consume(t){if(this.map.sort(function(l,a){return l[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 i=r.pop();for(;i;){for(const l of i)t.push(l);i=r.pop()}this.map.length=0}}function x_(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function v_(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function k_(){return{flow:{null:{name:"table",tokenize:w_,resolveAll:b_}}}}function w_(e,t,n){const r=this;let i=0,l=0,a;return o;function o(N){let U=r.events.length-1;for(;U>-1;){const oe=r.events[U][1].type;if(oe==="lineEnding"||oe==="linePrefix")U--;else break}const O=U>-1?r.events[U][1].type:null,re=O==="tableHead"||O==="tableRow"?_:c;return re===_&&r.parser.lazy[r.now().line]?n(N):re(N)}function c(N){return e.enter("tableHead"),e.enter("tableRow"),u(N)}function u(N){return N===124||(a=!0,l+=1),d(N)}function d(N){return N===null?n(N):de(N)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),m):n(N):_e(N)?Le(e,d,"whitespace")(N):(l+=1,a&&(a=!1,i+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(N)))}function f(N){return N===null||N===124||Ue(N)?(e.exit("data"),d(N)):(e.consume(N),N===92?h:f)}function h(N){return N===92||N===124?(e.consume(N),f):f(N)}function m(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),a=!1,_e(N)?Le(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):g(N))}function g(N){return N===45||N===58?v(N):N===124?(a=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),k):D(N)}function k(N){return _e(N)?Le(e,v,"whitespace")(N):v(N)}function v(N){return N===58?(l+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),x):N===45?(l+=1,x(N)):N===null||de(N)?z(N):D(N)}function x(N){return N===45?(e.enter("tableDelimiterFiller"),w(N)):D(N)}function w(N){return N===45?(e.consume(N),w):N===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),j):(e.exit("tableDelimiterFiller"),j(N))}function j(N){return _e(N)?Le(e,z,"whitespace")(N):z(N)}function z(N){return N===124?g(N):N===null||de(N)?!a||i!==l?D(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):D(N)}function D(N){return n(N)}function _(N){return e.enter("tableRow"),A(N)}function A(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),A):N===null||de(N)?(e.exit("tableRow"),t(N)):_e(N)?Le(e,A,"whitespace")(N):(e.enter("data"),C(N))}function C(N){return N===null||N===124||Ue(N)?(e.exit("data"),A(N)):(e.consume(N),N===92?R:C)}function R(N){return N===92||N===124?(e.consume(N),C):C(N)}}function b_(e,t){let n=-1,r=!0,i=0,l=[0,0,0,0],a=[0,0,0,0],o=!1,c=0,u,d,f;const h=new y_;for(;++n<e.length;){const m=e[n],g=m[1];m[0]==="enter"?g.type==="tableHead"?(o=!1,c!==0&&(Dh(h,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,f=void 0,l=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",d,t]])),i=g.type==="tableDelimiterRow"?2:d?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(l[1]!==0&&(a[0]=a[1],f=na(h,t,l,i,void 0,f),l=[0,0,0,0]),a[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(a[0]=a[1],f=na(h,t,l,i,void 0,f)),l=a,a=[l[1],n,0,0])):g.type==="tableHead"?(o=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,l[1]!==0?(a[0]=a[1],f=na(h,t,l,i,n,f)):a[1]!==0&&(f=na(h,t,a,i,n,f)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&Dh(h,t,c,u,d),h.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=v_(t.events,n))}return e}function na(e,t,n,r,i,l){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(l.end=Object.assign({},Ci(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const c=Ci(t.events,n[1]);if(l={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const u=Ci(t.events,n[2]),d=Ci(t.events,n[3]),f={type:o,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const h=t.events[n[2]],m=t.events[n[3]];if(h[1].end=Object.assign({},m[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,k=n[3]-n[2]-1;e.add(g,k,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(l.end=Object.assign({},Ci(t.events,i)),e.add(i,0,[["exit",l,t]]),l=void 0),l}function Dh(e,t,n,r,i){const l=[],a=Ci(t.events,n);i&&(i.end=Object.assign({},a),l.push(["exit",i,t])),r.end=Object.assign({},a),l.push(["exit",r,t]),e.add(n+1,0,l)}function Ci(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const j_={name:"tasklistCheck",tokenize:N_};function S_(){return{text:{91:j_}}}function N_(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),l)}function l(c){return Ue(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(c)}function o(c){return de(c)?t(c):_e(c)?e.check({tokenize:C_},t,n)(c):n(c)}}function C_(e,t,n){return Le(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function __(e){return tx([JC(),o_(),g_(e),k_(),S_()])}const E_={};function T_(e){const t=this,n=e||E_,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(__(n)),l.push(QC()),a.push(KC(n))}const z_={search_file:{label:"Searched files",activeLabel:"Searching files",icon:Ln,color:"#3b82f6"},search_files:{label:"Searched files",activeLabel:"Searching files",icon:Ln,color:"#3b82f6"},search_file_content:{label:"Searched content",activeLabel:"Searching content",icon:Ln,color:"#3b82f6"},search_directory:{label:"Searched directory",activeLabel:"Searching directory",icon:Ln,color:"#3b82f6"},read_file:{label:"Read file",activeLabel:"Reading file",icon:zn,color:"#8b5cf6"},write_file:{label:"Wrote file",activeLabel:"Writing file",icon:ew,color:"#f59e0b"},get_file_info:{label:"Got file info",activeLabel:"Getting file info",icon:zn,color:"#8b5cf6"},browse_directory:{label:"Browsed directory",activeLabel:"Browsing directory",icon:Zn,color:"#a78bfa"},list_directory:{label:"Listed directory",activeLabel:"Listing directory",icon:Zn,color:"#a78bfa"},list_recent_files:{label:"Listed recent files",activeLabel:"Listing recent files",icon:Zn,color:"#a78bfa"},analyze_data_file:{label:"Analyzed data",activeLabel:"Analyzing data",icon:Tm,color:"#ec4899"},run_shell_command:{label:"Ran command",activeLabel:"Running command",icon:Ya,color:"#22c55e"},execute_code:{label:"Executed code",activeLabel:"Executing code",icon:Jk,color:"#f59e0b"},query_documents:{label:"Queried documents",activeLabel:"Querying documents",icon:bi,color:"#06b6d4"},query_specific_file:{label:"Queried file",activeLabel:"Querying file",icon:bi,color:"#06b6d4"},search_indexed_chunks:{label:"Searched chunks",activeLabel:"Searching chunks",icon:bi,color:"#06b6d4"},semantic_search:{label:"Searched documents",activeLabel:"Searching documents",icon:bi,color:"#06b6d4"},evaluate_retrieval:{label:"Evaluated retrieval",activeLabel:"Evaluating retrieval",icon:bi,color:"#06b6d4"},index_document:{label:"Indexed document",activeLabel:"Indexing document",icon:Si,color:"#f97316"},index_directory:{label:"Indexed directory",activeLabel:"Indexing directory",icon:Si,color:"#f97316"},index_file:{label:"Indexed file",activeLabel:"Indexing file",icon:Si,color:"#f97316"},list_indexed_documents:{label:"Listed documents",activeLabel:"Listing documents",icon:Si,color:"#f97316"},summarize_document:{label:"Summarized",activeLabel:"Summarizing",icon:zn,color:"#8b5cf6"},dump_document:{label:"Extracted text",activeLabel:"Extracting text",icon:zn,color:"#8b5cf6"},rag_status:{label:"Checked RAG status",activeLabel:"Checking RAG",icon:Si,color:"#f97316"},add_watch_directory:{label:"Added watch dir",activeLabel:"Adding watch dir",icon:Zn,color:"#a78bfa"},web_search:{label:"Searched web",activeLabel:"Searching web",icon:Nd,color:"#14b8a6"},analyze_data:{label:"Analyzed data",activeLabel:"Analyzing data",icon:Tm,color:"#ec4899"}},Ih={label:"Used tool",activeLabel:"Using tool",icon:is,color:"#3b82f6"};function L_(e){return e?e.startsWith("mcp_")?{label:"MCP tool",activeLabel:"Running MCP tool",icon:Nd,color:"#7c3aed"}:z_[e]||Ih:Ih}function Gx({steps:e,isActive:t,variant:n="inline"}){const[r,i]=p.useState(!1),[l,a]=p.useState(new Set),o=p.useRef(0),c=p.useRef(new Map),u=p.useRef(t);p.useEffect(()=>{u.current=t},[t]),p.useEffect(()=>()=>{c.current.forEach(C=>clearTimeout(C)),c.current.clear()},[]);const d=p.useMemo(()=>{const C=[];for(const R of e){const N=C[C.length-1];if(R.type==="thinking"&&N&&N.type==="thinking"){const U=(N.detail||"")+(R.detail||"");C[C.length-1]={...R,detail:U||N.detail};continue}if(R.type==="status"&&N&&N.type==="status"&&R.active!==!1){C[C.length-1]={...R,label:R.label||N.label};continue}if(R.type==="thinking"&&N&&N.type==="status"&&N.active!==!1){C[C.length-1]={...N,type:"thinking",detail:R.detail||N.detail,active:R.active};continue}if(R.type==="status"&&N&&N.type==="thinking"){C[C.length-1]={...N,label:R.label||N.label,active:R.active??N.active};continue}C.push(R)}return C},[e]),f=d.filter(C=>C.type==="tool"),h=d.filter(C=>C.type==="policy_alert"),m=h.length>0,[g,k]=p.useState(""),[v,x]=p.useState("all"),w=p.useMemo(()=>!g&&v==="all"?d:d.filter(C=>{var R;return C.type!=="tool"?!0:!(g&&!((R=C.tool)!=null&&R.toLowerCase().includes(g.toLowerCase()))||v==="success"&&C.success!==!0||v==="error"&&C.success!==!1)}),[d,g,v]),z=d.filter(C=>C.type==="error").length>0;p.useEffect(()=>{m&&i(!0)},[m]),p.useEffect(()=>{o.current=d.length;const C=d.filter(R=>R.type==="tool"&&!R.mcpServer).map(R=>R.id);C.length>0&&a(R=>{const N=new Set(R);return C.forEach(U=>N.add(U)),N})},[d]);const D=p.useCallback(C=>{const R=c.current.get(C);R&&(clearTimeout(R),c.current.delete(C)),a(N=>{const U=new Set(N);return U.has(C)?U.delete(C):U.add(C),U})},[]);if(d.length===0)return null;const _=d.length,A=m?`Blocked by policy · ${h.length} alert${h.length!==1?"s":""}`:`${_} step${_!==1?"s":""}`+(f.length>0?` · ${f.length} tool${f.length!==1?"s":""}`:"");return s.jsxs("div",{className:`agent-activity ${n} ${t?"active":"done"} ${z?"has-errors":""} ${m?"has-policy-alerts":""}`,children:[s.jsxs("button",{className:"agent-summary-bar",onClick:()=>i(!r),"aria-expanded":r,"aria-label":r?"Collapse agent activity":"Expand agent activity",children:[s.jsxs("div",{className:"agent-summary-left",children:[z?s.jsx(kt,{size:14,className:"agent-icon-error"}):s.jsx(qi,{size:14,className:"agent-icon-done"}),s.jsx("span",{className:"agent-summary-text",children:A})]}),s.jsx("div",{className:"agent-summary-right",children:r?s.jsx(ci,{size:14}):s.jsx(us,{size:14})})]}),d.length>0&&s.jsxs("div",{className:`agent-flow-wrap ${r?"flow-expanded":"flow-collapsed"}`,children:[r&&f.length>=2&&s.jsxs("div",{className:"activity-filter-bar",children:[s.jsx("input",{type:"text",className:"activity-filter-input",placeholder:"Filter by tool name...","aria-label":"Filter by tool name",value:g,onChange:C=>k(C.target.value)}),s.jsxs("select",{className:"activity-filter-select","aria-label":"Filter by status",value:v,onChange:C=>x(C.target.value),children:[s.jsx("option",{value:"all",children:"All"}),s.jsx("option",{value:"success",children:"Success"}),s.jsx("option",{value:"error",children:"Error"})]})]}),s.jsx("div",{className:"agent-flow",children:w.map(C=>C.type==="thinking"?s.jsx(A_,{step:C},C.id):C.type==="status"?s.jsx(D_,{step:C},C.id):C.type==="tool"?s.jsx(M_,{step:C,isExpanded:l.has(C.id),onToggle:()=>D(C.id)},C.id):C.type==="plan"?s.jsx(R_,{step:C},C.id):C.type==="error"?s.jsx($_,{step:C},C.id):C.type==="policy_alert"?s.jsx(F_,{step:C},C.id):null)})]})]})}function A_({step:e}){const t=e.detail||e.label||"",n=p.useRef(null);return p.useEffect(()=>{e.active&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[t,e.active]),t?s.jsxs("div",{ref:n,className:"flow-thought-hacker",children:[s.jsx("span",{children:t}),e.active&&s.jsx("span",{className:"flow-thought-cursor"})]}):null}function D_({step:e}){const t=e.detail||e.label||"";return t?s.jsx("div",{className:`flow-thought ${e.active?"active":""}`,children:s.jsx("span",{className:"flow-thought-text",children:t})}):null}function I_(e){const t=/[A-Z]:[\\\/](?:[^\s*?"<>|,;)}\]]+[\\\/])*[^\s*?"<>|,;)}\]]*/gi,n=[];let r=0,i;for(;(i=t.exec(e))!==null;){i.index>r&&n.push(e.slice(r,i.index));const l=i[0],a=l.replace(/[)}\]]+$/,""),o=()=>{zd(a).catch(c=>E.ui.error("Failed to open path",c))};n.push(s.jsxs("span",{className:"tool-result-path",onClick:o,title:`Open: ${a}`,role:"button",tabIndex:0,onKeyDown:c=>{c.key==="Enter"&&o()},children:[s.jsx(Zn,{size:10,style:{flexShrink:0,opacity:.7}}),a]},i.index)),a.length<l.length&&n.push(l.slice(a.length)),r=i.index+l.length}return n.length===0?e:(r<e.length&&n.push(e.slice(r)),s.jsx(s.Fragment,{children:n}))}function P_({fileList:e}){const[t,n]=p.useState(!1),r=5,i=t?e.files:e.files.slice(0,r),l=e.total-r,a=(c,u)=>{const d=c.name||c.filename||c.file_name;return d?String(d):c.file_path?String(c.file_path).replace(/\\/g,"/").split("/").pop()||`File ${u+1}`:`File ${u+1}`},o=c=>c.directory?String(c.directory):"";return s.jsxs("div",{className:"file-list-view",children:[i.map((c,u)=>s.jsxs("div",{className:"file-list-item",children:[s.jsx(hy,{size:11,className:"file-list-icon"}),s.jsx("span",{className:"file-list-name",children:a(c,u)}),o(c)&&s.jsx("span",{className:"file-list-dir",children:o(c)})]},u)),l>0&&!t&&s.jsxs("button",{className:"file-list-more",onClick:()=>n(!0),children:["+",l," more"]}),t&&e.files.length<e.total&&s.jsxs("span",{className:"file-list-truncated",children:["Showing ",e.files.length," of ",e.total," files"]})]})}function M_({step:e,isExpanded:t,onToggle:n}){var c,u;const r=L_(e.tool),i=r.icon,l=r.color,a=e.active?r.activeLabel:r.label,o=!!(e.detail||e.result||e.commandOutput||(u=(c=e.fileList)==null?void 0:c.files)!=null&&u.length);return s.jsxs("div",{className:`flow-tool ${e.active?"active":""} ${e.success===!1?"error":""}`,children:[s.jsxs("button",{className:"flow-tool-header",onClick:o?n:void 0,style:o?void 0:{cursor:"default"},children:[s.jsxs("div",{className:"flow-tool-left",children:[e.active?s.jsx(mt,{size:13,className:"flow-tool-spinner",style:{color:l}}):e.success===!1?s.jsx(kt,{size:13,style:{color:"#ef4444"}}):e.success===!0?s.jsx(sr,{size:13,style:{color:"#22c55e"}}):s.jsx(i,{size:13,style:{color:l}}),s.jsx("span",{className:"flow-tool-label",children:a}),s.jsx("span",{className:"flow-tool-badge",style:{"--badge-color":l},children:e.tool}),e.mcpServer&&s.jsxs("span",{className:"flow-tool-mcp-server",children:["via ",e.mcpServer]})]}),s.jsxs("div",{className:"flow-tool-right",children:[e.latencyMs!=null&&!e.active&&s.jsxs("span",{className:"flow-tool-latency",children:[Math.round(e.latencyMs),"ms"]}),o&&s.jsx("span",{className:`flow-tool-chevron ${t?"expanded":""}`,children:s.jsx(us,{size:12})})]})]}),t&&o&&s.jsxs("div",{className:"flow-tool-detail",children:[e.detail&&!e.commandOutput&&s.jsxs("div",{className:"step-detail-args",children:[s.jsx("span",{className:"detail-section-label",children:"Arguments"}),s.jsx("div",{className:"detail-args-content",children:B_(e.detail)})]}),e.commandOutput&&s.jsx(U_,{output:e.commandOutput}),e.result&&!e.commandOutput&&s.jsxs("div",{className:`step-detail-result ${e.success===!1?"result-error":"result-success"}`,children:[s.jsx("span",{className:"detail-section-label",children:e.success===!1?"Error":"Result"}),s.jsx("div",{className:"detail-result-content",children:I_(e.result)})]}),e.retrievalChunks&&e.retrievalChunks.length>0&&s.jsx(O_,{chunks:e.retrievalChunks}),e.fileList&&e.fileList.files.length>0&&s.jsx(P_,{fileList:e.fileList})]})]})}function R_({step:e}){const[t,n]=p.useState(!1);return!e.planSteps||e.planSteps.length===0?null:s.jsxs("div",{className:"flow-plan",children:[s.jsxs("button",{className:"flow-plan-header flow-plan-toggle",onClick:()=>n(r=>!r),"aria-expanded":t,title:t?"Collapse plan":"Expand plan",children:[s.jsx(yy,{size:12}),s.jsx("span",{children:"Plan"}),s.jsxs("span",{className:"flow-plan-count",children:["(",e.planSteps.length,")"]}),t?s.jsx(ci,{size:11}):s.jsx(us,{size:11})]}),t&&s.jsx("ol",{className:"flow-plan-list",children:e.planSteps.map((r,i)=>s.jsx("li",{className:"flow-plan-item",children:r},i))})]})}function $_({step:e}){return s.jsxs("div",{className:"flow-error",children:[s.jsx(kt,{size:13}),s.jsx("span",{children:e.detail||e.label||"An error occurred"})]})}function F_({step:e}){return s.jsxs("div",{className:"flow-policy-alert",children:[s.jsxs("div",{className:"flow-policy-alert-header",children:[s.jsx(Ka,{size:14}),s.jsx("span",{className:"flow-policy-alert-title",children:"Policy Shield"}),s.jsx("span",{className:"flow-policy-alert-decision",children:e.decision||"BLOCK"})]}),s.jsxs("div",{className:"flow-policy-alert-body",children:[s.jsxs("div",{className:"flow-policy-alert-line",children:[s.jsx("span",{children:"Tool"}),s.jsx("code",{children:e.tool||"unknown tool"})]}),s.jsx("div",{className:"flow-policy-alert-reason",children:e.reason||e.detail}),e.ruleIds&&e.ruleIds.length>0&&s.jsxs("div",{className:"flow-policy-alert-line",children:[s.jsx("span",{children:"Rules"}),s.jsx("code",{children:e.ruleIds.join(", ")})]}),e.policyVersion&&s.jsxs("div",{className:"flow-policy-alert-line",children:[s.jsx("span",{children:"Policy"}),s.jsx("code",{children:e.policyVersion})]}),s.jsxs("div",{className:"flow-policy-alert-line",children:[s.jsx("span",{children:"Receipt"}),e.receiptId?s.jsx("code",{children:e.receiptId}):s.jsx("em",{children:"Receipt unavailable"})]})]})]})}function O_({chunks:e}){const[t,n]=p.useState(new Set),r=i=>{n(l=>{const a=new Set(l);return a.has(i)?a.delete(i):a.add(i),a})};return s.jsxs("div",{className:"chunks-view",children:[s.jsxs("span",{className:"detail-section-label",children:["Retrieved Chunks (",e.length,")"]}),s.jsx("div",{className:"chunks-list",children:e.map(i=>{const l=t.has(i.id);return s.jsxs("div",{className:`chunk-card ${l?"expanded":""}`,children:[s.jsxs("button",{className:"chunk-header",onClick:()=>r(i.id),children:[s.jsxs("div",{className:"chunk-header-left",children:[s.jsx(bi,{size:11,style:{color:"#06b6d4",flexShrink:0}}),i.source&&s.jsx("span",{className:"chunk-source",children:i.source}),i.page!=null&&s.jsxs("span",{className:"chunk-page",children:["p.",i.page]}),i.score!=null&&i.score>0&&s.jsx("span",{className:"chunk-score",children:i.score.toFixed(2)})]}),s.jsx("span",{className:`chunk-chevron ${l?"expanded":""}`,children:s.jsx(us,{size:11})})]}),s.jsx("div",{className:`chunk-body ${l?"show":""}`,children:l?s.jsx("pre",{className:"chunk-content",children:i.content}):s.jsx("div",{className:"chunk-preview",children:i.preview})})]},i.id)})})]})}function U_({output:e}){const[t,n]=p.useState(!1),r=p.useRef(null);p.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const i=p.useCallback(()=>{const o=e.stdout||e.stderr||"";navigator.clipboard.writeText(o).catch(()=>{}),n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)},[e]),l=!!(e.stdout||e.stderr),a=e.returnCode!==0;return s.jsxs("div",{className:`cmd-output ${a?"cmd-error":""}`,children:[s.jsxs("div",{className:"cmd-header",children:[s.jsxs("div",{className:"cmd-header-left",children:[s.jsx(Ya,{size:12,className:"cmd-header-icon"}),s.jsx("span",{className:"cmd-header-title",children:"Terminal"}),e.cwd&&s.jsx("span",{className:"cmd-cwd",children:e.cwd})]}),s.jsxs("div",{className:"cmd-header-right",children:[e.durationSeconds!=null&&s.jsxs("span",{className:"cmd-duration",children:[e.durationSeconds.toFixed(1),"s"]}),e.returnCode!==0&&s.jsxs("span",{className:"cmd-exit-code",children:["exit ",e.returnCode]}),l&&s.jsx("button",{className:`cmd-copy ${t?"copied":""}`,onClick:i,title:t?"Copied!":"Copy output",children:t?s.jsx(oi,{size:11}):s.jsx(Nl,{size:11})})]})]}),s.jsxs("div",{className:"cmd-line",children:[s.jsx("span",{className:"cmd-prompt",children:"$"}),s.jsx("span",{className:"cmd-text",children:e.command})]}),e.stdout&&s.jsx("pre",{className:"cmd-stdout",children:e.stdout}),e.stderr&&s.jsx("pre",{className:"cmd-stderr",children:e.stderr}),e.truncated&&s.jsx("div",{className:"cmd-truncated",children:"Output was truncated (exceeded size limit)"}),!l&&s.jsx("div",{className:"cmd-empty",children:"No output"})]})}function B_(e){const t=e.includes(`
532
+ `)?e.split(`
533
+ `).filter(Boolean):e.split(", ").filter(Boolean);return t.length<=1?s.jsx("span",{className:"arg-value",children:e}):s.jsx("div",{className:"args-grid",children:t.map((n,r)=>{const i=n.indexOf(":");if(i>0&&i<30){const l=n.slice(0,i).trim(),a=n.slice(i+1).trim();return s.jsxs("div",{className:"arg-row",children:[s.jsx("span",{className:"arg-key",children:l}),s.jsx("span",{className:"arg-value",children:a})]},r)}return s.jsx("div",{className:"arg-row",children:s.jsx("span",{className:"arg-value",children:n})},r)})})}function H_(e){if(!e)return!1;if(e.includes("NOT_CONNECTED:")||e.includes("AGENT_NOT_GRANTED:")||e.includes("AUTH_REQUIRED:"))return!0;const t=e.toLowerCase();return!!(t.includes("connectors → google")||t.includes("connections → google")||t.includes("email agent needs additional google permissions"))}function V_(e){var n;const t=window;(n=t.gaia)!=null&&n.openExternal?t.gaia.openExternal(e):window.open(e,"_blank","noopener")}function W_({connectorId:e="google"}){const[t,n]=p.useState(!1),[r,i]=p.useState(null),[l,a]=p.useState(!1),o=p.useCallback(async()=>{n(!0),i(null);try{const c=await Ty(e),u=c.available_scopes&&c.available_scopes.length>0?c.available_scopes:c.default_scopes,d=await zy(e,u);V_(d.authorization_url),a(!0)}catch(c){i(c instanceof Error?c.message:String(c))}finally{n(!1)}},[e]);return s.jsxs("div",{className:"email-connect-cta",role:"region","aria-label":"Connect Google",children:[s.jsxs("div",{className:"email-connect-cta__text",children:[s.jsx(kt,{size:14,className:"email-connect-cta__icon"}),s.jsx("span",{children:l?"A browser tab opened for Google sign-in. Return here when finished.":"Connect your Google account to use Email Triage."})]}),s.jsxs("button",{className:"email-connect-cta__button",onClick:()=>void o(),disabled:t,children:[t?s.jsx(mt,{size:12,className:"email-connect-cta__spinner"}):s.jsx(Gi,{size:12}),s.jsx("span",{children:l?"Reopen Google sign-in":"Connect Google"})]}),r&&s.jsx("div",{className:"email-connect-cta__error",role:"alert",children:r})]})}function Ph(e){if(!e||typeof e!="object")return!1;const t=e;return t.kind!=="email_pre_scan"?!1:Array.isArray(t.urgent)&&Array.isArray(t.actionable)&&Array.isArray(t.suggested_archives)&&Array.isArray(t.suggested_drafts)&&typeof t.informational_count=="number"}function G_(e){e&&window.dispatchEvent(new CustomEvent("gaia:send-message",{detail:{text:e}}))}function q_(e){const t=e.thread_id||e.message_id;if(!t)return;const n=`https://mail.google.com/mail/u/0/#inbox/${encodeURIComponent(t)}`;window.open(n,"_blank","noopener,noreferrer")}function Q_(e){if(!e)return"(unknown)";const t=e.trim(),n=t.indexOf("<");return n>0?t.slice(0,n).trim().replace(/^"|"$/g,""):t}function Mh({payload:e}){const[t,n]=p.useState(()=>new Set),r=p.useCallback(m=>{n(g=>{const k=new Set(g);return k.add(m),k})},[]),[i,l]=p.useState(null),a=p.useRef(null);p.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]);const o=p.useCallback((m,g)=>{i||(l(m),a.current=setTimeout(()=>{l(k=>k===m?null:k)},5e3),G_(g))},[i]),c=p.useCallback(m=>{o(m.message_id,`Archive message id ${m.message_id}.`)},[o]),u=p.useCallback(m=>{o(m.message_id,`Draft a reply to message id ${m.message_id}.`)},[o]),d=p.useMemo(()=>[{key:"urgent",title:"Urgent",icon:s.jsx(kt,{size:14}),items:e.urgent.filter(m=>!t.has(m.message_id)),intent:"urgent"},{key:"actionable",title:"Needs a response",icon:s.jsx(vy,{size:14}),items:e.actionable.filter(m=>!t.has(m.message_id)),intent:"actionable"},{key:"archives",title:"Suggested archives",icon:s.jsx(oy,{size:14}),items:e.suggested_archives.filter(m=>!t.has(m.message_id)),intent:"archive"}],[e,t]),f=d.reduce((m,g)=>m+g.items.length,0),h=e.informational_count;return s.jsxs("div",{className:"email-pre-scan",role:"region","aria-label":"Inbox pre-scan",children:[s.jsxs("div",{className:"email-pre-scan__header",children:[s.jsx(rw,{size:16,"aria-hidden":"true"}),s.jsx("span",{className:"email-pre-scan__title",children:"Inbox pre-scan"}),s.jsxs("span",{className:"email-pre-scan__totals",children:[f," surfaced",h>0?` · ${h} informational`:""]})]}),d.map(m=>m.items.length>0?s.jsx(K_,{def:m,pendingRow:i,onApproveArchive:c,onReply:u,onDismiss:r,onOpen:q_},m.key):null),f===0&&s.jsxs("div",{className:"email-pre-scan__empty",children:[s.jsx(sr,{size:14}),s.jsx("span",{children:"Nothing to surface — your inbox looks quiet."})]}),s.jsx(X_,{applied:e.preferences_applied})]})}function K_({def:e,pendingRow:t,onApproveArchive:n,onReply:r,onDismiss:i,onOpen:l}){return s.jsxs("section",{className:`email-pre-scan__section email-pre-scan__section--${e.intent}`,children:[s.jsxs("header",{className:"email-pre-scan__section-header",children:[e.icon,s.jsx("span",{className:"email-pre-scan__section-title",children:e.title}),s.jsx("span",{className:"email-pre-scan__section-count",children:e.items.length})]}),s.jsx("ul",{className:"email-pre-scan__list",children:e.items.map(a=>s.jsx(Y_,{item:a,intent:e.intent,isPending:t!==null,onApproveArchive:n,onReply:r,onDismiss:i,onOpen:l},a.message_id))})]})}function Y_({item:e,intent:t,isPending:n,onApproveArchive:r,onReply:i,onDismiss:l,onOpen:a}){const o=e.reason??e.why??"",c=Q_(e.sender);return s.jsxs("li",{className:"email-pre-scan__row",children:[s.jsxs("div",{className:"email-pre-scan__row-text",children:[s.jsxs("div",{className:"email-pre-scan__row-meta",children:[s.jsx("span",{className:"email-pre-scan__row-sender",title:e.sender,children:c}),s.jsx("span",{className:"email-pre-scan__row-subject",title:e.subject,children:e.subject||"(no subject)"})]}),o&&s.jsx("div",{className:"email-pre-scan__row-reason",title:o,children:o})]}),s.jsxs("div",{className:"email-pre-scan__row-actions",role:"group","aria-label":"Actions for this email",children:[t==="archive"?s.jsxs("button",{className:"email-pre-scan__action email-pre-scan__action--primary",onClick:()=>r(e),disabled:n,title:"Approve archive","aria-label":`Approve archive for "${e.subject}"`,children:[s.jsx(oy,{size:12}),s.jsx("span",{children:"Archive"})]}):s.jsxs("button",{className:"email-pre-scan__action email-pre-scan__action--primary",onClick:()=>i(e),disabled:n,title:"Draft a reply","aria-label":`Draft a reply to "${e.subject}"`,children:[s.jsx(jw,{size:12}),s.jsx("span",{children:"Reply"})]}),s.jsxs("button",{className:"email-pre-scan__action",onClick:()=>a(e),title:"Open in Gmail","aria-label":`Open "${e.subject}" in Gmail`,children:[s.jsx(Gi,{size:12}),s.jsx("span",{children:"Open"})]}),s.jsx("button",{className:"email-pre-scan__action email-pre-scan__action--ghost",onClick:()=>l(e.message_id),title:"Dismiss this row","aria-label":`Dismiss "${e.subject}"`,children:s.jsx(Ze,{size:12})})]})]})}function X_({applied:e}){const t=(e==null?void 0:e.priority_senders)??[],n=(e==null?void 0:e.low_priority_senders)??[],r=(e==null?void 0:e.category_defaults)??{};return t.length>0||n.length>0||Object.keys(r).length>0?s.jsxs("div",{className:"email-pre-scan__preferences","aria-label":"Active session preferences",children:[s.jsx("span",{className:"email-pre-scan__preferences-label",children:"Session preferences:"}),t.length>0&&s.jsxs("span",{className:"email-pre-scan__preferences-chip",title:"Always urgent",children:["+ ",t.length," priority sender",t.length===1?"":"s"]}),n.length>0&&s.jsxs("span",{className:"email-pre-scan__preferences-chip",title:"Always low-priority",children:["− ",n.length," low-priority sender",n.length===1?"":"s"]}),Object.entries(r).map(([l,a])=>s.jsxs("span",{className:"email-pre-scan__preferences-chip",title:`${l} → ${a}`,children:[l," → ",a]},l))]}):null}function J_({active:e}){const t="Thinking...",[n,r]=p.useState(0),[i,l]=p.useState("typing"),a=p.useRef(e);return p.useEffect(()=>{if(i!=="typing")return;if(n>=t.length){l("idle");return}const o=setTimeout(()=>r(c=>c+1),30);return()=>clearTimeout(o)},[i,n]),p.useEffect(()=>{a.current&&!e&&l("erasing"),a.current=e},[e]),p.useEffect(()=>{if(i!=="erasing")return;if(n<=0){l("done");return}const o=setTimeout(()=>r(c=>c-1),20);return()=>clearTimeout(o)},[i,n]),p.useEffect(()=>{e&&i==="done"&&(r(0),l("typing"))},[e,i]),i==="done"?null:s.jsxs("span",{className:"thinking-indicator",children:[s.jsx("span",{className:"thinking-indicator-text",children:t.slice(0,n)}),e&&s.jsx("span",{className:"cursor"})]})}function Z_(e){if(!e)return!1;const t=e.toLowerCase();return t.startsWith("error:")||t.startsWith("error -")||t.includes("traceback (most recent")||t.includes("object has no attribute")||t.includes("is lemonade server running")||t.includes("connection refused")||t.includes("failed to fetch")}const eE=/\s*\{\s*"?tool"?\s*:\s*"[^"]+"\s*,\s*"?tool_args"?\s*:\s*\{[^}]*\}\s*\}/g;function tE(e){const t=['"thought"','"answer"','"tool"'];let n="",r=0;for(;r<e.length;){const i=e.indexOf("{",r);if(i===-1){n+=e.slice(r);break}const l=e.slice(i,i+50);if(!t.some(d=>l.includes(d))){n+=e.slice(r,i+1),r=i+1;continue}n+=e.slice(r,i);let o=0,c=i;for(;c<e.length;c++)if(e[c]==="{")o++;else if(e[c]==="}"&&(o--,o===0))break;if(o!==0)break;const u=e.slice(i,c+1);try{const d=JSON.parse(u);d.answer&&(n+=d.answer)}catch{const d=u.indexOf('"answer"');if(d!==-1){const f=u.indexOf(":",d+8);if(f!==-1){let h=f+1;for(;h<u.length&&/\s/.test(u[h]);)h++;if(h<u.length&&u[h]==='"'){let m=u.slice(h+1);m.endsWith('"}')?m=m.slice(0,-2):m.endsWith('"')&&(m=m.slice(0,-1)),n+=m.replace(/\\"/g,'"').replace(/\\n/g,`
534
+ `).replace(/\\\\/g,"\\")}}}}r=c+1}return n}const nE=new Set(["email_pre_scan","email-pre-scan"]),rE=new Set(["python","py","javascript","js","typescript","ts","java","c","cpp","csharp","cs","go","rust","ruby","rb","php","swift","kotlin","scala","r","perl","lua","bash","sh","zsh","powershell","ps1","sql","html","css","scss","sass","less","xml","json","yaml","yml","toml","ini","csv","markdown","md","dockerfile","docker","makefile","cmake","nginx","apache","graphql","proto","protobuf","jsx","tsx","vue","svelte","dart","elixir","ex","erlang","haskell","hs","ocaml","ml","fsharp","fs","clojure","clj","lisp","scheme","racket","zig","nim","crystal","julia","matlab","octave","fortran","cobol","pascal","delphi","ada","assembly","asm","nasm","wasm","solidity","sol","verilog","vhdl","text","txt","plaintext","diff","patch","log","email_pre_scan","email-pre-scan"]);function iE(e){return e.replace(/```(\w*)[ \t]*\n([\s\S]*?)```/g,(t,n,r)=>{const i=n.toLowerCase();return i&&nE.has(i)||i&&rE.has(i)?t:r.trim()})}const sE={email_pre_scan:"email_pre_scan","email-pre-scan":"email_pre_scan"};function lE(e){const t=e.trimStart();if(!t.startsWith("{"))return e;const n=t.match(/^\{"kind"\s*:\s*"([^"]+)"/);if(!n)return e;const r=sE[n[1]];if(!r)return e;let i=0,l=-1,a=!1,o=!1;for(let f=0;f<t.length;f++){const h=t[f];if(o){o=!1;continue}if(a){h==="\\"?o=!0:h==='"'&&(a=!1);continue}if(h==='"')a=!0;else if(h==="{")i++;else if(h==="}"&&--i===0){l=f;break}}if(l===-1)return e;const c=t.slice(0,l+1),u=t.slice(l+1);return`${e.slice(0,e.length-t.length)}\`\`\`${r}
535
+ ${c}
536
+ \`\`\`
537
+ ${u}`}function aE(e){if(!e)return e;let t=e;t=lE(t),t=t.replace(eE,""),t=tE(t),t=t.replace(/<think>[\s\S]*?<\/think>/g,"");const n=(t.match(/\\n/g)||[]).length,r=(t.match(/\n/g)||[]).length;return n>2&&n>r*2&&(t=t.replace(/\\n/g,`
538
+ `),t=t.replace(/\\"/g,'"')),t=iE(t).trim(),t}function oE(e){if(!e)return"";const t=new Date(e),r=new Date().getTime()-t.getTime(),i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const l=Math.floor(i/60);return l<24?`${l}h ago`:t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Rh(e){return e?new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0}):""}function cE(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function $h({message:e,isStreaming:t,showTerminalCursor:n,agentSteps:r,agentStepsActive:i,onDelete:l,onResend:a,latencyMs:o,agentName:c}){var D,_,A;const u=e.role==="assistant"&&Z_(e.content),d=p.useMemo(()=>aE(e.content),[e.content]),[f,h]=p.useState(!1),[m,g]=p.useState(!1),k=p.useRef(null),v=p.useRef(null);p.useEffect(()=>()=>{k.current&&clearTimeout(k.current),v.current&&clearTimeout(v.current)},[]);const x=p.useCallback(()=>{var C;if((C=navigator.clipboard)!=null&&C.writeText)navigator.clipboard.writeText(e.content).catch(()=>{});else{const R=document.createElement("textarea");R.value=e.content,R.style.position="fixed",R.style.opacity="0",document.body.appendChild(R),R.select(),document.execCommand("copy"),document.body.removeChild(R)}h(!0),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>h(!1),2e3)},[e.content]),w=p.useCallback(()=>{if(!m){g(!0),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>g(!1),3e3);return}g(!1),v.current&&clearTimeout(v.current),l==null||l(e.id)},[m,e.id,l]),j=p.useCallback(()=>{a==null||a(e)},[e,a]),z=e.created_at?`${e.role==="user"?"Sent":"Replied"} ${Rh(e.created_at)}`:void 0;return s.jsx("div",{className:`msg msg-${e.role} ${u?"msg-error":""}`,title:z,children:s.jsxs("div",{className:"msg-inner",children:[s.jsxs("div",{className:"msg-header",children:[s.jsx("div",{className:"msg-header-left",children:e.role==="assistant"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"msg-avatar msg-avatar-assistant","aria-hidden":"true",children:s.jsx("img",{src:Oy,alt:""})}),s.jsx("span",{className:"msg-role-brand",children:"GAIA"}),(()=>{const R=((c==null?void 0:c.trim())??"").replace(/^gaia\b\s*/i,"");return R?s.jsx("span",{className:"msg-role-agent",children:R}):null})(),(t||e.created_at)&&s.jsx("span",{className:"msg-header-sep",children:"|"}),t&&s.jsx(J_,{active:!!i||!d}),!t&&e.created_at&&s.jsx("span",{className:"msg-timestamp",children:oE(e.created_at)})]})}),!t&&s.jsxs("div",{className:"msg-actions",children:[e.role==="user"&&a&&s.jsx("button",{className:"msg-action-btn",onClick:j,title:"Resend message","aria-label":"Resend message",children:s.jsx(qs,{size:12})}),s.jsx("button",{className:`msg-copy ${f?"copied":""}`,onClick:x,title:f?"Copied!":"Copy message","aria-label":f?"Copied to clipboard":"Copy message",children:f?s.jsx(oi,{size:12}):s.jsx(Nl,{size:12})}),l&&s.jsx("button",{className:`msg-action-btn msg-delete ${m?"confirm":""}`,onClick:w,title:m?"Click again to confirm":"Delete message","aria-label":m?"Confirm delete message":"Delete message",children:s.jsx(di,{size:12})})]})]}),s.jsxs("div",{className:"msg-body",children:[r&&r.length>0&&s.jsx(Gx,{steps:r,isActive:i??!1,variant:i?"inline":"summary"}),u&&s.jsxs("div",{className:"error-banner",children:[s.jsx(gn,{size:14}),s.jsx("span",{children:"Something went wrong"})]}),s.jsx(Tu,{content:d,showCursor:(t||n)&&!!d&&!i}),e.role==="assistant"&&!t&&H_(d)&&s.jsx(W_,{}),e.role==="assistant"&&!t&&(e.stats||o!=null||e.created_at)&&s.jsxs("div",{className:"msg-stats","aria-label":"Message performance stats",children:[e.created_at&&s.jsx("span",{className:"msg-stats-ts",title:"Message timestamp",children:Rh(e.created_at)}),o!=null&&o>0&&s.jsx("span",{title:"Total response time",children:cE(o)}),((D=e.stats)==null?void 0:D.tokens_per_second)!=null&&e.stats.tokens_per_second>0&&s.jsxs("span",{title:"Tokens per second",children:[e.stats.tokens_per_second," tok/s"]}),((_=e.stats)==null?void 0:_.time_to_first_token)!=null&&e.stats.time_to_first_token>0&&s.jsxs("span",{title:"Time to first token",children:[(e.stats.time_to_first_token*1e3).toFixed(0),"ms TTFT"]}),((A=e.stats)==null?void 0:A.output_tokens)!=null&&e.stats.output_tokens>0&&s.jsxs("span",{title:"Input → output tokens",children:[(e.stats.input_tokens??0).toLocaleString()," → ",e.stats.output_tokens.toLocaleString()," tokens"]})]})]})]})})}function uE({lang:e,code:t}){const[n,r]=p.useState(!1),i=p.useRef(null);p.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const l=p.useCallback(()=>{var a;if((a=navigator.clipboard)!=null&&a.writeText)navigator.clipboard.writeText(t).catch(()=>{});else{const o=document.createElement("textarea");o.value=t,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}r(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>r(!1),2e3)},[t]);return s.jsxs("div",{className:"code-block",children:[s.jsxs("div",{className:"code-header",children:[s.jsx("span",{className:"code-lang",children:e||"code"}),s.jsxs("button",{className:`code-copy ${n?"copied":""}`,onClick:l,title:n?"Copied!":"Copy","aria-label":n?"Copied to clipboard":"Copy code",children:[n?s.jsx(oi,{size:13}):s.jsx(Nl,{size:13}),s.jsx("span",{children:n?"Copied":"Copy"})]})]}),s.jsx("pre",{children:s.jsx("code",{children:t})})]})}const dE=/[A-Z]:[\\\/](?:[^\s*?"<>|,;)}\]]+[\\\/])*[^\s*?"<>|,;)}\]]*\.\w{1,5}/gi,fE=/[A-Z]:[\\\/](?:[^\s*?"<>|,;)}\]]+[\\\/])+/gi;function mE({path:e}){const t=n=>{n.preventDefault(),zd(e).catch(r=>{E.ui.error("Failed to open path",r)})};return s.jsxs("span",{className:"file-path-link",onClick:t,title:`Open in file explorer: ${e}`,role:"button",tabIndex:0,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),t(n))},children:[s.jsx(Zn,{size:12,className:"file-path-icon"}),e]})}function hE(e){const t=new RegExp(`(${dE.source}|${fE.source})`,"gi"),n=[];let r=0,i;for(;(i=t.exec(e))!==null;)i.index>r&&n.push(e.slice(r,i.index)),n.push(s.jsx(mE,{path:i[0]},i.index)),r=t.lastIndex;return n.length===0?e:(r<e.length&&n.push(e.slice(r)),s.jsx(s.Fragment,{children:n}))}function Nr(e){return Ki.Children.map(e,t=>typeof t=="string"?hE(t):t)}const pE=/```(email[_-]pre[_-]scan)[ \t]*\r?\n([\s\S]*?)\r?\n```/;function Tu({content:e,showCursor:t}){if(!e&&!t)return null;if(!e&&t)return s.jsx("span",{className:"cursor"});const n=pE.exec(e);if(n){const r=e.slice(0,n.index).trim(),i=n[2],l=e.slice(n.index+n[0].length).trim();try{const a=JSON.parse(i);if(Ph(a))return s.jsxs("div",{className:"md-content",children:[r&&s.jsx(Tu,{content:r}),s.jsx(Mh,{payload:a}),l&&s.jsx(Tu,{content:l}),t&&s.jsx("span",{className:"cursor"})]})}catch{}}return s.jsxs("div",{className:"md-content",children:[s.jsx(h2,{remarkPlugins:[T_],disallowedElements:[...v2],urlTransform:k2,components:{code({className:r,children:i,...l}){return s.jsx("code",{className:"inline-code",...l,children:i})},pre({children:r}){var l,a;const i=Ki.Children.toArray(r)[0];if(Ki.isValidElement(i)&&(i.type==="code"||((l=i.props)==null?void 0:l.className)!==void 0||typeof((a=i.props)==null?void 0:a.children)=="string")){const o=i.props,c=(o==null?void 0:o.className)||"",u=/language-([\w-]+)/.exec(c),d=String((o==null?void 0:o.children)||"").replace(/\n$/,""),f=(u==null?void 0:u[1])||"";if(f==="email_pre_scan"||f==="email-pre-scan")try{const h=JSON.parse(d);if(Ph(h))return s.jsx(Mh,{payload:h})}catch{}return s.jsx(uE,{lang:f,code:d})}return s.jsx("pre",{children:r})},table({children:r}){return s.jsx("div",{className:"md-table-wrap",children:s.jsx("table",{className:"md-table",children:r})})},a({href:r,children:i}){return s.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"md-link",children:i})},p({children:r}){return s.jsx("p",{className:"md-p",children:Nr(r)})},h1({children:r}){return s.jsx("h2",{className:"md-h2",children:Nr(r)})},h2({children:r}){return s.jsx("h3",{className:"md-h3",children:Nr(r)})},h3({children:r}){return s.jsx("h4",{className:"md-h4",children:Nr(r)})},ul({children:r}){return s.jsx("ul",{className:"md-ul",children:r})},ol({children:r}){return s.jsx("ol",{className:"md-ol",children:r})},li({children:r}){return s.jsx("li",{className:"md-li",children:Nr(r)})},blockquote({children:r}){return s.jsx("blockquote",{className:"md-blockquote",children:Nr(r)})},hr(){return s.jsx("hr",{className:"md-hr"})},td({children:r}){return s.jsx("td",{children:Nr(r)})},th({children:r}){return s.jsx("th",{children:Nr(r)})}},children:e}),t&&s.jsx("span",{className:"cursor"})]})}const gE=500,no="gaia_always_allow_tools",ct=_y((e,t)=>({notifications:[],showPanel:!1,typeFilter:null,addNotification:n=>e(r=>({notifications:[n,...r.notifications].slice(0,gE)})),dismiss:n=>e(r=>({notifications:r.notifications.map(i=>i.id===n?{...i,dismissed:!0}:i)})),markRead:n=>e(r=>({notifications:r.notifications.map(i=>i.id===n?{...i,read:!0}:i)})),markAllRead:()=>e(n=>({notifications:n.notifications.map(r=>({...r,read:!0}))})),clearAll:()=>e({notifications:[]}),setShowPanel:n=>e({showPanel:n}),setTypeFilter:n=>e({typeFilter:n}),respondToPermission:async(n,r,i)=>{var c;const l=t().notifications.find(u=>u.id===n),a=l==null?void 0:l.agentId,o=window.gaiaAPI;if((c=o==null?void 0:o.notification)!=null&&c.respondPermission)try{await o.notification.respondPermission(n,r,i)}catch(u){console.error("[notificationStore] Failed to send permission response via IPC:",u);return}else if(a)try{await My(a,r==="allow")}catch(u){console.error("[notificationStore] Failed to send permission response via REST:",u);return}if(r==="allow"&&i&&l!=null&&l.tool){const u=JSON.parse(localStorage.getItem(no)||"[]");u.includes(l.tool)||(u.push(l.tool),localStorage.setItem(no,JSON.stringify(u)))}e(u=>({notifications:u.notifications.map(d=>d.id===n?{...d,response:r,respondedAt:Date.now(),read:!0}:d)}))}})),qx=e=>e.notifications.filter(t=>!t.read&&!t.dismissed).length,yE=e=>{const t=e.notifications.filter(n=>!n.dismissed);return e.typeFilter?t.filter(n=>n.type===e.typeFilter):t},xE=e=>e.notifications.find(t=>t.type==="permission_request"&&!t.response&&!t.dismissed)??null,Qx="https://github.com/amd/gaia/issues/new",vE=[{label:"Image",extensions:new Set([".jpg",".jpeg",".png",".gif",".bmp",".tiff",".webp",".ico",".heic",".heif"]),message:"Image files cannot be indexed for text search.",alternatives:["Index PDFs that contain images — text is extracted automatically","Paste image descriptions or OCR text directly into the chat","Use GAIA's VLM agent for image analysis: gaia vlm"],featureTitle:"Support image file indexing and OCR"},{label:"Video",extensions:new Set([".mp4",".avi",".mkv",".mov",".wmv",".flv",".webm",".m4v"]),message:"Video files are not supported for indexing.",alternatives:["Extract subtitles or transcripts from videos and index those","Use GAIA's voice/talk mode for audio: gaia talk"],featureTitle:"Support video file indexing"},{label:"Audio",extensions:new Set([".mp3",".wav",".flac",".aac",".ogg",".wma",".m4a",".opus"]),message:"Audio files are not supported for indexing.",alternatives:["Use GAIA's voice mode for speech interaction: gaia talk","Transcribe audio to text first, then index the transcript"],featureTitle:"Support audio file transcription and indexing"},{label:"Archive",extensions:new Set([".zip",".rar",".7z",".tar",".gz",".bz2",".xz",".tgz"]),message:"Archive files must be extracted before indexing.",alternatives:["Extract the archive contents to a folder","Then index the folder or individual files from the Document Library"],featureTitle:"Support automatic archive extraction for indexing"},{label:"Executable",extensions:new Set([".exe",".msi",".dll",".so",".app",".dmg",".bin",".com"]),message:"Executable and binary files cannot be indexed.",alternatives:["Index source code files (.py, .js, .ts, .java, etc.) instead","Index documentation or README files from the project"],featureTitle:"Support binary file analysis"},{label:"Database",extensions:new Set([".sqlite",".db",".mdb",".accdb",".dbf"]),message:"Database files are not supported for direct indexing.",alternatives:["Export data to CSV or JSON format, then index those files","Use SQL queries to extract relevant data to a text file"],featureTitle:"Support database file indexing"},{label:"Microsoft Office",extensions:new Set([".doc",".docx",".ppt",".pptx",".xls"]),message:"Word, PowerPoint, and legacy Excel (.xls) files are not yet supported — GAIA does not currently ship parsers for these formats.",alternatives:["Save as PDF from Word or PowerPoint, then index the PDF","Re-save legacy .xls workbooks as .xlsx — GAIA supports modern Excel files"],featureTitle:"Support Microsoft Office (docx, pptx, xls) indexing"}];function Xs(e){const t=e.toLowerCase().startsWith(".")?e.toLowerCase():`.${e.toLowerCase()}`;for(const n of vE)if(n.extensions.has(t))return n;return null}const kE=new Set([".pdf",".txt",".md",".csv",".json",".xlsx",".html",".htm",".xml",".svg",".yaml",".yml",".py",".js",".ts",".java",".c",".cpp",".h",".rs",".go",".rb",".sh",".bat",".ps1",".log",".cfg",".ini",".toml"]);function ro(e){const t=e.toLowerCase().startsWith(".")?e.toLowerCase():`.${e.toLowerCase()}`;return kE.has(t)}function Kx(){const e="0.19.0",t=navigator.userAgent,n=navigator.platform||"unknown";return`**Environment:**
539
+ - GAIA Version: ${e}
540
+ - Platform: ${n}
541
+ - User Agent: ${t}
542
+ - Interface: Agent UI (Web)`}function Fh(e,t){const n=["## Feature Description","",`I would like GAIA to support: **${e}**`,"","## Use Case","","_Describe how you would use this feature:_","","## Current Workaround","","_Is there a workaround you are currently using?_","","---",Kx(),"","_Submitted from GAIA Agent UI_"].join(`
543
+ `),r=new URLSearchParams({title:`[Feature] ${e}`,body:n,labels:"enhancement,agent-ui"});return`${Qx}?${r.toString()}`}function zu(e,t){const n=["## Bug Description","",e,"","## Steps to Reproduce","","1. Open GAIA Agent UI","2. _Describe what you did:_","3. ","","## Expected Behavior","","_What did you expect to happen?_","","## Actual Behavior","","_What happened instead?_","","---",Kx(),"","_Submitted from GAIA Agent UI_"].join(`
544
+ `),r=new URLSearchParams({title:`[Bug] ${e}`,body:n,labels:"bug,agent-ui"});return`${Qx}?${r.toString()}`}function Yx({filename:e,error:t,onDismiss:n,timeout:r=15e3}){var m;const i=p.useRef(null);p.useEffect(()=>(r>0&&(i.current=setTimeout(n,r)),()=>{i.current&&clearTimeout(i.current)}),[n,r]);const l=e.includes(".")?"."+((m=e.split(".").pop())==null?void 0:m.toLowerCase()):"",a=l?Xs(l):null,o=t.toLowerCase().includes("unsupported file type")||t.toLowerCase().includes("not supported for indexing")||a!==null,c=t.toLowerCase().includes("fetch")||t.toLowerCase().includes("network")||t.toLowerCase().includes("connect");let u,d,f,h=kt;return o&&a?(u=`${a.label} files not supported`,d=a.message,f=Fh(a.featureTitle),h=gn):o?(u=`File type not supported: ${l}`,d="This file format cannot be indexed. Supported: PDF, TXT, MD, CSV, JSON, XLSX, HTML, XML, YAML, and 30+ code file formats.",f=Fh(`Support ${l} file indexing`),h=gn):c?(u="Connection error",d="Could not reach the GAIA server. Make sure the backend is running.",f=zu(`Upload connection error for ${e}`),h=kt):(u=`Failed to index "${e}"`,d=t||"An unexpected error occurred during indexing.",f=zu(`Indexing error: ${t.slice(0,80)}`),h=Kk),s.jsxs("div",{className:"upload-error-toast",role:"alert",children:[s.jsx(h,{size:16}),s.jsxs("div",{className:"upload-error-content",children:[s.jsx("div",{className:"upload-error-title",children:u}),s.jsxs("div",{className:"upload-error-detail",children:[d," ",o?s.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",children:"Request this feature →"}):s.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",children:"Report this issue →"})]})]}),s.jsx("button",{className:"upload-error-dismiss",onClick:n,"aria-label":"Dismiss",children:s.jsx(Ze,{size:14})})]})}function wE({sessionId:e,onClose:t}){const[n,r]=p.useState(!1),[i,l]=p.useState([]),[a,o]=p.useState([]),c=p.useRef(0),u=p.useRef(null),d=p.useCallback(m=>{l(g=>[...g,m])},[]);p.useEffect(()=>()=>{u.current&&(u.current.abort(),u.current=null)},[]);const f=p.useCallback(()=>{if(n)return;r(!0),l([]),o([]);const m=Py(e,"dashboard:refresh",{onChunk:g=>{},onAgentEvent:g=>{const k=++c.current,v=Date.now();g.type==="tool_start"?d({id:k,type:"tool",label:"Using tool",tool:g.tool,detail:g.detail,active:!0,timestamp:v}):g.type==="thinking"?d({id:k,type:"thinking",label:"Thinking",detail:g.content,active:!0,timestamp:v}):g.type==="tool_result"?(d({id:k,type:"tool",label:g.title||"Tool result",detail:g.summary,active:!1,success:g.success,timestamp:v}),o(x=>[...x,{id:k,title:g.title,summary:g.summary}])):g.type==="status"&&d({id:k,type:"status",label:g.message||"Working",detail:g.message,active:g.status==="working",timestamp:v})},onDone:g=>{E.stream.info("Dashboard stream done",g),r(!1)},onError:g=>{E.stream.error("Dashboard stream error",g),r(!1)}});u.current=m},[e,n,d]),h=p.useCallback(async()=>{try{await b0(e),r(!1),u.current&&(u.current.abort(),u.current=null)}catch(m){E.stream.error("Cancel request failed",m)}},[e]);return s.jsxs("div",{className:"dashboard-progress",children:[s.jsxs("div",{className:"dashboard-progress-bar",children:[s.jsxs("div",{className:"dashboard-progress-left",children:[s.jsx(mt,{className:`spin ${n?"visible":"hidden"}`}),s.jsx("strong",{className:"dashboard-title",children:"Refresh progress"})]}),s.jsxs("div",{className:"dashboard-controls",children:[s.jsx("button",{className:"btn btn-plain",onClick:()=>f(),disabled:n,title:"Start refresh",children:"Start"}),s.jsx("button",{className:"btn btn-plain",onClick:h,disabled:!n,title:"Cancel refresh",children:"Cancel"}),s.jsx("button",{className:"btn btn-plain",onClick:()=>{t&&t()},title:"Close",children:"Close"})]})]}),s.jsxs("div",{className:"dashboard-body",children:[s.jsx("div",{className:"dashboard-steps",children:s.jsx(Gx,{steps:i,isActive:n,variant:"inline"})}),s.jsxs("div",{className:"dashboard-surfaced",children:[s.jsx("h4",{children:"Surfaced"}),s.jsx("div",{className:"surfaced-list",children:a.map(m=>s.jsx("div",{className:"surfaced-card",children:s.jsxs("div",{className:"surfaced-card-body",children:[s.jsx("div",{className:"surfaced-card-title",children:m.title||"Result"}),s.jsx("div",{className:"surfaced-card-summary",children:m.summary})]})},m.id))})]})]})]})}const bE=["Summarize a document","Find a file on my computer","Analyze a spreadsheet","Show my recent files"],jE=/\s*\{\s*"?(?:tool|thought|goal)"?\s*:\s*"[^"]*"[^}]*(?:"?tool_args"?\s*:\s*\{[^}]*\})?\s*\}/g;function SE(e){const t=e.trim();if(!t.startsWith("{")||!t.includes('"thought"')&&!t.includes('"answer"')&&!t.includes('"goal"'))return e;try{const a=JSON.parse(t);if(a.answer!==void 0)return String(a.answer)}catch{}const n=t.indexOf('"answer"');if(n===-1)return"";const r=t.indexOf(":",n+8);if(r===-1)return"";let i=r+1;for(;i<t.length&&/\s/.test(t[i]);)i++;if(i>=t.length||t[i]!=='"')return"";let l=t.slice(i+1);return l.endsWith('"}')?l=l.slice(0,-2):l.endsWith('"')&&(l=l.slice(0,-1)),l.replace(/\\"/g,'"').replace(/\\n/g,`
545
+ `).replace(/\\\\/g,"\\")}function ra(e,t){var i;const n=++t.current,r=Date.now();switch(e.type){case"thinking":return{id:n,type:"thinking",label:"Thinking",detail:e.content,active:!0,timestamp:r};case"tool_start":return{id:n,type:"tool",label:"Using tool",tool:e.tool,detail:e.detail,active:!0,timestamp:r,mcpServer:e.mcp_server};case"plan":return{id:n,type:"plan",label:"Created plan",planSteps:e.steps,active:!1,success:!0,timestamp:r};case"step":return{id:n,type:"status",label:`Step ${e.step}${e.total?` of ${e.total}`:""}`,active:!0,timestamp:r};case"status":return(i=e.message)!=null&&i.startsWith("Agent: ")?null:{id:n,type:"status",label:e.message||e.status||"Working",active:e.status==="working",timestamp:r};case"agent_error":return{id:n,type:"error",label:"Error",detail:e.content,success:!1,active:!1,timestamp:r};case"policy_alert":{const l=e.tool||"unknown tool",a=e.reason||e.message||e.content||"Tool execution was blocked by governance policy.";return{id:n,type:"policy_alert",label:`Policy blocked ${l}`,detail:a,tool:l,decision:e.decision||"BLOCK",reason:a,ruleIds:e.rule_ids??[],policyVersion:e.policy_version,receiptId:e.receipt_id,success:!1,active:!1,timestamp:r}}default:return null}}function NE(e){return`policy-receipt-${encodeURIComponent(e)}`}function CE({sessionId:e,onCreateAgent:t,onAgentChange:n}){var Il,xi,xs;const{sessions:r,messages:i,setMessages:l,addMessage:a,removeMessage:o,removeMessagesFrom:c,updateSessionInList:u,isStreaming:d,streamingContent:f,setStreaming:h,setStreamContent:m,clearStreamContent:g,agentSteps:k,addAgentStep:v,updateLastAgentStep:x,appendThinkingContent:w,updateLastToolStep:j,clearAgentSteps:z,documents:D,setDocuments:_,setShowDocLibrary:A,setShowFileBrowser:C,setShowMemoryDashboard:R,isLoadingMessages:N,setLoadingMessages:U,systemStatus:O,agents:re,activeAgentId:oe,setActiveAgentId:te}=Se(),le=ct(L=>L.addNotification),fe=ct(L=>L.showPanel),T=ct(L=>L.setShowPanel),I=ct(L=>L.setTypeFilter),b=ct(qx),X=Se(L=>L.pendingPrompt),H=r.find(L=>L.id===e),S=new Set((H==null?void 0:H.document_ids)??[]),ie=D.filter(L=>S.has(L.id)),[ye,ae]=p.useState(""),[be,Ge]=p.useState(!1),[qe,Xe]=p.useState(""),[P,M]=p.useState(!1),[B,he]=p.useState(!1),[pe,ce]=p.useState([]),[ke,q]=p.useState([]),[Ce,Me]=p.useState(!1),[Qe,je]=p.useState(null),[Fe,Ht]=p.useState(null),[Mn,F]=p.useState(!1),[K,ue]=p.useState(!1),ve=p.useRef(null),Ne=(H==null?void 0:H.agent_type)||oe,wt=(Il=re.find(L=>L.id===(H==null?void 0:H.agent_type)))==null?void 0:Il.name,pt=(xi=re.find(L=>L.id===oe))==null?void 0:xi.name;p.useEffect(()=>{if(!K)return;const L=Q=>{ve.current&&!ve.current.contains(Q.target)&&ue(!1)};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[K]);const Ke=p.useCallback(async L=>{if(ue(!1),L===Ne)return;const Q=Ne;if(te(L),i.length===0){u(e,{agent_type:L});try{await ic(e,{agent_type:L})}catch{u(e,{agent_type:Q}),te(Q)}}else n==null||n(L)},[Ne,i.length,e,te,u,n]),[Pt,Jt]=p.useState(!1),it=p.useRef(""),Mt=p.useRef([]),bt=p.useRef(!1);p.useEffect(()=>{f&&(it.current=f)},[f]),p.useEffect(()=>{k.length>0&&(Mt.current=k.map(L=>({...L,active:!1})))},[k]),p.useEffect(()=>{if(!d&&bt.current){Jt(!0);const L=setTimeout(()=>{Jt(!1),it.current="",Mt.current=[]},350);return()=>clearTimeout(L)}bt.current=d},[d]);const vn=p.useRef(null),un=p.useRef(null),Zt=p.useRef(null),en=p.useRef(null),or=p.useRef(0),kn=p.useRef(!1),ms=p.useRef(()=>{}),wn=p.useRef(""),gt=p.useRef(null),Wn=p.useRef(null),cr=p.useRef(null),Tl=p.useRef(0),ur=p.useRef(!0),dr=p.useCallback(()=>{gt.current=null,wn.current&&m(wn.current)},[m]),fr=p.useRef(null),lt=p.useRef(0);p.useEffect(()=>{E.chat.info(`ChatView mounted for session=${e}, loading messages...`);const L=E.chat.time();U(!0);let Q=!1;const ee=(J=!1)=>{Rs(e).then(xe=>{if(Q)return;const ze=(xe.messages||[]).map(yt=>({...yt,agentSteps:yt.agentSteps||yt.agent_steps||void 0,stats:yt.stats||yt.inference_stats||void 0}));J?(l(ze),lt.current=ze.length,E.chat.timed(`Loaded ${ze.length} message(s) for session=${e}`,L)):ze.length!==lt.current&&!Se.getState().isStreaming&&(E.chat.info(`Messages changed externally: ${lt.current} -> ${ze.length}`),l(ze),lt.current=ze.length)}).catch(xe=>{Q||J&&(E.chat.error(`Failed to load messages for session=${e}`,xe),l([]))}).finally(()=>{!Q&&J&&U(!1)})};return ee(!0),fr.current=setInterval(()=>ee(!1),3e3),()=>{Q=!0,fr.current&&clearInterval(fr.current)}},[e,l,U]),p.useEffect(()=>{Ni().then(L=>_(L.documents||[])).catch(()=>{})},[_]),p.useEffect(()=>{const L=Se.getState().pendingPrompt;if(!L)return;E.chat.info(`Consuming pending prompt: "${L.slice(0,60)}"`),Se.getState().setPendingPrompt(null),ae(L);let Q=!1;return requestAnimationFrame(()=>{Q||ms.current(L)}),()=>{Q=!0}},[X]),p.useEffect(()=>{if(!ur.current)return;const Q=Date.now()-Tl.current,ee=100,J=()=>{var xe;Tl.current=Date.now(),(xe=vn.current)==null||xe.scrollIntoView({behavior:"smooth"})};Q>=ee&&J(),cr.current&&clearTimeout(cr.current),cr.current=setTimeout(J,ee)},[i,f,k]),p.useEffect(()=>{var L;(L=Zt.current)==null||L.focus()},[e]),p.useEffect(()=>()=>{en.current&&(en.current.abort(),en.current=null),gt.current!==null&&(cancelAnimationFrame(gt.current),gt.current=null),cr.current&&(clearTimeout(cr.current),cr.current=null),Wn.current&&(clearTimeout(Wn.current),Wn.current=null),Ht(null),wn.current="",q(L=>(L.forEach(Q=>{Q.url&&URL.revokeObjectURL(Q.url)}),[]))},[e]);const mr=p.useCallback(()=>{const L=un.current;if(!L)return;const Q=L.scrollHeight-L.scrollTop-L.clientHeight;ur.current=Q<=80,he(Q>200)},[]),hs=p.useCallback(()=>{var L;ur.current=!0,(L=vn.current)==null||L.scrollIntoView({behavior:"smooth"})},[]),bn=p.useCallback(()=>{E.stream.warn("User stopped generation"),en.current&&(en.current.abort(),en.current=null),gt.current!==null&&(cancelAnimationFrame(gt.current),gt.current=null);const L=Se.getState(),Q=wn.current||L.streamingContent;if(Q){E.stream.info(`Saving partial response (${Q.length} chars)`);const ee=L.agentSteps,J={id:Date.now()+1,session_id:e,role:"assistant",content:Q,created_at:new Date().toISOString(),rag_sources:null,agentSteps:ee.length>0?[...ee]:void 0};a(J)}wn.current="",h(!1),g(),ce([]),z()},[e,a,h,g,z]);p.useEffect(()=>{const L=Q=>{Q.key==="Escape"&&d&&(Q.preventDefault(),bn()),Q.key==="k"&&(Q.ctrlKey||Q.metaKey)&&(Q.preventDefault(),window.dispatchEvent(new CustomEvent("gaia:focus-search")))};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[d,bn]);const Gn=L=>{ae(L.target.value);const Q=L.target;Q.style.height="auto",Q.style.height=Math.min(Q.scrollHeight,200)+"px"},hr=p.useCallback(async L=>{var J;const Q=(J=L.clipboardData)==null?void 0:J.items;if(!Q)return;const ee=[];for(const xe of Array.from(Q))xe.type.startsWith("image/")&&ee.push(xe);if(ee.length!==0){L.preventDefault();for(const xe of ee){const ze=xe.getAsFile();if(!ze)continue;const yt=`attach-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,vr=URL.createObjectURL(ze),at={id:yt,file:ze,name:ze.name||`screenshot-${new Date().toISOString().slice(0,19).replace(/[T:]/g,"-")}.png`,url:vr,uploading:!0,uploaded:!1,isImage:!0};q(Et=>[...Et,at]),E.chat.info(`Pasted image: ${at.name} (${ze.size} bytes)`);try{const Et=await Rm(ze);q(St=>St.map(V=>V.id===yt?{...V,uploading:!1,uploaded:!0,serverUrl:Et.url}:V)),E.chat.info(`Upload complete: ${at.name} -> ${Et.url}`)}catch(Et){E.chat.error(`Upload failed: ${at.name}`,Et),q(St=>St.map(V=>V.id===yt?{...V,uploading:!1,error:"Upload failed"}:V))}}}},[]),zl=p.useCallback(async L=>{var ee;L.preventDefault(),L.stopPropagation(),M(!1);const Q=(ee=L.dataTransfer)==null?void 0:ee.files;if(!(!Q||Q.length===0))for(const J of Array.from(Q)){const xe=J.type.startsWith("image/"),ze=`attach-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,yt=xe?URL.createObjectURL(J):"",vr={id:ze,file:J,name:J.name,url:yt,uploading:!0,uploaded:!1,isImage:xe};q(at=>[...at,vr]),E.chat.info(`Dropped file: ${J.name} (${J.size} bytes, image=${xe})`);try{const at=await Rm(J);q(Et=>Et.map(St=>St.id===ze?{...St,uploading:!1,uploaded:!0,serverUrl:at.url}:St)),E.chat.info(`Upload complete: ${J.name} -> ${at.url}`)}catch(at){E.chat.error(`Upload failed: ${J.name}`,at),q(Et=>Et.map(St=>St.id===ze?{...St,uploading:!1,error:"Upload failed"}:St))}}},[]),Ll=p.useCallback(L=>{q(Q=>{const ee=Q.find(J=>J.id===L);return ee!=null&&ee.url&&URL.revokeObjectURL(ee.url),Q.filter(J=>J.id!==L)})},[]),jn=p.useCallback(async L=>{const Q=(L||ye).trim(),ee=ke.length>0&&ke.some(V=>V.uploaded);ur.current=!0;const J=(O==null?void 0:O.init_state)==="initializing";if(!Q&&!ee||d||J){!Q&&!ee&&E.chat.debug("Send blocked: empty message"),d&&E.chat.debug("Send blocked: already streaming"),J&&E.chat.debug("Send blocked: system initializing");return}let xe=Q;const ze=ke.filter(V=>V.uploaded&&V.serverUrl);if(ze.length>0){const V=ze.map(Z=>Z.isImage?`![${Z.name}](${Z.serverUrl})`:`[${Z.name}](${Z.serverUrl})`).join(`
546
+ `);xe=xe?`${xe}
547
+
548
+ ${V}`:V}E.chat.info(`Sending message to session=${e}`,{length:xe.length,preview:xe.slice(0,80)}),ae(""),Zt.current&&(Zt.current.style.height="auto",Zt.current.focus()),q(V=>(V.forEach(Z=>{Z.url&&URL.revokeObjectURL(Z.url)}),[]));const yt={id:Date.now(),session_id:e,role:"user",content:xe,created_at:new Date().toISOString(),rag_sources:null};a(yt),h(!0),g(),z(),ce([]),or.current=0,kn.current=!1,E.stream.info("Starting agent stream...");const vr=E.stream.time();let at="",Et=!1;wn.current="";const St=Py(e,xe,{onChunk:V=>{const Z=V.content||"";if(Z){V.type==="answer"?at=Z:(kn.current&&at.length>0&&(at+=`
549
+
550
+ `,kn.current=!1),at+=Z);let Te=at.replace(jE,"").trim();if(Te=SE(Te),Te){const dt=Te.lastIndexOf("{");if(dt>-1){const Ie=Te.slice(dt);/^\{\s*"(?:thought|answer|goal|tool)"/.test(Ie)&&(Ie.match(/\{/g)||[]).length>(Ie.match(/\}/g)||[]).length&&(Te=Te.slice(0,dt).trim())}}wn.current=Te,gt.current===null&&(gt.current=requestAnimationFrame(dr))}},onAgentEvent:V=>{var Te,dt,Ie;if(V.type==="tool_confirm"){if(!V.confirm_id){console.error("[ChatView] tool_confirm event missing confirm_id, ignoring");return}const Ae=V.tool||"";if(JSON.parse(localStorage.getItem(no)||"[]").includes(Ae)){w0(e,V.confirm_id,"allow",!1).catch(nt=>console.error("[ChatView] auto-confirm failed:",nt));return}const Vt={id:V.confirm_id,type:"permission_request",agentId:"chat",agentName:"GAIA",title:`Allow ${Ae}?`,message:`The agent wants to execute: ${Ae}`,timestamp:Date.now(),read:!1,dismissed:!1,priority:"high",tool:Ae,toolArgs:V.args,timeoutSeconds:V.timeout_seconds??60};le(Vt);return}if(V.type==="permission_request"){const Ae=V.tool||"";if(JSON.parse(localStorage.getItem(no)||"[]").includes(Ae)){My(e,!0).catch(nt=>console.error("[ChatView] auto-confirm failed:",nt));return}const{addNotification:Vt}=ct.getState();Vt({id:V.confirm_id??`perm-${Date.now()}`,type:"permission_request",agentId:e,agentName:"GAIA",title:`Allow ${Ae}?`,message:`The agent wants to execute: ${Ae}`,timestamp:Date.now(),read:!1,dismissed:!1,priority:"high",tool:Ae,toolArgs:V.args,timeoutSeconds:V.timeout_seconds??60});return}if(V.type==="policy_alert"){const Ae=V.tool||"unknown tool",Re=V.reason||V.message||V.content||"Tool execution was blocked by governance policy.",Vt={id:V.receipt_id??`policy-${Date.now()}-${or.current+1}`,type:"policy_alert",agentId:e,agentName:"GAIA",title:`Blocked: ${Ae} is restricted by policy.`,message:Re,timestamp:Date.now(),read:!1,dismissed:!1,priority:"critical",tool:Ae,decision:V.decision||"BLOCK",reason:Re,ruleIds:V.rule_ids??[],policyVersion:V.policy_version,receiptId:V.receipt_id};le(Vt);const nt=ra(V,or);nt&&v(nt),Ht({tool:Ae,receiptId:V.receipt_id}),Wn.current&&clearTimeout(Wn.current),Wn.current=setTimeout(()=>Ht(null),5200);return}if(V.type==="tool_end"){j({active:!1,success:V.success!==!1});return}if(V.type==="tool_result"){const Ae={result:V.summary||V.title||"Done",active:!1,success:V.success!==!1,latencyMs:V.latency_ms};V.command_output&&(Ae.commandOutput={command:V.command_output.command,stdout:V.command_output.stdout,stderr:V.command_output.stderr,returnCode:V.command_output.return_code,cwd:V.command_output.cwd,durationSeconds:V.command_output.duration_seconds,truncated:V.command_output.truncated}),(Te=V.result_data)!=null&&Te.chunks&&V.result_data.chunks.length>0&&(Ae.retrievalChunks=V.result_data.chunks.map(Re=>({id:Re.id,source:Re.source,sourcePath:Re.sourcePath,page:Re.page,score:Re.score,preview:Re.preview,content:Re.content}))),((dt=V.result_data)==null?void 0:dt.type)==="file_list"&&((Ie=V.result_data.files)==null?void 0:Ie.length)>0&&(Ae.fileList={files:V.result_data.files,total:V.result_data.total??V.result_data.files.length}),j(Ae);return}if(V.type==="tool_args"){j({detail:V.detail||JSON.stringify(V.args)});return}if(V.type==="thinking"){const Ae=Se.getState().agentSteps,Re=Ae[Ae.length-1];if(Re&&Re.type==="thinking"){w(V.content||"");return}const Vt=ra(V,or);Vt&&v(Vt);return}if(V.type==="status"){const Ae=V.status,Re=(V.message||"").trim();if(Re.toLowerCase().startsWith("executing "))return;if(Ae==="working"||Ae==="warning"||Ae==="info"){const Vt=Se.getState().agentSteps,nt=Vt[Vt.length-1];if(nt&&nt.type==="status"&&nt.active){x({label:Re||"Working",detail:Re});return}if(nt&&nt.type==="thinking"&&nt.active){x({label:Re||"Thinking"});return}const vs=ra(V,or);vs&&v(vs)}return}if(V.type==="step")return;const Z=ra(V,or);Z&&(v(Z),V.type==="tool_start"&&(kn.current=!0))},onDone:V=>{if(Et)return;Et=!0,gt.current!==null&&(cancelAnimationFrame(gt.current),gt.current=null),wn.current="";const Z=V.content||at;E.chat.timed(`Agent response complete: ${Z.length} chars`,vr);const Te=Se.getState().agentSteps.map(Ie=>({...Ie,active:!1})),dt=Te.some(Ie=>Ie.type==="policy_alert");if(Z||dt){lt.current=Se.getState().messages.length+1;const Ie={id:V.message_id||Date.now()+1,session_id:e,role:"assistant",content:Z,created_at:new Date().toISOString(),rag_sources:null,agentSteps:Te.length>0?Te:void 0,stats:V.stats||void 0};a(Ie)}if(ce(Te),h(!1),g(),z(),Zt.current&&Zt.current.focus(),setTimeout(()=>{Rs(e).then(Ie=>{if(Se.getState().currentSessionId!==e)return;const Ae=(Ie.messages||[]).map(Re=>({...Re,agentSteps:Re.agentSteps||Re.agent_steps||void 0,stats:Re.stats||Re.inference_stats||void 0}));l(Ae),lt.current=Ae.length}).catch(()=>{})},300),H&&H.title==="New Task"){const Ie=Q.slice(0,50)+(Q.length>50?"...":"");ic(e,{title:Ie}).then(()=>u(e,{title:Ie})).catch(Ae=>E.chat.error("Auto-title failed",Ae))}},onError:V=>{gt.current!==null&&(cancelAnimationFrame(gt.current),gt.current=null),wn.current="",E.chat.error(`Chat error for session=${e}`,V);let Z;const Te=V.message||"",dt=`
551
+
552
+ ---
553
+ *Unexpected error?* [Report it on GitHub](${zu(Te.slice(0,80))})`;Te.includes("Lemonade")||Te.includes("LLM")||Te.includes("Could not get response")?Z="Could not reach the LLM server. Make sure Lemonade Server is running:\n\n```\nlemonade-server serve\n```\n\nThen try sending your message again."+dt:V instanceof TypeError||Te.includes("fetch")||Te.includes("Failed to fetch")||Te.includes("NetworkError")?Z="Cannot connect to the GAIA server. Make sure the backend is running:\n\n```\ngaia chat --ui\n```"+dt:Te.includes("500")?Z="The server encountered an error. This usually means Lemonade Server is not running or the model failed to load.\n\nStart Lemonade Server with:\n```\nlemonade-server serve\n```"+dt:Te.includes("timed out")||Te.includes("timeout")||Te.includes("Timeout")?Z=`The request timed out. The query may be too complex — try breaking it into simpler questions.
554
+
555
+ If Lemonade Server is running but responses are slow, the model may need more resources.`+dt:Z=`Error: ${Te}`+dt;const Ie={id:Date.now()+2,session_id:e,role:"assistant",content:Z,created_at:new Date().toISOString(),rag_sources:null};a(Ie),h(!1),g(),z()},onAgentCreated:()=>{Ed().then(V=>Se.getState().setAgents(V.agents||[])).catch(()=>{})}},void 0,void 0,oe);en.current=St},[ye,ke,d,e,H,a,l,h,dr,g,u,v,x,w,j,z,oe,le]);ms.current=jn,p.useEffect(()=>{const L=Q=>{var xe;const J=(xe=Q.detail)==null?void 0:xe.text;typeof J=="string"&&J.trim()&&ms.current(J)};return window.addEventListener("gaia:send-message",L),()=>window.removeEventListener("gaia:send-message",L)},[]),p.useEffect(()=>{!d&&Zt.current&&Zt.current.focus()},[d]);const pr=p.useCallback(async L=>{d||(E.chat.info(`Deleting message ${L} from session=${e}`),je(L),setTimeout(async()=>{o(L),je(null);try{await x0(e,L)}catch(Q){E.chat.error(`Failed to delete message ${L}`,Q),Rs(e).then(ee=>{Se.getState().currentSessionId===e&&l(ee.messages||[])}).catch(()=>{})}},250))},[e,d,o,l]),jt=p.useCallback(async L=>{if(d||L.role!=="user")return;const Q=L.content;E.chat.info(`Resending message ${L.id} from session=${e}`,{preview:Q.slice(0,80)}),c(L.id);try{await v0(e,L.id)}catch(ee){E.chat.error(`Failed to delete messages from ${L.id}`,ee),Rs(e).then(J=>{Se.getState().currentSessionId===e&&l(J.messages||[])}).catch(()=>{});return}jn(Q)},[e,d,c,l,jn]),gr=L=>{L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),jn())},ps=()=>{Xe((H==null?void 0:H.title)||""),Ge(!0)},Rn=async()=>{qe.trim()&&qe!==(H==null?void 0:H.title)&&(await ic(e,{title:qe.trim()}),u(e,{title:qe.trim()})),Ge(!1)},qn=p.useCallback(async()=>{if(e)try{const L=await g0(e);u(e,{private:L.private})}catch(L){E.ui.warn("Failed to toggle private mode",L)}},[e,u]),yr=async()=>{try{const L=await y0(e),Q=new Blob([L.content],{type:"text/markdown"}),ee=URL.createObjectURL(Q),J=document.createElement("a");J.href=ee;const xe=((H==null?void 0:H.title)||"chat").replace(/[/\\:*?"<>|]/g,"_").slice(0,100);J.download=`${xe}.md`,J.click(),URL.revokeObjectURL(ee)}catch(L){E.chat.error("Export failed",L)}},Al=p.useCallback(async(L,Q)=>{L.stopPropagation();const ee=D.find(J=>J.id===Q);E.doc.info(`Detaching document from session: ${(ee==null?void 0:ee.filename)||Q}`);try{await C0(e,Q);const J=Se.getState().sessions.find(ze=>ze.id===e),xe=((J==null?void 0:J.document_ids)??[]).filter(ze=>ze!==Q);u(e,{document_ids:xe}),xe.length<=3&&Me(!1),E.doc.info(`Detached document from session: ${(ee==null?void 0:ee.filename)||Q}`)}catch(J){E.doc.error(`Failed to detach document: ${(ee==null?void 0:ee.filename)||Q}`,J)}},[D,e,u]),Dl=p.useCallback(async L=>{if(L.preventDefault(),L.stopPropagation(),M(!1),L.dataTransfer.files.length!==0)for(const Q of Array.from(L.dataTransfer.files)){E.doc.info(`Dropped on chat view: ${Q.name}`);try{const ee=await $y(Q);if(e&&(ee!=null&&ee.id))try{await Xa(e,ee.id);const J=Se.getState().sessions.find(ze=>ze.id===e),xe=(J==null?void 0:J.document_ids)??[];xe.includes(ee.id)||u(e,{document_ids:[...xe,ee.id]}),E.doc.info(`Auto-attached "${Q.name}" to session ${e}`)}catch(J){E.doc.warn(`Could not attach dropped document to session: ${J}`)}}catch(ee){E.doc.error(`Upload failed: ${Q.name}`,ee)}}},[e,u]),gs=L=>{L.preventDefault(),L.stopPropagation(),M(!0)},zo=L=>{L.preventDefault(),L.stopPropagation(),M(!1)},yi=L=>{ae(L),jn(L)},xr=!N&&i.length===0&&!d,ys=p.useMemo(()=>{const L=new Map;let Q;for(const ee of i)if(ee.role==="user"&&ee.created_at)Q=new Date(ee.created_at).getTime();else if(ee.role==="assistant"&&ee.created_at&&Q!==void 0){const J=new Date(ee.created_at).getTime();J>Q&&L.set(ee.id,J-Q),Q=void 0}return L},[i]);return s.jsxs("main",{className:`task-view ${P?"drag-active":""}`,onDrop:Dl,onDragOver:gs,onDragLeave:zo,children:[Mn&&s.jsx("div",{className:"dashboard-overlay",children:s.jsx(wE,{sessionId:e,onClose:()=>F(!1)})}),s.jsxs("header",{className:"task-header",children:[s.jsx("div",{className:"task-header-left",children:be?s.jsx("input",{className:"title-edit",value:qe,onChange:L=>Xe(L.target.value),onBlur:Rn,onKeyDown:L=>L.key==="Enter"&&Rn(),autoFocus:!0,"aria-label":"Edit task title"}):s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"task-title",children:(H==null?void 0:H.title)||"New Task"}),s.jsx("button",{className:"btn-icon-sm",onClick:ps,title:"Rename","aria-label":"Rename task",children:s.jsx(gw,{size:13})})]})}),s.jsxs("div",{className:"task-header-right",children:[s.jsxs("span",{className:`model-badge ${O!=null&&O.model_loaded?"":"no-model"}`,title:O!=null&&O.model_loaded&&(O!=null&&O.model_context_size)?`${O.model_loaded} · context window: ${O.model_context_size.toLocaleString()} tokens`:(O==null?void 0:O.model_loaded)||"No model loaded",children:[(O==null?void 0:O.model_loaded)||"No model loaded",(O==null?void 0:O.model_loaded)&&(O==null?void 0:O.model_context_size)!=null&&s.jsxs("span",{className:"model-ctx-size",children:[" · ",O.model_context_size%1024===0?`${O.model_context_size/1024}K`:O.model_context_size.toLocaleString()]})]}),s.jsx("button",{className:"btn-icon-sm",onClick:()=>A(!0),title:"Documents","aria-label":"Attach documents",children:s.jsx(pw,{size:15})}),s.jsx("button",{className:"btn-icon-sm",onClick:()=>C(!0),title:"Browse files","aria-label":"Browse files",children:s.jsx(hu,{size:15})}),s.jsx("button",{className:`btn-icon-sm${H!=null&&H.private?" active":""}`,onClick:qn,title:H!=null&&H.private?"Private mode on — click to disable":"Enable private mode (nothing saved to memory)","aria-label":H!=null&&H.private?"Disable private mode":"Enable private mode","aria-pressed":!!(H!=null&&H.private),children:s.jsx(my,{size:15})}),s.jsx("button",{className:"btn-icon-sm",onClick:()=>R(!0),title:"Memory","aria-label":"Open memory dashboard",children:s.jsx(ei,{size:15})}),s.jsx("button",{className:"btn-icon-sm",onClick:yr,title:"Export","aria-label":"Export task",children:s.jsx(ui,{size:15})}),s.jsx("button",{className:"btn-icon-sm",onClick:()=>F(L=>!L),title:"Refresh dashboard","aria-label":"Refresh dashboard",children:s.jsx(Em,{size:15})}),s.jsxs("button",{className:`notification-center-trigger ${b>0?"has-unread":""}`,onClick:()=>T(!fe),"aria-label":"Open notification center","aria-expanded":fe,title:"Notifications",children:[s.jsx(uy,{size:15}),b>0&&s.jsx("span",{className:"notification-center-trigger-badge",children:b>99?"99+":b})]})]})]}),ie.length>0&&(()=>{const L=[...ie].sort((J,xe)=>{const ze=J.last_accessed_at||J.indexed_at||"";return(xe.last_accessed_at||xe.indexed_at||"").localeCompare(ze)}),Q=Ce?L:L.slice(0,3),ee=L.length-3;return s.jsxs("div",{className:`doc-context-bar${Ce?" doc-context-expanded":""}`,"aria-label":`${ie.length} indexed document${ie.length!==1?"s":""}`,children:[s.jsx(sr,{size:12,className:"doc-context-icon"}),s.jsxs("span",{className:"doc-context-label",onClick:()=>A(!0),title:"Click to manage documents",role:"button",tabIndex:0,children:[ie.length," indexed"]}),s.jsxs("div",{className:`doc-context-pills${Ce?" doc-context-pills-expanded":""}`,children:[Q.map(J=>s.jsxs("span",{className:"doc-pill",title:J.filepath||J.filename,children:[s.jsx(zn,{size:9,className:"doc-pill-icon"}),s.jsx("span",{className:"doc-pill-name",children:J.filename}),s.jsx("button",{className:"doc-pill-remove",onClick:xe=>Al(xe,J.id),title:`Remove ${J.filename} from this session`,"aria-label":`Remove ${J.filename} from this session`,children:s.jsx(Ze,{size:10})})]},J.id)),!Ce&&ee>0&&s.jsxs("button",{className:"doc-pill-more",onClick:J=>{J.stopPropagation(),Me(!0)},title:"Show all indexed files","aria-label":`Show ${ee} more files`,children:["+",ee," more"]}),Ce&&ee>0&&s.jsx("button",{className:"doc-pill-collapse",onClick:J=>{J.stopPropagation(),Me(!1)},title:"Show fewer files","aria-label":"Collapse file list",children:"show less"})]})]})})(),s.jsxs("div",{className:"messages-scroll",ref:un,onScroll:mr,children:[N&&s.jsx("div",{className:"skeleton-messages","aria-label":"Loading messages",children:[0,1,2].map(L=>s.jsxs("div",{className:"skeleton-msg",children:[s.jsxs("div",{className:"skeleton-header",children:[s.jsx("div",{className:"skeleton-avatar"}),s.jsx("div",{className:"skeleton-role"})]}),s.jsxs("div",{className:"skeleton-lines",children:[s.jsx("div",{className:"skeleton-line"}),s.jsx("div",{className:"skeleton-line"}),L!==2&&s.jsx("div",{className:"skeleton-line"})]})]},L))}),xr&&s.jsxs("div",{className:"empty-task",children:[s.jsx("div",{className:"empty-task-icon",children:s.jsx(pu,{size:36,strokeWidth:1.2})}),s.jsx("h4",{className:"empty-task-title",children:"What can I help you with?"}),s.jsx("p",{className:"empty-task-desc",children:"Ask about your documents, search files, or analyze data — powered by local AI."}),s.jsx("div",{className:"empty-task-suggestions",children:bE.map(L=>s.jsx("button",{className:"empty-task-chip",onClick:()=>yi(L),children:L},L))})]}),i.map((L,Q)=>{const ee=!d&&!Pt&&L.role==="assistant"&&i.slice(Q+1).every(ze=>ze.role!=="assistant");if(Pt&&L.role==="assistant"&&Q===i.length-1)return null;const xe=ys.get(L.id);return s.jsx("div",{className:Qe===L.id?"msg-deleting":void 0,children:s.jsx($h,{message:L,showTerminalCursor:ee,agentSteps:L.role==="assistant"?L.agentSteps:void 0,onDelete:d?void 0:pr,onResend:!d&&L.role==="user"?jt:void 0,latencyMs:xe,agentName:L.role==="assistant"?wt:void 0})},L.id)}),(d||Pt)&&s.jsx("div",{className:`streaming-bubble ${Pt?"stream-ending":"stream-active"}`,children:s.jsx($h,{message:{id:-1,session_id:e,role:"assistant",content:(d?f:it.current)||"",created_at:"",rag_sources:null},isStreaming:d,showTerminalCursor:Pt,agentSteps:d?k:Mt.current,agentStepsActive:d&&k.some(L=>L.active),agentName:pt})}),s.jsx("div",{ref:vn})]}),B&&s.jsx("button",{className:"scroll-bottom-btn",onClick:hs,title:"Scroll to bottom","aria-label":"Scroll to bottom",children:s.jsx(Em,{size:16})}),P&&s.jsxs("div",{className:"drag-overlay",children:[s.jsx(yl,{size:32,strokeWidth:1.5}),s.jsx("span",{children:"Drop files to index"})]}),Fe&&s.jsxs("div",{className:"toast policy-alert-toast",role:"alert",children:[s.jsxs("span",{children:["Blocked: ",Fe.tool," is restricted by policy."]}),Fe.receiptId?s.jsx("button",{type:"button",className:"policy-alert-toast-link",onClick:()=>{const L=Fe.receiptId;L&&(I("policy_alert"),T(!0),window.setTimeout(()=>{var Q;(Q=document.getElementById(NE(L)))==null||Q.scrollIntoView({behavior:"smooth",block:"center"})},80))},children:"View receipt"}):s.jsx("span",{className:"policy-alert-toast-missing",children:"Receipt unavailable"})]}),s.jsxs("div",{className:"input-area",children:[s.jsxs("div",{className:`input-box ${ke.length>0?"has-attachments":""}`,onDrop:zl,onDragOver:L=>{L.preventDefault(),L.stopPropagation()},children:[s.jsxs("div",{className:"input-content",children:[ke.length>0&&s.jsx("div",{className:"attachment-strip",children:ke.map(L=>s.jsxs("div",{className:`attachment-preview ${L.error?"attachment-error":""}`,children:[L.isImage&&L.url?s.jsx("img",{src:L.url,alt:L.name,className:"attachment-thumb"}):s.jsx("div",{className:"attachment-file-icon",children:s.jsx(zn,{size:16})}),s.jsx("span",{className:"attachment-name",title:L.name,children:L.name.length>20?L.name.slice(0,17)+"...":L.name}),L.uploading&&s.jsx("span",{className:"attachment-spinner"}),L.error&&s.jsx("span",{className:"attachment-error-text",children:L.error}),s.jsx("button",{className:"attachment-remove",onClick:()=>Ll(L.id),title:"Remove","aria-label":`Remove ${L.name}`,children:s.jsx(Ze,{size:12})})]},L.id))}),s.jsx("textarea",{ref:Zt,className:"msg-input",value:ye,onChange:Gn,onKeyDown:gr,onPaste:hr,placeholder:"Type a message or paste an image... (Shift+Enter for new line)",rows:1,disabled:d||(O==null?void 0:O.init_state)==="initializing","aria-label":"Message input"})]}),s.jsxs("div",{className:"input-btns",children:[s.jsx("button",{className:"btn-icon-sm",onClick:()=>A(!0),title:"Upload document","aria-label":"Upload document",children:s.jsx(yl,{size:15})}),s.jsx("button",{className:"btn-icon-sm",onClick:()=>C(!0),title:"Browse files","aria-label":"Browse files",children:s.jsx(hu,{size:15})}),d?s.jsx("button",{className:"stop-btn",onClick:bn,title:"Stop generating","aria-label":"Stop generating",children:s.jsx(Sw,{size:14})}):s.jsx("button",{className:"send-btn",onClick:()=>jn(),disabled:!ye.trim()&&!ke.some(L=>L.uploaded),title:"Send (Enter)","aria-label":"Send message",children:s.jsx(vw,{size:16})})]})]}),s.jsxs("div",{className:"input-footer",children:[t&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"create-agent-btn",onClick:t,title:"Build a custom agent","aria-label":"Build a custom agent",children:s.jsx(gl,{size:10})}),re.length>1&&s.jsx("span",{className:"input-footer-sep"})]}),re.length>1&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"agent-picker",ref:ve,children:[s.jsxs("button",{className:"agent-picker-btn",onClick:()=>!d&&ue(L=>!L),title:"Switch agent","aria-label":"Switch agent",disabled:d,children:[s.jsx(qa,{size:10}),s.jsx("span",{children:((xs=re.find(L=>L.id===Ne))==null?void 0:xs.name)||"Agent"}),s.jsx(ci,{size:10})]}),K&&s.jsx("div",{className:"agent-picker-dropdown",children:re.map(L=>s.jsxs("button",{className:`agent-picker-option${L.id===Ne?" active":""}`,onClick:()=>Ke(L.id),children:[s.jsx(qa,{size:12}),s.jsx("span",{children:L.name})]},L.id))})]}),s.jsx("span",{className:"input-footer-sep"})]}),s.jsxs("span",{className:"input-footer-item",children:[s.jsx(xy,{size:10}),s.jsx("span",{children:"100% local & private"})]}),s.jsx("span",{className:"input-footer-sep"}),s.jsxs("span",{className:"input-footer-item",children:[s.jsx("kbd",{className:"kbd-hint",children:"Enter"}),s.jsx("span",{children:"send"})]}),s.jsxs("span",{className:"input-footer-item",children:[s.jsx("kbd",{className:"kbd-hint",children:"Shift+Enter"}),s.jsx("span",{children:"new line"})]}),d&&s.jsxs("span",{className:"input-footer-item",children:[s.jsx("kbd",{className:"kbd-hint",children:"Esc"}),s.jsx("span",{children:"stop"})]}),s.jsx("span",{className:"input-footer-sep"}),s.jsxs("span",{className:"input-footer-item",children:[s.jsx("kbd",{className:"kbd-hint",children:"Ctrl+K"}),s.jsx("span",{children:"search"})]}),s.jsxs("span",{className:"input-footer-item",children:[s.jsx("kbd",{className:"kbd-hint",children:"Ctrl+V"}),s.jsx("span",{children:"paste image"})]})]})]})]})}const _E={"message-circle":cw,"file-text":zn,"folder-search":hu,table:wy,globe:Nd,mail:vy,zap:qi,plug:xw,wrench:is,cpu:rs,hammer:tw,shield:Yn,code:fy,bot:qa};function Xx(e){return e&&_E[e]||qa}function EE(e){return e==="builtin"?s.jsx("span",{className:"agent-badge agent-badge-builtin",children:"Built-in"}):e==="native"?s.jsx("span",{className:"agent-badge agent-badge-native",children:"Native"}):e==="installed"?s.jsx("span",{className:"agent-badge agent-badge-installed",children:"Installed"}):s.jsx("span",{className:"agent-badge agent-badge-custom",children:"Custom"})}function TE({agent:e,isActive:t,isElectron:n,onSelect:r,onStartChat:i,onViewDetails:l}){var g,k;const o=!(e.source==="native")||n,c=(g=e.models)==null?void 0:g[0],u=e.tools_count??0,d=(k=e.conversation_starters)==null?void 0:k[0],f=e.required_connections??[],h=Xx(e.icon),m=["agent-hub-card",t&&"active",!o&&"disabled"].filter(Boolean).join(" ");return s.jsxs("div",{className:m,role:"button",tabIndex:o?0:-1,onClick:()=>o&&r(e.id),onKeyDown:v=>{o&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),r(e.id))},children:[s.jsxs("div",{className:"agent-hub-card-header",children:[s.jsx("div",{className:"agent-hub-card-icon",children:s.jsx(h,{size:18})}),s.jsxs("div",{className:"agent-hub-card-info",children:[s.jsx("h3",{className:"agent-hub-card-name",children:e.name}),s.jsxs("div",{className:"agent-hub-card-badges",children:[EE(e.source),e.language&&e.language!=="python"&&s.jsx("span",{className:"agent-badge agent-badge-native",children:e.language.toUpperCase()}),e.category&&e.category!=="general"&&s.jsx("span",{className:"agent-badge agent-badge-category",children:e.category})]})]})]}),s.jsx("p",{className:"agent-hub-card-desc",children:e.description||"Custom agent"}),s.jsxs("div",{className:"agent-hub-card-meta",children:[c&&s.jsxs("span",{className:"agent-hub-card-meta-item",children:[s.jsx(rs,{size:12}),c]}),u>0&&s.jsxs("span",{className:"agent-hub-card-meta-item",children:[s.jsx(is,{size:12}),u," tools"]}),f.length>0?s.jsxs("span",{className:"agent-hub-card-meta-item",children:[s.jsx(Yn,{size:12}),f.map(v=>v.connector_id).join(", ")]}):s.jsxs("span",{className:"agent-hub-card-meta-item",children:[s.jsx(Yn,{size:12}),"No special permissions"]})]}),d&&s.jsx("div",{className:"agent-hub-card-starter",children:d}),s.jsxs("div",{className:"agent-hub-card-actions",children:[s.jsx("button",{className:"btn-start-chat",disabled:!o,title:o?`Start chat with ${e.name}`:"Available in GAIA Desktop",onClick:v=>{v.stopPropagation(),i(e.id)},children:"Start Chat"}),s.jsx("button",{className:"btn-details",onClick:v=>{v.stopPropagation(),l(e)},children:"Details"})]})]})}const zE=typeof window<"u"&&!!window.electronAPI;function LE({agent:e,onClose:t,onStartChat:n}){const r=e.required_connections??[],i=e.tags??[],l=e.conversation_starters??[],a=e.models??[],o=e.tools_count??0,u=!(e.source==="native")||zE,d=Xx(e.icon),f=p.useCallback(h=>{h.key==="Escape"&&t()},[t]);return p.useEffect(()=>(document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)),[f]),s.jsx("div",{className:"agent-detail-overlay",onClick:t,children:s.jsxs("div",{className:"agent-detail-modal",role:"dialog","aria-modal":"true","aria-labelledby":"agent-detail-title",onClick:h=>h.stopPropagation(),children:[s.jsxs("div",{className:"agent-detail-header",children:[s.jsx("div",{className:"agent-detail-icon",children:s.jsx(d,{size:24})}),s.jsxs("div",{className:"agent-detail-title-area",children:[s.jsx("h2",{id:"agent-detail-title",className:"agent-detail-name",children:e.name}),s.jsxs("div",{className:"agent-hub-card-badges",children:[e.source==="builtin"&&s.jsx("span",{className:"agent-badge agent-badge-builtin",children:"Built-in"}),e.source==="native"&&s.jsx("span",{className:"agent-badge agent-badge-native",children:"Native"}),e.source==="custom_python"&&s.jsx("span",{className:"agent-badge agent-badge-custom",children:"Custom"}),e.source==="installed"&&s.jsx("span",{className:"agent-badge agent-badge-installed",children:"Installed"}),e.language&&e.language!=="python"&&s.jsx("span",{className:"agent-badge agent-badge-native",children:e.language.toUpperCase()}),e.category&&e.category!=="general"&&s.jsx("span",{className:"agent-badge agent-badge-category",children:e.category})]})]}),s.jsx("button",{className:"agent-detail-close",onClick:t,"aria-label":"Close",children:s.jsx(Ze,{size:18})})]}),s.jsxs("div",{className:"agent-detail-body",children:[s.jsxs("div",{className:"agent-detail-section",children:[s.jsx("div",{className:"agent-detail-section-title",children:"About"}),s.jsx("p",{className:"agent-detail-desc",children:e.description||"No description available."})]}),s.jsxs("div",{className:"agent-detail-section",children:[s.jsx("div",{className:"agent-detail-section-title",children:"Details"}),s.jsxs("div",{className:"agent-detail-meta-grid",children:[a.length>0&&s.jsxs("div",{className:"agent-detail-meta-item",children:[s.jsx(rs,{size:14}),s.jsxs("div",{children:[s.jsx("div",{className:"agent-detail-meta-label",children:"Model"}),s.jsx("div",{className:"agent-detail-meta-value",children:a[0]})]})]}),o>0&&s.jsxs("div",{className:"agent-detail-meta-item",children:[s.jsx(is,{size:14}),s.jsxs("div",{children:[s.jsx("div",{className:"agent-detail-meta-label",children:"Tools"}),s.jsx("div",{className:"agent-detail-meta-value",children:o})]})]}),e.min_memory_gb!=null&&s.jsxs("div",{className:"agent-detail-meta-item",children:[s.jsx(gy,{size:14}),s.jsxs("div",{children:[s.jsx("div",{className:"agent-detail-meta-label",children:"Min Memory"}),s.jsxs("div",{className:"agent-detail-meta-value",children:[e.min_memory_gb," GB"]})]})]}),a.length>1&&s.jsxs("div",{className:"agent-detail-meta-item",children:[s.jsx(rs,{size:14}),s.jsxs("div",{children:[s.jsx("div",{className:"agent-detail-meta-label",children:"Fallback"}),s.jsx("div",{className:"agent-detail-meta-value",children:a[1]})]})]})]})]}),s.jsxs("div",{className:"agent-detail-section",children:[s.jsx("div",{className:"agent-detail-section-title",children:"Access Rights"}),r.length>0?s.jsx("div",{className:"agent-detail-permissions",children:r.map((h,m)=>s.jsxs("div",{className:"agent-detail-permission",children:[s.jsx(Yn,{size:14}),s.jsx("span",{children:h.connector_id}),h.reason&&s.jsxs("span",{style:{color:"var(--text-muted)",fontSize:12},children:[" — ",h.reason]})]},m))}):s.jsx("p",{className:"agent-detail-no-permissions",children:"No special permissions required."})]}),i.length>0&&s.jsxs("div",{className:"agent-detail-section",children:[s.jsx("div",{className:"agent-detail-section-title",children:"Tags"}),s.jsx("div",{className:"agent-detail-tags",children:i.map(h=>s.jsx("span",{className:"agent-detail-tag",children:h},h))})]}),l.length>0&&s.jsxs("div",{className:"agent-detail-section",children:[s.jsx("div",{className:"agent-detail-section-title",children:"Try asking"}),s.jsx("div",{className:"agent-detail-starters",children:l.map(h=>s.jsx("button",{className:"agent-detail-starter-chip",disabled:!u,title:u?void 0:"Available in GAIA Desktop",onClick:()=>{n(e.id,h),t()},children:h},h))})]})]})]})})}const AE=typeof window<"u"&&!!window.electronAPI;function DE(e){const t={builtin:0,custom_python:1,installed:2,native:3};return[...e].sort((n,r)=>{const i=t[n.source]??1,l=t[r.source]??1;return i!==l?i-l:n.name.localeCompare(r.name)})}function IE({agents:e,activeAgentId:t,onSelect:n,onStartChat:r,onCreateAgent:i}){const[l,a]=p.useState(""),[o,c]=p.useState("all"),[u,d]=p.useState(null),f=e.length>6,h=p.useMemo(()=>{const g=new Set;return e.forEach(k=>{k.category&&k.category!=="general"&&g.add(k.category)}),Array.from(g).sort()},[e]),m=p.useMemo(()=>{let g=e;if(l){const k=l.toLowerCase();g=g.filter(v=>v.name.toLowerCase().includes(k)||v.description.toLowerCase().includes(k)||(v.tags??[]).some(x=>x.toLowerCase().includes(k))||(v.category??"").toLowerCase().includes(k))}return o!=="all"&&(g=g.filter(k=>k.category===o)),DE(g)},[e,l,o]);return s.jsxs("div",{className:"agent-hub",children:[s.jsxs("div",{className:"agent-hub-header",children:[s.jsx("span",{className:"agent-hub-title",children:"Choose Your Agent"}),f&&s.jsxs("div",{className:"agent-hub-controls",children:[s.jsxs("div",{className:"agent-hub-search",children:[s.jsx(Ln,{size:14}),s.jsx("input",{type:"text",placeholder:"Search agents...","aria-label":"Search agents",value:l,onChange:g=>a(g.target.value)})]}),h.length>0&&s.jsxs("select",{className:"agent-hub-filter","aria-label":"Filter by category",value:o,onChange:g=>c(g.target.value),children:[s.jsx("option",{value:"all",children:"All categories"}),h.map(g=>s.jsx("option",{value:g,children:g},g))]})]})]}),s.jsxs("div",{className:"agent-hub-grid",children:[m.length===0&&s.jsx("div",{className:"agent-hub-empty",children:"No agents match your search."}),m.map(g=>s.jsx(TE,{agent:g,isActive:g.id===t,isElectron:AE,onSelect:n,onStartChat:k=>r(k),onViewDetails:d},g.id)),i&&s.jsxs("div",{className:"agent-hub-card create-new",role:"button",tabIndex:0,onClick:i,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),i())},children:[s.jsx("div",{className:"create-icon",children:s.jsx(gl,{size:22})}),s.jsx("div",{className:"create-title",children:"Build a Custom Agent"}),s.jsx("div",{className:"create-desc",children:"Create a new agent through conversation"})]})]}),u&&s.jsx(LE,{agent:u,onClose:()=>d(null),onStartChat:r})]})}const Oh="GAIA",ia="Your private AI assistant, running 100% locally on AMD Ryzen AI",PE=65,ME=350;function Jx(e,t){return t===","||t==="."?60+Math.random()*50:t===" "?15+Math.random()*25:Math.random()<.35?8+Math.random()*12:Math.random()<.06?45+Math.random()*35:18+Math.random()*22}const RE=["Scan my Downloads and tell me what I should clean up","Index a folder of documents so I can chat about them","What have I been working on lately? Show my recent files","What hardware is in my PC? Tell me about my CPU and GPU"];function $E({onNewTask:e,onSendPrompt:t,onCreateAgent:n}){const{systemStatus:r,agents:i,activeAgentId:l,setActiveAgentId:a}=Se(),o=p.useMemo(()=>{var C;const A=i.find(R=>R.id===l);return(C=A==null?void 0:A.conversation_starters)!=null&&C.length?A.conversation_starters:RE},[i,l]),[c,u]=p.useState(""),[d,f]=p.useState(!1),[h,m]=p.useState(""),[g,k]=p.useState(!1),[v,x]=p.useState("title"),[w,j]=p.useState(!1),z=r!==null&&!r.initialized,D=(r==null?void 0:r.init_state)==="initializing",_=r!==null&&r.lemonade_running&&!r.model_loaded;return p.useEffect(()=>{let A=0;const C=setInterval(()=>{A++,A<=Oh.length?u(Oh.slice(0,A)):(clearInterval(C),f(!0))},PE);return()=>clearInterval(C)},[]),p.useEffect(()=>{if(!d)return;let A=!1;const C=setTimeout(()=>{if(A)return;x("subtitle");let N=0;const U=()=>{if(!A)if(N++,N<=ia.length){m(ia.slice(0,N));const O=ia[N-1],re=N>1?ia[N-2]:"",oe=Jx(O,re);R.current=setTimeout(U,oe)}else k(!0),x("done")};U()},ME),R={current:null};return()=>{A=!0,clearTimeout(C),R.current&&clearTimeout(R.current)}},[d]),p.useEffect(()=>{if(!g)return;const A=setTimeout(()=>j(!0),200);return()=>clearTimeout(A)},[g]),s.jsx("main",{className:"welcome",children:s.jsxs("div",{className:`welcome-inner ${w?"content-revealed":""}`,children:[s.jsxs("h1",{className:`welcome-title${d?" typing-done":""}`,children:[c.length>=4?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"gaia-glow",children:c.slice(0,4)}),s.jsx("span",{children:c.slice(4)})]}):c,v==="title"&&s.jsx("span",{className:`terminal-cursor${d?" blink":""}`})]}),s.jsx("p",{className:"welcome-sub",children:s.jsxs("span",{className:"typewriter-text",children:[h,(v==="subtitle"||v==="done")&&s.jsx("span",{className:`terminal-cursor terminal-cursor-sub${v==="done"?" blink":""}`})]})}),s.jsxs("span",{className:"welcome-version",children:["v","0.19.0"," ",s.jsx("span",{className:"beta-badge",children:"BETA"})]}),s.jsxs("div",{className:"features",children:[s.jsx(sa,{icon:s.jsx(xy,{size:22}),title:"Private",desc:"Data stays on your device",codeHint:"> encrypt --local",expandedDesc:"All processing happens on-device. No cloud, no tracking, complete data privacy."}),s.jsx(sa,{icon:s.jsx(qi,{size:22}),title:"Fast",desc:"NPU acceleration",codeHint:"> npu.accelerate()",expandedDesc:"Hardware-accelerated with AMD Ryzen AI NPU for real-time local inference."}),s.jsx(sa,{icon:s.jsx(zn,{size:22}),title:"Smart",desc:"Document Q&A",codeHint:'> rag.query("...")',expandedDesc:"RAG-powered document Q&A — index files and chat with their contents."}),s.jsx(sa,{icon:s.jsx(Zk,{size:22}),title:"Free",desc:"No subscriptions",codeHint:"> license: MIT",expandedDesc:"No API keys, no subscriptions, no hidden costs. Fully open-source."})]}),i.length>0&&s.jsx(IE,{agents:i,activeAgentId:l,onSelect:a,onStartChat:(A,C)=>{a(A),C?t(C):e()},onCreateAgent:n}),z&&s.jsxs("div",{className:"welcome-setup-hint",children:[s.jsx(Ya,{size:14}),s.jsxs("span",{children:[s.jsx("strong",{children:"First time?"})," Run ",s.jsx("code",{children:"gaia init --profile chat"})," in a terminal to install Lemonade Server and download the required AI model",r!=null&&r.default_model_size_gb?` (~${r.default_model_size_gb.toFixed(1)} GB).`:"."]})]}),!z&&_&&s.jsxs("div",{className:"welcome-setup-hint",children:[s.jsx(Ya,{size:14}),s.jsxs("span",{children:["No model loaded. Run ",s.jsx("code",{children:"gaia init --profile chat"})," to download",r!=null&&r.default_model_size_gb?` (~${r.default_model_size_gb.toFixed(1)} GB).`:"."]})]}),s.jsx("div",{className:"welcome-actions",children:s.jsx("button",{className:"btn-primary start-btn",onClick:e,disabled:D,children:"Start a New Task"})}),s.jsxs("div",{className:"suggestions",children:[s.jsx("span",{className:"suggestions-label",children:"Try asking:"}),s.jsx("div",{className:"suggestion-chips",children:o.map(A=>s.jsx("button",{className:"chip",onClick:()=>t(A),disabled:D,children:A},A))})]}),s.jsx("p",{className:"welcome-copyright",children:"© 2025–2026 Advanced Micro Devices, Inc. All rights reserved."})]})})}function sa({icon:e,title:t,desc:n,expandedDesc:r,codeHint:i}){const[l,a]=p.useState("idle"),[o,c]=p.useState(i),[u,d]=p.useState(""),f=p.useRef(null),h=()=>{a("erasing"),d("");let k=i.length;const v=()=>{if(k--,k>=0)c(i.slice(0,k)),f.current=setTimeout(v,15+Math.random()*20);else{a("typing"),c("");let x=0;const w=()=>{if(x++,x<=r.length){d(r.slice(0,x));const j=r[x-1],z=x>1?r[x-2]:"";f.current=setTimeout(w,Jx(j,z))}else a("done")};w()}};v()},m=()=>{f.current&&clearTimeout(f.current),a("idle"),c(i),d("")};p.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const g=l!=="idle";return s.jsxs("div",{className:`feature-card ${g?"feature-hovered":""}`,onMouseEnter:h,onMouseLeave:m,children:[s.jsx("div",{className:"feature-icon",children:e}),s.jsx("h3",{children:t}),s.jsx("p",{children:n}),s.jsxs("div",{className:"feature-terminal",children:[l==="idle"&&s.jsx("span",{className:"feature-code-hint",children:i}),l==="erasing"&&s.jsxs("span",{className:"feature-inline",children:[s.jsx("span",{className:"feature-code-hint feature-code-erasing",children:o}),s.jsx("span",{className:"terminal-cursor terminal-cursor-sm"})]}),(l==="typing"||l==="done")&&s.jsxs("span",{className:"feature-inline",children:[s.jsx("span",{className:"feature-expanded-text",children:u}),s.jsx("span",{className:`terminal-cursor terminal-cursor-sm${l==="done"?" blink":""}`})]})]})]})}function FE(e){const t=Math.floor((Date.now()-e)/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return`${n}m ${r}s`}function OE(e){try{const t=new Date(e);if(isNaN(t.getTime()))return"";const r=new Date().getTime()-t.getTime(),i=Math.floor(r/1e3),l=Math.floor(i/60),a=Math.floor(l/60),o=Math.floor(a/24);return i<60?"just now":l<60?`${l}m ago`:a<24?`${a}h ago`:o===1?"yesterday":o<7?`${o}d ago`:t.toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch{return""}}function UE(e){try{const t=new Date(e);return isNaN(t.getTime())?"":t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"})}catch{return""}}function BE(){const{documents:e,setDocuments:t,setShowDocLibrary:n,setShowFileBrowser:r,currentSessionId:i,sessions:l,updateSessionInList:a}=Se(),o=l.find(T=>T.id===i)??null,[c,u]=p.useState(!1),[d,f]=p.useState(!1),[h,m]=p.useState(""),[g,k]=p.useState(""),[v,x]=p.useState(null),w=p.useRef(new Map),[,j]=p.useState(0);p.useEffect(()=>{E.doc.info("Loading document library...");const T=E.doc.time();Ni().then(I=>{const b=I.documents||[];t(b),E.doc.timed(`Loaded ${b.length} document(s), ${I.total_chunks||0} chunks, ${I.total_size_bytes||0} bytes total`,T)}).catch(I=>{E.doc.error("Failed to load documents",I),t([])})},[t]);const z=e.some(T=>T.indexing_status==="indexing"||T.indexing_status==="pending");p.useEffect(()=>{if(!z)return;const T=Se.getState().documents;for(const X of T)(X.indexing_status==="indexing"||X.indexing_status==="pending")&&!w.current.has(X.id)&&w.current.set(X.id,Date.now());let I=!1;const b=setInterval(async()=>{if(j(X=>X+1),!I){I=!0;try{const H=Se.getState().documents.filter(S=>S.indexing_status==="indexing"||S.indexing_status==="pending");for(const S of H)try{const ie=await S0(S.id);if(ie.indexing_status!=="indexing"&&ie.indexing_status!=="pending"){w.current.delete(S.id);const ye=await Ni();t(ye.documents||[]);break}}catch{}}finally{I=!1}}},2e3);return()=>clearInterval(b)},[z,t]),p.useEffect(()=>{const T=new Set(e.filter(I=>I.indexing_status==="indexing"||I.indexing_status==="pending").map(I=>I.id));for(const I of w.current.keys())T.has(I)||w.current.delete(I)},[e]),p.useEffect(()=>{const T=setInterval(async()=>{try{const b=(await Ni()).documents||[],X=Se.getState().documents;(b.length!==X.length||b.some((S,ie)=>{const ye=X.find(ae=>ae.id===S.id);return!ye||ye.indexing_status!==S.indexing_status||ye.indexed_at!==S.indexed_at||ye.chunk_count!==S.chunk_count}))&&(t(b),E.doc.debug("Document list refreshed (server-side changes detected)"))}catch{}},15e3);return()=>clearInterval(T)},[t]);const D=e.reduce((T,I)=>T+I.file_size,0),_=e.reduce((T,I)=>T+I.chunk_count,0),A=T=>{if(T<=0)return"0 B";const I=1024,b=["B","KB","MB","GB"],X=Math.min(Math.floor(Math.log(T)/Math.log(I)),b.length-1);return parseFloat((T/Math.pow(I,X)).toFixed(1))+" "+b[X]},C=p.useCallback(async(T,I)=>{var H;const b=T.includes(".")?"."+((H=T.split(".").pop())==null?void 0:H.toLowerCase()):"";if(b&&!ro(b)){const S=Xs(b),ie=S?S.message:`The file type "${b}" is not supported for indexing.`;E.doc.warn(`Unsupported file type: ${T} (${b})`),x({filename:T,error:ie});return}E.doc.info(`Indexing document: ${T}`);const X=E.doc.time();f(!0),m(`Indexing ${T}...`),x(null);try{const S=await I();if(E.doc.timed(`Indexed "${T}": ${(S==null?void 0:S.chunk_count)||"?"} chunks`,X),i&&(S!=null&&S.id))try{await Xa(i,S.id);const ye=Se.getState().sessions.find(be=>be.id===i),ae=(ye==null?void 0:ye.document_ids)??[];ae.includes(S.id)||a(i,{document_ids:[...ae,S.id]}),E.doc.info(`Auto-attached "${T}" to session ${i}`)}catch(ye){E.doc.warn(`Could not attach document to session: ${ye}`)}const ie=await Ni();t(ie.documents||[]),m("")}catch(S){E.doc.error(`Failed to index "${T}"`,S);const ie=S instanceof Error?S.message:"Upload failed";x({filename:T,error:ie}),m("")}finally{f(!1)}},[i,a,t]),R=p.useCallback(async(T,I)=>{await C(I,()=>Ry(T))},[C]),N=p.useCallback(async T=>{await C(T.name,()=>$y(T))},[C]),U=p.useCallback(async T=>{T.preventDefault(),u(!1);const I=Array.from(T.dataTransfer.files);E.doc.info(`Dropped ${I.length} file(s) into Document Library`);for(const b of I)await N(b)},[N]),O=p.useCallback(async T=>{const I=e.find(b=>b.id===T);E.doc.info(`Deleting document: ${(I==null?void 0:I.filename)||T}`);try{await j0(T),w.current.delete(T),t(e.filter(b=>b.id!==T)),E.doc.info(`Deleted document: ${(I==null?void 0:I.filename)||T}`)}catch(b){E.doc.error(`Failed to delete document: ${(I==null?void 0:I.filename)||T}`,b)}},[e,t]),re=p.useCallback(async(T,I)=>{E.doc.info(`Opening folder for: ${T}`);try{await zd(T,!0)}catch(b){E.doc.error(`Failed to open folder for: ${I}`,b)}},[]),oe=p.useCallback(async T=>{const I=e.find(b=>b.id===T);E.doc.info(`Cancelling indexing for: ${(I==null?void 0:I.filename)||T}`);try{await N0(T),w.current.delete(T);const b=await Ni();t(b.documents||[]),E.doc.info(`Cancelled indexing for: ${(I==null?void 0:I.filename)||T}`)}catch(b){E.doc.error(`Failed to cancel indexing: ${(I==null?void 0:I.filename)||T}`,b)}},[e,t]),te=p.useCallback(async T=>{if(!i)return;const I=e.find(b=>b.id===T);E.doc.info(`Attaching document to session: ${(I==null?void 0:I.filename)||T}`);try{await Xa(i,T);const b=Se.getState().sessions.find(H=>H.id===i),X=(b==null?void 0:b.document_ids)??[];X.includes(T)||a(i,{document_ids:[...X,T]}),E.doc.info(`Attached "${(I==null?void 0:I.filename)||T}" to session ${i}`)}catch(b){E.doc.error(`Failed to attach document to session: ${(I==null?void 0:I.filename)||T}`,b)}},[i,e,a]),le=p.useCallback(async T=>{T.preventDefault(),g.trim()&&(E.doc.info(`Indexing from path input: ${g.trim()}`),await R(g.trim(),g.trim().split(/[\\/]/).pop()||"file"),k(""))},[g,R]),fe=T=>{const I=T.indexing_status||"complete",b=w.current.get(T.id),X=T.indexed_at?OE(T.indexed_at):"",H=T.indexed_at?UE(T.indexed_at):"";switch(I){case"indexing":case"pending":return s.jsxs("div",{className:"doc-indexing-status",children:[s.jsxs("div",{className:"doc-indexing-bar",children:[s.jsx("div",{className:"doc-indexing-bar-track",children:s.jsx("div",{className:"doc-indexing-bar-fill"})}),s.jsxs("span",{className:"doc-indexing-label",children:[s.jsx(aw,{size:12,className:"doc-spin"}),"Indexing",b?` (${FE(b)})`:"..."]})]}),s.jsxs("button",{className:"btn-cancel",onClick:S=>{S.stopPropagation(),oe(T.id)},title:"Cancel indexing","aria-label":`Cancel indexing ${T.filename}`,children:[s.jsx(Lm,{size:14}),"Cancel"]})]});case"failed":return s.jsxs("span",{className:"doc-status-badge doc-status-failed",children:[s.jsx(kt,{size:12})," Failed"]});case"cancelled":return s.jsxs("span",{className:"doc-status-badge doc-status-cancelled",children:[s.jsx(Lm,{size:12})," Cancelled"]});case"missing":return s.jsxs("span",{className:"doc-status-badge doc-status-missing",children:[s.jsx(kt,{size:12})," File missing"]});default:return s.jsxs("span",{className:"doc-meta",children:[A(T.file_size)," · ",T.chunk_count," chunks",X&&s.jsxs("span",{className:"doc-timestamp",title:`Indexed: ${H}`,children:[s.jsx(Qa,{size:10}),X]})]})}};return s.jsx("div",{className:"modal-overlay",onClick:()=>n(!1),role:"dialog","aria-modal":"true","aria-label":"Document Library",children:s.jsxs("div",{className:"modal-panel doc-modal",onClick:T=>T.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h3",{children:"Document Library"}),s.jsx("button",{className:"btn-icon",onClick:()=>n(!1),"aria-label":"Close document library",children:s.jsx(Ze,{size:18})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsx("div",{className:`drop-zone ${c?"drag-over":""} ${d?"uploading":""}`,onDragOver:T=>{T.preventDefault(),u(!0)},onDragLeave:()=>u(!1),onDrop:U,children:d?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"upload-spinner"}),s.jsx("p",{children:h})]}):s.jsxs(s.Fragment,{children:[s.jsx(yl,{size:32,strokeWidth:1.5}),s.jsx("p",{children:"Drop files here to index"}),s.jsx("span",{className:"drop-hint",children:"PDF, TXT, MD, code files, and 50+ formats"})]})}),s.jsxs("form",{className:"path-input-form",onSubmit:le,children:[s.jsx(Zn,{size:16,className:"path-icon"}),s.jsx("input",{type:"text",className:"path-input",value:g,onChange:T=>k(T.target.value),placeholder:"Or enter file path: C:\\docs\\manual.pdf","aria-label":"File path to index"}),s.jsx("button",{type:"submit",className:"btn-secondary",disabled:!g.trim()||d,children:"Index"}),s.jsxs("button",{type:"button",className:"btn-secondary",onClick:()=>{n(!1),r(!0)},title:"Browse files on this computer",children:[s.jsx(Ln,{size:14}),"Browse Files"]})]}),v&&s.jsx(Yx,{filename:v.filename,error:v.error,onDismiss:()=>x(null)}),e.length>0&&s.jsxs("div",{className:"doc-stats",children:[s.jsxs("span",{children:[e.length," document",e.length!==1?"s":""]}),s.jsx("span",{children:"·"}),s.jsxs("span",{children:[_," chunks"]}),s.jsx("span",{children:"·"}),s.jsx("span",{children:A(D)})]}),s.jsxs("div",{className:"doc-list",children:[e.length===0&&!d&&s.jsxs("div",{className:"empty-docs",children:[s.jsx(zn,{size:32,strokeWidth:1}),s.jsx("p",{children:"No documents indexed yet"}),s.jsx("span",{children:"Drop files above or enter a file path"})]}),e.map(T=>{var I;return s.jsxs("div",{className:`doc-row ${T.indexing_status==="indexing"?"doc-row-indexing":""}`,children:[s.jsxs("div",{className:"doc-info",children:[s.jsx("span",{className:"doc-name",children:T.filename}),fe(T)]}),s.jsxs("div",{className:"doc-row-actions",children:[T.filepath&&s.jsx("button",{className:"btn-icon-sm doc-open-folder",onClick:()=>re(T.filepath,T.filename),title:`Open folder: ${T.filepath}`,"aria-label":`Open containing folder for ${T.filename}`,children:s.jsx(Zn,{size:14})}),i&&T.indexing_status==="complete"&&!((I=o==null?void 0:o.document_ids)!=null&&I.includes(T.id))&&s.jsx("button",{className:"btn-icon-sm doc-attach",onClick:()=>te(T.id),title:"Use in current session","aria-label":`Attach ${T.filename} to current session`,children:s.jsx(lw,{size:14})}),T.indexing_status!=="indexing"&&T.indexing_status!=="pending"&&s.jsx("button",{className:"btn-icon-sm doc-delete",onClick:()=>O(T.id),title:"Remove","aria-label":`Remove ${T.filename}`,children:s.jsx(di,{size:14})})]})]},T.id)})]})]})]})})}function HE(e){if(e.type==="folder")return s.jsx(py,{size:16});const t=(e.extension||"").toLowerCase();return[".csv",".xlsx",".xls",".tsv"].includes(t)?s.jsx(wy,{size:16}):[".py",".js",".ts",".java",".c",".cpp",".go",".rs"].includes(t)?s.jsx(fy,{size:16}):[".pdf",".doc",".docx",".txt",".md"].includes(t)?s.jsx(zn,{size:16}):s.jsx(hy,{size:16})}function VE(e){if(e<=0)return"";const t=1024,n=["B","KB","MB","GB"],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/Math.pow(t,r)).toFixed(1))+" "+n[r]}function WE(e){if(!e)return"";const t=new Date(e),n=new Date,r=n.getTime()-t.getTime(),i=Math.floor(r/36e5);if(i<1)return"Just now";if(i<24)return`${i}h ago`;const l=Math.floor(i/24);return l<7?`${l}d ago`:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:t.getFullYear()!==n.getFullYear()?"numeric":void 0})}function GE(e){switch(e){case"home":return s.jsx(nw,{size:14});case"desktop":return s.jsx(uw,{size:14});case"documents":return s.jsx(zn,{size:14});case"download":return s.jsx(ui,{size:14});default:return s.jsx(py,{size:14})}}const qE=[{label:"All Files",value:""},{label:"Documents",value:"pdf,doc,docx,txt,md"},{label:"Spreadsheets",value:"csv,xlsx,xls,tsv"},{label:"Code",value:"py,js,ts,java,c,cpp,go,rs,rb,sh"},{label:"Data",value:"json,xml,yaml,yml,csv,tsv"}];async function Uh(e,t,n,r){var f;const i=[],l=[];for(const h of e){const m=h.includes(".")?"."+((f=h.split(".").pop())==null?void 0:f.toLowerCase()):"";m&&!ro(m)?l.push(h):i.push(h)}const a=[],o=[];let c=0,u="";const d=new Set(t.filter(h=>h.type==="folder").map(h=>h.path));for(const h of i)try{if(d.has(h)){const m=await E0(h),g=[];m.documents.forEach(k=>{k.id&&g.push(k.id)}),g.length>0&&(g.forEach(k=>a.push(k)),o.push(h))}else{const m=await Ry(h);m!=null&&m.id&&(a.push(m.id),o.push(h))}}catch(m){c++,u=m instanceof Error?m.message:"Unknown error"}if(n&&a.length>0){for(const k of a)try{await Xa(n,k)}catch(v){E.doc.warn(`Could not attach document to session: ${v}`)}const h=Se.getState().sessions.find(k=>k.id===n),m=(h==null?void 0:h.document_ids)??[],g=a.filter(k=>!m.includes(k));g.length>0&&r(n,{document_ids:[...m,...g]})}return{docIds:a,supported:i,succeededFiles:o,unsupported:l,failed:c,lastError:u}}function QE(){const{setShowFileBrowser:e,currentSessionId:t,updateSessionInList:n,setPendingPrompt:r}=Se(),[i,l]=p.useState(""),[a,o]=p.useState(null),[c,u]=p.useState([]),[d,f]=p.useState([]),[h,m]=p.useState(!1),[g,k]=p.useState(null),[v,x]=p.useState(""),[w,j]=p.useState(null),[z,D]=p.useState(!1),[_,A]=p.useState(""),[C,R]=p.useState(new Set),[N,U]=p.useState(null),[O,re]=p.useState(!1),[oe,te]=p.useState(new Set),[le,fe]=p.useState(null),T=p.useRef(null),[I,b]=p.useState(null),X=p.useCallback(async P=>{m(!0),k(null),j(null),x("");try{const M=await _0(P);l(M.current_path),o(M.parent_path),u(M.entries),M.quick_links.length>0&&f(M.quick_links),E.ui.info(`Browsing: ${M.current_path} (${M.entries.length} items)`)}catch(M){const B=M instanceof Error?M.message:"Failed to load directory";k(B),E.ui.error("Browse failed",M)}finally{m(!1)}},[]);p.useEffect(()=>{X()},[X]),p.useEffect(()=>()=>{T.current&&clearTimeout(T.current)},[]);const H=p.useCallback(async()=>{if(!v.trim()){j(null);return}D(!0),k(null);try{const P=await T0(v.trim(),_||void 0,30);j(P.results),E.ui.info(`Search "${v}": ${P.total} results`)}catch(P){const M=P instanceof Error?P.message:"Search failed";k(M),E.ui.error("Search failed",P)}finally{D(!1)}},[v,_]),S=P=>{P.key==="Enter"&&H()},ie=p.useCallback(P=>{P.type==="folder"&&(X(P.path),R(new Set),U(null))},[X]),ye=p.useCallback(async P=>{re(!0);try{const M=await z0(P);U(M)}catch(M){E.ui.error("Preview failed",M)}finally{re(!1)}},[]),ae=p.useCallback(async()=>{if(C.size===0)return;const P=Array.from(C);if(b(null),!P.some(B=>{var pe;const he=B.includes(".")?"."+((pe=B.split(".").pop())==null?void 0:pe.toLowerCase()):"";return!he||ro(he)})){const B=P[0],he=B.lastIndexOf("."),pe=he>0?B.slice(he).toLowerCase():"",ce=Xs(pe);b({filename:P.length===1?B.split(/[\\/]/).pop()||B:`${P.length} files`,error:ce?ce.message:`File type "${pe}" is not supported for indexing.`});return}te(new Set(P)),fe(`Indexing ${P.length} file(s)...`);try{const B=await Uh(P,c,t,n);if(B.failed>0)fe(`Done: ${B.docIds.length} indexed, ${B.failed} failed`),b({filename:`${B.failed} file(s)`,error:B.lastError||"Indexing failed for some files"});else{const he=B.unsupported.length>0?` (${B.unsupported.length} skipped — unsupported type)`:"";fe(`Successfully indexed ${B.docIds.length} file(s)${he}`)}T.current&&clearTimeout(T.current),T.current=setTimeout(()=>fe(null),5e3),R(new Set)}catch(B){E.doc.error("Index selected failed",B),b({filename:P.length===1?P[0].split(/[\\/]/).pop()||P[0]:`${P.length} files`,error:B instanceof Error?B.message:"An unexpected error occurred."})}finally{te(new Set)}},[C,t,n,c]),be=p.useCallback(async()=>{if(C.size===0)return;const P=Array.from(C);b(null),te(new Set(P)),fe(`Indexing ${P.length} file(s) for analysis...`);try{const M=await Uh(P,c,t,n);if(M.supported.length===0){const pe=P[0].lastIndexOf("."),ce=pe>0?P[0].slice(pe).toLowerCase():"",ke=Xs(ce);b({filename:P.length===1?P[0].split(/[\\/]/).pop()||P[0]:`${P.length} files`,error:(ke==null?void 0:ke.message)??`File type "${ce}" is not supported for indexing.`});return}if(M.docIds.length===0){b({filename:M.supported.length===1?M.supported[0].split(/[\\/]/).pop()||M.supported[0]:`${M.supported.length} files`,error:"Failed to index selected file(s). Please try again."});return}M.failed>0&&fe(`Warning: ${M.failed} file(s) failed to index and will be excluded.`);const B=(M.succeededFiles.length>0?M.succeededFiles:M.supported).map(pe=>pe.split(/[\\/]/).pop()||pe),he=B.length===1?`Please analyze this document for me: ${B[0]}`:`Please analyze these documents for me:
556
+ ${B.map(pe=>`- ${pe}`).join(`
557
+ `)}`;r(he),e(!1),R(new Set)}catch(M){E.doc.error("Ask Agent failed",M),b({filename:P.length===1?P[0].split(/[\\/]/).pop()||P[0]:`${P.length} files`,error:M instanceof Error?M.message:"An unexpected error occurred."})}finally{te(new Set),fe(null)}},[C,t,n,c,r,e]),Ge=i?i.replace(/\\/g,"/").split("/").filter(Boolean):[],qe=Ge.map((P,M)=>({label:P,path:Ge.slice(0,M+1).join("/")+(M===0&&P.includes(":")?"/":"")})),Xe=w?w.map(P=>({name:P.name,path:P.path,type:"file",size:P.size,extension:P.extension||"",modified:P.modified||""})):c;return s.jsx("div",{className:"modal-overlay",onClick:()=>e(!1),role:"dialog","aria-modal":"true","aria-label":"File Browser",children:s.jsxs("div",{className:`modal-panel file-browser-modal ${N?"has-preview":""}`,onClick:P=>P.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsxs("h3",{children:[s.jsx(Zn,{size:18})," File Browser"]}),s.jsx("button",{className:"btn-icon",onClick:()=>e(!1),"aria-label":"Close",children:s.jsx(Ze,{size:18})})]}),s.jsxs("div",{className:"file-browser-body",children:[s.jsx("div",{className:"fb-quick-links",children:d.map(P=>s.jsxs("button",{className:"fb-quick-link",onClick:()=>X(P.path),title:P.path,children:[GE(P.icon),s.jsx("span",{children:P.name})]},P.path))}),s.jsxs("div",{className:"fb-search-bar",children:[s.jsxs("div",{className:"fb-search-input-wrap",children:[s.jsx(Ln,{size:14,className:"fb-search-icon"}),s.jsx("input",{type:"text",className:"fb-search-input",placeholder:"Search files on your PC...",value:v,onChange:P=>x(P.target.value),onKeyDown:S,"aria-label":"Search files"}),v&&s.jsx("button",{className:"fb-search-clear",onClick:()=>{x(""),j(null)},"aria-label":"Clear search",children:s.jsx(Ze,{size:12})})]}),s.jsx("select",{className:"fb-type-filter",value:_,onChange:P=>A(P.target.value),"aria-label":"File type filter",children:qE.map(P=>s.jsx("option",{value:P.value,children:P.label},P.value))}),s.jsx("button",{className:"fb-search-btn",onClick:H,disabled:!v.trim()||z,children:z?"Searching...":"Search"})]}),!w&&s.jsxs("div",{className:"fb-breadcrumb",children:[s.jsx("button",{className:"fb-crumb",onClick:()=>X("/"),children:s.jsx(gy,{size:12})}),qe.map((P,M)=>s.jsxs("span",{className:"fb-crumb-item",children:[s.jsx(us,{size:12,className:"fb-crumb-sep"}),s.jsx("button",{className:"fb-crumb",onClick:()=>X(P.path),children:P.label})]},M)),a&&s.jsx("button",{className:"fb-up-btn",onClick:()=>X(a),title:"Go up",children:s.jsx(Qk,{size:14})})]}),w&&s.jsxs("div",{className:"fb-search-header",children:[s.jsxs("span",{children:["Found ",w.length,' result(s) for "',v,'"']}),s.jsx("button",{className:"fb-back-btn",onClick:()=>{j(null),x("")},children:"Back to browsing"})]}),g&&s.jsx("div",{className:"fb-error",children:g}),s.jsxs("div",{className:"fb-content",children:[s.jsxs("div",{className:"fb-file-list",children:[h&&s.jsx("div",{className:"fb-loading",children:"Loading..."}),!h&&Xe.length===0&&s.jsx("div",{className:"fb-empty",children:w?"No files found":"This folder is empty"}),!h&&Xe.map(P=>{var pe;const M=P.extension||(P.name.includes(".")?"."+((pe=P.name.split(".").pop())==null?void 0:pe.toLowerCase()):""),B=P.type==="file"&&M&&!ro(M),he=B?Xs(M):null;return s.jsxs("div",{className:`fb-entry ${P.type} ${C.has(P.path)?"selected":""} ${B?"unsupported":""}`,onClick:()=>P.type==="folder"?ie(P):ye(P.path),onDoubleClick:()=>P.type==="folder"?ie(P):void 0,title:B?`${(he==null?void 0:he.label)||"This"} file type cannot be indexed`:P.path,children:[s.jsx("input",{type:"checkbox",className:"fb-entry-checkbox",checked:C.has(P.path),onChange:()=>{R(ce=>{const ke=new Set(ce);return ke.has(P.path)?ke.delete(P.path):ke.add(P.path),ke})},onClick:ce=>ce.stopPropagation(),"aria-label":`Select ${P.name}`}),s.jsx("span",{className:"fb-entry-icon",children:HE(P)}),s.jsx("span",{className:"fb-entry-name",title:P.path,children:P.name}),B&&s.jsx("span",{className:"fb-unsupported-badge",children:"Not indexable"}),s.jsx("span",{className:"fb-entry-size",children:P.type==="file"?VE(P.size):""}),s.jsx("span",{className:"fb-entry-date",children:WE(P.modified)})]},P.path)})]}),N&&s.jsxs("div",{className:"fb-preview",children:[s.jsxs("div",{className:"fb-preview-header",children:[s.jsx("span",{className:"fb-preview-name",children:N.name}),s.jsx("button",{className:"btn-icon-sm",onClick:()=>U(null),"aria-label":"Close preview",children:s.jsx(Ze,{size:14})})]}),s.jsxs("div",{className:"fb-preview-meta",children:[s.jsx("span",{children:N.size_display}),N.total_lines&&s.jsxs("span",{children:[N.total_lines," lines"]}),N.columns&&s.jsxs("span",{children:[N.columns.length," columns"]}),N.row_count!==null&&s.jsxs("span",{children:[N.row_count," rows"]})]}),N.columns&&s.jsxs("div",{className:"fb-preview-columns",children:[s.jsx("strong",{children:"Columns:"})," ",N.columns.join(", ")]}),O?s.jsx("div",{className:"fb-preview-loading",children:"Loading preview..."}):N.is_text&&N.preview_lines.length>0?s.jsx("pre",{className:"fb-preview-content",children:N.preview_lines.slice(0,30).join(`
558
+ `)}):s.jsx("div",{className:"fb-preview-binary",children:"Binary file - no preview available"})]})]}),I&&s.jsx(Yx,{filename:I.filename,error:I.error,onDismiss:()=>b(null)}),s.jsxs("div",{className:"fb-actions",children:[s.jsx("div",{className:"fb-selection-info",children:C.size>0?`${C.size} item(s) selected`:"Select files to index or analyze"}),le&&s.jsx("span",{className:"fb-index-status",children:le}),s.jsxs("div",{className:"fb-action-btns",children:[s.jsxs("button",{className:"fb-action-btn secondary",onClick:ae,disabled:C.size===0||oe.size>0,title:"Index selected files for RAG search",children:[s.jsx(yl,{size:14}),"Index Selected"]}),s.jsxs("button",{className:"fb-action-btn primary",onClick:be,disabled:C.size===0||oe.size>0,title:"Index and send selected files to the chat agent for analysis",children:[s.jsx(ei,{size:14}),"Ask Agent"]})]})]})]})]})})}const Yd="/api";async function Pe(e,t,n){const r=`${Yd}${t}`,i={};e!=="GET"&&(i["X-Gaia-UI"]="1"),n!==void 0&&(i["Content-Type"]="application/json");const l={method:e,headers:Object.keys(i).length>0?i:void 0,body:n!==void 0?JSON.stringify(n):void 0},a=await fetch(r,l);if(!a.ok){const c=await a.text().catch(()=>"");let u=c;try{u=JSON.parse(c).detail||c}catch{}throw new Error(u||`Memory API error (HTTP ${a.status})`)}if((a.headers.get("content-type")||"").includes("application/json"))return a.json()}function Zx(e){const t=[];for(const[n,r]of Object.entries(e))if(!(r==null||r===""))if(Array.isArray(r))for(const i of r)t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`);else t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`);return t.length?`?${t.join("&")}`:""}function KE(){return Pe("GET","/memory/stats")}function YE(e=30){return Pe("GET",`/memory/activity?days=${e}`)}function XE(e={}){return Pe("GET",`/memory/knowledge${Zx(e)}`)}function JE(e){return Pe("POST","/memory/knowledge",e)}function Bh(e,t){return Pe("PUT",`/memory/knowledge/${encodeURIComponent(e)}`,t)}function ZE(e){return Pe("DELETE",`/memory/knowledge/${encodeURIComponent(e)}`)}function eT(){return Pe("GET","/memory/entities")}function tT(){return Pe("GET","/memory/tools")}function nT(e=20){return Pe("GET",`/memory/conversations?limit=${e}`)}function rT(e,t=20){return Pe("GET",`/memory/conversations/search?query=${encodeURIComponent(e)}&limit=${t}`)}function iT(e){return Pe("GET",`/memory/conversations/${encodeURIComponent(e)}`)}function sT(e=7){return Pe("GET",`/memory/upcoming?days=${e}`)}function lT(){return Pe("GET","/memory/embedding-coverage")}function aT(){return Pe("POST","/memory/consolidate")}function oT(){return Pe("POST","/memory/rebuild-embeddings")}function cT(){return Pe("POST","/memory/reconcile")}function uT(){return Pe("POST","/memory/rebuild-fts")}function dT(){return Pe("POST","/memory/refresh-system-context")}function fT(){return new EventSource(`${Yd}/memory/stream-discovery`)}function mT(e){return new EventSource(`${Yd}/memory/stream-inference?include_browser=${e}`)}function hT(e){return Pe("POST","/memory/commit-discovery",{items:e})}function pT(e){return Pe("POST","/memory/commit-inference",{insights:e})}function gT(){return Pe("GET","/memory/settings")}function wi(e){return Pe("PUT","/memory/settings",e)}function yT(){return Pe("DELETE","/memory/all")}function xT(){return Pe("POST","/memory/reinitialize")}function vT(){return Pe("GET","/goals/stats")}function kT(e={}){return Pe("GET",`/goals${Zx(e)}`)}function wT(e){return Pe("POST","/goals",e)}function bT(e){return Pe("PUT",`/goals/${encodeURIComponent(e)}/approve`)}function jT(e){return Pe("PUT",`/goals/${encodeURIComponent(e)}/reject`)}function ST(e){return Pe("PUT",`/goals/${encodeURIComponent(e)}/cancel`)}function NT(e){return Pe("DELETE",`/goals/${encodeURIComponent(e)}`)}function Hh(e){if(!e)return"—";try{const t=new Date(e);if(isNaN(t.getTime()))return"—";const n={month:"short",day:"numeric"};return t.getFullYear()!==new Date().getFullYear()&&(n.year="numeric"),t.toLocaleDateString(void 0,n)}catch{return"—"}}function Cn(e){if(!e)return"";try{const t=new Date(e);return isNaN(t.getTime())?"":t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return""}}function Cr(e){if(!e)return"—";try{const t=new Date(e);if(isNaN(t.getTime()))return"—";const n=Date.now(),r=t.getTime()-n,i=Math.abs(r),l=Math.floor(i/1e3),a=Math.floor(i/6e4),o=Math.floor(i/36e5),c=Math.floor(i/864e5);return r<0?l<5?"just now":l<60?`${l}s ago`:o===0?`${a}m ago`:c===0?`${o}h ago`:c===1?"yesterday":c<30?`${c}d ago`:Cn(e):l<5?"now":l<60?`in ${l}s`:o===0?`in ${a}m`:c===0?`in ${o}h`:c===1?"tomorrow":c<30?`in ${c}d`:Cn(e)}catch{return"—"}}function CT(e){if(e<=0)return"0 B";const t=1024,n=["B","KB","MB","GB"],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/Math.pow(t,r)).toFixed(1))+" "+n[r]}function _T(e){return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function Vh(e){try{return new Date(e).getTime()<Date.now()}catch{return!1}}function ET(e){return e>=.7?"high":e>=.4?"medium":"low"}function Wh(e){return e>=.9?"high":e>=.7?"medium":"low"}function TT(e,t){const n=Hh(e),r=Hh(t);return n==="—"&&r==="—"?"":n===r?n:`${n} – ${r}`}function zT(e){if(e.length===0)return 0;const t=new Date().toISOString().slice(0,10),n=e.find(r=>r.date===t);return n?n.knowledge_added:0}const Gh=["fact","preference","error","skill","note","reminder"],LT={work:"blue",technical:"purple",personal:"green",general:"gray"};function AT(){var nf,rf,sf,lf,af,of,cf,uf,df,ff,mf,hf,pf,gf,yf,xf;const{setShowMemoryDashboard:e}=Se(),[t,n]=p.useState(null),[r,i]=p.useState([]),[l,a]=p.useState(null),[o,c]=p.useState([]),[u,d]=p.useState([]),[f,h]=p.useState([]),[m,g]=p.useState(null),[k,v]=p.useState([]),[x,w]=p.useState(!0),[j,z]=p.useState(null),[D,_]=p.useState(null),[A,C]=p.useState(!1),[R,N]=p.useState(null),[U,O]=p.useState([]),re=p.useRef(0),[oe,te]=p.useState([]),[le,fe]=p.useState(""),[T,I]=p.useState(""),[b,X]=p.useState(""),[H,S]=p.useState("updated_at"),[ie,ye]=p.useState("desc"),[ae,be]=p.useState(0),[Ge,qe]=p.useState(!1),Xe=15,[P,M]=p.useState(""),[B,he]=p.useState(null),pe=p.useRef(null),[ce,ke]=p.useState(null),[q,Ce]=p.useState(!1),[Me,Qe]=p.useState(null),[je,Fe]=p.useState({content:"",category:"fact",domain:"",context:"global",entity:"",sensitive:!1,due_at:""}),[Ht,Mn]=p.useState(new Set),[F,K]=p.useState(!1),[ue,ve]=p.useState(!1),[Ne,wt]=p.useState(!1),[pt,Ke]=p.useState(!1),[Pt,Jt]=p.useState(!1),[it,Mt]=p.useState(!1),[bt,vn]=p.useState(null),[un,Zt]=p.useState("dashboard"),[en,or]=p.useState([]),[kn,ms]=p.useState(null),[wn,gt]=p.useState(!1),[Wn,cr]=p.useState(null),[Tl,ur]=p.useState(!1),[dr,fr]=p.useState({title:"",description:"",priority:"medium"}),[lt,mr]=p.useState("idle"),[hs,bn]=p.useState([]),[Gn,hr]=p.useState([]),[zl,Ll]=p.useState(null),jn=p.useRef(null),pr=p.useRef(null),[jt,gr]=p.useState("idle"),[ps,Rn]=p.useState([]),[qn,yr]=p.useState([]),[Al,Dl]=p.useState(null),[gs,zo]=p.useState(!1),yi=p.useRef(null),xr=p.useRef(null),[ys,Il]=p.useState(30),[xi,xs]=p.useState(!1),[L,Q]=p.useState(!1),[ee,J]=p.useState(!1),[xe,ze]=p.useState(!1),[yt,vr]=p.useState(!1),[at,Et]=p.useState(!1),St=p.useRef(null),V=p.useRef(null),Z=p.useCallback((y,$="info")=>{const se=++re.current;O(me=>[...me,{id:se,text:y,type:$}]),setTimeout(()=>{O(me=>me.filter(Oe=>Oe.id!==se))},4e3)},[]);p.useEffect(()=>{if(!A)return;const y=$=>{V.current&&!V.current.contains($.target)&&C(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[A]),p.useEffect(()=>{const y=$=>{$.key==="Escape"&&(bt?vn(null):Pt?Jt(!1):it?Mt(!1):ce?ke(null):A?C(!1):q||Me?(Ce(!1),Qe(null)):R?N(null):e(!1))};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[ce,A,q,Me,R,e,bt,Pt,it]);const Te=p.useCallback(async()=>{try{const y=await KE();n(y)}catch(y){E.system.warn("Failed to load memory stats",y)}},[]),dt=p.useCallback(async()=>{try{const y=await YE(ys);i(y)}catch(y){E.system.warn("Failed to load memory activity",y)}},[ys]),Ie=p.useCallback(async()=>{try{const y=await XE({category:oe.length>0?oe:void 0,context:le||void 0,entity:T||void 0,search:b||void 0,sort_by:H,order:ie,offset:ae,limit:Xe,include_sensitive:!0,include_superseded:Ge});a(y)}catch(y){E.system.warn("Failed to load knowledge",y)}},[oe,le,T,b,H,ie,ae,Ge]),Ae=p.useCallback(async()=>{try{const y=await tT();c(y)}catch(y){E.system.warn("Failed to load tool summary",y)}},[]),Re=p.useCallback(async()=>{try{const y=await nT(20);d(y)}catch(y){E.system.warn("Failed to load conversations",y)}},[]),Vt=p.useCallback(async()=>{try{const y=await sT(7);h(y)}catch(y){E.system.warn("Failed to load upcoming items",y)}},[]),nt=p.useCallback(async()=>{try{const y=await lT();g(y)}catch(y){E.system.warn("Failed to load embedding coverage",y)}},[]),vs=p.useCallback(async()=>{try{const y=await eT();v(y||[])}catch(y){E.system.warn("Failed to load entities",y)}},[]),Jd=p.useCallback(async()=>{try{const y=await gT();ve(y.mcp_memory_enabled),K(y.memory_enabled),wt(y.system_discovery_consent)}catch(y){E.system.warn("Failed to load memory settings",y)}},[]),kr=p.useCallback(async()=>{gt(!0);try{const[y,$]=await Promise.all([kT(),vT()]);or(y.goals),ms($)}catch(y){E.system.warn("Failed to load goals",y)}finally{gt(!1)}},[]),Rt=p.useCallback(async()=>{w(!0),z(null);try{await Promise.all([Te(),dt(),Ie(),Ae(),Re(),Vt(),nt(),vs(),Jd(),kr()])}catch(y){z("Failed to load memory data. Is the backend running?"),E.system.error("Memory dashboard load failed",y)}finally{w(!1)}},[Te,dt,Ie,Ae,Re,Vt,nt,vs,Jd,kr]);p.useEffect(()=>{Rt()},[Rt]),p.useEffect(()=>{Ie()},[Ie]);const Zd=p.useRef(!0);p.useEffect(()=>{if(Zd.current){Zd.current=!1;return}dt()},[dt]);const tv=p.useCallback(y=>{X(y),Et(!0),St.current&&clearTimeout(St.current),St.current=setTimeout(()=>{be(0),Et(!1)},300)},[]),nv=p.useCallback(async()=>{if(je.content.trim())try{await JE({content:je.content,category:je.category,domain:je.domain||void 0,context:je.context,entity:je.entity||void 0,sensitive:je.sensitive,due_at:je.due_at||void 0}),Ce(!1),Fe({content:"",category:"fact",domain:"",context:"global",entity:"",sensitive:!1,due_at:""}),Ie(),Te(),nt(),E.ui.info("Created new knowledge entry"),Z("Memory created successfully","success")}catch(y){E.system.error("Failed to create knowledge",y),Z("Failed to create memory","error")}},[je,Ie,Te,nt,Z]),rv=p.useCallback(async()=>{if(!(!Me||!je.content.trim()))try{await Bh(Me,{content:je.content,category:je.category,domain:je.domain||void 0,context:je.context,entity:je.entity||void 0,sensitive:je.sensitive,due_at:je.due_at||void 0}),Qe(null),Fe({content:"",category:"fact",domain:"",context:"global",entity:"",sensitive:!1,due_at:""}),Ie(),E.ui.info(`Updated knowledge ${Me}`),Z("Memory updated","success")}catch(y){E.system.error("Failed to update knowledge",y),Z("Failed to update memory","error")}},[Me,je,Ie,Z]),iv=p.useCallback(async y=>{try{await ZE(y),Ie(),Te(),nt(),E.ui.info(`Deleted knowledge ${y}`),Z("Memory deleted","info")}catch($){E.system.error("Failed to delete knowledge",$),Z("Failed to delete memory","error")}},[Ie,Te,nt,Z]),sv=p.useCallback(async y=>{try{await Bh(y.id,{sensitive:!y.sensitive}),Ie(),E.ui.info(`Toggled sensitive for ${y.id}: ${!y.sensitive}`),Z(y.sensitive?"Unmarked as sensitive":"Marked as sensitive","info")}catch($){E.system.error("Failed to toggle sensitive",$),Z("Failed to toggle sensitive flag","error")}},[Ie,Z]),lv=p.useCallback(y=>{Qe(y.id),Ce(!1),Fe({content:y.content,category:y.category,domain:y.domain||"",context:y.context,entity:y.entity||"",sensitive:y.sensitive,due_at:y.due_at||""})},[]),av=p.useCallback(y=>{navigator.clipboard.writeText(y).catch(()=>{}),E.ui.info(`Copied knowledge ID: ${y}`),Z("ID copied to clipboard","info")},[Z]),ov=p.useCallback(y=>{if(M(y),pe.current&&clearTimeout(pe.current),!y.trim()){he(null);return}pe.current=setTimeout(async()=>{try{const $=await rT(y.trim(),20);he($)}catch($){E.system.warn("Conversation search failed",$)}},300)},[]),ef=p.useCallback(async y=>{try{const $=await iT(y);ke({sessionId:y,turns:$})}catch($){E.system.error("Failed to load conversation detail",$)}},[]),cv=p.useCallback(y=>{te($=>$.includes(y)?$.filter(se=>se!==y):[...$,y]),be(0)},[]),ks=p.useCallback(y=>{H===y?ye($=>$==="desc"?"asc":"desc"):(S(y),ye("desc")),be(0)},[H]),uv=p.useCallback(async()=>{xs(!0),C(!1);try{const y=await aT();await Rt(),Z(`Consolidated ${y.consolidated??0} sessions, extracted ${y.extracted_items??0} items`,"success")}catch(y){E.system.error("Failed to consolidate sessions",y),Z("Failed to consolidate sessions","error")}finally{xs(!1)}},[Rt,Z]),dv=p.useCallback(async()=>{Q(!0),C(!1);try{const y=await oT();await nt(),Z(`Backfilled ${y.backfilled??0} embeddings${y.total_without?` (${y.total_without} were missing)`:""}`,"success")}catch(y){E.system.error("Failed to rebuild embeddings",y),Z("Failed to rebuild embeddings","error")}finally{Q(!1)}},[nt,Z]),fv=p.useCallback(async()=>{J(!0),C(!1);try{const y=await cT();await Rt(),Z(`Checked ${y.pairs_checked??0} pairs: ${y.reinforced??0} reinforced, ${y.contradicted??0} contradicted`,"success")}catch(y){E.system.error("Failed to reconcile memory",y),Z("Failed to reconcile memory","error")}finally{J(!1)}},[Rt,Z]),mv=p.useCallback(async()=>{ze(!0),C(!1);try{await uT(),await Rt(),Z("FTS indexes rebuilt successfully","success")}catch(y){E.system.error("Failed to rebuild FTS index",y),Z("Failed to rebuild FTS indexes","error")}finally{ze(!1)}},[Rt,Z]),hv=p.useCallback(async()=>{vr(!0),C(!1);try{const y=await dT();await Rt(),y.skipped?Z("System context collection is disabled — enable it in settings","error"):Z(`System context refreshed: ${y.stored} facts updated`,"success")}catch(y){E.system.error("Failed to refresh system context",y),Z("Failed to refresh system context","error")}finally{vr(!1)}},[Rt,Z]),tf=xi||L||ee||xe||yt,pv=p.useCallback(()=>{mr("running"),bn([]),hr([]),Ll(null);const y=fT();pr.current=y,y.onmessage=$=>{try{const se=JSON.parse($.data);if(se.type==="log")bn(me=>[...me,{text:se.message,kind:"log"}]);else if(se.type==="finding"){const me=se.item;bn(Oe=>[...Oe,{text:` Found: ${me.content}`,kind:"finding"}]),hr(Oe=>[...Oe,{...me,_checked:!0}])}else se.type==="error"?bn(me=>[...me,{text:` Error: ${se.message}`,kind:"error"}]):se.type==="done"&&(y.close(),pr.current=null,bn(me=>[...me,{text:`Done. ${se.total??0} items discovered.`,kind:"log"}]),mr("review"))}catch{bn(se=>[...se,{text:"Failed to parse event data.",kind:"error"}])}},y.onerror=()=>{y.close(),pr.current=null,bn($=>[...$,{text:"Connection error. Is the GAIA server running?",kind:"error"}]),hr($=>(mr($.length>0?"review":"idle"),$))}},[]),gv=p.useCallback(async()=>{const y=Gn.filter($=>$._checked);if(y.length!==0){mr("saving");try{const $=y.map(({_checked:me,...Oe})=>Oe),se=await hT($);Ll(se.stored),mr("done"),Z(`Saved ${se.stored} items to memory`,"success")}catch($){E.system.error("Failed to commit discovery items",$),Z("Failed to save discovery items","error"),mr("review")}}},[Gn,Z]),yv=p.useCallback(()=>{gr("running"),Rn([]),yr([]),Dl(null);const y=mT(gs);xr.current=y,y.onmessage=$=>{try{const se=JSON.parse($.data);if(se.type==="log")Rn(me=>[...me,{text:se.message,kind:"log"}]);else if(se.type==="insight"){const me=se.item;Rn(Oe=>[...Oe,{text:` Insight: ${me.content}`,kind:"finding"}]),yr(Oe=>[...Oe,{...me,_checked:!0}])}else se.type==="error"?Rn(me=>[...me,{text:` Error: ${se.message}`,kind:"error"}]):se.type==="done"&&(y.close(),xr.current=null,Rn(me=>[...me,{text:`Done. ${se.total??0} insights generated.`,kind:"log"}]),gr("review"))}catch{Rn(se=>[...se,{text:"Failed to parse event data.",kind:"error"}])}},y.onerror=()=>{y.close(),xr.current=null,Rn($=>[...$,{text:"Connection error. Is Lemonade Server running?",kind:"error"}]),yr($=>(gr($.length>0?"review":"idle"),$))}},[gs]),xv=p.useCallback(async()=>{const y=qn.filter($=>$._checked);if(y.length!==0){gr("saving");try{const $=y.map(({_checked:me,...Oe})=>Oe),se=await pT($);Dl(se.stored),gr("done"),Z(`Saved ${se.stored} insights to memory`,"success")}catch($){E.system.error("Failed to commit inference insights",$),Z("Failed to save inference insights","error"),gr("review")}}},[qn,Z]);p.useEffect(()=>{jn.current&&(jn.current.scrollTop=jn.current.scrollHeight)},[hs]),p.useEffect(()=>{yi.current&&(yi.current.scrollTop=yi.current.scrollHeight)},[ps]),p.useEffect(()=>()=>{pr.current&&(pr.current.close(),pr.current=null),xr.current&&(xr.current.close(),xr.current=null)},[]);const ws=y=>H!==y?null:s.jsx("span",{className:"mem-sort-arrow",children:ie==="desc"?"↓":"↑"}),Pl=Math.max(1,...r.map(y=>y.conversations+y.tool_calls+y.knowledge_added+y.errors)),vv=(nf=t==null?void 0:t.knowledge)!=null&&nf.by_context?Object.keys(t.knowledge.by_context):[];return s.jsxs("div",{className:"memory-dashboard-page",children:[s.jsxs("div",{className:"memory-dashboard-header",children:[s.jsxs("div",{className:"memory-dashboard-header-left",children:[s.jsx("button",{className:"btn-icon settings-back-btn",onClick:()=>e(!1),"aria-label":"Back",children:s.jsx(cy,{size:18})}),s.jsxs("h3",{children:["Memory Dashboard ",s.jsx("span",{style:{fontSize:11,fontWeight:600,color:"#f59e0b",background:"rgba(245,158,11,0.15)",padding:"2px 8px",borderRadius:4,marginLeft:8,verticalAlign:"middle",letterSpacing:"0.5px"},children:"BETA"})]})]}),s.jsxs("div",{className:"memory-dashboard-header-actions",children:[m&&m.total_items>0&&s.jsxs("div",{className:"mem-embedding-coverage",title:`${m.with_embedding} of ${m.total_items} entries embedded`,children:[s.jsx("div",{className:"mem-embedding-bar",children:s.jsx("div",{className:"mem-embedding-fill",style:{width:`${Math.round(m.coverage_pct)}%`}})}),s.jsxs("span",{className:"mem-embedding-label",children:[Math.round(m.coverage_pct),"% embedded"]})]}),s.jsxs("div",{className:"mem-maintenance-wrap",ref:V,children:[s.jsxs("button",{className:`btn-icon ${tf?"mem-spinning":""}`,onClick:()=>C(y=>!y),title:"Maintenance actions","aria-label":"Maintenance actions","aria-expanded":A,children:[tf?s.jsx("div",{className:"mem-spinner-sm"}):s.jsx(Si,{size:16}),s.jsx(ci,{size:10,style:{marginLeft:2}})]}),A&&s.jsxs("div",{className:"mem-maintenance-menu",role:"menu",children:[s.jsxs("button",{className:"mem-maintenance-item",onClick:uv,disabled:xi,role:"menuitem",children:[s.jsx(zm,{size:14}),xi?"Consolidating...":"Consolidate Sessions"]}),s.jsxs("button",{className:"mem-maintenance-item",onClick:dv,disabled:L,role:"menuitem",children:[s.jsx(qi,{size:14}),L?"Rebuilding...":"Rebuild Embeddings"]}),s.jsxs("button",{className:"mem-maintenance-item",onClick:fv,disabled:ee,role:"menuitem",children:[s.jsx(ji,{size:14}),ee?"Reconciling...":"Reconcile Memory"]}),s.jsx("div",{className:"mem-maintenance-divider"}),s.jsxs("button",{className:"mem-maintenance-item",onClick:hv,disabled:yt,role:"menuitem",children:[s.jsx(qs,{size:14}),yt?"Refreshing...":"Refresh System Context"]}),s.jsx("div",{className:"mem-maintenance-divider"}),s.jsxs("button",{className:"mem-maintenance-item",onClick:mv,disabled:xe,role:"menuitem",children:[s.jsx(Ln,{size:14}),xe?"Rebuilding...":"Rebuild FTS Indexes"]})]})]}),s.jsx("button",{className:"btn-icon",onClick:Rt,title:"Refresh","aria-label":"Refresh dashboard",children:s.jsx(qs,{size:16})})]})]}),s.jsxs("div",{className:"mem-tab-bar",role:"tablist",children:[s.jsxs("button",{className:`mem-tab-btn${un==="dashboard"?" mem-tab-active":""}`,onClick:()=>Zt("dashboard"),role:"tab","aria-selected":un==="dashboard",children:[s.jsx(ei,{size:14})," Dashboard"]}),s.jsxs("button",{className:`mem-tab-btn${un==="goals"?" mem-tab-active":""}`,onClick:()=>{Zt("goals"),kr()},role:"tab","aria-selected":un==="goals",children:[s.jsx(Am,{size:14})," Goals",kn&&(kn.goals.pending_approval??0)>0&&s.jsx("span",{className:"mem-tab-badge",children:kn.goals.pending_approval})]}),s.jsxs("button",{className:`mem-tab-btn${un==="profile"?" mem-tab-active":""}`,onClick:()=>Zt("profile"),role:"tab","aria-selected":un==="profile",children:[s.jsx(Cw,{size:14})," Profile"]})]}),s.jsxs("div",{className:"memory-dashboard-body",children:[un==="dashboard"&&s.jsx(s.Fragment,{children:x&&!t?s.jsxs("div",{className:"mem-loading",children:[s.jsx("div",{className:"mem-spinner"}),"Loading memory data..."]}):j?s.jsxs("div",{className:"mem-empty",children:[s.jsx("div",{className:"mem-empty-icon",children:s.jsx(gn,{size:32})}),s.jsx("p",{children:j}),s.jsxs("button",{className:"btn-secondary",onClick:Rt,style:{marginTop:12},children:[s.jsx(qs,{size:14})," Retry"]})]}):s.jsxs(s.Fragment,{children:[!F&&s.jsxs("div",{className:"mem-empty-state",style:{margin:"40px 0"},children:[s.jsx("div",{className:"mem-empty-icon",style:{opacity:.5},children:s.jsx(Yn,{size:32})}),s.jsx("p",{style:{color:"#888",fontSize:14},children:"Memory is disabled. Enable it in Settings below to start storing knowledge, conversations, and preferences."})]}),F&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mem-stat-cards",children:[s.jsxs("div",{className:"mem-stat-card","data-accent":"purple",children:[s.jsx("div",{className:"mem-stat-value",children:((rf=t==null?void 0:t.knowledge)==null?void 0:rf.total)??0}),s.jsx("div",{className:"mem-stat-label",children:"Stored"}),s.jsx("div",{className:"mem-stat-sub",children:(()=>{var $;const y=zT(r);return y>0?`+${y} today`:($=t==null?void 0:t.knowledge)!=null&&$.by_category?Object.entries(t.knowledge.by_category).slice(0,3).map(([se,me])=>`${me} ${se}s`).join(", "):"No entries"})()})]}),s.jsxs("div",{className:"mem-stat-card","data-accent":"gold",children:[s.jsx("div",{className:"mem-stat-value",children:((sf=t==null?void 0:t.knowledge)==null?void 0:sf.total_retrievals)??0}),s.jsx("div",{className:"mem-stat-label",children:"Retrieved"}),s.jsx("div",{className:"mem-stat-sub",children:(lf=t==null?void 0:t.knowledge)!=null&&lf.total&&((af=t==null?void 0:t.knowledge)!=null&&af.total_retrievals)?`avg ${(t.knowledge.total_retrievals/t.knowledge.total).toFixed(1)}x per memory`:"No recalls yet"})]}),s.jsxs("div",{className:"mem-stat-card","data-accent":"blue",children:[s.jsx("div",{className:"mem-stat-value",children:((of=t==null?void 0:t.conversations)==null?void 0:of.total_sessions)??0}),s.jsx("div",{className:"mem-stat-label",children:"Sessions"}),s.jsx("div",{className:"mem-stat-sub",children:TT(((cf=t==null?void 0:t.conversations)==null?void 0:cf.first_session)??null,((uf=t==null?void 0:t.conversations)==null?void 0:uf.last_session)??null)||`${((df=t==null?void 0:t.conversations)==null?void 0:df.total_turns)??0} total turns`})]}),s.jsxs("div",{className:"mem-stat-card","data-accent":"green",children:[s.jsx("div",{className:"mem-stat-value",children:((ff=t==null?void 0:t.tools)==null?void 0:ff.total_calls)??0}),s.jsx("div",{className:"mem-stat-label",children:"Tool Calls"}),s.jsxs("div",{className:"mem-stat-sub",children:[((mf=t==null?void 0:t.tools)==null?void 0:mf.unique_tools)??0," tools"]})]}),s.jsxs("div",{className:"mem-stat-card","data-accent":"red",children:[s.jsx("div",{className:"mem-stat-value",children:((hf=t==null?void 0:t.tools)==null?void 0:hf.overall_success_rate)!=null?`${Math.round(t.tools.overall_success_rate*100)}%`:"—"}),s.jsx("div",{className:"mem-stat-label",children:"Success Rate"}),s.jsxs("div",{className:"mem-stat-sub",children:[((pf=t==null?void 0:t.tools)==null?void 0:pf.total_errors)??0," errors"]})]})]}),s.jsxs("div",{className:"mem-section",children:[s.jsxs("div",{className:"mem-section-title mem-section-title-row",children:[s.jsxs("span",{className:"mem-section-title-left",children:[s.jsx(Dm,{size:14})," Activity"]}),s.jsx("div",{className:"mem-range-tabs",role:"group","aria-label":"Activity range",children:[1,7,30].map(y=>s.jsx("button",{className:`mem-range-tab${ys===y?" active":""}`,onClick:()=>Il(y),children:y===1?"1D":y===7?"7D":"30D"},y))})]}),r.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mem-activity-chart",children:r.map((y,$)=>{const se=y.conversations+y.tool_calls+y.knowledge_added+y.errors,me=$===0||$===r.length-1||$%7===0,Oe=new Date(y.date+"T00:00:00").toLocaleDateString(void 0,{month:"short",day:"numeric"});return s.jsxs("div",{className:"mem-activity-bar-group",onMouseEnter:()=>_($),onMouseLeave:()=>_(null),children:[y.errors>0&&s.jsx("div",{className:"mem-activity-bar errors",style:{height:`${y.errors/Pl*100}%`}}),y.knowledge_added>0&&s.jsx("div",{className:"mem-activity-bar knowledge",style:{height:`${y.knowledge_added/Pl*100}%`}}),y.tool_calls>0&&s.jsx("div",{className:"mem-activity-bar tool_calls",style:{height:`${y.tool_calls/Pl*100}%`}}),y.conversations>0&&s.jsx("div",{className:"mem-activity-bar conversations",style:{height:`${y.conversations/Pl*100}%`}}),me&&s.jsx("span",{className:"mem-activity-date-label",children:Oe}),D===$&&se>0&&s.jsxs("div",{className:"mem-activity-tooltip",children:[s.jsx("strong",{children:Oe}),s.jsx("br",{}),y.conversations>0&&s.jsxs(s.Fragment,{children:[y.conversations," conversations",s.jsx("br",{})]}),y.tool_calls>0&&s.jsxs(s.Fragment,{children:[y.tool_calls," tool calls",s.jsx("br",{})]}),y.knowledge_added>0&&s.jsxs(s.Fragment,{children:[y.knowledge_added," learned",s.jsx("br",{})]}),y.errors>0&&s.jsxs(s.Fragment,{children:[y.errors," errors"]})]})]},y.date)})}),s.jsxs("div",{className:"mem-activity-legend",children:[s.jsxs("span",{className:"mem-activity-legend-item",children:[s.jsx("span",{className:"mem-activity-legend-dot conversations"})," Conversations"]}),s.jsxs("span",{className:"mem-activity-legend-item",children:[s.jsx("span",{className:"mem-activity-legend-dot tool_calls"})," Tool Calls"]}),s.jsxs("span",{className:"mem-activity-legend-item",children:[s.jsx("span",{className:"mem-activity-legend-dot knowledge"})," Knowledge"]}),s.jsxs("span",{className:"mem-activity-legend-item",children:[s.jsx("span",{className:"mem-activity-legend-dot errors"})," Errors"]})]})]}):s.jsxs("div",{className:"mem-empty",children:[s.jsx("div",{className:"mem-empty-icon",children:s.jsx(Dm,{size:28})}),s.jsx("p",{children:"No activity data yet"})]})]}),s.jsxs("div",{className:"mem-section",children:[s.jsxs("div",{className:"mem-section-title mem-section-title-row",children:[s.jsxs("span",{className:"mem-section-title-left",children:[s.jsx(ei,{size:14})," Knowledge Browser",l&&l.total>0&&s.jsx("span",{className:"mem-section-count",children:l.total})]}),!q&&!Me&&s.jsxs("button",{className:"mem-section-add-btn",onClick:()=>Ce(!0),title:"Add a memory entry",children:[s.jsx(gl,{size:13})," Add"]})]}),s.jsxs("div",{className:"mem-filters",children:[s.jsxs("div",{className:"mem-category-pills",role:"group","aria-label":"Filter by category",children:[Gh.map(y=>s.jsx("button",{className:`mem-category-pill ${y}${oe.includes(y)?" active":""}`,onClick:()=>cv(y),"aria-pressed":oe.includes(y),children:y},y)),oe.length>0&&s.jsx("button",{className:"mem-category-pill clear",onClick:()=>{te([]),be(0)},"aria-label":"Clear category filters",children:"✕ Clear"})]}),s.jsxs("select",{className:"mem-filter-select",value:le,onChange:y=>{fe(y.target.value),be(0)},"aria-label":"Filter by context",children:[s.jsx("option",{value:"",children:"All Contexts"}),vv.map(y=>s.jsx("option",{value:y,children:y},y))]}),s.jsxs("select",{className:"mem-filter-select",value:T,onChange:y=>{I(y.target.value),be(0)},"aria-label":"Filter by entity",children:[s.jsx("option",{value:"",children:"All Entities"}),k.map(y=>s.jsxs("option",{value:y.entity,children:[y.entity," (",y.count,")"]},y.entity))]}),s.jsxs("div",{className:"mem-filter-search-wrap",children:[at?s.jsx("div",{className:"mem-spinner-sm search-icon",style:{width:12,height:12,borderWidth:1.5}}):s.jsx(Ln,{size:13,className:"search-icon"}),s.jsx("input",{className:"mem-filter-search",type:"text",placeholder:"Search memories...",value:b,onChange:y=>tv(y.target.value),"aria-label":"Search memories"})]}),s.jsxs("label",{className:"mem-filter-toggle",title:"Show entries that have been superseded by newer versions",children:[s.jsx("input",{type:"checkbox",checked:Ge,onChange:y=>qe(y.target.checked)}),s.jsx("span",{children:"Superseded"})]})]}),(q||Me)&&s.jsxs("div",{className:"mem-inline-form",children:[s.jsxs("div",{className:"mem-inline-form-row",children:[s.jsx("label",{children:"Content"}),s.jsx("textarea",{value:je.content,onChange:y=>Fe($=>({...$,content:y.target.value})),placeholder:"What should the agent remember?"})]}),s.jsxs("div",{className:"mem-inline-form-row",children:[s.jsx("label",{children:"Category"}),s.jsx("select",{value:je.category,onChange:y=>Fe($=>({...$,category:y.target.value})),children:Gh.map(y=>s.jsx("option",{value:y,children:y.charAt(0).toUpperCase()+y.slice(1)},y))})]}),s.jsxs("div",{className:"mem-inline-form-row",children:[s.jsx("label",{children:"Context"}),s.jsx("input",{type:"text",value:je.context,onChange:y=>Fe($=>({...$,context:y.target.value})),placeholder:"global"})]}),s.jsxs("div",{className:"mem-inline-form-row",children:[s.jsx("label",{children:"Domain"}),s.jsx("input",{type:"text",value:je.domain,onChange:y=>Fe($=>({...$,domain:y.target.value})),placeholder:"e.g., python, frontend"})]}),s.jsxs("div",{className:"mem-inline-form-row",children:[s.jsx("label",{children:"Entity"}),s.jsx("input",{type:"text",value:je.entity,onChange:y=>Fe($=>({...$,entity:y.target.value})),placeholder:"e.g., person:sarah_chen"})]}),s.jsxs("div",{className:"mem-inline-form-row",children:[s.jsx("label",{children:"Due At"}),s.jsx("input",{type:"text",value:je.due_at,onChange:y=>Fe($=>({...$,due_at:y.target.value})),placeholder:"ISO 8601 (e.g., 2026-03-25T09:00:00-07:00)"})]}),s.jsxs("div",{className:"mem-inline-form-row",children:[s.jsx("label",{children:"Sensitive"}),s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:12},children:[s.jsx("input",{type:"checkbox",checked:je.sensitive,onChange:y=>Fe($=>({...$,sensitive:y.target.checked}))}),"Mark as sensitive (excluded from system prompt)"]})]}),s.jsxs("div",{className:"mem-inline-form-actions",children:[s.jsx("button",{className:"btn-secondary",onClick:()=>{Ce(!1),Qe(null)},children:"Cancel"}),s.jsx("button",{className:"btn-primary",onClick:Me?rv:nv,style:{padding:"8px 20px",fontSize:13},children:Me?"Update":"Save"})]})]}),l&&l.items.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{overflowX:"auto"},children:s.jsxs("table",{className:"mem-knowledge-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsxs("th",{onClick:()=>ks("category"),className:H==="category"?"sorted":"",children:["Category",ws("category")]}),s.jsx("th",{children:"Content"}),s.jsxs("th",{onClick:()=>ks("context"),className:H==="context"?"sorted":"",children:["Context",ws("context")]}),s.jsx("th",{children:"Entity"}),s.jsxs("th",{onClick:()=>ks("confidence"),className:H==="confidence"?"sorted":"",children:["Confidence",ws("confidence")]}),s.jsx("th",{children:"Source"}),s.jsxs("th",{onClick:()=>ks("updated_at"),className:H==="updated_at"?"sorted":"",children:["Updated",ws("updated_at")]}),s.jsxs("th",{onClick:()=>ks("created_at"),className:H==="created_at"?"sorted":"",children:["Created",ws("created_at")]}),s.jsx("th",{children:"Due"}),s.jsx("th",{})]})}),s.jsx("tbody",{children:l.items.map(y=>{const $=R===y.id,se=y.has_embedding;return s.jsxs(Ki.Fragment,{children:[s.jsxs("tr",{className:`${y.superseded_by?"mem-superseded-row":""} ${$?"mem-expanded-row":""}`,onClick:()=>N($?null:y.id),onKeyDown:me=>{(me.key==="Enter"||me.key===" ")&&(me.preventDefault(),N($?null:y.id))},tabIndex:0,role:"row","aria-expanded":$,style:{cursor:"pointer"},children:[s.jsx("td",{children:s.jsx("span",{className:`mem-cat-badge ${y.category}`,children:y.category})}),s.jsx("td",{children:s.jsxs("div",{className:"mem-content-cell",title:y.content,children:[se!==void 0&&s.jsx("span",{className:`mem-embed-dot ${se?"embedded":"missing"}`,title:se?"Embedded":"Embedding missing",children:s.jsx(Xk,{size:6,fill:"currentColor"})}),y.sensitive&&s.jsx("span",{className:"mem-sensitive-badge",title:"Sensitive",children:s.jsx(Yn,{size:11})}),s.jsx("span",{className:y.sensitive&&!Ht.has(y.id)?"mem-sensitive-blur":y.superseded_by?"mem-superseded-text":"",onClick:me=>{y.sensitive&&(me.stopPropagation(),Mn(Oe=>{const wr=new Set(Oe);return wr.has(y.id)?wr.delete(y.id):wr.add(y.id),wr}))},children:y.content})]})}),s.jsx("td",{children:s.jsx("span",{className:"mem-date-cell",children:y.context})}),s.jsx("td",{children:y.entity?s.jsx("span",{className:"mem-entity-link",onClick:me=>{me.stopPropagation(),I(y.entity),be(0)},title:`Filter by ${y.entity}`,children:y.entity}):s.jsx("span",{className:"mem-date-cell",children:"—"})}),s.jsx("td",{children:s.jsxs("div",{className:"mem-confidence",children:[s.jsx("div",{className:"mem-confidence-bar",children:s.jsx("div",{className:`mem-confidence-fill ${ET(y.confidence)}`,style:{width:`${y.confidence*100}%`}})}),y.confidence.toFixed(2)]})}),s.jsx("td",{children:s.jsx("span",{className:"mem-date-cell",children:y.source||"—"})}),s.jsx("td",{children:s.jsx("span",{className:"mem-date-cell",title:Cn(y.updated_at),children:Cr(y.updated_at)})}),s.jsx("td",{children:s.jsx("span",{className:"mem-date-cell",title:Cn(y.created_at),children:Cr(y.created_at)})}),s.jsx("td",{children:y.due_at?s.jsx("span",{className:`mem-due-badge ${Vh(y.due_at)?"overdue":"upcoming"}`,title:Cn(y.due_at),children:Cr(y.due_at)}):s.jsx("span",{className:"mem-due-badge none",children:"—"})}),s.jsx("td",{children:s.jsxs("div",{className:"mem-row-actions",onClick:me=>me.stopPropagation(),children:[s.jsx("button",{className:"mem-row-action-btn",onClick:()=>lv(y),title:"Edit",children:s.jsx(yw,{size:13})}),s.jsx("button",{className:"mem-row-action-btn",onClick:()=>sv(y),title:y.sensitive?"Unmark sensitive":"Mark sensitive",children:y.sensitive?s.jsx(ww,{size:13}):s.jsx(Yn,{size:13})}),s.jsx("button",{className:"mem-row-action-btn",onClick:()=>av(y.id),title:"Copy ID",children:s.jsx(Nl,{size:13})}),s.jsx("button",{className:"mem-row-action-btn delete",onClick:()=>iv(y.id),title:"Delete",children:s.jsx(di,{size:13})})]})})]}),$&&s.jsx("tr",{className:"mem-detail-row",children:s.jsx("td",{colSpan:10,children:s.jsxs("div",{className:"mem-detail-panel",children:[s.jsxs("div",{className:"mem-detail-grid",children:[s.jsxs("div",{className:"mem-detail-field",children:[s.jsx("span",{className:"mem-detail-label",children:"ID"}),s.jsx("span",{className:"mem-detail-value",children:y.id})]}),s.jsxs("div",{className:"mem-detail-field",children:[s.jsx("span",{className:"mem-detail-label",children:"Domain"}),s.jsx("span",{className:"mem-detail-value",children:y.domain||"—"})]}),s.jsxs("div",{className:"mem-detail-field",children:[s.jsx("span",{className:"mem-detail-label",children:"Source"}),s.jsx("span",{className:"mem-detail-value",children:y.source||"—"})]}),s.jsxs("div",{className:"mem-detail-field",children:[s.jsx("span",{className:"mem-detail-label",children:"Use Count"}),s.jsx("span",{className:"mem-detail-value",children:y.use_count??0})]}),s.jsxs("div",{className:"mem-detail-field",children:[s.jsx("span",{className:"mem-detail-label",children:"Created"}),s.jsx("span",{className:"mem-detail-value",children:Cn(y.created_at)})]}),s.jsxs("div",{className:"mem-detail-field",children:[s.jsx("span",{className:"mem-detail-label",children:"Updated"}),s.jsx("span",{className:"mem-detail-value",children:Cn(y.updated_at)})]}),s.jsxs("div",{className:"mem-detail-field",children:[s.jsx("span",{className:"mem-detail-label",children:"Last Used"}),s.jsx("span",{className:"mem-detail-value",children:Cn(y.last_used)})]}),s.jsxs("div",{className:"mem-detail-field",children:[s.jsx("span",{className:"mem-detail-label",children:"Reminded At"}),s.jsx("span",{className:"mem-detail-value",children:Cn(y.reminded_at)})]}),y.superseded_by&&s.jsxs("div",{className:"mem-detail-field",children:[s.jsx("span",{className:"mem-detail-label",children:"Superseded By"}),s.jsx("span",{className:"mem-detail-value mem-detail-chain",children:y.superseded_by})]}),y.metadata&&s.jsxs("div",{className:"mem-detail-field mem-detail-full",children:[s.jsx("span",{className:"mem-detail-label",children:"Metadata"}),s.jsx("span",{className:"mem-detail-value",children:typeof y.metadata=="object"?JSON.stringify(y.metadata,null,2):y.metadata})]})]}),s.jsxs("div",{className:"mem-detail-content-full",children:[s.jsx("span",{className:"mem-detail-label",children:"Full Content"}),s.jsx("div",{className:"mem-detail-content-text",children:y.content})]})]})})})]},y.id)})})]})}),s.jsxs("div",{className:"mem-pagination",children:[s.jsxs("span",{children:[ae+1,"–",Math.min(ae+Xe,l.total)," of ",l.total]}),s.jsxs("div",{className:"mem-pagination-btns",children:[s.jsx("button",{className:"mem-page-btn",disabled:ae===0,onClick:()=>be(Math.max(0,ae-Xe)),children:s.jsx(Yk,{size:14})}),s.jsx("button",{className:"mem-page-btn",disabled:ae+Xe>=l.total,onClick:()=>be(ae+Xe),children:s.jsx(us,{size:14})})]})]})]}):s.jsxs("div",{className:"mem-empty",children:[s.jsx("div",{className:"mem-empty-icon",children:s.jsx(ei,{size:28})}),s.jsx("p",{children:b||oe.length>0||le||T?"No matching memories":"No memories stored yet"})]})]}),s.jsxs("div",{className:"mem-two-col",children:[s.jsxs("div",{className:"mem-section",children:[s.jsxs("div",{className:"mem-section-title",children:[s.jsx(is,{size:14})," Tool Performance"]}),o.length>0?s.jsx("div",{style:{overflowX:"auto"},children:s.jsxs("table",{className:"mem-tool-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Tool"}),s.jsx("th",{children:"Calls"}),s.jsx("th",{children:"Success"}),s.jsx("th",{children:"Avg Time"}),s.jsx("th",{children:"Last Used"}),s.jsx("th",{children:"Last Error"})]})}),s.jsx("tbody",{children:o.map(y=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("span",{className:"mem-tool-name",children:y.tool_name})}),s.jsx("td",{children:y.total_calls}),s.jsx("td",{children:s.jsxs("div",{className:"mem-confidence",children:[s.jsx("div",{className:"mem-confidence-bar",style:{width:40},children:s.jsx("div",{className:`mem-confidence-fill ${Wh(y.success_rate)}`,style:{width:`${y.success_rate*100}%`}})}),s.jsxs("span",{className:`mem-success-rate ${Wh(y.success_rate)}`,children:[Math.round(y.success_rate*100),"%"]})]})}),s.jsx("td",{children:_T(y.avg_duration_ms)}),s.jsx("td",{children:s.jsx("span",{className:"mem-date-cell",title:Cn(y.last_used),children:Cr(y.last_used)})}),s.jsx("td",{children:s.jsx("span",{className:"mem-tool-error",title:y.last_error||"",children:y.last_error||"—"})})]},y.tool_name))})]})}):s.jsxs("div",{className:"mem-empty",children:[s.jsx("div",{className:"mem-empty-icon",children:s.jsx(is,{size:28})}),s.jsx("p",{children:"No tool calls recorded yet"})]})]}),s.jsxs("div",{className:"mem-section",children:[s.jsxs("div",{className:"mem-section-title",children:[s.jsx(Qa,{size:14})," Upcoming & Overdue"]}),f.length>0?s.jsx("div",{className:"mem-temporal-list",children:f.map(y=>{const $=Vh(y.due_at);return s.jsxs("div",{className:`mem-temporal-item ${$?"overdue":"upcoming"}`,children:[s.jsx("span",{className:"mem-temporal-icon",children:$?s.jsx(gn,{size:16}):s.jsx(Qa,{size:16})}),s.jsxs("div",{className:"mem-temporal-content",children:[s.jsx("div",{className:"mem-temporal-text",children:y.content}),s.jsxs("div",{className:"mem-temporal-date",children:[$?"OVERDUE":"Due",": ",Cr(y.due_at),y.context!=="global"&&` · ${y.context}`]})]})]},y.id)})}):s.jsxs("div",{className:"mem-empty",children:[s.jsx("div",{className:"mem-empty-icon",children:s.jsx(ji,{size:28})}),s.jsx("p",{children:"Nothing upcoming or overdue"})]})]})]}),s.jsxs("div",{className:"mem-section",children:[s.jsxs("div",{className:"mem-section-title",children:[s.jsx(pu,{size:14})," Conversation History"]}),s.jsxs("div",{className:"mem-conv-search",children:[s.jsx(Ln,{size:13,className:"search-icon"}),s.jsx("input",{type:"text",placeholder:"Search conversations...",value:P,onChange:y=>ov(y.target.value),"aria-label":"Search conversations"}),P&&s.jsx("button",{className:"mem-search-clear",onClick:()=>{M(""),he(null)},"aria-label":"Clear search",children:s.jsx(Ze,{size:12})})]}),B!==null?B.length>0?s.jsx("div",{className:"mem-conv-list",children:B.map(y=>s.jsxs("div",{className:"mem-conv-item",onClick:()=>ef(y.session_id),children:[s.jsxs("div",{className:"mem-conv-info",children:[s.jsxs("div",{className:"mem-conv-session-id",children:[s.jsx("span",{className:`mem-conv-turn-role ${y.role}`,children:y.role})," ",y.session_id.slice(0,8),"..."]}),s.jsx("div",{className:"mem-conv-preview",children:y.content})]}),s.jsx("div",{className:"mem-conv-meta",children:s.jsx("span",{children:Cr(y.timestamp)})})]},y.id))}):s.jsx("div",{className:"mem-empty",children:s.jsxs("p",{children:["No conversations match “",P,"”"]})}):u.length>0?s.jsx("div",{className:"mem-conv-list",children:u.map(y=>s.jsxs("div",{className:"mem-conv-item",onClick:()=>ef(y.session_id),children:[s.jsxs("div",{className:"mem-conv-info",children:[s.jsxs("div",{className:"mem-conv-session-id",children:[y.session_id.slice(0,8),"...",y.consolidated&&s.jsx("span",{className:"mem-consolidated-badge",title:"Consolidated",children:s.jsx(zm,{size:11})})]}),y.first_message&&s.jsx("div",{className:"mem-conv-preview",children:y.first_message})]}),s.jsxs("div",{className:"mem-conv-meta",children:[s.jsxs("span",{children:[y.turn_count," turns"]}),s.jsx("span",{children:Cr(y.last_activity)})]})]},y.session_id))}):s.jsxs("div",{className:"mem-empty",children:[s.jsx("div",{className:"mem-empty-icon",children:s.jsx(pu,{size:28})}),s.jsx("p",{children:"No conversation history in memory"})]})]}),ce&&s.jsxs("div",{className:"mem-conv-detail-overlay",children:[s.jsxs("div",{className:"mem-conv-detail-header",children:[s.jsxs("h4",{children:["Session: ",ce.sessionId.slice(0,12),"..."]}),s.jsx("button",{className:"btn-icon",onClick:()=>ke(null),children:s.jsx(Ze,{size:16})})]}),s.jsxs("div",{className:"mem-conv-detail-body",children:[ce.turns.map(y=>s.jsxs("div",{className:"mem-conv-turn",children:[s.jsxs("div",{className:"mem-conv-turn-header",children:[s.jsx("div",{className:`mem-conv-turn-role ${y.role}`,children:y.role}),s.jsx("span",{className:"mem-conv-turn-time",title:Cn(y.timestamp),children:Cr(y.timestamp)})]}),s.jsx("div",{className:"mem-conv-turn-content",children:y.content})]},y.id)),ce.turns.length===0&&s.jsx("div",{className:"mem-empty",children:"No turns found"})]})]})]}),s.jsxs("div",{className:"mem-section",children:[s.jsxs("div",{className:"mem-section-title",children:[s.jsx(Yn,{size:14})," Settings ",s.jsx("span",{style:{fontSize:10,fontWeight:600,color:"#f59e0b",background:"rgba(245,158,11,0.15)",padding:"1px 6px",borderRadius:4,marginLeft:6,verticalAlign:"middle",letterSpacing:"0.5px"},children:"BETA"})]}),s.jsxs("div",{className:"mem-setting-row",children:[s.jsxs("div",{className:"mem-setting-info",children:[s.jsx("span",{className:"mem-setting-label",children:"Memory enabled"}),s.jsx("span",{className:"mem-setting-desc",children:"When disabled, no knowledge or conversation data is stored during any session (global incognito)."})]}),s.jsx("button",{className:`mem-toggle${F?" mem-toggle-on":""}`,disabled:pt,onClick:async()=>{if(!F){vn("memory");return}Ke(!0);try{const y=await wi({memory_enabled:!1});K(y.memory_enabled)}catch(y){E.system.warn("Failed to disable memory",y)}finally{Ke(!1)}},"aria-pressed":F,"aria-label":`Memory is ${F?"enabled":"disabled"}`,children:F?"On":"Off"})]}),bt&&(()=>{const $={memory:{title:"Enable Agent Memory?",description:"Agent memory is a work-in-progress. By enabling it:",bullets:[["Conversations and facts are stored ","locally on this machine"],["Stored data ","may be lost"," during updates"],["You can disable it at any time from this settings panel"]],buttonLabel:"Enable Memory",onConfirm:async()=>{const se=await wi({memory_enabled:!0});K(se.memory_enabled),Z("Memory enabled","info")}},mcp:{title:"Enable MCP Memory Access?",description:"This exposes memory data to external MCP clients:",bullets:[["MCP clients can ","read your stored memories"," (read-only)"],["Requires an ","MCP server restart"," to take effect"],["Intended for debugging and troubleshooting only"]],buttonLabel:"Enable MCP Access",onConfirm:async()=>{const se=await wi({mcp_memory_enabled:!0});ve(se.mcp_memory_enabled),Z("MCP memory access enabled","info")}},discovery:{title:"Enable System Discovery?",description:"This scans your system to personalize responses:",bullets:[["Collects ","hardware, software, and environment"," information"],["Scans files, git repos, browser history, and SSH config"],["All data stays ","local on this machine"]],buttonLabel:"Enable Discovery",onConfirm:async()=>{var me;const se=await wi({system_discovery_consent:!0});if(wt(se.system_discovery_consent),se.system_context_error)Z(`System discovery enabled but scan failed: ${se.system_context_error}`,"error");else{const Oe=((me=se.system_context_refresh)==null?void 0:me.stored)??0;Z(`System discovery enabled — ${Oe} system facts collected`,"info")}Rt()}}}[bt];return s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",zIndex:9998,backdropFilter:"blur(4px)"},onClick:()=>vn(null)}),s.jsxs("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:9999,background:"#1a1a2e",border:"1px solid #333",borderRadius:12,padding:"28px 32px",maxWidth:420,width:"90vw",boxShadow:"0 20px 60px rgba(0,0,0,0.5)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:16},children:[s.jsx("span",{style:{fontSize:11,fontWeight:700,color:"#f59e0b",background:"rgba(245,158,11,0.15)",padding:"3px 10px",borderRadius:4,letterSpacing:"0.5px"},children:"BETA"}),s.jsx("span",{style:{fontSize:16,fontWeight:600,color:"#e0e0e0"},children:$.title})]}),s.jsx("p",{style:{fontSize:13,lineHeight:1.6,color:"#999",margin:"0 0 8px"},children:$.description}),s.jsx("ul",{style:{fontSize:13,lineHeight:1.7,color:"#999",margin:"0 0 24px",paddingLeft:20},children:$.bullets.map((se,me)=>s.jsx("li",{children:se.map((Oe,wr)=>wr%2===1?s.jsx("strong",{style:{color:"#ccc"},children:Oe},wr):s.jsx("span",{children:Oe},wr))},me))}),s.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[s.jsx("button",{className:"btn-secondary",onClick:()=>vn(null),style:{padding:"8px 20px",fontSize:13,borderRadius:6},children:"Cancel"}),s.jsx("button",{disabled:pt,onClick:async()=>{Ke(!0);try{await $.onConfirm()}catch(se){E.system.warn("Failed to update setting",se),Z("Failed to update setting. Please try again.","error")}finally{Ke(!1),vn(null)}},style:{padding:"8px 24px",fontSize:13,fontWeight:600,borderRadius:6,border:"none",cursor:"pointer",background:"linear-gradient(135deg, #f59e0b, #d97706)",color:"#000"},children:$.buttonLabel})]})]})]})})(),s.jsxs("div",{className:"mem-setting-row",children:[s.jsxs("div",{className:"mem-setting-info",children:[s.jsx("span",{className:"mem-setting-label",children:"MCP memory access"}),s.jsx("span",{className:"mem-setting-desc",children:"Expose read-only memory tools to MCP clients (for debug/troubleshooting). Requires MCP server restart."})]}),s.jsx("button",{className:`mem-toggle${ue?" mem-toggle-on":""}`,disabled:pt,onClick:async()=>{if(!ue){vn("mcp");return}Ke(!0);try{const y=await wi({mcp_memory_enabled:!1});ve(y.mcp_memory_enabled)}catch(y){E.system.warn("Failed to update memory settings",y)}finally{Ke(!1)}},"aria-label":"Toggle MCP memory access","aria-pressed":ue,children:ue?"On":"Off"})]}),s.jsxs("div",{className:"mem-setting-row",children:[s.jsxs("div",{className:"mem-setting-info",children:[s.jsx("span",{className:"mem-setting-label",children:"System discovery"}),s.jsx("span",{className:"mem-setting-desc",children:"Allow GAIA to scan your system for hardware, software, and environment information to personalize responses."})]}),s.jsx("button",{className:`mem-toggle${Ne?" mem-toggle-on":""}`,disabled:pt,onClick:async()=>{if(!Ne){vn("discovery");return}Ke(!0);try{const y=await wi({system_discovery_consent:!1});wt(y.system_discovery_consent)}catch(y){E.system.warn("Failed to update system discovery setting",y)}finally{Ke(!1)}},"aria-label":"Toggle system discovery","aria-pressed":Ne,children:Ne?"On":"Off"})]}),s.jsxs("div",{className:"mem-setting-row mem-setting-row-danger",children:[s.jsxs("div",{className:"mem-setting-info",children:[s.jsx("span",{className:"mem-setting-label",children:"Re-initialize memory"}),s.jsx("span",{className:"mem-setting-desc",children:"Wipe all memories, conversations, and tool logs, then re-collect system information. This cannot be undone."})]}),it?s.jsxs("div",{className:"mem-delete-confirm",children:[s.jsx("span",{className:"mem-delete-confirm-label",children:"Are you sure?"}),s.jsx("button",{className:"mem-btn-danger",disabled:pt,onClick:async()=>{Ke(!0);try{const y=await xT();Z(`Re-initialized: cleared ${y.cleared.knowledge} entries, restored ${y.system_context.stored} system facts`,"info"),Rt()}catch(y){E.system.warn("Failed to reinitialize memory",y),Z("Failed to re-initialize memory","error")}finally{Ke(!1),Mt(!1)}},children:"Yes, re-initialize"}),s.jsx("button",{className:"btn-secondary",onClick:()=>Mt(!1),style:{padding:"6px 14px",fontSize:12},children:"Cancel"})]}):s.jsx("button",{className:"mem-btn-danger",disabled:pt,onClick:()=>Mt(!0),children:"Re-initialize"})]}),s.jsxs("div",{className:"mem-setting-row mem-setting-row-danger",children:[s.jsxs("div",{className:"mem-setting-info",children:[s.jsx("span",{className:"mem-setting-label",children:"Delete all memories"}),s.jsx("span",{className:"mem-setting-desc",children:"Permanently wipe all knowledge entries, conversation history, and tool logs. This cannot be undone."})]}),Pt?s.jsxs("div",{className:"mem-delete-confirm",children:[s.jsx("span",{className:"mem-delete-confirm-label",children:"Are you sure?"}),s.jsx("button",{className:"mem-btn-danger",disabled:pt,onClick:async()=>{Ke(!0);try{const y=await yT();Z(`Deleted ${y.knowledge} knowledge entries, ${y.conversations} conversations`,"info"),Rt()}catch(y){E.system.warn("Failed to clear memory",y),Z("Failed to clear memory","error")}finally{Ke(!1),Jt(!1)}},children:"Yes, delete all"}),s.jsx("button",{className:"btn-secondary",onClick:()=>Jt(!1),style:{padding:"6px 14px",fontSize:12},children:"Cancel"})]}):s.jsx("button",{className:"mem-btn-danger",disabled:pt,onClick:()=>Jt(!0),children:"Delete All"})]})]}),t&&s.jsxs("div",{className:"mem-db-footer",children:[s.jsxs("span",{children:["Database: ",CT(t.db_size_bytes),((gf=t.knowledge)==null?void 0:gf.avg_confidence)!=null&&` · Avg confidence: ${t.knowledge.avg_confidence.toFixed(2)}`]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[((yf=t.knowledge)==null?void 0:yf.entity_count)!=null&&t.knowledge.entity_count>0&&s.jsxs("span",{children:[t.knowledge.entity_count," entities"]}),((xf=t.knowledge)==null?void 0:xf.sensitive_count)!=null&&t.knowledge.sensitive_count>0&&s.jsxs("span",{children:[s.jsx(Yn,{size:10})," ",t.knowledge.sensitive_count," sensitive"]})]})]})]})}),un==="profile"&&s.jsxs("div",{className:"mem-profile-grid",children:[s.jsxs("div",{className:"mem-profile-card",children:[s.jsxs("div",{className:"mem-profile-card-title",children:[s.jsx(rs,{size:16})," System Discovery"]}),s.jsx("p",{className:"mem-profile-desc",children:"Scan your system to discover apps, projects, and usage patterns."}),s.jsx("button",{className:"btn-primary mem-profile-run-btn",disabled:lt==="running"||lt==="saving",onClick:pv,children:lt==="running"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mem-spinner-sm"})," Running..."]}):"Run Discovery"}),hs.length>0&&s.jsx("div",{className:"mem-log",ref:jn,children:hs.map((y,$)=>s.jsx("div",{className:`mem-log-line ${y.kind}`,children:y.text},$))}),(lt==="review"||lt==="saving"||lt==="done")&&Gn.length>0&&s.jsxs("div",{className:"mem-review-section",children:[s.jsx("div",{className:"mem-review-header",children:"Review & Save"}),s.jsx("div",{className:"mem-review-list",children:Gn.map((y,$)=>s.jsxs("label",{className:"mem-review-item",children:[s.jsx("input",{type:"checkbox",checked:y._checked,disabled:lt==="saving"||lt==="done",onChange:()=>{hr(se=>se.map((me,Oe)=>Oe===$?{...me,_checked:!me._checked}:me))}}),s.jsx("span",{className:"mem-review-content",children:y.content}),s.jsx("span",{className:"mem-source-badge",children:y._source_name||y.category}),s.jsxs("span",{className:"mem-conf-badge",children:[Math.round(y.confidence*100),"%"]})]},$))}),s.jsxs("div",{className:"mem-review-actions",children:[s.jsx("button",{className:"btn-primary",disabled:lt==="saving"||lt==="done"||Gn.filter(y=>y._checked).length===0,onClick:gv,children:lt==="saving"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mem-spinner-sm"})," Saving..."]}):`Save Selected (${Gn.filter(y=>y._checked).length})`}),s.jsxs("span",{className:"mem-review-select-links",children:[s.jsx("a",{onClick:()=>hr(y=>y.map($=>({...$,_checked:!0}))),children:"Select All"})," / ",s.jsx("a",{onClick:()=>hr(y=>y.map($=>({...$,_checked:!1}))),children:"None"})]})]})]}),lt==="done"&&zl!==null&&s.jsxs("div",{className:"mem-profile-success",children:[s.jsx(ji,{size:14})," Saved ",zl," items to memory"]}),lt==="review"&&Gn.length===0&&s.jsx("div",{className:"mem-profile-empty",children:"No items discovered."})]}),s.jsxs("div",{className:"mem-profile-card",children:[s.jsxs("div",{className:"mem-profile-card-title",children:[s.jsx(bw,{size:16})," AI Profile Inference"]}),s.jsx("p",{className:"mem-profile-desc",children:"Use the local LLM to generate profile insights from your data."}),s.jsx("p",{className:"mem-profile-note",children:"Requires Lemonade Server running."}),s.jsxs("label",{className:"mem-profile-checkbox",children:[s.jsx("input",{type:"checkbox",checked:gs,onChange:y=>zo(y.target.checked),disabled:jt==="running"||jt==="saving"}),"Include browser history"]}),s.jsx("button",{className:"btn-primary mem-profile-run-btn",disabled:jt==="running"||jt==="saving",onClick:yv,children:jt==="running"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mem-spinner-sm"})," Running..."]}):"Run Inference"}),ps.length>0&&s.jsx("div",{className:"mem-log",ref:yi,children:ps.map((y,$)=>s.jsx("div",{className:`mem-log-line ${y.kind}`,children:y.text},$))}),(jt==="review"||jt==="saving"||jt==="done")&&qn.length>0&&s.jsxs("div",{className:"mem-review-section",children:[s.jsx("div",{className:"mem-review-header",children:"Review & Save"}),s.jsx("div",{className:"mem-review-list",children:qn.map((y,$)=>s.jsxs("label",{className:"mem-review-item",children:[s.jsx("input",{type:"checkbox",checked:y._checked,disabled:jt==="saving"||jt==="done",onChange:()=>{yr(se=>se.map((me,Oe)=>Oe===$?{...me,_checked:!me._checked}:me))}}),s.jsx("span",{className:"mem-review-content",children:y.content}),s.jsx("span",{className:`mem-domain-badge ${LT[y.domain]||"gray"}`,children:y.domain}),s.jsxs("span",{className:"mem-conf-badge",children:[Math.round(y.confidence*100),"%"]})]},$))}),s.jsxs("div",{className:"mem-review-actions",children:[s.jsx("button",{className:"btn-primary",disabled:jt==="saving"||jt==="done"||qn.filter(y=>y._checked).length===0,onClick:xv,children:jt==="saving"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mem-spinner-sm"})," Saving..."]}):`Save Selected (${qn.filter(y=>y._checked).length})`}),s.jsxs("span",{className:"mem-review-select-links",children:[s.jsx("a",{onClick:()=>yr(y=>y.map($=>({...$,_checked:!0}))),children:"Select All"})," / ",s.jsx("a",{onClick:()=>yr(y=>y.map($=>({...$,_checked:!1}))),children:"None"})]})]})]}),jt==="done"&&Al!==null&&s.jsxs("div",{className:"mem-profile-success",children:[s.jsx(ji,{size:14})," Saved ",Al," insights to memory"]}),jt==="review"&&qn.length===0&&s.jsx("div",{className:"mem-profile-empty",children:"No insights generated."})]})]}),un==="goals"&&s.jsxs("div",{className:"mem-goals-tab",children:[s.jsx("div",{className:"mem-goals-stats-row",children:["queued","in_progress","completed","failed"].map(y=>s.jsxs("div",{className:`mem-goals-stat-pill mem-goal-status-${y.replace("_","-")}`,children:[s.jsx("span",{className:"mem-goals-stat-n",children:(kn==null?void 0:kn.goals[y])??0}),s.jsx("span",{className:"mem-goals-stat-label",children:y.replace("_"," ")})]},y))}),en.filter(y=>y.status==="pending_approval").length>0&&s.jsxs("div",{className:"mem-goals-approval-banner",children:[s.jsxs("div",{className:"mem-goals-approval-title",children:[s.jsx(qi,{size:14})," Agent suggested ",en.filter(y=>y.status==="pending_approval").length," goal(s) — review before execution"]}),en.filter(y=>y.status==="pending_approval").map(y=>s.jsxs("div",{className:"mem-goals-approval-item",children:[s.jsxs("div",{className:"mem-goals-approval-text",children:[s.jsx("strong",{children:y.title}),s.jsx("span",{children:y.description})]}),s.jsxs("div",{className:"mem-goals-approval-actions",children:[s.jsx("button",{className:"btn-danger-sm",onClick:async()=>{await jT(y.id),kr()},children:"Reject"}),s.jsx("button",{className:"btn-secondary",onClick:async()=>{await bT(y.id),kr()},children:"Accept"})]})]},y.id))]}),s.jsx("div",{className:"mem-goals-toolbar",children:s.jsxs("button",{className:"btn-primary",onClick:()=>ur(y=>!y),children:[s.jsx(gl,{size:14})," New Goal"]})}),Tl&&s.jsxs("div",{className:"mem-goals-add-form",children:[s.jsx("input",{className:"mem-input",placeholder:"Goal title",value:dr.title,onChange:y=>fr($=>({...$,title:y.target.value}))}),s.jsx("textarea",{className:"mem-input",placeholder:"Description — what should the agent work toward?",rows:2,value:dr.description,onChange:y=>fr($=>({...$,description:y.target.value}))}),s.jsxs("div",{className:"mem-goals-form-row",children:[s.jsxs("select",{className:"mem-select",value:dr.priority,onChange:y=>fr($=>({...$,priority:y.target.value})),children:[s.jsx("option",{value:"low",children:"Low priority"}),s.jsx("option",{value:"medium",children:"Medium priority"}),s.jsx("option",{value:"high",children:"High priority"})]}),s.jsx("button",{className:"btn-primary",onClick:async()=>{dr.title.trim()&&(await wT(dr),fr({title:"",description:"",priority:"medium"}),ur(!1),kr())},children:"Create"}),s.jsx("button",{className:"btn-secondary",onClick:()=>ur(!1),children:"Cancel"})]})]}),wn?s.jsxs("div",{className:"mem-loading",children:[s.jsx("div",{className:"mem-spinner"})," Loading goals..."]}):en.filter(y=>y.status!=="pending_approval"&&y.status!=="rejected").length===0?s.jsxs("div",{className:"mem-empty",children:[s.jsx("div",{className:"mem-empty-icon",children:s.jsx(Am,{size:32})}),s.jsx("p",{children:"No goals yet. Create one or let the agent suggest goals in autonomous mode."})]}):s.jsx("div",{className:"mem-goals-list",children:en.filter(y=>y.status!=="pending_approval"&&y.status!=="rejected").map(y=>s.jsxs("div",{className:`mem-goal-card mem-goal-status-${y.status.replace("_","-")}`,children:[s.jsxs("div",{className:"mem-goal-header",onClick:()=>cr($=>$===y.id?null:y.id),children:[s.jsxs("div",{className:"mem-goal-header-left",children:[s.jsx("span",{className:`mem-goal-status-dot status-${y.status.replace("_","-")}`}),s.jsx("span",{className:"mem-goal-title",children:y.title}),s.jsx("span",{className:`mem-goal-priority mem-priority-${y.priority}`,children:y.priority}),y.source!=="user"&&s.jsxs("span",{className:"mem-goal-source-badge",children:[s.jsx(qi,{size:10})," ",y.source.replace("_"," ")]})]}),s.jsxs("div",{className:"mem-goal-header-right",children:[s.jsxs("span",{className:"mem-goal-task-count",children:[s.jsx(yy,{size:12}),y.tasks.filter($=>$.status==="completed").length,"/",y.tasks.length]}),y.status==="queued"&&s.jsx("button",{className:"mem-goal-action-btn mem-goal-cancel-btn",onClick:async $=>{$.stopPropagation(),await ST(y.id),kr()},children:"Cancel"}),s.jsx("button",{className:"mem-goal-action-btn mem-goal-delete-btn",onClick:async $=>{$.stopPropagation(),confirm(`Delete goal "${y.title}"?`)&&(await NT(y.id),kr())},children:s.jsx(di,{size:12})}),s.jsx(ci,{size:14,className:Wn===y.id?"mem-chevron-open":""})]})]}),Wn===y.id&&s.jsxs("div",{className:"mem-goal-body",children:[y.description&&s.jsx("p",{className:"mem-goal-desc",children:y.description}),y.progress_notes&&s.jsx("p",{className:"mem-goal-progress",children:y.progress_notes}),y.tasks.length>0?s.jsx("div",{className:"mem-task-list",children:y.tasks.map($=>s.jsxs("div",{className:`mem-task-row mem-task-status-${$.status}`,children:[s.jsx("span",{className:`mem-task-dot status-${$.status}`}),s.jsx("span",{className:"mem-task-desc",children:$.description}),s.jsx("span",{className:"mem-task-status-label",children:$.status}),$.result&&s.jsx("span",{className:"mem-task-result",children:$.result})]},$.id))}):s.jsx("p",{className:"mem-goal-no-tasks",children:"No tasks yet — the agent will break this down when it starts."})]})]},y.id))})]})]}),U.length>0&&s.jsx("div",{className:"mem-toast-container","aria-live":"polite",children:U.map(y=>s.jsxs("div",{className:`mem-toast mem-toast-${y.type}`,role:"status",children:[y.type==="success"&&s.jsx(ji,{size:14}),y.type==="error"&&s.jsx(gn,{size:14}),y.type==="info"&&s.jsx(ei,{size:14}),s.jsx("span",{children:y.text})]},y.id))})]})}const Js=32768,Xd="Qwen3.5-35B-A3B-GGUF",DT=3e5,IT=18e5,PT=1e4;function ev(e,t){const[n,r]=p.useState(!1),[i,l]=p.useState(!1),a=p.useRef(null),o=p.useRef(null),c=p.useRef(null),u=p.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null),o.current&&(clearTimeout(o.current),o.current=null),c.current&&(clearInterval(c.current),c.current=null)},[]);p.useEffect(()=>u,[u]);const d=p.useCallback((g,k)=>{c.current&&clearInterval(c.current),c.current=setInterval(async()=>{var v,x;try{const w=await _d();k==="load"?((v=w.model_loaded)==null?void 0:v.toLowerCase())===g.toLowerCase()&&(r(!1),a.current&&(clearTimeout(a.current),a.current=null),c.current&&(clearInterval(c.current),c.current=null)):(w.model_downloaded===!0||((x=w.model_loaded)==null?void 0:x.toLowerCase())===g.toLowerCase())&&(l(!1),o.current&&(clearTimeout(o.current),o.current=null),c.current&&(clearInterval(c.current),c.current=null))}catch{}},PT)},[]),f=e??Xd,h=p.useCallback(async(g,k)=>{const v=g??f,x=k??Js;r(!0);try{await a0(v,x),E.system.info(`Load model triggered: ${v} (ctx=${x})`),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>r(!1),DT),d(v,"load")}catch(w){E.system.error("Failed to trigger model load",w),r(!1)}},[f,t,d]),m=p.useCallback(async(g=!1,k)=>{const v=k??f;l(!0);try{await o0(v,g),E.system.info(`Download model triggered: ${v} (force=${g})`),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>l(!1),IT),d(v,"download")}catch(x){E.system.error("Failed to trigger model download",x),l(!1)}},[f,d]);return{isLoadingModel:n,isDownloadingModel:i,loadModel:h,downloadModel:m}}const qh=Cd();function MT(){const{setAgents:e}=Se(),[t,n]=p.useState({kind:"idle"}),[r,i]=p.useState([]),l=p.useRef(null),a=p.useRef(null),o=p.useRef(null);p.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),p.useEffect(()=>{var v;t.kind==="error"&&((v=o.current)==null||v.scrollIntoView({behavior:"smooth",block:"nearest"}))},[t]);const c=p.useCallback((v,x=5e3)=>{n(v),a.current&&clearTimeout(a.current),(v.kind==="success"||v.kind==="error")&&(a.current=setTimeout(()=>n({kind:"idle"}),x))},[]),u=p.useCallback(async()=>{try{const[v,x]=await Promise.all([Ed(),c0()]);e(v.agents||[]),i(x.agents||[])}catch(v){E.api.warn("Failed to refresh custom agents",v)}},[e]);p.useEffect(()=>{u()},[u]);const d=r,f=d.length>0,h=p.useCallback(async()=>{if(window.confirm(`Exported bundle contains your agent source files as-is. Any API keys, tokens, or credentials in agent.py will be included in the bundle. Review before sharing.
559
+
560
+ Continue?`)){c({kind:"working",message:"Exporting…"});try{const x=await fetch(`${qh}/agents/export`,{method:"POST",headers:{"X-Gaia-UI":"1"}});if(!x.ok){const D=await x.text().catch(()=>"");let _=D;try{_=JSON.parse(D).detail||D}catch{}throw new Error(_||`Export failed (HTTP ${x.status})`)}const w=await x.blob(),j=URL.createObjectURL(w),z=document.createElement("a");z.href=j,z.download="gaia-agents-export.zip",document.body.appendChild(z),z.click(),document.body.removeChild(z),URL.revokeObjectURL(j),c({kind:"success",message:"Export downloaded."})}catch(x){console.error("Agent export failed:",x);const w=x instanceof Error?x.message:String(x);E.api.error("Agent export failed",x),c({kind:"error",message:`Export failed: ${w}`})}}},[c]),m=p.useCallback(()=>{var v;(v=l.current)==null||v.click()},[]),g=p.useCallback(async v=>{var D;const x=(D=v.target.files)==null?void 0:D[0];if(v.target.value="",!x)return;let w=null;if(x.size<=100*1024*1024)try{w=await RT(x)}catch(_){E.api.warn("Could not pre-read bundle.json from zip",_)}const j=w&&w.length>0?`Agents to install: ${w.join(", ")}`:"Agents to install: (unable to read bundle contents — contents will be validated by the server)";if(window.confirm(`Importing this bundle will run third-party Python code on your machine when the agent is selected. Only import bundles from sources you trust.
561
+
562
+ `+j+`
563
+
564
+ Import?`)){c({kind:"working",message:"Uploading…"});try{const _=new FormData;_.append("bundle",x,x.name);const A=await fetch(`${qh}/agents/import`,{method:"POST",headers:{"X-Gaia-UI":"1"},body:_});if(!A.ok){const O=await A.text().catch(()=>"");let re=O;try{re=JSON.parse(O).detail||O}catch{}throw new Error(re||`Import failed (HTTP ${A.status})`)}const C=await A.json(),R=C.imported||[],N=C.overwritten||[];await u();let U;if(R.length===0?U="No agents imported":(U=`Installed ${R.length} agent(s): ${R.join(", ")}`,N.length>0&&(U+=` (replaced: ${N.join(", ")})`)),C.requires_restart&&(U+=" — restart required for replaced agents to take full effect"),C.errors&&C.errors.length>0){const O=C.errors.map(re=>`${re.id}: ${re.error}`).join("; ");c({kind:"error",message:`${U}. Errors: ${O}`})}else c({kind:"success",message:U})}catch(_){console.error("Agent import failed:",_);const A=_ instanceof Error?_.message:String(_);E.api.error("Agent import failed",_),c({kind:"error",message:`Import failed: ${A}`})}}},[c,u]),k=t.kind==="working";return s.jsxs("section",{className:"settings-section",children:[s.jsx("h4",{children:"Custom Agents"}),d.length===0?s.jsx("p",{className:"danger-warning",style:{marginBottom:12},children:"No custom agents installed yet. Import a bundle below to add one."}):s.jsx("div",{className:"status-grid",style:{marginBottom:12},children:d.map(v=>s.jsxs("div",{className:"status-row",children:[s.jsx("span",{className:"status-label",children:v.name}),s.jsxs("div",{className:"status-value-wrap",children:[s.jsx("span",{className:`status-value ${v.registered?"ok":"warn"}`,children:v.id}),v.registered?v.source&&s.jsx("span",{className:"status-hint",children:s.jsx("code",{children:v.source})}):s.jsx("span",{className:"status-hint",children:"Not loaded"})]})]},v.id))}),s.jsxs("div",{className:"setting-actions",style:{display:"flex",gap:8,flexWrap:"wrap"},children:[s.jsx("button",{className:"btn-model-save",onClick:h,disabled:k||!f,title:f?void 0:"No custom agents to export",children:k&&t.message.startsWith("Export")?s.jsxs(s.Fragment,{children:[s.jsx(mt,{size:13,className:"btn-spinner"})," Exporting…"]}):s.jsxs(s.Fragment,{children:[s.jsx(ui,{size:13,style:{verticalAlign:-2,marginRight:6}}),"Export All"]})}),s.jsx("button",{className:"btn-model-save",onClick:m,disabled:k,children:k&&t.message.startsWith("Upload")?s.jsxs(s.Fragment,{children:[s.jsx(mt,{size:13,className:"btn-spinner"})," Uploading…"]}):s.jsxs(s.Fragment,{children:[s.jsx(yl,{size:13,style:{verticalAlign:-2,marginRight:6}}),"Import"]})}),s.jsx("input",{ref:l,type:"file",accept:".zip,application/zip",style:{display:"none"},onChange:g})]}),t.kind!=="idle"&&s.jsxs("div",{ref:o,className:"danger-warning",style:{marginTop:12,display:"flex",alignItems:"center",gap:8,color:t.kind==="error"?"var(--accent-gold)":"var(--text-secondary)"},role:"status",children:[t.kind==="working"&&s.jsx(mt,{size:14,className:"btn-spinner"}),t.kind==="success"&&s.jsx(sr,{size:14}),t.kind==="error"&&s.jsx(kt,{size:14}),s.jsx("span",{children:t.message})]})]})}async function RT(e){const t=await e.arrayBuffer(),n=new DataView(t),r=new Uint8Array(t),i=Math.min(t.byteLength,65557),l=t.byteLength-i;let a=-1;for(let d=t.byteLength-22;d>=l;d--)if(n.getUint32(d,!0)===101010256){a=d;break}if(a<0)return null;const o=n.getUint16(a+10,!0);let u=n.getUint32(a+16,!0);for(let d=0;d<o;d++){if(u+46>t.byteLength||n.getUint32(u,!0)!==33639248)return null;const f=n.getUint16(u+10,!0),h=n.getUint32(u+20,!0),m=n.getUint16(u+28,!0),g=n.getUint16(u+30,!0),k=n.getUint16(u+32,!0),v=n.getUint32(u+42,!0);if(new TextDecoder("utf-8").decode(r.subarray(u+46,u+46+m))==="bundle.json"){if(v+30>t.byteLength||n.getUint32(v,!0)!==67324752)return null;const w=n.getUint16(v+26,!0),j=n.getUint16(v+28,!0),z=v+30+w+j,D=z+h;if(D>t.byteLength)return null;const _=r.subarray(z,D);let A;if(f===0)A=new TextDecoder("utf-8").decode(_);else if(f===8){const N=new DecompressionStream("deflate-raw"),U=new Blob([_]).stream().pipeThrough(N),O=await new Response(U).arrayBuffer();A=new TextDecoder("utf-8").decode(O)}else return null;const C=JSON.parse(A),R=C==null?void 0:C.agent_ids;return Array.isArray(R)&&R.every(N=>typeof N=="string")?R:null}u+=46+m+g+k}return null}const Qh=E.api;function $T(e){switch(e){case"connector.configured":return"configured";case"connector.disconnected":return"disconnected";case"connection.revoked":return"disconnected";case"connector.oauth.completed":return"oauth_completed";case"connection.connected":return"oauth_completed";case"connector.oauth.error":return"oauth_error";case"connector.tested":return"tested";case"connector.enabled":return"enabled";case"connector.disabled":return"disabled";case"connector.grant.changed":return"grant_changed";default:return null}}function FT(e){const t=p.useRef(e);p.useEffect(()=>{t.current=e},[e]),p.useEffect(()=>{const n=`${Cd()}/connectors/events`;let r=null,i=1e3,l=null,a=!1;const o=()=>{a||(r=new EventSource(n),r.onopen=()=>{i=1e3},r.onmessage=c=>{try{const u=JSON.parse(c.data),d=$T(u.type);if(d===null){Qh.debug("connectors-sse: ignoring event",u.type);return}const f=u.payload??{},h=f.connector_id??f.provider??null;t.current({connectorId:h,reason:d,payload:f})}catch(u){Qh.warn("connectors-sse: malformed event",u)}},r.onerror=()=>{r==null||r.close(),r=null,!a&&(l=setTimeout(o,i),i=Math.min(i*2,3e4))})};return o(),()=>{a=!0,l&&clearTimeout(l),r==null||r.close()}},[])}function OT(e){return e.type==="mcp_server"&&e.configured}function UT({connector:e,onChanged:t}){const[n,r]=p.useState(!1),[i,l]=p.useState(!1),[a,o]=p.useState(null),[c,u]=p.useState(null),d=p.useRef(null),f=p.useRef(null);if(p.useEffect(()=>{if(!n)return;const k=v=>{const x=v.target;d.current&&!d.current.contains(x)&&f.current&&!f.current.contains(x)&&r(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]),p.useEffect(()=>{if(!n)return;const k=v=>{v.key==="Escape"&&r(!1)};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[n]),p.useEffect(()=>{if(!n)return;const k=()=>{if(!d.current)return;const v=d.current.getBoundingClientRect();u({top:v.bottom+4,right:window.innerWidth-v.right})};return window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[n]),!OT(e))return null;const h=k=>{k.stopPropagation(),k.preventDefault()},m=k=>{if(h(k),!n&&d.current){const v=d.current.getBoundingClientRect();u({top:v.bottom+4,right:window.innerWidth-v.right})}r(v=>!v)},g=async k=>{l(!0),o(null);try{await k(),r(!1),t()}catch(v){o(v instanceof Error?v.message:String(v))}finally{l(!1)}};return s.jsxs("div",{className:"connector-tile-menu",onClick:h,onKeyDown:h,children:[s.jsx("button",{ref:d,type:"button",className:"connector-tile-menu-trigger","aria-haspopup":"menu","aria-expanded":n,"aria-label":"Connector actions",onClick:m,disabled:i,children:s.jsx(fw,{size:14})}),n&&c&&s.jsxs("div",{ref:f,role:"menu",className:"connector-tile-menu-popup",style:{position:"fixed",top:c.top,right:c.right},children:[e.enabled?s.jsx("button",{role:"menuitem",type:"button",className:"connector-tile-menu-item",onClick:()=>void g(()=>Dy(e.id)),disabled:i,children:"Disable"}):s.jsx("button",{role:"menuitem",type:"button",className:"connector-tile-menu-item",onClick:()=>void g(()=>Ay(e.id)),disabled:i,children:"Enable"}),s.jsx("div",{className:"connector-tile-menu-divider"}),s.jsx("button",{role:"menuitem",type:"button",className:"connector-tile-menu-item connector-tile-menu-item--danger",onClick:()=>void g(()=>Td(e.id)),disabled:i,children:"Disconnect"}),a&&s.jsx("div",{className:"connector-tile-menu-error",children:a})]})]})}const BT={"https://www.googleapis.com/auth/gmail.readonly":"Read emails","https://www.googleapis.com/auth/gmail.modify":"Organize emails (archive, label, trash)","https://www.googleapis.com/auth/gmail.send":"Send emails on your behalf","https://www.googleapis.com/auth/gmail.compose":"Compose emails","https://www.googleapis.com/auth/calendar.readonly":"View calendar events","https://www.googleapis.com/auth/calendar.events":"Create & respond to calendar events","https://www.googleapis.com/auth/drive.readonly":"Read Google Drive files","https://www.googleapis.com/auth/drive.file":"Manage Drive files created by this app","https://www.googleapis.com/auth/spreadsheets.readonly":"Read Google Sheets","https://www.googleapis.com/auth/spreadsheets":"Edit Google Sheets",openid:"Identify you",email:"See your email address",profile:"See your basic profile info"};function HT(e){return BT[e]??e.split(/[/.:]/).pop()??e}function VT(){const[e,t]=p.useState([]),[n,r]=p.useState([]),[i,l]=p.useState(!0),[a,o]=p.useState(null),[c,u]=p.useState(null),d=p.useCallback(async()=>{try{const[{connectors:m},{agent_mcps:g}]=await Promise.all([u0(),d0()]);t(m),r(g),o(null)}catch(m){o(m instanceof Error?m.message:String(m))}finally{l(!1)}},[]);p.useEffect(()=>{d()},[d]);const f=m=>u(g=>g===m?null:m),h=p.useCallback(async m=>{try{const g=await Ty(m);t(k=>k.map(v=>v.id===m?g:v))}catch{d()}},[d]);return FT(p.useCallback(m=>{m.connectorId?h(m.connectorId):d()},[h,d])),s.jsxs("section",{className:"settings-section connectors-section",children:[s.jsx("h4",{children:"Connectors"}),s.jsx("p",{className:"settings-help",children:"Connect external accounts and MCP servers so agents can use them on your behalf. Each agent must be granted scopes individually."}),a&&s.jsxs("div",{className:"error-banner",children:[s.jsx(kt,{size:14}),s.jsx("span",{children:a})]}),i?s.jsx("div",{className:"connectors-loading",children:s.jsx(mt,{size:16,className:"spin"})}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"connectors-list",children:e.map(m=>s.jsx(WT,{connector:m,expanded:c===m.id,onToggle:()=>f(m.id),onChanged:()=>void h(m.id)},m.id))}),n.length>0&&s.jsx(KT,{servers:n,expanded:c,onToggle:f})]})]})}function WT({connector:e,expanded:t,onToggle:n,onChanged:r}){const i=()=>e.configured?e.type==="mcp_server"&&e.enabled===!1?s.jsx("span",{className:"connector-status disabled",children:"Disabled"}):s.jsxs("span",{className:"connector-status ok",children:[s.jsx(sr,{size:12}),e.account_id??"Configured"]}):s.jsx("span",{className:"connector-status idle",children:"Not configured"});return s.jsxs("div",{className:`connector-tile${t?" connector-tile--open":""}`,children:[s.jsxs("button",{className:"connector-tile-header",onClick:n,"aria-expanded":t,children:[s.jsx("span",{className:"connector-tile-name",children:e.display_name}),s.jsx("span",{className:"connector-tile-type",children:e.type==="oauth_pkce"?"OAuth":"MCP"}),i(),s.jsx(UT,{connector:e,onChanged:r}),s.jsx("span",{className:"connector-tile-chevron",children:t?s.jsx(dy,{size:14}):s.jsx(ci,{size:14})})]}),t&&s.jsxs("div",{className:"connector-detail",children:[e.type==="oauth_pkce"?s.jsx(GT,{connector:e,onChanged:r}):s.jsx(qT,{connector:e,onChanged:r}),e.configured&&s.jsx(XT,{connectorId:e.id})]})]})}function GT({connector:e,onChanged:t}){const[n,r]=p.useState(!1),[i,l]=p.useState(null),[a,o]=p.useState({});p.useEffect(()=>{const g=()=>{t()};return window.addEventListener("focus",g),()=>window.removeEventListener("focus",g)},[t]);const c=g=>{var v;const k=window;(v=k.gaia)!=null&&v.openExternal?k.gaia.openExternal(g):window.open(g,"_blank","noopener")},u=async()=>{var g;r(!0),l(null);try{const k=await zy(e.id,(g=e.available_scopes)!=null&&g.length?e.available_scopes:e.default_scopes);c(k.authorization_url)}catch(k){l(k instanceof Error?k.message:String(k))}finally{r(!1)}},d=async()=>{r(!0),l(null);try{await Td(e.id),t()}catch(g){l(g instanceof Error?g.message:String(g))}finally{r(!1)}},f=async()=>{var k;const g=(e.oauth_setup_fields??[]).filter(v=>{var x;return v.required!==!1&&!((x=a[v.key])!=null&&x.trim())}).map(v=>v.label);if(g.length){l(`Required: ${g.join(", ")}`);return}r(!0),l(null);try{const v=(k=e.available_scopes)!=null&&k.length?e.available_scopes:e.default_scopes,x=await Ly(e.id,{...a,scopes:v}),w=typeof x.authorization_url=="string"?x.authorization_url:null;w&&c(w),t()}catch(v){l(v instanceof Error?v.message:String(v))}finally{r(!1)}},h=e.oauth_setup_fields??[],m=e.configurable===!1&&!e.configured&&h.length>0;return s.jsxs("div",{className:"configure-body",children:[e.description&&s.jsx("p",{className:"connector-desc",children:e.description}),m&&s.jsxs("div",{className:"oauth-setup-form",children:[s.jsx("p",{className:"connector-desc",children:"First-time setup — provide your OAuth client credentials below. They’re stored encrypted in your OS keyring and reused for future connections."}),h.map(g=>s.jsxs("label",{className:"oauth-setup-field",children:[s.jsx("span",{className:"oauth-setup-label",children:g.label}),s.jsx("input",{type:g.kind==="secret"?"password":"text",className:"oauth-setup-input",placeholder:g.placeholder,value:a[g.key]??"",onChange:k=>o(v=>({...v,[g.key]:k.target.value})),autoComplete:"off",spellCheck:!1}),g.help_md&&s.jsx("span",{className:"oauth-setup-help",children:g.help_md})]},g.key))]}),i&&s.jsxs("div",{className:"configure-error",children:[s.jsx(kt,{size:12})," ",i]}),s.jsxs("div",{className:"configure-actions",children:[e.configured?s.jsx("button",{className:"btn-secondary",disabled:n,onClick:()=>void d(),children:n?s.jsx(mt,{size:12,className:"spin"}):"Disconnect"}):m?s.jsx("button",{className:"btn-primary",disabled:n,onClick:()=>void f(),children:n?s.jsx(mt,{size:12,className:"spin"}):s.jsxs(s.Fragment,{children:[s.jsx(Gi,{size:12})," Save & Connect"]})}):e.configurable===!1?s.jsx("span",{className:"connector-setup-required",title:e.config_error??void 0,children:"Setup required"}):s.jsx("button",{className:"btn-primary",disabled:n,onClick:()=>void u(),children:n?s.jsx(mt,{size:12,className:"spin"}):s.jsxs(s.Fragment,{children:[s.jsx(Gi,{size:12})," Connect"]})}),(e.docs_url||e.product_url)&&s.jsxs("a",{href:e.docs_url||e.product_url||"#",target:"_blank",rel:"noopener noreferrer",className:"connector-product-link",children:["Learn more ",s.jsx(Gi,{size:11})]})]})]})}function qT({connector:e,onChanged:t}){const[n,r]=p.useState(()=>Object.fromEntries(e.mcp_env_keys.map(m=>[m,""]))),[i,l]=p.useState(!1),[a,o]=p.useState(!1),[c,u]=p.useState(null);p.useEffect(()=>{r(Object.fromEntries(e.mcp_env_keys.map(m=>[m,""])))},[e.mcp_env_keys.join(",")]);const d=async()=>{const m=Object.fromEntries(Object.entries(n).filter(([,g])=>g.trim()!==""));if(Object.keys(m).length!==0){l(!0),u(null),o(!1);try{await Ly(e.id,m),o(!0),t(),setTimeout(()=>o(!1),2200)}catch(g){u(g instanceof Error?g.message:String(g))}finally{l(!1)}}},f=async()=>{l(!0),u(null);try{await Td(e.id),r(Object.fromEntries(e.mcp_env_keys.map(m=>[m,""]))),t()}catch(m){u(m instanceof Error?m.message:String(m))}finally{l(!1)}},h=async()=>{l(!0),u(null);try{e.enabled?await Dy(e.id):await Ay(e.id),t()}catch(m){u(m instanceof Error?m.message:String(m))}finally{l(!1)}};return s.jsxs("div",{className:"configure-body",children:[e.description&&s.jsx("p",{className:"connector-desc",children:e.description}),c&&s.jsxs("div",{className:"configure-error",children:[s.jsx(kt,{size:12})," ",c]}),e.configured&&s.jsxs("div",{className:"connector-toggle-row",children:[s.jsx("span",{className:"connector-toggle-label",children:"Active"}),s.jsxs("span",{className:"toggle-switch",children:[s.jsx("input",{type:"checkbox",checked:e.enabled!==!1,onChange:()=>void h(),disabled:i,"aria-label":e.enabled?"Disable this MCP server":"Enable this MCP server"}),s.jsx("span",{className:"toggle-track"})]})]}),e.configured&&e.enabled===!1&&s.jsx("p",{className:"connector-toggle-help",children:"Credentials and per-agent grants are preserved. Re-enable to make this server's tools available again."}),e.mcp_env_keys.map(m=>s.jsxs("div",{className:"mcp-key-row",children:[s.jsx("label",{className:"mcp-key-label",children:m}),s.jsx("input",{type:"password",className:"mcp-key-input",placeholder:e.configured?"••••••••":"Enter value",value:n[m]??"",onChange:g=>r(k=>({...k,[m]:g.target.value})),spellCheck:!1,autoComplete:"off"})]},m)),s.jsxs("div",{className:"configure-actions",children:[s.jsx("button",{className:`btn-model-save${a?" saved":""}`,disabled:i||Object.values(n).every(m=>m.trim()===""),onClick:()=>void d(),children:i?s.jsx(mt,{size:12,className:"spin"}):a?s.jsxs(s.Fragment,{children:[s.jsx(sr,{size:12})," Saved"]}):"Save"}),e.configured&&s.jsx("button",{className:"btn-secondary",disabled:i,onClick:()=>void f(),children:"Disconnect"}),e.product_url&&s.jsxs("a",{href:e.product_url,target:"_blank",rel:"noopener noreferrer",className:"connector-product-link",children:["Docs ",s.jsx(Gi,{size:11})]})]})]})}function QT({agent:e,connectorId:t,grantedScopes:n,onChanged:r}){var m;const i=(m=e.required_connections)==null?void 0:m.find(g=>g.connector_id===t),l=e.namespaced_agent_id;if(!i||!l)return null;const[a,o]=p.useState(()=>new Set(n)),[c,u]=p.useState(null),[d,f]=p.useState(null);p.useEffect(()=>{o(new Set(n))},[n.join(",")]);const h=async g=>{if(c!==null)return;const k=new Set(a);k.has(g)?k.delete(g):k.add(g),o(k),u(g),f(null);try{k.size===0?await h0(t,l):await m0(t,l,[...k]),r()}catch(v){o(new Set(n)),f(v instanceof Error?v.message:String(v))}finally{u(null)}};return s.jsxs("div",{className:"grant-agent-card",children:[s.jsx("div",{className:"grant-agent-card-name",children:e.name}),s.jsx("div",{className:"grant-scope-list",children:i.scopes.map(g=>s.jsxs("label",{className:"grant-scope-item",children:[s.jsx("span",{className:"grant-scope-label",children:HT(g)}),s.jsxs("span",{className:"toggle-switch",children:[s.jsx("input",{type:"checkbox",checked:a.has(g),onChange:()=>void h(g),disabled:c!==null}),s.jsx("span",{className:"toggle-track"})]})]},g))}),d&&s.jsxs("div",{className:"grant-scope-warning grant-scope-warning--error",children:[s.jsx(kt,{size:11})," ",d]})]})}function KT({servers:e,expanded:t,onToggle:n}){return s.jsxs("div",{className:"agent-mcps-section",children:[s.jsx("div",{className:"agent-mcps-section-header",children:"Custom agent servers"}),s.jsx("div",{className:"connectors-list",children:e.map(r=>{const i=`${r.agent_id}::${r.server_name}`;return s.jsx(YT,{server:r,expanded:t===i,onToggle:()=>n(i)},i)})})]})}function YT({server:e,expanded:t,onToggle:n}){const r=[e.command,...e.args].join(" ");return s.jsxs("div",{className:`agent-mcp-tile${t?" agent-mcp-tile--open":""}`,children:[s.jsxs("button",{type:"button",className:"agent-mcp-tile-header",onClick:n,"aria-expanded":t,children:[s.jsx("span",{className:"agent-mcp-server-name",children:e.server_name}),s.jsxs("span",{className:"agent-mcp-agent-label",children:["via ",e.agent_name]}),e.disabled?s.jsx("span",{className:"agent-mcp-status disabled",children:"Disabled"}):s.jsxs("span",{className:"agent-mcp-status enabled",children:[s.jsx(sr,{size:11})," Active"]}),s.jsx("span",{className:"agent-mcp-readonly-badge",children:"read-only"}),s.jsx("span",{className:"agent-mcp-chevron",children:t?s.jsx(dy,{size:14}):s.jsx(ci,{size:14})})]}),t&&s.jsxs("div",{className:"agent-mcp-detail",children:[r&&s.jsx("div",{className:"agent-mcp-command-row",children:r}),s.jsx("div",{className:"agent-mcp-config-path",children:e.config_path}),s.jsxs("div",{className:"agent-mcp-config-hint",children:["Edit the agent's ",s.jsx("code",{children:"mcp_servers.json"})," to change this server."]})]})]})}function XT({connectorId:e}){const{agents:t}=Se(),[n,r]=p.useState({}),[i,l]=p.useState(!0),a=p.useCallback(async()=>{try{const{grants:c}=await f0(e);r(c)}catch{r({})}finally{l(!1)}},[e]);if(p.useEffect(()=>{a()},[a]),i)return null;const o=t.filter(c=>{var u;return c.namespaced_agent_id&&((u=c.required_connections)==null?void 0:u.some(d=>d.connector_id===e))});return s.jsxs("div",{className:"connection-grants",children:[s.jsx("div",{className:"grants-header",children:"Per-agent grants"}),o.length===0?s.jsx("div",{className:"grants-empty",children:"No agents require access to this connector."}):o.map(c=>s.jsx(QT,{agent:c,connectorId:e,grantedScopes:n[c.namespaced_agent_id]??[],onChanged:()=>void a()},c.namespaced_agent_id))]})}function JT(){const{setShowSettings:e,sessions:t,removeSession:n,agents:r}=Se(),[i,l]=p.useState(null),[a,o]=p.useState(!0),[c,u]=p.useState([]),[d,f]=p.useState(""),[h,m]=p.useState(""),[g,k]=p.useState(!1),[v,x]=p.useState(!1),[w,j]=p.useState(null),[z,D]=p.useState(!1),_=p.useRef(null);p.useEffect(()=>{E.system.info("Checking system status...");const P=E.system.time();_d().then(M=>{l(M),E.system.timed("System status received",P,{lemonade:M.lemonade_running?"running":"stopped",model:M.model_loaded||"none",embedding:M.embedding_model_loaded?"yes":"no",disk:`${M.disk_space_gb}GB free`,memory:M.memory_available_gb!=null?`${M.memory_available_gb}GB available`:"unknown"}),M.lemonade_running||E.system.warn("Lemonade Server is NOT running.")}).catch(M=>{E.system.error("Failed to get system status",M),l(null)}).finally(()=>o(!1)),D0().then(M=>u(M.servers)).catch(()=>{}),s0().then(M=>{const B=M.custom_model??"";f(B),m(B)}).catch(M=>{E.system.error("Failed to load settings",M)}).finally(()=>k(!0))},[]),p.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const A=p.useCallback(async()=>{const P=d.trim(),M=P.length>0?P:"";x(!0),j(null),D(!1);try{E.system.info("Saving custom_model override",{custom_model:M});const he=(await l0({custom_model:M})).custom_model??"";f(he),m(he),D(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>D(!1),2200)}catch(B){const he=B instanceof Error?B.message:String(B);E.system.error("Failed to save custom_model",B),j(he)}finally{x(!1)}},[d]),C=d.trim()!==h.trim(),R=(i==null?void 0:i.default_model_name)??Xd,{isLoadingModel:N,isDownloadingModel:U,loadModel:O,downloadModel:re}=ev(R),oe=[{label:"4K",value:4096},{label:"8K",value:8192},{label:"16K",value:16384},{label:"32K",value:32768}],te=(i==null?void 0:i.model_context_size)??null,[le,fe]=p.useState("");p.useEffect(()=>{te!=null&&fe(String(te))},[te]);const T=(()=>{const P=parseInt(le,10);return Number.isFinite(P)&&P>0?P:null})(),I=T!=null&&T!==te,b=(i==null?void 0:i.model_loaded)??R,X=p.useCallback(async()=>{T&&(E.system.info(`Reloading ${b} with ctx_size=${T}`),await O(b,T))},[T,b,O]),[H,S]=p.useState(!1),ie=p.useRef(null);p.useEffect(()=>()=>{ie.current&&clearTimeout(ie.current)},[]);const ye=p.useCallback(async()=>{if(!H){S(!0),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>S(!1),4e3);return}S(!1),ie.current&&clearTimeout(ie.current),E.system.warn(`Clearing ALL data: ${t.length} session(s)`);const P=E.system.time();let M=0;for(const B of t)try{await Iy(B.id),n(B.id),M++}catch(he){E.system.error(`Failed to delete session ${B.id}`,he)}E.system.timed(`Cleared ${M}/${t.length} session(s)`,P),e(!1)},[H,t,n,e]),ae="0.19.0",be=!!(i!=null&&i.lemonade_running&&i.model_loaded&&i.expected_model_loaded===!1),Ge=!!(i!=null&&i.lemonade_running&&i.model_loaded&&i.context_size_sufficient===!1),qe=!!(i!=null&&i.lemonade_running&&!i.model_loaded&&i.model_downloaded===!1),Xe=be||Ge;return s.jsxs("div",{className:"settings-page",children:[s.jsxs("div",{className:"settings-page-header",children:[s.jsx("button",{className:"btn-icon settings-back-btn",onClick:()=>e(!1),"aria-label":"Back",children:s.jsx(cy,{size:18})}),s.jsx("h3",{children:"Settings"})]}),s.jsxs("div",{className:"settings-page-body",children:[s.jsxs("section",{className:"settings-section",children:[s.jsx("h4",{children:"System Status"}),a?s.jsx("p",{className:"loading-text",children:"Checking system..."}):i?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"status-grid",children:[s.jsx(Nn,{label:"Lemonade Server",value:i.lemonade_running?`Running${i.lemonade_version?` v${i.lemonade_version}`:""}`:"Not Running",ok:i.lemonade_running,hint:i.lemonade_running?void 0:i.initialized?"Run: lemonade-server serve":"Run: gaia init --profile chat"}),s.jsx(Nn,{label:"Model",value:i.model_loaded||"None loaded",ok:!!i.model_loaded&&i.expected_model_loaded!==!1,hint:i.model_loaded?i.expected_model_loaded===!1?`Expected: ${R}`:void 0:"Run: gaia init --profile chat"}),i.model_size_gb!=null&&s.jsx(Nn,{label:"Model Size",value:`${i.model_size_gb} GB`,ok:!0}),i.model_device&&s.jsx(Nn,{label:"Device",value:i.model_device.toUpperCase(),ok:i.model_device!=="cpu"}),i.model_context_size!=null&&s.jsx(Nn,{label:"Context Window",value:`${(i.model_context_size/1024).toFixed(0)}K tokens`,ok:i.context_size_sufficient}),i.model_labels&&i.model_labels.length>0&&s.jsx(Nn,{label:"Capabilities",value:i.model_labels.join(", "),ok:!0}),s.jsx(Nn,{label:"Embedding Model",value:i.embedding_model_loaded?"Available":"Not loaded",ok:i.embedding_model_loaded}),i.gpu_name&&s.jsx(Nn,{label:"GPU",value:`${i.gpu_name}${i.gpu_vram_gb?` (${i.gpu_vram_gb} GB)`:""}`,ok:!0}),s.jsx(Nn,{label:"Disk Space",value:`${i.disk_space_gb} GB free`,ok:i.disk_space_gb>5,hint:!i.model_loaded&&i.disk_space_gb<30?`Models require ~25 GB — only ${i.disk_space_gb} GB available`:void 0}),s.jsx(Nn,{label:"Memory",value:i.memory_available_gb!=null?`${i.memory_available_gb} GB available`:"unknown",ok:i.memory_available_gb!=null&&i.memory_available_gb>2}),i.processor_name&&s.jsx(Nn,{label:"Processor",value:i.processor_name,ok:i.device_supported!==!1})]}),qe&&s.jsxs("div",{className:"model-action-row model-action-row--download",children:[s.jsxs("div",{className:"model-action-info",children:[s.jsx("span",{className:"model-action-label",children:"Model not downloaded."}),s.jsxs("span",{className:"model-action-desc",children:[s.jsx("strong",{children:R})," is required for GAIA Chat (~25 GB)."]})]}),s.jsx("button",{className:"btn-model-action btn-model-action--download",onClick:()=>re(!1),disabled:U,children:U?s.jsxs(s.Fragment,{children:[s.jsx(mt,{size:13,className:"btn-spinner"})," Downloading…"]}):"Download"})]}),Xe&&s.jsxs("div",{className:"model-action-row model-action-row--load",children:[s.jsxs("div",{className:"model-action-info",children:[s.jsx("span",{className:"model-action-label",children:be?"Wrong model loaded.":"Context window too small."}),s.jsxs("span",{className:"model-action-desc",children:["Load ",s.jsx("strong",{children:R})," with ",(Js/1024).toFixed(0),"K token context."]})]}),s.jsx("button",{className:"btn-model-action btn-model-action--load",onClick:()=>O(),disabled:N,children:N?s.jsxs(s.Fragment,{children:[s.jsx(mt,{size:13,className:"btn-spinner"})," Loading…"]}):"Load Model"})]}),i.lemonade_running&&s.jsxs("div",{className:"force-redownload-row",children:[s.jsx("span",{className:"force-redownload-label",children:"If the model file is corrupted:"}),s.jsx("button",{className:"btn-force-redownload",onClick:()=>re(!0),disabled:U,children:U?s.jsxs(s.Fragment,{children:[s.jsx(mt,{size:12,className:"btn-spinner"})," Downloading…"]}):"Force Re-download"})]})]}):s.jsxs("div",{className:"status-error",children:[s.jsx("p",{children:"Could not connect to server"}),s.jsx("code",{children:"gaia chat --ui"})]})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("h4",{children:"Active Model"}),s.jsx("p",{className:"model-override-desc",children:"Override the model used by the active agent. Leave empty to use the current agent’s preferred model."}),s.jsxs("div",{className:"model-input-row",children:[s.jsx("input",{type:"text",className:`model-input${h?" has-override":""}`,placeholder:"Use agent default",value:d,onChange:P=>{f(P.target.value),j(null),D(!1)},onKeyDown:P=>{P.key==="Enter"&&!v&&C&&g&&(P.preventDefault(),A())},disabled:!g||v,spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-label":"Custom model override"}),s.jsx("div",{className:"model-btn-group",children:s.jsx("button",{className:`btn-model-save${z?" saved":""}`,onClick:()=>{A()},disabled:!g||v||!C&&!z,"aria-label":"Save custom model",children:v?s.jsxs(s.Fragment,{children:[s.jsx(mt,{size:13,className:"btn-spinner"})," Saving…"]}):z?s.jsxs(s.Fragment,{children:[s.jsx(sr,{size:13})," Saved"]}):"Save"})})]}),s.jsxs("p",{className:"model-status-hint",children:["Accepts a Lemonade model ID (e.g. ",s.jsx("code",{children:"Qwen3-4B-Instruct-2507-GGUF"}),")"," ","or a HuggingFace ID (e.g. ",s.jsx("code",{children:"unsloth/Qwen3-4B-GGUF"}),")."]}),w&&s.jsxs("div",{className:"model-warning",role:"alert",children:[s.jsx(kt,{size:14}),s.jsxs("div",{className:"model-warning-content",children:[s.jsx("strong",{children:"Could not save"}),s.jsx("p",{children:w})]})]})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("h4",{children:"Context Size"}),s.jsx("p",{className:"model-override-desc",children:"Reload the active model with a different context window. Larger contexts use more memory and slow inference; going past the model’s training length may degrade quality."}),s.jsx("div",{className:"ctx-preset-row",children:oe.map(P=>{const M=T===P.value;return s.jsx("button",{className:`btn-ctx-preset${M?" active":""}`,onClick:()=>fe(String(P.value)),disabled:N,type:"button",children:P.label},P.value)})}),s.jsxs("div",{className:"model-input-row",children:[s.jsx("input",{type:"number",className:"model-input",placeholder:te!=null?String(te):"4096",value:le,min:512,step:1024,onChange:P=>fe(P.target.value),disabled:N,"aria-label":"Context size in tokens"}),s.jsx("div",{className:"model-btn-group",children:s.jsx("button",{className:"btn-model-save",onClick:()=>{X()},disabled:N||!I||!(i!=null&&i.lemonade_running),"aria-label":"Reload model with new context size",children:N?s.jsxs(s.Fragment,{children:[s.jsx(mt,{size:13,className:"btn-spinner"})," Reloading…"]}):"Apply"})})]}),s.jsxs("p",{className:"model-status-hint",children:["Current: ",s.jsx("code",{children:te!=null?`${te.toLocaleString()} tokens`:"unknown"}),(i==null?void 0:i.model_loaded)&&s.jsxs(s.Fragment,{children:[" on ",s.jsx("code",{children:i.model_loaded})]}),"."]})]}),i&&i.memory_available_gb!=null&&(()=>{const P=i.memory_available_gb,M=r.filter(B=>B.min_memory_gb!=null&&B.min_memory_gb>P);return M.length===0?null:s.jsxs("section",{className:"settings-section",children:[s.jsx("h4",{children:"Memory Warnings"}),s.jsx("div",{className:"status-grid",children:M.map(B=>s.jsxs("div",{className:"status-row status-row--has-hint",children:[s.jsx("span",{className:"status-label",children:B.name}),s.jsxs("div",{className:"status-value-wrap",children:[s.jsxs("span",{className:"status-value warn memory-warning-value",children:[s.jsx(kt,{size:12}),"Needs ~",B.min_memory_gb," GB free"]}),s.jsxs("span",{className:"status-hint",children:["Only ",i.memory_available_gb," GB available — model load may fail or swap heavily."]})]})]},B.id))})]})})(),c.length>0&&s.jsxs("section",{className:"settings-section",children:[s.jsx("h4",{children:"MCP Servers"}),s.jsx("div",{className:"status-grid",children:c.map(P=>s.jsxs("div",{className:"status-row",children:[s.jsx("span",{className:"status-label",children:P.name}),s.jsx("div",{className:"status-value-wrap",children:P.connected?s.jsxs("span",{className:"status-value ok mcp-status-connected",children:[s.jsx(sr,{size:12}),P.tool_count," tool",P.tool_count!==1?"s":""]}):s.jsxs("span",{className:"status-value warn mcp-status-failed",title:P.error??void 0,children:[s.jsx(kt,{size:12}),"Failed"]})})]},P.name))})]}),s.jsx(MT,{}),s.jsx(VT,{}),s.jsxs("section",{className:"settings-section",children:[s.jsx("h4",{children:"About"}),s.jsxs("div",{className:"about-info",children:[s.jsxs("p",{children:["GAIA v",ae," ",s.jsx("span",{className:"beta-badge",children:"BETA"})]}),s.jsx("p",{className:"about-sub",children:"Privacy-first AI chat for AMD Ryzen AI PCs."})]})]}),s.jsxs("section",{className:"settings-section",children:[s.jsx("h4",{children:"Privacy & Data"}),s.jsxs("div",{className:"setting-row",children:[s.jsx("span",{children:"Data location"}),s.jsx("code",{className:"setting-path",children:"~/.gaia/chat/"})]}),s.jsx("div",{className:"danger-divider"}),s.jsxs("div",{className:"setting-actions",children:[s.jsx("p",{className:"danger-warning",children:"This will permanently delete all sessions, messages, and documents."}),s.jsx("button",{className:"btn-danger",onClick:ye,children:H?"Click again to confirm":"Clear All Data"})]})]})]})]})}function Nn({label:e,value:t,ok:n,hint:r}){return s.jsxs("div",{className:`status-row${r?" status-row--has-hint":""}`,children:[s.jsx("span",{className:"status-label",children:e}),s.jsxs("div",{className:"status-value-wrap",children:[s.jsx("span",{className:`status-value ${n?"ok":"warn"}`,children:t}),r&&s.jsx("span",{className:"status-hint",children:s.jsx("code",{children:r})})]})]})}const ZT="modulepreload",e4=function(e,t){return new URL(e,t).href},Kh={},t4=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){const a=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),c=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(u=>{if(u=e4(u,r),u in Kh)return;Kh[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(!!r)for(let g=a.length-1;g>=0;g--){const k=a[g];if(k.href===u&&(!d||k.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":ZT,d||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),d)return new Promise((g,k)=>{m.addEventListener("load",g),m.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${u}`)))})}))}function l(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&l(o.reason);return t().catch(l)})};let kc=null;function n4({isOpen:e,onClose:t,onStop:n,error:r}){const[i,l]=p.useState(null),[a,o]=p.useState(!1),c=p.useRef(null),u=p.useCallback(async()=>{try{const m=await Fy();return l(m),m}catch(m){return E.system.error("Failed to fetch tunnel status",m),null}},[]);p.useEffect(()=>{if(!e||r)return;u();const m=setInterval(async()=>{const g=await u();g!=null&&g.active&&(g!=null&&g.url)&&clearInterval(m)},2e3);return()=>clearInterval(m)},[e,r,u]),p.useEffect(()=>{if(!(i!=null&&i.active)||!i.url||!i.token||!c.current)return;const m=`${i.url}/?token=${i.token}`;E.system.info(`Generating QR code for: ${m}`),(async()=>{if(!kc)try{const v=await t4(()=>import("./browser-CTB2jwNe.js").then(x=>x.b),[],import.meta.url);kc=v.default||v}catch{E.system.error("QR code library not available - install with: npm install qrcode");return}const k=document.documentElement.getAttribute("data-theme")==="dark";try{await kc.toCanvas(c.current,m,{width:200,margin:2,color:{dark:k?"#e6edf3":"#111827",light:k?"#0d0d0d":"#ffffff"}})}catch(v){E.system.error("QR code generation failed",v)}})()},[i==null?void 0:i.active,i==null?void 0:i.url,i==null?void 0:i.token]);const d=p.useRef(null),f=p.useCallback(()=>{if(!(i!=null&&i.url)||!(i!=null&&i.token))return;const m=`${i.url}/?token=${i.token}`;navigator.clipboard.writeText(m).then(()=>{o(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>o(!1),2e3)})},[i]);if(p.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),!e)return null;const h=i!=null&&i.active&&(i!=null&&i.url)&&(i!=null&&i.token)?`${i.url}/?token=${i.token}`:"";return s.jsx("div",{className:"modal-overlay",onClick:t,role:"dialog","aria-modal":"true","aria-label":"Mobile Access",children:s.jsxs("div",{className:"modal-panel mobile-modal",onClick:m=>m.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsxs("h3",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s.jsx(ky,{size:18}),"Mobile Access"]}),s.jsx("button",{className:"btn-icon",onClick:t,"aria-label":"Close",children:s.jsx(Ze,{size:18})})]}),s.jsxs("div",{className:"modal-body mobile-modal-body",children:[s.jsxs("div",{className:"tunnel-status",children:[s.jsx("span",{className:`status-dot ${i!=null&&i.active?"active":r?"error":"starting"}`}),s.jsx("span",{children:i!=null&&i.active?"Tunnel active":r?"Connection failed":"Starting tunnel..."}),!(i!=null&&i.active)&&!r&&s.jsx("span",{className:"tunnel-spinner"})]}),r&&s.jsx("div",{className:"tunnel-error",children:r}),s.jsx("div",{className:"qr-code-area",children:i!=null&&i.active?s.jsx("canvas",{ref:c}):r?s.jsx("div",{className:"qr-placeholder error",children:"Failed to connect"}):s.jsxs("div",{className:"qr-placeholder",children:[s.jsx("div",{className:"placeholder-spinner"}),s.jsx("span",{children:"Connecting..."})]})}),(i==null?void 0:i.active)&&h&&s.jsxs("div",{className:"tunnel-url-area",children:[s.jsx("label",{children:"Mobile URL"}),s.jsxs("div",{className:"tunnel-url-row",children:[s.jsx("input",{type:"text",readOnly:!0,value:h}),s.jsxs("button",{className:`copy-url-btn ${a?"copied":""}`,onClick:f,title:"Copy URL",children:[a?s.jsx(oi,{size:13}):s.jsx(Nl,{size:13}),a?"Copied":"Copy"]})]})]}),(i==null?void 0:i.active)&&(i==null?void 0:i.publicIp)&&(i==null?void 0:i.url)&&!i.url.includes("ngrok-free.app")&&s.jsxs("div",{className:"tunnel-password-hint",children:[s.jsx("label",{children:"Tunnel Password"}),s.jsx("div",{className:"tunnel-password-value",children:i.publicIp}),s.jsx("span",{className:"tunnel-password-note",children:"Enter this when the tunnel page asks for a password"})]}),s.jsx("div",{className:"mobile-instructions",children:s.jsxs("ol",{children:[s.jsx("li",{children:"Scan the QR code with your phone's camera"}),(i==null?void 0:i.url)&&!i.url.includes("ngrok-free.app")&&s.jsx("li",{children:"Enter the tunnel password shown above when prompted"}),s.jsx("li",{children:"Chat with GAIA from your mobile device"}),s.jsx("li",{children:"Your data stays secure via encrypted tunnel"})]})}),s.jsxs("div",{className:"mobile-access-actions",children:[(i==null?void 0:i.active)&&n&&s.jsx("button",{className:"btn-danger",onClick:n,title:"Close the tunnel and revoke the mobile URL",children:"Stop Tunnel"}),s.jsx("button",{className:"btn-secondary",onClick:t,children:"Close"})]})]})]})})}function r4({onRetry:e}){var j;const{backendConnected:t,systemStatus:n,currentSessionId:r,messages:i}=Se(),[l,a]=p.useState(!1),o=!!r&&i.length>0,c=(n==null?void 0:n.default_model_name)??Xd,{isLoadingModel:u,isDownloadingModel:d,loadModel:f,downloadModel:h}=ev(c),m=p.useRef(n==null?void 0:n.lemonade_running),g=p.useRef(n==null?void 0:n.model_downloaded),k=p.useRef(n==null?void 0:n.context_size_sufficient),v=p.useRef(n==null?void 0:n.expected_model_loaded);p.useEffect(()=>{if(o)return;const z=n==null?void 0:n.lemonade_running,D=n==null?void 0:n.model_downloaded,_=n==null?void 0:n.context_size_sufficient,A=n==null?void 0:n.expected_model_loaded;let C=!1;m.current!==z&&(m.current=z,z===!1&&(C=!0)),g.current!==D&&(g.current=D,D===!1&&(C=!0)),k.current!==_&&(k.current=_,_===!1&&(C=!0)),v.current!==A&&(v.current=A,A===!1&&(C=!0)),C&&a(!1)},[n,o]);const x=(n==null?void 0:n.download_progress)??null;if(d||(x==null?void 0:x.state)==="downloading"||(x==null?void 0:x.state)==="starting"||(x==null?void 0:x.state)==="error"){const z=n!=null&&n.default_model_size_gb?`~${n.default_model_size_gb.toFixed(1)} GB`:"large download",D=(x==null?void 0:x.state)==="error";return s.jsxs("div",{className:`connection-banner ${D?"connection-banner--error":"connection-banner--warning"}`,role:D?"alert":"status",children:[s.jsx("div",{className:"connection-banner__icon",children:D?s.jsx(gn,{size:16}):s.jsx(ui,{size:16})}),s.jsx("div",{className:"connection-banner__text",children:D?s.jsxs(s.Fragment,{children:["Download of ",s.jsx("strong",{children:c})," failed."," ",(x==null?void 0:x.message)&&s.jsx("span",{className:"connection-banner__hint",children:x.message})]}):s.jsxs(s.Fragment,{children:["Downloading ",s.jsx("strong",{children:c})," (",z,").",(x==null?void 0:x.state)==="downloading"&&x.file&&s.jsxs(s.Fragment,{children:[" ",s.jsxs("span",{className:"connection-banner__hint",children:["File ",x.file_index," / ",x.total_files,": ",s.jsx("code",{children:x.file})]})]})]})}),D?s.jsx("button",{className:"connection-banner__retry",onClick:()=>h(!1),children:"Retry"}):s.jsx("span",{className:"connection-banner__loading connection-banner__progress",children:x&&x.state==="downloading"&&x.total_bytes>0?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"connection-banner__progress-bar",role:"progressbar","aria-valuenow":x.percent,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Download progress",children:s.jsx("span",{className:"connection-banner__progress-fill",style:{width:`${x.percent}%`}})}),s.jsxs("span",{className:"connection-banner__progress-label",children:[x.percent,"% ·"," ",(x.downloaded_bytes/1e9).toFixed(2)," /"," ",(x.total_bytes/1e9).toFixed(2)," GB"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(mt,{size:13,className:"connection-banner__spinner"}),(x==null?void 0:x.state)==="starting"?"Starting download…":"Downloading…"]})}),D&&s.jsx("button",{className:"connection-banner__dismiss",onClick:()=>a(!0),"aria-label":"Dismiss",children:s.jsx(Ze,{size:14})})]})}if((n==null?void 0:n.init_state)==="initializing"){const z=(j=n.init_tasks)==null?void 0:j.find(_=>_.status==="running"),D=(z==null?void 0:z.name)||"Preparing AI system";return s.jsxs("div",{className:"connection-banner connection-banner--init",role:"status",children:[s.jsx("div",{className:"connection-banner__icon",children:s.jsx(mt,{size:16,className:"connection-banner__spinner"})}),s.jsxs("div",{className:"connection-banner__text",children:[D,s.jsxs("span",{className:"thinking-dots",children:[s.jsx("span",{children:"."}),s.jsx("span",{children:"."}),s.jsx("span",{children:"."})]})]})]})}if(l||o)return null;if(!t)return s.jsxs("div",{className:"connection-banner connection-banner--error",role:"alert",children:[s.jsx("div",{className:"connection-banner__icon",children:s.jsx(_w,{size:16})}),s.jsxs("div",{className:"connection-banner__text",children:["Cannot connect to GAIA server."," ",s.jsxs("span",{className:"connection-banner__hint",children:["Start it with: ",s.jsx("code",{children:"gaia chat --ui"})]})]}),e&&s.jsx("button",{className:"connection-banner__retry",onClick:e,children:"Retry"})]});if(n&&!n.lemonade_running)return s.jsxs("div",{className:"connection-banner connection-banner--warning",role:"status",children:[s.jsx("div",{className:"connection-banner__icon",children:s.jsx(gn,{size:16})}),s.jsxs("div",{className:"connection-banner__text",children:["LLM server is not responding — it may be busy or not running."," ",s.jsxs("span",{className:"connection-banner__hint",children:["If not started, run: ",s.jsx("code",{children:"lemonade-server serve"})]})]}),e&&s.jsx("button",{className:"connection-banner__retry",onClick:e,children:"Check again"}),s.jsx("button",{className:"connection-banner__dismiss",onClick:()=>a(!0),"aria-label":"Dismiss",children:s.jsx(Ze,{size:14})})]});if(n&&n.lemonade_running&&!n.model_loaded&&n.model_downloaded===!1){const z=n.default_model_size_gb?`~${n.default_model_size_gb.toFixed(1)} GB`:"large download";return s.jsxs("div",{className:"connection-banner connection-banner--warning",role:"status",children:[s.jsx("div",{className:"connection-banner__icon",children:s.jsx(ui,{size:16})}),s.jsxs("div",{className:"connection-banner__text",children:["Required model ",s.jsx("strong",{children:c})," is not downloaded (",z,")."]}),s.jsx("button",{className:"connection-banner__retry",onClick:()=>h(!1),children:"Download"}),e&&s.jsx("button",{className:"connection-banner__retry connection-banner__retry--secondary",onClick:e,children:"Recheck"}),s.jsx("button",{className:"connection-banner__dismiss",onClick:()=>a(!0),"aria-label":"Dismiss",children:s.jsx(Ze,{size:14})})]})}if(n&&n.lemonade_running&&n.model_loaded&&n.expected_model_loaded===!1&&!n.embedding_model_loaded){const z=n.model_loaded,D=n.context_size_sufficient===!1;return s.jsxs("div",{className:"connection-banner connection-banner--warning",role:"status",children:[s.jsx("div",{className:"connection-banner__icon",children:s.jsx(rs,{size:16})}),s.jsxs("div",{className:"connection-banner__text",children:["Wrong model loaded: ",s.jsx("strong",{children:z}),"."," ","GAIA Chat requires ",s.jsx("strong",{children:c}),".",D&&s.jsxs(s.Fragment,{children:[" ","Context window is also too small."]})]}),u?s.jsxs("span",{className:"connection-banner__loading",children:[s.jsx(mt,{size:13,className:"connection-banner__spinner"}),"Loading…"]}):s.jsx("button",{className:"connection-banner__retry",onClick:()=>f(),children:"Load Now"}),e&&!u&&s.jsx("button",{className:"connection-banner__retry connection-banner__retry--secondary",onClick:e,children:"Recheck"}),s.jsx("button",{className:"connection-banner__dismiss",onClick:()=>a(!0),"aria-label":"Dismiss",children:s.jsx(Ze,{size:14})})]})}if(n&&n.lemonade_running&&n.model_loaded&&n.context_size_sufficient===!1){const z=n.model_context_size??0,D=n.lemonade_url??"http://localhost:13305";return s.jsxs("div",{className:"connection-banner connection-banner--warning",role:"status",children:[s.jsx("div",{className:"connection-banner__icon",children:s.jsx(sw,{size:16})}),s.jsxs("div",{className:"connection-banner__text",children:["LLM context window is too small (",z.toLocaleString()," tokens;"," ",Js.toLocaleString()," required)."," ",s.jsxs("span",{className:"connection-banner__hint",children:["In"," ",s.jsx("a",{className:"connection-banner__link",href:D,target:"_blank",rel:"noreferrer",children:"Lemonade"}),", set ctx‑size to ",Js.toLocaleString(),", or restart with:"," ",s.jsxs("code",{children:["lemonade-server serve --ctx-size ",Js]})]})]}),e&&s.jsx("button",{className:"connection-banner__retry",onClick:e,children:"Check again"}),s.jsx("button",{className:"connection-banner__dismiss",onClick:()=>a(!0),"aria-label":"Dismiss",children:s.jsx(Ze,{size:14})})]})}return null}const i4={status:"idle",version:null,progress:0,releaseNotes:null,error:null};function s4(){const[e,t]=p.useState(i4);return p.useEffect(()=>{const n=window.gaiaUpdater;if(!n)return;let r=!0;n.getStatus().then(l=>{r&&l&&t(l)}).catch(()=>{});const i=n.onStatusChange(l=>{r&&l&&t(l)});return()=>{r=!1;try{i()}catch{}}},[]),e}function l4(){const e=s4(),[t,n]=p.useState(!1),r=p.useCallback(()=>{const i=window.gaiaUpdater;i==null||i.check().catch(()=>{})},[]);if(t||e.status==="idle"||e.status==="checking"||e.status==="disabled")return null;if(e.status==="downloading"){const i=Math.max(0,Math.min(100,e.progress));return s.jsxs("div",{className:"update-chip update-chip--downloading",role:"status","aria-live":"polite",title:`Downloading update${e.version?` ${e.version}`:""}…`,children:[s.jsx(ui,{size:13,className:"update-chip__icon"}),s.jsxs("span",{className:"update-chip__label",children:["Downloading update… ",i,"%"]})]})}return e.status==="available"?s.jsxs("div",{className:"update-chip update-chip--available",role:"status",title:e.releaseNotes||"A new version is available.",children:[s.jsx(ui,{size:13,className:"update-chip__icon"}),s.jsxs("span",{className:"update-chip__label",children:["Update available",e.version?`: ${e.version}`:""]}),s.jsx("button",{type:"button",className:"update-chip__dismiss",onClick:()=>n(!0),"aria-label":"Dismiss update notification",children:s.jsx(Ze,{size:11})})]}):e.status==="downloaded"?s.jsxs("div",{className:"update-chip update-chip--ready",role:"status","aria-live":"polite",children:[s.jsx(qs,{size:13,className:"update-chip__icon"}),s.jsx("button",{type:"button",className:"update-chip__action",onClick:r,title:"Click to restart and apply the update",children:"Update ready — restart to apply"})]}):e.status==="error"?s.jsxs("div",{className:"update-chip update-chip--error",role:"status",title:e.error||"Update check failed.",children:[s.jsx(gn,{size:13,className:"update-chip__icon"}),s.jsx("span",{className:"update-chip__label",children:"Update check failed"}),s.jsx("button",{type:"button",className:"update-chip__dismiss",onClick:()=>n(!0),"aria-label":"Dismiss update error",children:s.jsx(Ze,{size:11})})]}):null}function a4(){const e=ct(xE),t=ct(n=>n.respondToPermission);return e?s.jsx("div",{className:"permission-overlay",role:"dialog","aria-modal":"true","aria-label":"Permission Request",children:s.jsx(o4,{notification:e,onRespond:t},e.id)}):null}function o4({notification:e,onRespond:t}){const n=e.timeoutSeconds!=null&&e.timeoutSeconds>0,[r,i]=p.useState(n?e.timeoutSeconds:null),l=p.useRef(null),[a,o]=p.useState(!1),[c,u]=p.useState(!1),d=p.useRef(!1),f=p.useRef(t);f.current=t,p.useEffect(()=>{if(n)return l.current=setInterval(()=>{i(v=>v===null||v<=1?(l.current&&clearInterval(l.current),0):v-1)},1e3),()=>{l.current&&clearInterval(l.current)}},[n]),p.useEffect(()=>{if(r===0){if(d.current)return;d.current=!0,o(!0),f.current(e.id,"deny",!1)}},[r,e.id]);const h=p.useCallback(async()=>{if(!d.current){d.current=!0,o(!0),l.current&&clearInterval(l.current);try{await t(e.id,"allow",c)}finally{d.current=!1,o(!1)}}},[e.id,t,c]),m=p.useCallback(async()=>{if(!d.current){d.current=!0,o(!0),l.current&&clearInterval(l.current);try{await t(e.id,"deny",!1)}finally{d.current=!1,o(!1)}}},[e.id,t]);p.useEffect(()=>{const v=x=>{x.key==="Enter"&&!x.shiftKey?(x.preventDefault(),h()):x.key==="Escape"&&(x.preventDefault(),m())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[h,m]);const g=e.toolArgs,k=g&&Object.keys(g).length>0;return s.jsxs("div",{className:"permission-prompt",children:[s.jsxs("div",{className:"permission-header",children:[s.jsx("div",{className:"permission-header-icon",children:s.jsx(Ka,{size:24})}),s.jsxs("div",{className:"permission-header-text",children:[s.jsx("h2",{className:"permission-title",children:"Permission Request"}),s.jsx("span",{className:"permission-agent",children:e.agentName})]}),r!==null&&r>0&&s.jsxs("div",{className:"permission-countdown",title:"Auto-deny on timeout",children:[s.jsx(Qa,{size:14}),s.jsxs("span",{children:[r,"s"]})]})]}),s.jsxs("div",{className:"permission-body",children:[s.jsx("p",{className:"permission-message",children:e.message}),e.tool&&s.jsxs("div",{className:"permission-tool-info",children:[s.jsxs("div",{className:"permission-tool-header",children:[s.jsx(gn,{size:14}),s.jsx("span",{children:"Tool Invocation"})]}),s.jsx("div",{className:"permission-tool-name",children:s.jsx("code",{children:e.tool})}),k&&s.jsx("div",{className:"permission-tool-args",children:s.jsx("pre",{children:JSON.stringify(g,null,2)})})]}),e.priority==="critical"&&s.jsxs("div",{className:"permission-critical-banner",children:[s.jsx(gn,{size:14}),s.jsx("span",{children:"This is a critical-tier operation"})]}),s.jsxs("label",{className:"permission-remember",children:[s.jsx("input",{type:"checkbox",checked:c,onChange:v=>u(v.target.checked),disabled:a}),s.jsx("span",{children:"Always allow this tool"})]})]}),s.jsxs("div",{className:"permission-actions",children:[s.jsxs("button",{className:"permission-btn permission-btn-deny",onClick:m,disabled:a,title:"Deny (Esc)",children:[s.jsx(Ze,{size:16}),"Deny"]}),s.jsxs("button",{className:"permission-btn permission-btn-allow",onClick:h,disabled:a,title:"Allow (Enter)",children:[s.jsx(oi,{size:16}),"Allow"]})]}),s.jsxs("div",{className:"permission-hints",children:[s.jsxs("span",{children:[s.jsx("kbd",{children:"Enter"})," Allow"]}),s.jsxs("span",{children:[s.jsx("kbd",{children:"Esc"})," Deny"]})]})]})}const c4={permission_request:{icon:s.jsx(Ka,{size:16}),colorClass:"notif-type-permission",label:"Permission"},policy_alert:{icon:s.jsx(Ka,{size:16}),colorClass:"notif-type-policy",label:"Policy"},security_alert:{icon:s.jsx(gn,{size:16}),colorClass:"notif-type-security",label:"Security"},status_change:{icon:s.jsx(ji,{size:16}),colorClass:"notif-type-status",label:"Status"},info:{icon:s.jsx(iw,{size:16}),colorClass:"notif-type-info",label:"Info"},error:{icon:s.jsx(kt,{size:16}),colorClass:"notif-type-error",label:"Error"}};function u4(e){const n=Date.now()-e,r=Math.floor(n/1e3);if(r<60)return"just now";const i=Math.floor(r/60);if(i<60)return`${i}m ago`;const l=Math.floor(i/60);if(l<24)return`${l}h ago`;const a=Math.floor(l/24);return a<7?`${a}d ago`:new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function d4({onClose:e}){const t=ct(yE),n=ct(qx),r=ct(v=>v.markRead),i=ct(v=>v.markAllRead),l=ct(v=>v.clearAll),a=ct(v=>v.dismiss),o=ct(v=>v.addNotification),c=ct(v=>v.respondToPermission),u=ct(v=>v.typeFilter),d=ct(v=>v.setTypeFilter),f=p.useRef(!1);p.useEffect(()=>{var x;const v=window.gaiaAPI;!((x=v==null?void 0:v.notification)!=null&&x.onNotification)||f.current||(f.current=!0,v.notification.onNotification(w=>{o(w)}))},[o]);const h=p.useCallback(v=>{r(v)},[r]),m=p.useCallback(v=>{c(v.id,"allow",!1)},[c]),g=p.useCallback(v=>{c(v.id,"deny",!1)},[c]);p.useEffect(()=>{const v=x=>{x.key==="Escape"&&!x.defaultPrevented&&e()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[e]);const k=[{key:null,label:"All"},{key:"permission_request",label:"Permissions"},{key:"policy_alert",label:"Policy"},{key:"error",label:"Errors"},{key:"security_alert",label:"Security"},{key:"status_change",label:"Status"},{key:"info",label:"Info"}];return s.jsxs("div",{className:"notification-center",role:"dialog","aria-label":"Notification Center",children:[s.jsxs("div",{className:"notification-center-header",children:[s.jsxs("div",{className:"notification-center-title-row",children:[s.jsx("h2",{className:"notification-center-title",children:"Notifications"}),n>0&&s.jsx("span",{className:"notification-center-badge",children:n})]}),s.jsx("button",{className:"btn-icon notification-center-close",onClick:e,"aria-label":"Close notification center",children:s.jsx(Ze,{size:18})})]}),s.jsx("div",{className:"notification-filter-bar",role:"tablist","aria-label":"Filter notifications",children:k.map(v=>s.jsx("button",{role:"tab","aria-selected":u===v.key,className:`notification-filter-tab ${u===v.key?"active":""}`,onClick:()=>d(v.key),children:v.label},v.key??"all"))}),s.jsx("div",{className:"notification-list",children:t.length===0?s.jsxs("div",{className:"notification-empty",children:[s.jsx(uy,{size:40,strokeWidth:1.2}),s.jsx("span",{children:"No notifications"})]}):t.map(v=>{const x=c4[v.type];return s.jsxs("div",{className:`notification-item ${v.read?"":"unread"} ${x.colorClass}`,id:v.type==="policy_alert"&&v.receiptId?`policy-receipt-${encodeURIComponent(v.receiptId)}`:void 0,onClick:()=>h(v.id),role:"button",tabIndex:0,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&h(v.id)},children:[!v.read&&s.jsx("span",{className:"notification-unread-dot"}),s.jsx("span",{className:"notification-icon",children:x.icon}),s.jsxs("div",{className:"notification-content",children:[s.jsxs("div",{className:"notification-content-header",children:[s.jsx("span",{className:"notification-agent",children:v.agentName}),s.jsx("span",{className:"notification-time",children:u4(v.timestamp)})]}),v.title&&s.jsx("span",{className:"notification-title",children:v.title}),s.jsx("span",{className:"notification-message",children:v.message}),v.type==="permission_request"&&v.tool&&s.jsxs("span",{className:"notification-tool",children:["Tool: ",s.jsx("code",{children:v.tool})]}),v.type==="policy_alert"&&s.jsxs("div",{className:"notification-policy-details",children:[v.tool&&s.jsxs("span",{className:"notification-tool",children:["Tool: ",s.jsx("code",{children:v.tool})]}),v.reason&&s.jsxs("span",{className:"notification-policy-reason",children:["Reason: ",v.reason]}),v.ruleIds&&v.ruleIds.length>0&&s.jsxs("span",{className:"notification-tool",children:["Rules: ",s.jsx("code",{children:v.ruleIds.join(", ")})]}),v.policyVersion&&s.jsxs("span",{className:"notification-tool",children:["Policy: ",s.jsx("code",{children:v.policyVersion})]}),s.jsxs("span",{className:"notification-tool",children:["Receipt:"," ",v.receiptId?s.jsx("code",{children:v.receiptId}):s.jsx("em",{children:"Receipt unavailable"})]})]}),v.type==="permission_request"&&!v.response&&s.jsxs("div",{className:"notification-actions",children:[s.jsxs("button",{className:"notification-action-btn notification-action-allow",onClick:w=>{w.stopPropagation(),m(v)},children:[s.jsx(oi,{size:14}),"Approve"]}),s.jsxs("button",{className:"notification-action-btn notification-action-deny",onClick:w=>{w.stopPropagation(),g(v)},children:[s.jsx(Ze,{size:14}),"Deny"]})]}),v.type==="permission_request"&&v.response&&s.jsx("span",{className:`notification-response-badge ${v.response==="allow"?"response-allow":"response-deny"}`,children:v.response==="allow"?"Approved":"Denied"})]}),s.jsx("button",{className:"notification-dismiss",onClick:w=>{w.stopPropagation(),a(v.id)},"aria-label":"Dismiss notification",children:s.jsx(Ze,{size:14})})]},v.id)})}),t.length>0&&s.jsxs("div",{className:"notification-center-footer",children:[s.jsxs("button",{className:"notification-footer-btn",onClick:i,disabled:n===0,children:[s.jsx(oi,{size:14}),"Mark All Read"]}),s.jsxs("button",{className:"notification-footer-btn notification-footer-clear",onClick:l,children:[s.jsx(di,{size:14}),"Clear"]})]})]})}function la({show:e,children:t,duration:n=250}){const[r,i]=p.useState(!1),[l,a]=p.useState("idle");return p.useEffect(()=>{if(e)i(!0),requestAnimationFrame(()=>a("entering"));else if(r){a("exiting");const o=setTimeout(()=>{i(!1),a("idle")},n);return()=>clearTimeout(o)}},[e,r,n]),r?s.jsx("div",{className:`animated-presence ${l}`,"data-duration":n,children:t}):null}function f4(){const{currentSessionId:e,setSessions:t,setCurrentSession:n,addSession:r,removeSession:i,updateSessionInList:l,setMessages:a,showDocLibrary:o,showFileBrowser:c,showSettings:u,setShowSettings:d,showMemoryDashboard:f,setShowMemoryDashboard:h,sidebarOpen:m,toggleSidebar:g,setSidebarOpen:k,systemStatus:v,setSystemStatus:x,setBackendConnected:w,setAgents:j}=Se(),z=ct(q=>q.showPanel),D=ct(q=>q.setShowPanel),_=p.useRef(""),A=p.useCallback(async()=>{try{const Ce=(await Ed()).agents||[],Me=Ce.map(Qe=>Qe.id).sort().join(",");Me!==_.current&&(_.current=Me,j(Ce))}catch{}},[j]);p.useEffect(()=>{A();const q=setInterval(A,3e4);return()=>clearInterval(q)},[A]);const[C,R]=p.useState(!1),[N,U]=p.useState(!1),[O,re]=p.useState(!1),[oe,te]=p.useState(null),le=p.useRef(null),fe=p.useRef(0),T=3,I=p.useCallback(async()=>{try{const q=await _d();if(w(!0),q.lemonade_running)fe.current=0,x(q);else if(fe.current+=1,E.system.warn(`Lemonade health check failed (${fe.current}/${T})`),fe.current>=T)x(q);else{const Ce=Se.getState().systemStatus;Ce&&Ce.lemonade_running?x({...Ce,disk_space_gb:q.disk_space_gb,memory_available_gb:q.memory_available_gb}):x(q)}E.system.info("System status:",{lemonade:q.lemonade_running,model:q.model_loaded,failCount:fe.current})}catch(q){E.system.warn("System status check failed",q),w(!1),x(null)}},[x,w]),b=p.useRef(3e3);p.useEffect(()=>(I(),b.current=3e3,le.current=setInterval(I,3e3),()=>{le.current&&clearInterval(le.current)}),[I]),p.useEffect(()=>{const q=v==null?void 0:v.init_state;if(!q||q==="initializing")return;const Ce=15e3;Ce!==b.current&&(b.current=Ce,le.current&&clearInterval(le.current),le.current=setInterval(I,Ce))},[v==null?void 0:v.init_state,I]);const X=p.useRef(null),H=p.useRef("");p.useEffect(()=>{i0("0.19.0"),E.system.info("App mounting, loading sessions...");const q=E.system.time(),Ce=Qe=>Qe.map(je=>`${je.id}|${je.updated_at}|${je.title}`).join(`
565
+ `),Me=(Qe=!1)=>{p0().then(je=>{const Fe=je.sessions||[];if(Qe){t(Fe),w(!0),H.current=Ce(Fe),E.system.timed(`Loaded ${Fe.length} session(s)`,q);return}const Ht=Se.getState().sessions;if(Fe.length===0&&Ht.length>0){E.system.warn(`Session poll returned 0 sessions but sidebar has ${Ht.length} — skipping update to prevent data loss`);return}const Mn=Ce(Fe);Mn!==H.current&&(E.system.info(`Session list changed (${Ht.length} → ${Fe.length} sessions)`),t(Fe),H.current=Mn)}).catch(je=>{Qe&&(E.system.error("Failed to load sessions from backend",je),E.system.warn("Is the Python backend running? Start it with: gaia chat --ui"))})};return Me(!0),X.current=setInterval(()=>Me(!1),5e3),()=>{X.current&&clearInterval(X.current)}},[t,r,i,l,w]),p.useEffect(()=>{if(e)return;const Ce=new URLSearchParams(window.location.search).get("session"),Me=window.location.hash.replace(/^#/,""),Qe=Ce||Me;if(!Qe)return;E.nav.info(`URL session parameter: ${Qe}`);const je=setTimeout(()=>{const{sessions:Fe}=Se.getState();let Ht=Fe.some(Mn=>Mn.id===Qe)?Qe:I0(Fe,Qe);Ht?(n(Ht),a([])):E.nav.warn(`Session ${Qe} not found in loaded sessions`)},500);return()=>clearTimeout(je)},[e,n,a]),p.useEffect(()=>{if(e){const q=Fi(e);window.location.hash!==`#${q}`&&window.history.replaceState(null,"",`#${q}`)}else window.location.hash&&window.history.replaceState(null,"",window.location.pathname+window.location.search)},[e]),p.useEffect(()=>{Fy().then(q=>{U(q.active===!0)}).catch(()=>{})},[]),p.useEffect(()=>{const q=()=>{window.innerWidth>768&&k(!0)};return window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[k]);const[S,ie]=p.useState(null),ye=p.useCallback(async()=>{E.chat.info("Creating new task session..."),ie(null);try{const{activeAgentId:q}=Se.getState(),Ce=await gu({title:"New Task",agent_type:q});E.chat.info(`Session created: id=${Ce.id}, title="${Ce.title}"`),r(Ce),n(Ce.id),a([]),window.innerWidth<=768&&k(!1)}catch(q){E.chat.error("Failed to create session",q),I(),ie("Failed to create task. Is the server running?"),setTimeout(()=>ie(null),6e3)}},[r,n,a,k,I]),ae=p.useCallback(async q=>{Se.getState().setActiveAgentId(q),await ye()},[ye]),{setPendingPrompt:be}=Se(),Ge=p.useCallback(async q=>{E.chat.info(`New task with prompt: "${q.slice(0,60)}..."`),be(q),await ye()},[ye,be]),qe=p.useCallback(async()=>{E.chat.info("Creating builder agent session..."),ie(null);try{be("Hi, I'd like to create a new custom agent.");const q=await gu({title:"New Agent",agent_type:"builder"});E.chat.info(`Builder session created: id=${q.id}`),r(q),n(q.id),a([]),window.innerWidth<=768&&k(!1)}catch(q){be(null),E.chat.error("Failed to create builder session",q),I(),ie("Failed to create task. Is the server running?"),setTimeout(()=>ie(null),6e3)}},[r,n,a,k,I,be]),Xe=p.useCallback(async()=>{if(N){E.system.info("Reopening mobile access modal (tunnel already running)"),te(null),R(!0);return}E.system.info("Starting mobile access tunnel..."),R(!0),re(!0),te(null);try{const q=await L0();q.error?(E.system.error("Tunnel failed to start:",q.error),U(!1),te(q.error)):(U(!0),E.system.info("Tunnel started successfully"))}catch(q){E.system.error("Tunnel start error:",q),U(!1),te(q instanceof Error?q.message:"Failed to connect")}finally{re(!1)}},[N]),P=p.useCallback(async()=>{E.system.info("Stopping mobile access tunnel...");try{await A0()}catch(q){E.system.warn("stopTunnel call failed (continuing)",q)}U(!1),te(null),R(!1)},[]);p.useEffect(()=>{const{sessions:q,setActiveAgentId:Ce}=Se.getState(),Me=q.find(Qe=>Qe.id===e);Me!=null&&Me.agent_type&&Ce(Me.agent_type)},[e]),p.useEffect(()=>{e?E.nav.info(`Viewing session: ${e}`):E.nav.info("Viewing welcome screen (no session selected)")},[e]),p.useEffect(()=>{o&&E.ui.info("Document Library opened")},[o]),p.useEffect(()=>{u&&E.ui.info("Settings page opened")},[u]);const[M,B]=p.useState(typeof window<"u"&&window.innerWidth<=768);p.useEffect(()=>{const q=()=>B(window.innerWidth<=768);return window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]);const[he,pe]=p.useState(!1),[ce,ke]=p.useState(null);return p.useEffect(()=>{if(e!==ce){pe(!0);const q=setTimeout(()=>{ke(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{pe(!1)})})},220);return()=>clearTimeout(q)}},[e,ce]),s.jsxs("div",{className:"app",children:[s.jsx("button",{className:"sidebar-toggle",onClick:g,"aria-label":m?"Close sidebar":"Open sidebar",children:s.jsx(ow,{size:18})}),s.jsx("div",{className:`sidebar-overlay ${m?"visible":""}`,onClick:()=>k(!1),"aria-hidden":"true"}),s.jsx(M0,{onNewTask:ye,onHome:()=>{n(null),d(!1),h(!1),window.history.replaceState(null,"",window.location.pathname)},tunnelActive:N,tunnelLoading:O,onMobileToggle:Xe}),s.jsx("div",{className:"main-content",children:u?s.jsx(JT,{}):f?s.jsx(AT,{}):s.jsxs(s.Fragment,{children:[s.jsx(r4,{onRetry:I}),s.jsx("div",{className:`view-container ${he?"view-transitioning":""}`,children:ce?s.jsx(CE,{sessionId:ce,onCreateAgent:qe,onAgentChange:ae},ce):s.jsx($E,{onNewTask:ye,onSendPrompt:Ge,onCreateAgent:qe})})]})}),s.jsx(la,{show:o,children:s.jsx(BE,{})}),s.jsx(la,{show:c,children:s.jsx(QE,{})}),s.jsx(la,{show:z,children:s.jsx("div",{className:"notification-center-popover",children:s.jsx(d4,{onClose:()=>D(!1)})})}),!M&&s.jsx(la,{show:C,children:s.jsx(n4,{isOpen:C,onClose:()=>R(!1),onStop:P,error:oe})}),s.jsx(a4,{}),s.jsx(l4,{}),S&&s.jsx("div",{className:"toast",role:"alert",children:S})]})}const m4=localStorage.getItem("gaia-chat-theme");m4!=="light"&&document.documentElement.setAttribute("data-theme","dark");wc.createRoot(document.getElementById("root")).render(s.jsx(Ki.StrictMode,{children:s.jsx(f4,{})}));