@amd-gaia/agent-ui 0.24.0 → 0.24.1
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.
|
@@ -8,7 +8,7 @@ Error generating stack: `+e.message+`
|
|
|
8
8
|
`+e.stack}}var ye=Object.prototype.hasOwnProperty,be=t.unstable_scheduleCallback,xe=t.unstable_cancelCallback,Se=t.unstable_shouldYield,Ce=t.unstable_requestPaint,we=t.unstable_now,Te=t.unstable_getCurrentPriorityLevel,Ee=t.unstable_ImmediatePriority,De=t.unstable_UserBlockingPriority,Oe=t.unstable_NormalPriority,ke=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,je=t.log,Me=t.unstable_setDisableYieldValue,Ne=null,Pe=null;function Fe(e){if(typeof je==`function`&&Me(e),Pe&&typeof Pe.setStrictMode==`function`)try{Pe.setStrictMode(Ne,e)}catch{}}var Ie=Math.clz32?Math.clz32:ze,Le=Math.log,Re=Math.LN2;function ze(e){return e>>>=0,e===0?32:31-(Le(e)/Re|0)|0}var Be=256,Ve=262144,He=4194304;function Ue(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function B(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ue(n))):i=Ue(o):i=Ue(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ue(n))):i=Ue(o)):i=Ue(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function We(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ge(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ke(){var e=He;return He<<=1,!(He&62914560)&&(He=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ie(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Xe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Xe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ie(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ze(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ie(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Qe(e,t){var n=t&-t;return n=n&42?1:$e(n),(n&(e.suspendedLanes|t))===0?n:0}function $e(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function et(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function tt(){var e=N.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function nt(e,t){var n=N.p;try{return N.p=e,t()}finally{N.p=n}}var rt=Math.random().toString(36).slice(2),it=`__reactFiber$`+rt,at=`__reactProps$`+rt,ot=`__reactContainer$`+rt,st=`__reactEvents$`+rt,ct=`__reactListeners$`+rt,lt=`__reactHandles$`+rt,ut=`__reactResources$`+rt,dt=`__reactMarker$`+rt;function ft(e){delete e[it],delete e[at],delete e[st],delete e[ct],delete e[lt]}function pt(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ot]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[it])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function mt(e){if(e=e[it]||e[ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function gt(e){var t=e[ut];return t||=e[ut]={hoistableStyles:new Map,hoistableScripts:new Map},t}function V(e){e[dt]=!0}var _t=new Set,vt={};function yt(e,t){bt(e,t),bt(e+`Capture`,t)}function bt(e,t){for(vt[e]=t,e=0;e<t.length;e++)_t.add(t[e])}var xt=RegExp(`^[: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]*$`),St={},Ct={};function wt(e){return ye.call(Ct,e)?!0:ye.call(St,e)?!1:xt.test(e)?Ct[e]=!0:(St[e]=!0,!1)}function Tt(e,t,n){if(wt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Et(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Dt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Ot(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function kt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function At(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jt(e){if(!e._valueTracker){var t=kt(e)?`checked`:`value`;e._valueTracker=At(e,t,``+e[t])}}function Mt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=kt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Nt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Pt=/[\n"\\]/g;function Ft(e){return e.replace(Pt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function It(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Ot(t)):e.value!==``+Ot(t)&&(e.value=``+Ot(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Rt(e,o,Ot(n)):Rt(e,o,Ot(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Ot(s):e.removeAttribute(`name`)}function Lt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){jt(e);return}n=n==null?``:``+Ot(n),t=t==null?n:``+Ot(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),jt(e)}function Rt(e,t,n){t===`number`&&Nt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function zt(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=``+Ot(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 Bt(e,t,n){if(t!=null&&(t=``+Ot(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ot(n)}function Vt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(re(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Ot(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),jt(e)}function Ht(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ut=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function H(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Ut.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Wt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&H(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&H(e,o,t[o])}function Gt(e){if(e.indexOf(`-`)===-1)return!1;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 Kt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`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`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`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`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`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`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),qt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Jt(e){return qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Yt(){}var Xt=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var U=null,Qt=null;function $t(e){var t=mt(e);if(t&&(e=t.stateNode)){var n=e[at]||null;a:switch(e=t.stateNode,t.type){case`input`:if(It(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Ft(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[at]||null;if(!a)throw Error(i(90));It(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Mt(r)}break a;case`textarea`:Bt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&zt(e,!!n.multiple,t,!1)}}}var en=!1;function tn(e,t,n){if(en)return e(t,n);en=!0;try{return e(t)}finally{if(en=!1,(U!==null||Qt!==null)&&(_u(),U&&(t=U,e=Qt,Qt=U=null,$t(t),e)))for(t=0;t<e.length;t++)$t(e[t])}}function W(e,t){var n=e.stateNode;if(n===null)return null;var r=n[at]||null;if(r===null)return null;n=r[t];a: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 a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var nn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),rn=!1;if(nn)try{var an={};Object.defineProperty(an,"passive",{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var on=null,G=null,sn=null;function cn(){if(sn)return sn;var e,t=G,n=t.length,r,i=`value`in on?on.value:on.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return sn=i.slice(e,1<r?1-r:void 0)}function ln(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 un(){return!0}function dn(){return!1}function fn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?un:dn,this.isPropagationStopped=dn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=un)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=un)},persist:function(){},isPersistent:un}),t}var pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mn=fn(pn),hn=m({},pn,{view:0,detail:0}),gn=fn(hn),_n,vn,yn,bn=m({},hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,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!==yn&&(yn&&e.type===`mousemove`?(_n=e.screenX-yn.screenX,vn=e.screenY-yn.screenY):vn=_n=0,yn=e),_n)},movementY:function(e){return`movementY`in e?e.movementY:vn}}),xn=fn(bn),Sn=fn(m({},bn,{dataTransfer:0})),Cn=fn(m({},hn,{relatedTarget:0})),wn=fn(m({},pn,{animationName:0,elapsedTime:0,pseudoElement:0})),Tn=fn(m({},pn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),En=fn(m({},pn,{data:0})),Dn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},On={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`},kn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function An(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kn[e])?!!t[e]:!1}function jn(){return An}var Mn=fn(m({},hn,{key:function(e){if(e.key){var t=Dn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?On[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(e){return e.type===`keypress`?ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Nn=fn(m({},bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=fn(m({},hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn})),Fn=fn(m({},pn,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=fn(m({},bn,{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})),Ln=fn(m({},pn,{newState:0,oldState:0})),Rn=[9,13,27,32],zn=nn&&`CompositionEvent`in window,Bn=null;nn&&`documentMode`in document&&(Bn=document.documentMode);var Vn=nn&&`TextEvent`in window&&!Bn,Hn=nn&&(!zn||Bn&&8<Bn&&11>=Bn),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return Rn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!zn&&Gn(e,t)?(e=cn(),sn=G=on=null,qn=!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 Hn&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={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 Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){U?Qt?Qt.push(r):Qt=[r]:U=r,t=Td(t,`onChange`),0<t.length&&(n=new mn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){_d(e,0)}function nr(e){if(Mt(ht(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(nn){var ar;if(nn){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function cr(){$n&&($n.detachEvent(`onpropertychange`,lr),er=$n=null)}function lr(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Zt(e)),tn(tr,t)}}function ur(e,t,n){e===`focusin`?(cr(),$n=t,er=n,$n.attachEvent(`onpropertychange`,lr)):e===`focusout`&&cr()}function dr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function fr(e,t){if(e===`click`)return nr(t)}function pr(e,t){if(e===`input`||e===`change`)return nr(t)}function mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var hr=typeof Object.is==`function`?Object.is:mr;function gr(e,t){if(hr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)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(!ye.call(t,i)||!hr(e[i],t[i]))return!1}return!0}function _r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vr(e,t){var n=_r(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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=_r(n)}}function yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Nt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nt(e.document)}return t}function xr(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`)}var Sr=nn&&`documentMode`in document&&11>=document.documentMode,Cr=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Cr==null||Cr!==Nt(r)||(r=Cr,`selectionStart`in r&&xr(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}),Tr&&gr(Tr,r)||(Tr=r,r=Td(wr,`onSelect`),0<r.length&&(t=new mn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Cr)))}function Or(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var kr={animationend:Or(`Animation`,`AnimationEnd`),animationiteration:Or(`Animation`,`AnimationIteration`),animationstart:Or(`Animation`,`AnimationStart`),transitionrun:Or(`Transition`,`TransitionRun`),transitionstart:Or(`Transition`,`TransitionStart`),transitioncancel:Or(`Transition`,`TransitionCancel`),transitionend:Or(`Transition`,`TransitionEnd`)},Ar={},jr={};nn&&(jr=document.createElement(`div`).style,`AnimationEvent`in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),`TransitionEvent`in window||delete kr.transitionend.transition);function Mr(e){if(Ar[e])return Ar[e];if(!kr[e])return e;var t=kr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jr)return Ar[e]=t[n];return e}var Nr=Mr(`animationend`),K=Mr(`animationiteration`),Pr=Mr(`animationstart`),Fr=Mr(`transitionrun`),Ir=Mr(`transitionstart`),Lr=Mr(`transitioncancel`),Rr=Mr(`transitionend`),zr=new Map,Br=`abort auxClick beforeToggle 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(` `);Br.push(`scrollEnd`);function Vr(e,t){zr.set(e,t),yt(t,[e])}var Hr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Ur=[],Wr=0,Gr=0;function Kr(){for(var e=Wr,t=Gr=Wr=0;t<e;){var n=Ur[t];Ur[t++]=null;var r=Ur[t];Ur[t++]=null;var i=Ur[t];Ur[t++]=null;var a=Ur[t];if(Ur[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Xr(n,i,a)}}function qr(e,t,n,r){Ur[Wr++]=e,Ur[Wr++]=t,Ur[Wr++]=n,Ur[Wr++]=r,Gr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Jr(e,t,n,r){return qr(e,t,n,r),q(e)}function Yr(e,t){return qr(e,null,null,t),q(e)}function Xr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ie(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function q(e){if(50<cu)throw cu=0,lu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Zr={};function Qr(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.refCleanup=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 J(e,t,n,r){return new Qr(e,t,n,r)}function $r(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ei(e,t){var n=e.alternate;return n===null?(n=J(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&65011712,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.refCleanup=e.refCleanup,n}function ti(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ni(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)$r(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=J(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return ri(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=J(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=J(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=J(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=J(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ri(e,t,n,r){return e=J(7,e,r,t),e.lanes=n,e}function ii(e,t,n){return e=J(6,e,null,t),e.lanes=n,e}function ai(e){var t=J(18,null,null,0);return t.stateNode=e,t}function oi(e,t,n){return t=J(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var si=new WeakMap;function ci(e,t){if(typeof e==`object`&&e){var n=si.get(e);return n===void 0?(t={value:e,source:t,stack:ve(t)},si.set(e,t),t):n}return{value:e,source:t,stack:ve(t)}}var li=[],ui=0,di=null,fi=0,pi=[],mi=0,hi=null,gi=1,_i=``;function vi(e,t){li[ui++]=fi,li[ui++]=di,di=e,fi=t}function yi(e,t,n){pi[mi++]=gi,pi[mi++]=_i,pi[mi++]=hi,hi=e;var r=gi;e=_i;var i=32-Ie(r)-1;r&=~(1<<i),n+=1;var a=32-Ie(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,gi=1<<32-Ie(t)+i|n<<i|r,_i=a+e}else gi=1<<a|n<<i|r,_i=e}function bi(e){e.return!==null&&(vi(e,1),yi(e,1,0))}function xi(e){for(;e===di;)di=li[--ui],li[ui]=null,fi=li[--ui],li[ui]=null;for(;e===hi;)hi=pi[--mi],pi[mi]=null,_i=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null}function Si(e,t){pi[mi++]=gi,pi[mi++]=_i,pi[mi++]=hi,gi=t.id,_i=t.overflow,hi=e}var Ci=null,wi=null,Ti=!1,Ei=null,Di=!1,Oi=Error(i(519));function ki(e){throw Fi(ci(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Oi}function Ai(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[it]=e,t[at]=r,n){case`dialog`:vd(`cancel`,t),vd(`close`,t);break;case`iframe`:case`object`:case`embed`:vd(`load`,t);break;case`video`:case`audio`:for(n=0;n<hd.length;n++)vd(hd[n],t);break;case`source`:vd(`error`,t);break;case`img`:case`image`:case`link`:vd(`error`,t),vd(`load`,t);break;case`details`:vd(`toggle`,t);break;case`input`:vd(`invalid`,t),Lt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:vd(`invalid`,t);break;case`textarea`:vd(`invalid`,t),Vt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&(vd(`beforetoggle`,t),vd(`toggle`,t)),r.onScroll!=null&&vd(`scroll`,t),r.onScrollEnd!=null&&vd(`scrollend`,t),r.onClick!=null&&(t.onclick=Yt),t=!0):t=!1,t||ki(e,!0)}function ji(e){for(Ci=e.return;Ci;)switch(Ci.tag){case 5:case 31:case 13:Di=!1;return;case 27:case 3:Di=!0;return;default:Ci=Ci.return}}function Mi(e){if(e!==Ci)return!1;if(!Ti)return ji(e),Ti=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&wi&&ki(e),ji(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));wi=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));wi=uf(e)}else t===27?(t=wi,Zd(e.type)?(e=lf,lf=null,wi=e):wi=t):wi=Ci?cf(e.stateNode.nextSibling):null;return!0}function Ni(){wi=Ci=null,Ti=!1}function Pi(){var e=Ei;return e!==null&&(Jl===null?Jl=e:Jl.push.apply(Jl,e),Ei=null),e}function Fi(e){Ei===null?Ei=[e]:Ei.push(e)}var Ii=F(null),Li=null,Ri=null;function zi(e,t,n){oe(Ii,t._currentValue),t._currentValue=n}function Bi(e){e._currentValue=Ii.current,I(Ii)}function Vi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Hi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Vi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Vi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Ui(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;hr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===R.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&Hi(t,e,n,r),t.flags|=262144}function Wi(e){for(e=e.firstContext;e!==null;){if(!hr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Gi(e){Li=e,Ri=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ki(e){return Ji(Li,e)}function qi(e,t){return Li===null&&Gi(e),Ji(e,t)}function Ji(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ri===null){if(e===null)throw Error(i(308));Ri=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ri=Ri.next=t;return n}var Yi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Xi=t.unstable_scheduleCallback,Zi=t.unstable_NormalPriority,Qi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $i(){return{controller:new Yi,data:new Map,refCount:0}}function ea(e){e.refCount--,e.refCount===0&&Xi(Zi,function(){e.controller.abort()})}var ta=null,na=0,ra=0,ia=null;function aa(e,t){if(ta===null){var n=ta=[];na=0,ra=ld(),ia={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return na++,t.then(oa,oa),t}function oa(){if(--na===0&&ta!==null){ia!==null&&(ia.status=`fulfilled`);var e=ta;ta=null,ra=0,ia=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function sa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ca=M.S;M.S=function(e,t){Zl=we(),typeof t==`object`&&t&&typeof t.then==`function`&&aa(e,t),ca!==null&&ca(e,t)};var la=F(null);function ua(){var e=la.current;return e===null?Ml.pooledCache:e}function da(e,t){t===null?oe(la,la.current):oe(la,t.pool)}function fa(){var e=ua();return e===null?null:{parent:Qi._currentValue,pool:e}}var pa=Error(i(460)),ma=Error(i(474)),ha=Error(i(542)),ga={then:function(){}};function _a(e){return e=e.status,e===`fulfilled`||e===`rejected`}function va(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yt,Yt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Sa(e),e;default:if(typeof t.status==`string`)t.then(Yt,Yt);else{if(e=Ml,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Sa(e),e}throw ba=t,pa}}function ya(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ba=e,pa):e}}var ba=null;function xa(){if(ba===null)throw Error(i(459));var e=ba;return ba=null,e}function Sa(e){if(e===pa||e===ha)throw Error(i(483))}var Ca=null,wa=0;function Ta(e){var t=wa;return wa+=1,Ca===null&&(Ca=[]),va(Ca,e,t)}function Ea(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Da(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Oa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ei(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ii(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&ya(i)===t.type)?(t=a(t,n.props),Ea(t,n),t.return=e,t):(t=ni(n.type,n.key,n.props,null,e.mode,r),Ea(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=oi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ri(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ii(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ni(t.type,t.key,t.props,null,e.mode,n),Ea(n,t),n.return=e,n;case v:return t=oi(t,e.mode,n),t.return=e,t;case O:return t=ya(t),f(e,t,n)}if(re(t)||A(t))return t=ri(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ta(t),n);if(t.$$typeof===C)return f(e,qi(e,t),n);Da(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=ya(n),p(e,t,n,r)}if(re(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ta(n),r);if(n.$$typeof===C)return p(e,t,qi(e,n),r);Da(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=ya(r),m(e,t,n,r,i)}if(re(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ta(r),i);if(r.$$typeof===C)return m(e,t,n,qi(t,r),i);Da(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ti&&vi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Ti&&vi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Ti&&vi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ti&&vi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ti&&vi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ti&&vi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&ya(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ea(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=ri(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ni(o.type,o.key,o.props,null,e.mode,c),Ea(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=oi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=ya(o),b(e,r,o,c)}if(re(o))return h(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ta(o),c);if(o.$$typeof===C)return b(e,r,qi(e,o),c);Da(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ii(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{wa=0;var i=b(e,t,n,r);return Ca=null,i}catch(t){if(t===pa||t===ha)throw t;var a=J(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ka=Oa(!0),Aa=Oa(!1),ja=!1;function Ma(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Na(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Fa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=q(e),Xr(e,null,n),t}return qr(e,r,t,n),q(e)}function Y(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}function Ia(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var X=!1;function La(){if(X){var e=ia;if(e!==null)throw e}}function Ra(e,t,n,r){X=!1;var i=e.updateQueue;ja=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Pl&f)===f:(r&f)===f){f!==0&&f===ra&&(X=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:ja=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Hl|=o,e.lanes=o,e.memoizedState=d}}function za(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ba(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)za(n[e],t)}var Z=F(null),Va=F(0);function Ha(e,t){e=Bl,oe(Va,e),oe(Z,t),Bl=e|t.baseLanes}function Ua(){oe(Va,Bl),oe(Z,Z.current)}function Wa(){Bl=Va.current,I(Z),I(Va)}var Ga=F(null),Ka=null;function qa(e){var t=e.alternate;oe(Qa,Qa.current&1),oe(Ga,e),Ka===null&&(t===null||Z.current!==null||t.memoizedState!==null)&&(Ka=e)}function Ja(e){oe(Qa,Qa.current),oe(Ga,e),Ka===null&&(Ka=e)}function Ya(e){e.tag===22?(oe(Qa,Qa.current),oe(Ga,e),Ka===null&&(Ka=e)):Xa(e)}function Xa(){oe(Qa,Qa.current),oe(Ga,Ga.current)}function Za(e){I(Ga),Ka===e&&(Ka=null),I(Qa)}var Qa=F(0);function $a(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){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 eo=0,Q=null,to=null,no=null,ro=!1,io=!1,ao=!1,oo=0,so=0,co=null,lo=0;function uo(){throw Error(i(321))}function fo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0}function po(e,t,n,r,i,a){return eo=a,Q=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?As:js,ao=!1,a=n(r,i),ao=!1,io&&(a=ho(t,n,r,i)),mo(e),a}function mo(e){M.H=ks;var t=to!==null&&to.next!==null;if(eo=0,no=to=Q=null,ro=!1,so=0,co=null,t)throw Error(i(300));e===null||Js||(e=e.dependencies,e!==null&&Wi(e)&&(Js=!0))}function ho(e,t,n,r){Q=e;var a=0;do{if(io&&(co=null),so=0,io=!1,25<=a)throw Error(i(301));if(a+=1,no=to=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}M.H=Ms,o=t(n,r)}while(io);return o}function go(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?Co(t):t,e=e.useState()[0],(to===null?null:to.memoizedState)!==e&&(Q.flags|=1024),t}function _o(){var e=oo!==0;return oo=0,e}function vo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function yo(e){if(ro){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ro=!1}eo=0,no=to=Q=null,io=!1,so=oo=0,co=null}function bo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return no===null?Q.memoizedState=no=e:no=no.next=e,no}function xo(){if(to===null){var e=Q.alternate;e=e===null?null:e.memoizedState}else e=to.next;var t=no===null?Q.memoizedState:no.next;if(t!==null)no=t,to=e;else{if(e===null)throw Q.alternate===null?Error(i(467)):Error(i(310));to=e,e={memoizedState:to.memoizedState,baseState:to.baseState,baseQueue:to.baseQueue,queue:to.queue,next:null},no===null?Q.memoizedState=no=e:no=no.next=e}return no}function So(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Co(e){var t=so;return so+=1,co===null&&(co=[]),e=va(co,e,t),t=Q,(no===null?t.memoizedState:no.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?As:js),e}function wo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Co(e);if(e.$$typeof===C)return Ki(e)}throw Error(i(438,String(e)))}function To(e){var t=null,n=Q.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Q.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=So(),Q.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ee;return t.index++,n}function Eo(e,t){return typeof t==`function`?t(e):t}function Do(e){return Oo(xo(),to,e)}function Oo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(eo&f)===f:(Pl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ra&&(d=!0);else if((eo&p)===p){u=u.next,p===ra&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,Q.lanes|=p,Hl|=p;f=u.action,ao&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,Q.lanes|=f,Hl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!hr(o,e.memoizedState)&&(Js=!0,d&&(n=ia,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function ko(e){var t=xo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);hr(o,t.memoizedState)||(Js=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ao(e,t,n){var r=Q,a=xo(),o=Ti;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!hr((to||a).memoizedState,n);if(s&&(a.memoizedState=n,Js=!0),a=a.queue,ts(No.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||no!==null&&no.memoizedState.tag&1){if(r.flags|=2048,Xo(9,{destroy:void 0},Mo.bind(null,r,a,n,t),null),Ml===null)throw Error(i(349));o||eo&127||jo(r,t,n)}return n}function jo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Q.updateQueue,t===null?(t=So(),Q.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Mo(e,t,n,r){t.value=n,t.getSnapshot=r,Po(t)&&Fo(e)}function No(e,t,n){return n(function(){Po(t)&&Fo(e)})}function Po(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!hr(e,n)}catch{return!0}}function Fo(e){var t=Yr(e,2);t!==null&&fu(t,e,2)}function Io(e){var t=bo();if(typeof e==`function`){var n=e;if(e=n(),ao){Fe(!0);try{n()}finally{Fe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:e},t}function Lo(e,t,n,r){return e.baseState=n,Oo(e,to,typeof r==`function`?r:Eo)}function Ro(e,t,n,r,a){if(Es(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};M.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,zo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function zo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),Bo(e,t,s)}catch(n){Ho(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),Bo(e,t,a)}catch(n){Ho(e,t,n)}}function Bo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Vo(e,t,n)},function(n){return Ho(e,t,n)}):Vo(e,t,n)}function Vo(e,t,n){t.status=`fulfilled`,t.value=n,Uo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,zo(e,n)))}function Ho(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Uo(t),t=t.next;while(t!==r)}e.action=null}function Uo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Wo(e,t){return t}function Go(e,t){if(Ti){var n=Ml.formState;if(n!==null){a:{var r=Q;if(Ti){if(wi){b:{for(var i=wi,a=Di;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){wi=cf(i.nextSibling),r=i.data===`F!`;break a}}ki(r)}r=!1}r&&(t=n[0])}}return n=bo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:t},n.queue=r,n=Cs.bind(null,Q,r),r.dispatch=n,r=Io(!1),a=Ts.bind(null,Q,!1,r.queue),r=bo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ro.bind(null,Q,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ko(e){return qo(xo(),to,e)}function qo(e,t,n){if(t=Oo(e,t,Wo)[0],e=Do(Eo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Co(t)}catch(e){throw e===pa?ha:e}else r=t;t=xo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Q.flags|=2048,Xo(9,{destroy:void 0},Jo.bind(null,i,n),null)),[r,a,e]}function Jo(e,t){e.action=t}function Yo(e){var t=xo(),n=to;if(n!==null)return qo(t,n,e);xo(),t=t.memoizedState,n=xo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Xo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Q.updateQueue,t===null&&(t=So(),Q.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Zo(){return xo().memoizedState}function Qo(e,t,n,r){var i=bo();Q.flags|=e,i.memoizedState=Xo(1|t,{destroy:void 0},n,r===void 0?null:r)}function $o(e,t,n,r){var i=xo();r=r===void 0?null:r;var a=i.memoizedState.inst;to!==null&&r!==null&&fo(r,to.memoizedState.deps)?i.memoizedState=Xo(t,a,n,r):(Q.flags|=e,i.memoizedState=Xo(1|t,a,n,r))}function es(e,t){Qo(8390656,8,e,t)}function ts(e,t){$o(2048,8,e,t)}function ns(e){Q.flags|=4;var t=Q.updateQueue;if(t===null)t=So(),Q.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function rs(e){var t=xo().memoizedState;return ns({ref:t,nextImpl:e}),function(){if($&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function is(e,t){return $o(4,2,e,t)}function as(e,t){return $o(4,4,e,t)}function os(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ss(e,t,n){n=n==null?null:n.concat([e]),$o(4,4,os.bind(null,t,e),n)}function cs(){}function ls(e,t){var n=xo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&fo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function us(e,t){var n=xo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&fo(t,r[1]))return r[0];if(r=e(),ao){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r}function ds(e,t,n){return n===void 0||eo&1073741824&&!(Pl&261930)?e.memoizedState=t:(e.memoizedState=n,e=du(),Q.lanes|=e,Hl|=e,n)}function fs(e,t,n,r){return hr(n,t)?n:Z.current===null?!(eo&42)||eo&1073741824&&!(Pl&261930)?(Js=!0,e.memoizedState=n):(e=du(),Q.lanes|=e,Hl|=e,t):(e=ds(e,n,r),hr(e,t)||(Js=!0),e)}function ps(e,t,n,r,i){var a=N.p;N.p=a!==0&&8>a?a:8;var o=M.T,s={};M.T=s,Ts(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ws(e,t,sa(c,r),uu(e)):ws(e,t,r,uu(e))}catch(n){ws(e,t,{then:function(){},status:`rejected`,reason:n},uu())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function ms(){}function hs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=gs(e).queue;ps(e,a,t,P,n===null?ms:function(){return _s(e),n(r)})}function gs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:P},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function _s(e){var t=gs(e);t.next===null&&(t=e.alternate.memoizedState),ws(e,t.next.queue,{},uu())}function vs(){return Ki(Qf)}function ys(){return xo().memoizedState}function bs(){return xo().memoizedState}function xs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=uu();e=Pa(n);var r=Fa(t,e,n);r!==null&&(fu(r,t,n),Y(r,t,n)),t={cache:$i()},e.payload=t;return}t=t.return}}function Ss(e,t,n){var r=uu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Es(e)?Ds(t,n):(n=Jr(e,t,n,r),n!==null&&(fu(n,e,r),Os(n,t,r)))}function Cs(e,t,n){ws(e,t,n,uu())}function ws(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Es(e))Ds(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,hr(s,o))return qr(e,t,i,0),Ml===null&&Kr(),!1}catch{}if(n=Jr(e,t,i,r),n!==null)return fu(n,e,r),Os(n,t,r),!0}return!1}function Ts(e,t,n,r){if(r={lane:2,revertLane:ld(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Es(e)){if(t)throw Error(i(479))}else t=Jr(e,n,r,2),t!==null&&fu(t,e,2)}function Es(e){var t=e.alternate;return e===Q||t!==null&&t===Q}function Ds(e,t){io=ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Os(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var ks={readContext:Ki,use:wo,useCallback:uo,useContext:uo,useEffect:uo,useImperativeHandle:uo,useLayoutEffect:uo,useInsertionEffect:uo,useMemo:uo,useReducer:uo,useRef:uo,useState:uo,useDebugValue:uo,useDeferredValue:uo,useTransition:uo,useSyncExternalStore:uo,useId:uo,useHostTransitionStatus:uo,useFormState:uo,useActionState:uo,useOptimistic:uo,useMemoCache:uo,useCacheRefresh:uo};ks.useEffectEvent=uo;var As={readContext:Ki,use:wo,useCallback:function(e,t){return bo().memoizedState=[e,t===void 0?null:t],e},useContext:Ki,useEffect:es,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Qo(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qo(4194308,4,e,t)},useInsertionEffect:function(e,t){Qo(4,2,e,t)},useMemo:function(e,t){var n=bo();t=t===void 0?null:t;var r=e();if(ao){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=bo();if(n!==void 0){var i=n(t);if(ao){Fe(!0);try{n(t)}finally{Fe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ss.bind(null,Q,e),[r.memoizedState,e]},useRef:function(e){var t=bo();return e={current:e},t.memoizedState=e},useState:function(e){e=Io(e);var t=e.queue,n=Cs.bind(null,Q,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:cs,useDeferredValue:function(e,t){return ds(bo(),e,t)},useTransition:function(){var e=Io(!1);return e=ps.bind(null,Q,e.queue,!0,!1),bo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Q,a=bo();if(Ti){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ml===null)throw Error(i(349));Pl&127||jo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,es(No.bind(null,r,o,e),[e]),r.flags|=2048,Xo(9,{destroy:void 0},Mo.bind(null,r,o,n,t),null),n},useId:function(){var e=bo(),t=Ml.identifierPrefix;if(Ti){var n=_i,r=gi;n=(r&~(1<<32-Ie(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=oo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=lo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:vs,useFormState:Go,useActionState:Go,useOptimistic:function(e){var t=bo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ts.bind(null,Q,!0,n),n.dispatch=t,[e,t]},useMemoCache:To,useCacheRefresh:function(){return bo().memoizedState=xs.bind(null,Q)},useEffectEvent:function(e){var t=bo(),n={impl:e};return t.memoizedState=n,function(){if($&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},js={readContext:Ki,use:wo,useCallback:ls,useContext:Ki,useEffect:ts,useImperativeHandle:ss,useInsertionEffect:is,useLayoutEffect:as,useMemo:us,useReducer:Do,useRef:Zo,useState:function(){return Do(Eo)},useDebugValue:cs,useDeferredValue:function(e,t){return fs(xo(),to.memoizedState,e,t)},useTransition:function(){var e=Do(Eo)[0],t=xo().memoizedState;return[typeof e==`boolean`?e:Co(e),t]},useSyncExternalStore:Ao,useId:ys,useHostTransitionStatus:vs,useFormState:Ko,useActionState:Ko,useOptimistic:function(e,t){return Lo(xo(),to,e,t)},useMemoCache:To,useCacheRefresh:bs};js.useEffectEvent=rs;var Ms={readContext:Ki,use:wo,useCallback:ls,useContext:Ki,useEffect:ts,useImperativeHandle:ss,useInsertionEffect:is,useLayoutEffect:as,useMemo:us,useReducer:ko,useRef:Zo,useState:function(){return ko(Eo)},useDebugValue:cs,useDeferredValue:function(e,t){var n=xo();return to===null?ds(n,e,t):fs(n,to.memoizedState,e,t)},useTransition:function(){var e=ko(Eo)[0],t=xo().memoizedState;return[typeof e==`boolean`?e:Co(e),t]},useSyncExternalStore:Ao,useId:ys,useHostTransitionStatus:vs,useFormState:Yo,useActionState:Yo,useOptimistic:function(e,t){var n=xo();return to===null?(n.baseState=e,[e,n.queue.dispatch]):Lo(n,to,e,t)},useMemoCache:To,useCacheRefresh:bs};Ms.useEffectEvent=rs;function Ns(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ps={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=uu(),i=Pa(r);i.payload=t,n!=null&&(i.callback=n),t=Fa(e,i,r),t!==null&&(fu(t,e,r),Y(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=uu(),i=Pa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Fa(e,i,r),t!==null&&(fu(t,e,r),Y(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=uu(),r=Pa(n);r.tag=2,t!=null&&(r.callback=t),t=Fa(e,r,n),t!==null&&(fu(t,e,n),Y(t,e,n))}};function Fs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!gr(n,r)||!gr(i,a):!0}function Is(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&&Ps.enqueueReplaceState(t,t.state,null)}function Ls(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Rs(e){Hr(e)}function zs(e){console.error(e)}function Bs(e){Hr(e)}function Vs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Hs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Us(e,t,n){return n=Pa(n),n.tag=3,n.payload={element:null},n.callback=function(){Vs(e,t)},n}function Ws(e){return e=Pa(e),e.tag=3,e}function Gs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Hs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Hs(t,n,r),typeof i!=`function`&&(eu===null?eu=new Set([this]):eu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ks(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ui(t,n,a,!0),n=Ga.current,n!==null){switch(n.tag){case 31:case 13:return Ka===null?wu():n.alternate===null&&Vl===0&&(Vl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ga?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Uu(e,r,a)),!1;case 22:return n.flags|=65536,r===ga?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Uu(e,r,a)),!1}throw Error(i(435,n.tag))}return Uu(e,r,a),wu(),!1}if(Ti)return t=Ga.current,t===null?(r!==Oi&&(t=Error(i(423),{cause:r}),Fi(ci(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=ci(r,n),a=Us(e.stateNode,r,a),Ia(e,a),Vl!==4&&(Vl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Oi&&(e=Error(i(422),{cause:r}),Fi(ci(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=ci(o,n),ql===null?ql=[o]:ql.push(o),Vl!==4&&(Vl=2),t===null)return!0;r=ci(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Us(n.stateNode,r,e),Ia(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(eu===null||!eu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ws(a),Gs(a,e,n,r),Ia(n,a),!1}n=n.return}while(n!==null);return!1}var qs=Error(i(461)),Js=!1;function Ys(e,t,n,r){t.child=e===null?Aa(t,null,n,r):ka(t,e.child,n,r)}function Xs(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Gi(t),r=po(e,t,n,o,a,i),s=_o(),e!==null&&!Js?(vo(e,t,i),bc(e,t,i)):(Ti&&s&&bi(t),t.flags|=1,Ys(e,t,r,i),t.child)}function Zs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!$r(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Qs(e,t,a,r,i)):(e=ni(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!xc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?gr:n,n(o,r)&&e.ref===t.ref)return bc(e,t,i)}return t.flags|=1,e=ei(a,r),e.ref=t.ref,e.return=t,t.child=e}function Qs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(gr(a,r)&&e.ref===t.ref){if(Js=!1,t.pendingProps=r=a,xc(e,i))e.flags&131072&&(Js=!0);else return t.lanes=e.lanes,bc(e,t,i)}}return oc(e,t,n,r,i)}function $s(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return tc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&da(t,a===null?null:a.cachePool),a===null?Ua():Ha(t,a),Ya(t);else return r=t.lanes=536870912,tc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&da(t,null),Ua(),Xa(t)):(da(t,a.cachePool),Ha(t,a),Xa(t),t.memoizedState=null);return Ys(e,t,i,n),t.child}function ec(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function tc(e,t,n,r,i){var a=ua();return a=a===null?null:{parent:Qi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&da(t,null),Ua(),Ya(t),e!==null&&Ui(e,t,r,!0),t.childLanes=i,null}function nc(e,t){return t=hc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function rc(e,t,n){return ka(t,e.child,null,n),e=nc(t,t.pendingProps),e.flags|=2,Za(t),t.memoizedState=null,e}function ic(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ti){if(r.mode===`hidden`)return e=nc(t,r),t.lanes=536870912,ec(null,e);if(Ja(t),(e=wi)?(e=rf(e,Di),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:hi===null?null:{id:gi,overflow:_i},retryLane:536870912,hydrationErrors:null},n=ai(e),n.return=t,t.child=n,Ci=t,wi=null)):e=null,e===null)throw ki(t);return t.lanes=536870912,null}return nc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Ja(t),a){if(t.flags&256)t.flags&=-257,t=rc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Js||Ui(e,t,n,!1),a=(n&e.childLanes)!==0,Js||a){if(r=Ml,r!==null&&(s=Qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Yr(e,s),fu(r,e,s),qs;wu(),t=rc(e,t,n)}else e=o.treeContext,wi=cf(s.nextSibling),Ci=t,Ti=!0,Ei=null,Di=!1,e!==null&&Si(t,e),t=nc(t,r),t.flags|=4096;return t}return e=ei(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ac(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function oc(e,t,n,r,i){return Gi(t),n=po(e,t,n,r,void 0,i),r=_o(),e!==null&&!Js?(vo(e,t,i),bc(e,t,i)):(Ti&&r&&bi(t),t.flags|=1,Ys(e,t,n,i),t.child)}function sc(e,t,n,r,i,a){return Gi(t),t.updateQueue=null,n=ho(t,r,n,i),mo(e),r=_o(),e!==null&&!Js?(vo(e,t,a),bc(e,t,a)):(Ti&&r&&bi(t),t.flags|=1,Ys(e,t,n,a),t.child)}function cc(e,t,n,r,i){if(Gi(t),t.stateNode===null){var a=Zr,o=n.contextType;typeof o==`object`&&o&&(a=Ki(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ps,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ma(t),o=n.contextType,a.context=typeof o==`object`&&o?Ki(o):Zr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ns(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ps.enqueueReplaceState(a,a.state,null),Ra(t,r,a,i),La(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ls(n,s);a.props=c;var l=a.context,u=n.contextType;o=Zr,typeof u==`object`&&u&&(o=Ki(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Is(t,a,r,o),ja=!1;var f=t.memoizedState;a.state=f,Ra(t,r,a,i),La(),l=t.memoizedState,s||f!==l||ja?(typeof d==`function`&&(Ns(t,n,d,r),l=t.memoizedState),(c=ja||Fs(t,n,c,r,f,l,o))?(u||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=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Na(e,t),o=t.memoizedProps,u=Ls(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Zr,typeof l==`object`&&l&&(c=Ki(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Is(t,a,r,c),ja=!1,f=t.memoizedState,a.state=f,Ra(t,r,a,i),La();var p=t.memoizedState;o!==d||f!==p||ja||e!==null&&e.dependencies!==null&&Wi(e.dependencies)?(typeof s==`function`&&(Ns(t,n,s,r),p=t.memoizedState),(u=ja||Fs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Wi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,ac(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ka(t,e.child,null,i),t.child=ka(t,null,n,i)):Ys(e,t,n,i),t.memoizedState=a.state,e=t.child):e=bc(e,t,i),e}function lc(e,t,n,r){return Ni(),t.flags|=256,Ys(e,t,n,r),t.child}var uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function dc(e){return{baseLanes:e,cachePool:fa()}}function fc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Gl),e}function pc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(Qa.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Ti){if(a?qa(t):Xa(t),(e=wi)?(e=rf(e,Di),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:hi===null?null:{id:gi,overflow:_i},retryLane:536870912,hydrationErrors:null},n=ai(e),n.return=t,t.child=n,Ci=t,wi=null)):e=null,e===null)throw ki(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(Xa(t),a=t.mode,c=hc({mode:`hidden`,children:c},a),r=ri(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=dc(n),r.childLanes=fc(e,s,n),t.memoizedState=uc,ec(null,r)):(qa(t),mc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(qa(t),t.flags&=-257,t=gc(e,t,n)):t.memoizedState===null?(Xa(t),c=r.fallback,a=t.mode,r=hc({mode:`visible`,children:r.children},a),c=ri(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ka(t,e.child,null,n),r=t.child,r.memoizedState=dc(n),r.childLanes=fc(e,s,n),t.memoizedState=uc,t=ec(null,r)):(Xa(t),t.child=e.child,t.flags|=128,t=null);else if(qa(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Fi({value:r,source:null,stack:null}),t=gc(e,t,n)}else if(Js||Ui(e,t,n,!1),s=(n&e.childLanes)!==0,Js||s){if(s=Ml,s!==null&&(r=Qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Yr(e,r),fu(s,e,r),qs;af(c)||wu(),t=gc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,wi=cf(c.nextSibling),Ci=t,Ti=!0,Ei=null,Di=!1,e!==null&&Si(t,e),t=mc(t,r.children),t.flags|=4096);return t}return a?(Xa(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ei(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ri(c,a,n,null),c.flags|=2):c=ei(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ec(null,r),r=t.child,c=e.child.memoizedState,c===null?c=dc(n):(a=c.cachePool,a===null?a=fa():(l=Qi._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=fc(e,s,n),t.memoizedState=uc,ec(e.child,r)):(qa(t),n=e.child,e=n.sibling,n=ei(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function mc(e,t){return t=hc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function hc(e,t){return e=J(22,e,null,t),e.lanes=0,e}function gc(e,t,n){return ka(t,e.child,null,n),e=mc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _c(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Vi(e.return,t,n)}function vc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function yc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Qa.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,oe(Qa,o),Ys(e,t,r,n),r=Ti?fi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&_c(e,n,t);else if(e.tag===19)_c(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&$a(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),vc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&$a(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}vc(t,!0,n,null,a,r);break;case`together`:vc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function bc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Hl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ui(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ei(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ei(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function xc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Wi(e)))}function Sc(e,t,n){switch(t.tag){case 3:le(t,t.stateNode.containerInfo),zi(t,Qi,e.memoizedState.cache),Ni();break;case 27:case 5:ue(t);break;case 4:le(t,t.stateNode.containerInfo);break;case 10:zi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ja(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(qa(t),e=bc(e,t,n),e===null?null:e.sibling):pc(e,t,n):(qa(t),t.flags|=128,null);qa(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Ui(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return yc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),oe(Qa,Qa.current),r)break;return null;case 22:return t.lanes=0,$s(e,t,n,t.pendingProps);case 24:zi(t,Qi,e.memoizedState.cache)}return bc(e,t,n)}function Cc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Js=!0;else{if(!xc(e,n)&&!(t.flags&128))return Js=!1,Sc(e,t,n);Js=!!(e.flags&131072)}}else Js=!1,Ti&&t.flags&1048576&&yi(t,fi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ya(t.elementType),t.type=e,typeof e==`function`)$r(e)?(r=Ls(e,r),t.tag=1,t=cc(null,t,e,r,n)):(t.tag=0,t=oc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=Xs(null,t,e,r,n);break a}if(a===D){t.tag=14,t=Zs(null,t,e,r,n);break a}}throw t=ne(e)||e,Error(i(306,t,``))}}return t;case 0:return oc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ls(r,t.pendingProps),cc(e,t,r,a,n);case 3:a:{if(le(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Na(e,t),Ra(t,r,null,n);var s=t.memoizedState;if(r=s.cache,zi(t,Qi,r),r!==o.cache&&Hi(t,[Qi],n,!0),La(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=lc(e,t,r,n);break a}if(r!==a){a=ci(Error(i(424)),t),Fi(a),t=lc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(wi=cf(e.firstChild),Ci=t,Ti=!0,Ei=null,Di=!0,n=Aa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ni(),r===a){t=bc(e,t,n);break a}Ys(e,t,r,n)}t=t.child}return t;case 26:return ac(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ti||(n=t.type,e=t.pendingProps,r=Bd(L.current).createElement(n),r[it]=t,r[at]=e,Pd(r,n,e),V(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ue(t),e===null&&Ti&&(r=t.stateNode=ff(t.type,t.pendingProps,L.current),Ci=t,Di=!0,a=wi,Zd(t.type)?(lf=a,wi=cf(r.firstChild)):wi=a),Ys(e,t,t.pendingProps.children,n),ac(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ti&&((a=r=wi)&&(r=tf(r,t.type,t.pendingProps,Di),r===null?a=!1:(t.stateNode=r,Ci=t,wi=cf(r.firstChild),Di=!1,a=!0)),a||ki(t)),ue(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=po(e,t,go,null,null,n),Qf._currentValue=a),ac(e,t),Ys(e,t,r,n),t.child;case 6:return e===null&&Ti&&((e=n=wi)&&(n=nf(n,t.pendingProps,Di),n===null?e=!1:(t.stateNode=n,Ci=t,wi=null,e=!0)),e||ki(t)),null;case 13:return pc(e,t,n);case 4:return le(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ka(t,null,r,n):Ys(e,t,r,n),t.child;case 11:return Xs(e,t,t.type,t.pendingProps,n);case 7:return Ys(e,t,t.pendingProps,n),t.child;case 8:return Ys(e,t,t.pendingProps.children,n),t.child;case 12:return Ys(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,zi(t,t.type,r.value),Ys(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Gi(t),a=Ki(a),r=r(a),t.flags|=1,Ys(e,t,r,n),t.child;case 14:return Zs(e,t,t.type,t.pendingProps,n);case 15:return Qs(e,t,t.type,t.pendingProps,n);case 19:return yc(e,t,n);case 31:return ic(e,t,n);case 22:return $s(e,t,n,t.pendingProps);case 24:return Gi(t),r=Ki(Qi),e===null?(a=ua(),a===null&&(a=Ml,o=$i(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ma(t),zi(t,Qi,a)):((e.lanes&n)!==0&&(Na(e,t),Ra(t,null,null,n),La()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,zi(t,Qi,r),r!==a.cache&&Hi(t,[Qi],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),zi(t,Qi,r))),Ys(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function wc(e){e.flags|=4}function Tc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(xu())e.flags|=8192;else throw ba=ga,ma}}else e.flags&=-16777217}function Ec(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t)){if(xu())e.flags|=8192;else throw ba=ga,ma}}function Dc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ke(),e.lanes|=t,Kl|=t)}function Oc(e,t){if(!Ti)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 kc(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&65011712,r|=i.flags&65011712,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 Ac(e,t,n){var r=t.pendingProps;switch(xi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kc(t),null;case 1:return kc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Bi(Qi),z(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Mi(t)?wc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Pi())),kc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(wc(t),o===null?(kc(t),Tc(t,a,null,r,n)):(kc(t),Ec(t,o))):o?o===e.memoizedState?(kc(t),t.flags&=-16777217):(wc(t),kc(t),Ec(t,o)):(e=e.memoizedProps,e!==r&&wc(t),kc(t),Tc(t,a,e,r,n)),null;case 27:if(de(t),n=L.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&wc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return kc(t),null}e=se.current,Mi(t)?Ai(t,e):(e=ff(a,r,n),t.stateNode=e,wc(t))}return kc(t),null;case 5:if(de(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&wc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return kc(t),null}if(o=se.current,Mi(t))Ai(t,o);else{var s=Bd(L.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[it]=t,o[at]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&wc(t)}}return kc(t),Tc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&wc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=L.current,Mi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ci,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||ki(t,!0)}else e=Bd(e).createTextNode(r),e[it]=t,t.stateNode=e}return kc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Mi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[it]=t}else Ni(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kc(t),e=!1}else n=Pi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Za(t),t):(Za(t),null);if(t.flags&128)throw Error(i(558))}return kc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Mi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[it]=t}else Ni(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kc(t),a=!1}else a=Pi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Za(t),t):(Za(t),null)}return Za(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Dc(t,t.updateQueue),kc(t),null);case 4:return z(),e===null&&xd(t.stateNode.containerInfo),kc(t),null;case 10:return Bi(t.type),kc(t),null;case 19:if(I(Qa),r=t.memoizedState,r===null)return kc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Oc(r,!1);else{if(Vl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=$a(e),o!==null){for(t.flags|=128,Oc(r,!1),e=o.updateQueue,t.updateQueue=e,Dc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ti(n,e),n=n.sibling;return oe(Qa,Qa.current&1|2),Ti&&vi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&we()>Ql&&(t.flags|=128,a=!0,Oc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=$a(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Dc(t,e),Oc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ti)return kc(t),null}else 2*we()-r.renderingStartTime>Ql&&n!==536870912&&(t.flags|=128,a=!0,Oc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(kc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=we(),e.sibling=null,n=Qa.current,oe(Qa,a?n&1|2:n&1),Ti&&vi(t,r.treeForkCount),e);case 22:case 23:return Za(t),Wa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(kc(t),t.subtreeFlags&6&&(t.flags|=8192)):kc(t),n=t.updateQueue,n!==null&&Dc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&I(la),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Bi(Qi),kc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function jc(e,t){switch(xi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bi(Qi),z(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return de(t),null;case 31:if(t.memoizedState!==null){if(Za(t),t.alternate===null)throw Error(i(340));Ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Za(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return I(Qa),null;case 4:return z(),null;case 10:return Bi(t.type),null;case 22:case 23:return Za(t),Wa(),e!==null&&I(la),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Bi(Qi),null;case 25:return null;default:return null}}function Mc(e,t){switch(xi(t),t.tag){case 3:Bi(Qi),z();break;case 26:case 27:case 5:de(t);break;case 4:z();break;case 31:t.memoizedState!==null&&Za(t);break;case 13:Za(t);break;case 19:I(Qa);break;case 10:Bi(t.type);break;case 22:case 23:Za(t),Wa(),e!==null&&I(la);break;case 24:Bi(Qi)}}function Nc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Hu(t,t.return,e)}}function Pc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Hu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Hu(t,t.return,e)}}function Fc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ba(t,n)}catch(t){Hu(e,e.return,t)}}}function Ic(e,t,n){n.props=Ls(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Hu(e,t,n)}}function Lc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Hu(e,t,n)}}function Rc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Hu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Hu(e,t,n)}else n.current=null}}function zc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Hu(e,e.return,t)}}function Bc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[at]=t}catch(t){Hu(e,e.return,t)}}function Vc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Hc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Vc(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.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Uc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Uc(e,t,n),e=e.sibling;e!==null;)Uc(e,t,n),e=e.sibling}function Wc(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&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function Gc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[it]=e,t[at]=n}catch(t){Hu(e,e.return,t)}}var Kc=!1,qc=!1,Jc=!1,Yc=typeof WeakSet==`function`?WeakSet:Set,Xc=null;function Zc(e,t){if(e=e.containerInfo,Rd=sp,e=br(e),xr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Xc=t;Xc!==null;)if(t=Xc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Xc=e;else for(;Xc!==null;){switch(t=Xc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Ls(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Hu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,Xc=e;break}Xc=t.return}}function Qc(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:pl(e,n),r&4&&Nc(5,n);break;case 1:if(pl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Hu(n,n.return,e)}else{var i=Ls(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Hu(n,n.return,e)}}}r&64&&Fc(n),r&512&&Lc(n,n.return);break;case 3:if(pl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ba(e,t)}catch(e){Hu(n,n.return,e)}}break;case 27:t===null&&r&4&&Gc(n);case 26:case 5:pl(e,n),t===null&&r&4&&zc(n),r&512&&Lc(n,n.return);break;case 12:pl(e,n);break;case 31:pl(e,n),r&4&&il(e,n);break;case 13:pl(e,n),r&4&&al(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ku.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Kc,!r){t=t!==null&&t.memoizedState!==null||qc,i=Kc;var a=qc;Kc=r,(qc=t)&&!a?hl(e,n,!!(n.subtreeFlags&8772)):pl(e,n),Kc=i,qc=a}break;case 30:break;default:pl(e,n)}}function $c(e){var t=e.alternate;t!==null&&(e.alternate=null,$c(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ft(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var el=null,tl=!1;function nl(e,t,n){for(n=n.child;n!==null;)rl(e,t,n),n=n.sibling}function rl(e,t,n){if(Pe&&typeof Pe.onCommitFiberUnmount==`function`)try{Pe.onCommitFiberUnmount(Ne,n)}catch{}switch(n.tag){case 26:qc||Rc(n,t),nl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:qc||Rc(n,t);var r=el,i=tl;Zd(n.type)&&(el=n.stateNode,tl=!1),nl(e,t,n),pf(n.stateNode),el=r,tl=i;break;case 5:qc||Rc(n,t);case 6:if(r=el,i=tl,el=null,nl(e,t,n),el=r,tl=i,el!==null){if(tl)try{(el.nodeType===9?el.body:el.nodeName===`HTML`?el.ownerDocument.body:el).removeChild(n.stateNode)}catch(e){Hu(n,t,e)}else try{el.removeChild(n.stateNode)}catch(e){Hu(n,t,e)}}break;case 18:el!==null&&(tl?(e=el,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(el,n.stateNode));break;case 4:r=el,i=tl,el=n.stateNode.containerInfo,tl=!0,nl(e,t,n),el=r,tl=i;break;case 0:case 11:case 14:case 15:Pc(2,n,t),qc||Pc(4,n,t),nl(e,t,n);break;case 1:qc||(Rc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Ic(n,t,r)),nl(e,t,n);break;case 21:nl(e,t,n);break;case 22:qc=(r=qc)||n.memoizedState!==null,nl(e,t,n),qc=r;break;default:nl(e,t,n)}}function il(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Hu(t,t.return,e)}}}function al(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Hu(t,t.return,e)}}function ol(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Yc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Yc),t;default:throw Error(i(435,e.tag))}}function sl(e,t){var n=ol(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=qu.bind(null,e,t);t.then(r,r)}})}function cl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){el=c.stateNode,tl=!1;break a}break;case 5:el=c.stateNode,tl=!1;break a;case 3:case 4:el=c.stateNode.containerInfo,tl=!0;break a}c=c.return}if(el===null)throw Error(i(160));rl(o,s,a),el=null,tl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ul(t,e),t=t.sibling}var ll=null;function ul(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:cl(t,e),dl(e),r&4&&(Pc(3,e,e.return),Nc(3,e),Pc(5,e,e.return));break;case 1:cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),r&64&&Kc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=ll;if(cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[dt]||o[it]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[it]=e,V(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[it]=e,V(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode)}else e.stateNode=If(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Bc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),n!==null&&r&4&&Bc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),e.flags&32){a=e.stateNode;try{Ht(a,``)}catch(t){Hu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Bc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Jc=!0);break;case 6:if(cl(t,e),dl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Hu(e,e.return,t)}}break;case 3:if(Bf=null,a=ll,ll=gf(t.containerInfo),cl(t,e),ll=a,dl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Hu(e,e.return,t)}Jc&&(Jc=!1,fl(e));break;case 4:r=ll,ll=gf(e.stateNode.containerInfo),cl(t,e),dl(e),ll=r;break;case 12:cl(t,e),dl(e);break;case 31:cl(t,e),dl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 13:cl(t,e),dl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Xl=we()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Kc,d=qc;if(Kc=u||a,qc=d||l,cl(t,e),qc=d,Kc=u,dl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Kc||qc||ml(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Hu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Hu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){Hu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,sl(e,n))));break;case 19:cl(t,e),dl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 30:break;case 21:break;default:cl(t,e),dl(e)}}function dl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Vc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Wc(e,Hc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ht(o,``),n.flags&=-33),Wc(e,Hc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Uc(e,Hc(e),s);break;default:throw Error(i(161))}}catch(t){Hu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function fl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;fl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function pl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Qc(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Pc(4,t,t.return),ml(t);break;case 1:Rc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Ic(t,t.return,n),ml(t);break;case 27:pf(t.stateNode);case 26:case 5:Rc(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function hl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:hl(i,a,n),Nc(4,a);break;case 1:if(hl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Hu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)za(c[i],s)}catch(e){Hu(r,r.return,e)}}n&&o&64&&Fc(a),Lc(a,a.return);break;case 27:Gc(a);case 26:case 5:hl(i,a,n),n&&r===null&&o&4&&zc(a),Lc(a,a.return);break;case 12:hl(i,a,n);break;case 31:hl(i,a,n),n&&o&4&&il(i,a);break;case 13:hl(i,a,n),n&&o&4&&al(i,a);break;case 22:a.memoizedState===null&&hl(i,a,n),Lc(a,a.return);break;case 30:break;default:hl(i,a,n)}t=t.sibling}}function gl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ea(n))}function _l(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ea(e))}function vl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)yl(e,t,n,r),t=t.sibling}function yl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:vl(e,t,n,r),i&2048&&Nc(9,t);break;case 1:vl(e,t,n,r);break;case 3:vl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ea(e)));break;case 12:if(i&2048){vl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Hu(t,t.return,e)}}else vl(e,t,n,r);break;case 31:vl(e,t,n,r);break;case 13:vl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?vl(e,t,n,r):(a._visibility|=2,bl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?vl(e,t,n,r):xl(e,t),i&2048&&gl(o,t);break;case 24:vl(e,t,n,r),i&2048&&_l(t.alternate,t);break;default:vl(e,t,n,r)}}function bl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:bl(a,o,s,c,i),Nc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,bl(a,o,s,c,i)):u._visibility&2?bl(a,o,s,c,i):xl(a,o),i&&l&2048&&gl(o.alternate,o);break;case 24:bl(a,o,s,c,i),i&&l&2048&&_l(o.alternate,o);break;default:bl(a,o,s,c,i)}t=t.sibling}}function xl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:xl(n,r),i&2048&&gl(r.alternate,r);break;case 24:xl(n,r),i&2048&&_l(r.alternate,r);break;default:xl(n,r)}t=t.sibling}}var Sl=8192;function Cl(e,t,n){if(e.subtreeFlags&Sl)for(e=e.child;e!==null;)wl(e,t,n),e=e.sibling}function wl(e,t,n){switch(e.tag){case 26:Cl(e,t,n),e.flags&Sl&&e.memoizedState!==null&&Gf(n,ll,e.memoizedState,e.memoizedProps);break;case 5:Cl(e,t,n);break;case 3:case 4:var r=ll;ll=gf(e.stateNode.containerInfo),Cl(e,t,n),ll=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Sl,Sl=16777216,Cl(e,t,n),Sl=r):Cl(e,t,n));break;default:Cl(e,t,n)}}function Tl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function El(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Xc=r,kl(r,e)}Tl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Dl(e),e=e.sibling}function Dl(e){switch(e.tag){case 0:case 11:case 15:El(e),e.flags&2048&&Pc(9,e,e.return);break;case 3:El(e);break;case 12:El(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ol(e)):El(e);break;default:El(e)}}function Ol(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Xc=r,kl(r,e)}Tl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Pc(8,t,t.return),Ol(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ol(t));break;default:Ol(t)}e=e.sibling}}function kl(e,t){for(;Xc!==null;){var n=Xc;switch(n.tag){case 0:case 11:case 15:Pc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ea(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Xc=r;else a:for(n=e;Xc!==null;){r=Xc;var i=r.sibling,a=r.return;if($c(r),r===n){Xc=null;break a}if(i!==null){i.return=a,Xc=i;break a}Xc=a}}}var Al={getCacheForType:function(e){var t=Ki(Qi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ki(Qi).controller.signal}},jl=typeof WeakMap==`function`?WeakMap:Map,$=0,Ml=null,Nl=null,Pl=0,Fl=0,Il=null,Ll=!1,Rl=!1,zl=!1,Bl=0,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=null,Jl=null,Yl=!1,Xl=0,Zl=0,Ql=1/0,$l=null,eu=null,tu=0,nu=null,ru=null,iu=0,au=0,ou=null,su=null,cu=0,lu=null;function uu(){return $&2&&Pl!==0?Pl&-Pl:M.T===null?tt():ld()}function du(){if(Gl===0){if(!(Pl&536870912)||Ti){var e=Ve;Ve<<=1,!(Ve&3932160)&&(Ve=262144),Gl=e}else Gl=536870912}return e=Ga.current,e!==null&&(e.flags|=32),Gl}function fu(e,t,n){(e===Ml&&(Fl===2||Fl===9)||e.cancelPendingCommit!==null)&&(yu(e,0),gu(e,Pl,Gl,!1)),Je(e,n),(!($&2)||e!==Ml)&&(e===Ml&&(!($&2)&&(Ul|=n),Vl===4&&gu(e,Pl,Gl,!1)),td(e))}function pu(e,t,n){if($&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||We(e,t),a=r?Du(e,t):Tu(e,t,!0),o=r;do{if(a===0){Rl&&!r&&gu(e,t,0,!1);break}if(n=e.current.alternate,o&&!hu(n)){a=Tu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=ql;var l=c.current.memoizedState.isDehydrated;if(l&&(yu(c,s).flags|=256),s=Tu(c,s,!1),s!==2){if(zl&&!l){c.errorRecoveryDisabledLanes|=o,Ul|=o,a=4;break a}o=Jl,Jl=a,o!==null&&(Jl===null?Jl=o:Jl.push.apply(Jl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){yu(e,0),gu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:gu(r,t,Gl,!Ll);break a;case 2:Jl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Xl+300-we(),10<a)){if(gu(r,t,Gl,!Ll),B(r,0,!0)!==0)break a;iu=t,r.timeoutHandle=Kd(mu.bind(null,r,n,Jl,$l,Yl,t,Gl,Ul,Kl,Ll,o,`Throttled`,-0,0),a);break a}mu(r,n,Jl,$l,Yl,t,Gl,Ul,Kl,Ll,o,null,-0,0)}break}while(1);td(e)}function mu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yt},wl(t,a,d);var m=(a&62914560)===a?Xl-we():(a&4194048)===a?Zl-we():0;if(m=qf(d,m),m!==null){iu=a,e.cancelPendingCommit=m(Pu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),gu(e,a,o,!l);return}}Pu(e,t,a,n,r,i,o,s,c)}function hu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!hr(a(),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 gu(e,t,n,r){t&=~Wl,t&=~Ul,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ie(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Xe(e,n,t)}function _u(){return $&6?!0:(nd(0,!1),!1)}function vu(){if(Nl!==null){if(Fl===0)var e=Nl.return;else e=Nl,Ri=Li=null,yo(e),Ca=null,wa=0,e=Nl;for(;e!==null;)Mc(e.alternate,e),e=e.return;Nl=null}}function yu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),iu=0,vu(),Ml=e,Nl=n=ei(e.current,null),Pl=t,Fl=0,Il=null,Ll=!1,Rl=We(e,t),zl=!1,Kl=Gl=Wl=Ul=Hl=Vl=0,Jl=ql=null,Yl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ie(r),a=1<<i;t|=e[i],r&=~a}return Bl=t,Kr(),n}function bu(e,t){Q=null,M.H=ks,t===pa||t===ha?(t=xa(),Fl=3):t===ma?(t=xa(),Fl=4):Fl=t===qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Il=t,Nl===null&&(Vl=1,Vs(e,ci(t,e.current)))}function xu(){var e=Ga.current;return e===null?!0:(Pl&4194048)===Pl?Ka===null:(Pl&62914560)===Pl||Pl&536870912?e===Ka:!1}function Su(){var e=M.H;return M.H=ks,e===null?ks:e}function Cu(){var e=M.A;return M.A=Al,e}function wu(){Vl=4,Ll||(Pl&4194048)!==Pl&&Ga.current!==null||(Rl=!0),!(Hl&134217727)&&!(Ul&134217727)||Ml===null||gu(Ml,Pl,Gl,!1)}function Tu(e,t,n){var r=$;$|=2;var i=Su(),a=Cu();(Ml!==e||Pl!==t)&&($l=null,yu(e,t)),t=!1;var o=Vl;a:do try{if(Fl!==0&&Nl!==null){var s=Nl,c=Il;switch(Fl){case 8:vu(),o=6;break a;case 3:case 2:case 9:case 6:Ga.current===null&&(t=!0);var l=Fl;if(Fl=0,Il=null,ju(e,s,c,l),n&&Rl){o=0;break a}break;default:l=Fl,Fl=0,Il=null,ju(e,s,c,l)}}Eu(),o=Vl;break}catch(t){bu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ri=Li=null,$=r,M.H=i,M.A=a,Nl===null&&(Ml=null,Pl=0,Kr()),o}function Eu(){for(;Nl!==null;)ku(Nl)}function Du(e,t){var n=$;$|=2;var r=Su(),a=Cu();Ml!==e||Pl!==t?($l=null,Ql=we()+500,yu(e,t)):Rl=We(e,t);a:do try{if(Fl!==0&&Nl!==null){t=Nl;var o=Il;b:switch(Fl){case 1:Fl=0,Il=null,ju(e,t,o,1);break;case 2:case 9:if(_a(o)){Fl=0,Il=null,Au(t);break}t=function(){Fl!==2&&Fl!==9||Ml!==e||(Fl=7),td(e)},o.then(t,t);break a;case 3:Fl=7;break a;case 4:Fl=5;break a;case 7:_a(o)?(Fl=0,Il=null,Au(t)):(Fl=0,Il=null,ju(e,t,o,7));break;case 5:var s=null;switch(Nl.tag){case 26:s=Nl.memoizedState;case 5:case 27:var c=Nl;if(s?Wf(s):c.stateNode.complete){Fl=0,Il=null;var l=c.sibling;if(l!==null)Nl=l;else{var u=c.return;u===null?Nl=null:(Nl=u,Mu(u))}break b}}Fl=0,Il=null,ju(e,t,o,5);break;case 6:Fl=0,Il=null,ju(e,t,o,6);break;case 8:vu(),Vl=6;break a;default:throw Error(i(462))}}Ou();break}catch(t){bu(e,t)}while(1);return Ri=Li=null,M.H=r,M.A=a,$=n,Nl===null?(Ml=null,Pl=0,Kr(),Vl):0}function Ou(){for(;Nl!==null&&!Se();)ku(Nl)}function ku(e){var t=Cc(e.alternate,e,Bl);e.memoizedProps=e.pendingProps,t===null?Mu(e):Nl=t}function Au(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=sc(n,t,t.pendingProps,t.type,void 0,Pl);break;case 11:t=sc(n,t,t.pendingProps,t.type.render,t.ref,Pl);break;case 5:yo(t);default:Mc(n,t),t=Nl=ti(t,Bl),t=Cc(n,t,Bl)}e.memoizedProps=e.pendingProps,t===null?Mu(e):Nl=t}function ju(e,t,n,r){Ri=Li=null,yo(t),Ca=null,wa=0;var i=t.return;try{if(Ks(e,i,t,n,Pl)){Vl=1,Vs(e,ci(n,e.current)),Nl=null;return}}catch(t){if(i!==null)throw Nl=i,t;Vl=1,Vs(e,ci(n,e.current)),Nl=null;return}t.flags&32768?(Ti||r===1?e=!0:Rl||Pl&536870912?e=!1:(Ll=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ga.current,r!==null&&r.tag===13&&(r.flags|=16384))),Nu(t,e)):Mu(t)}function Mu(e){var t=e;do{if(t.flags&32768){Nu(t,Ll);return}e=t.return;var n=Ac(t.alternate,t,Bl);if(n!==null){Nl=n;return}if(t=t.sibling,t!==null){Nl=t;return}Nl=t=e}while(t!==null);Vl===0&&(Vl=5)}function Nu(e,t){do{var n=jc(e.alternate,e);if(n!==null){n.flags&=32767,Nl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Nl=e;return}Nl=e=n}while(e!==null);Vl=6,Nl=null}function Pu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do zu();while(tu!==0);if($&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Gr,Ye(e,n,o,s,c,l),e===Ml&&(Nl=Ml=null,Pl=0),ru=t,nu=e,iu=n,au=o,ou=a,su=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Ju(Oe,function(){return Bu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=M.T,M.T=null,a=N.p,N.p=2,s=$,$|=4;try{Zc(e,t,n)}finally{$=s,N.p=a,M.T=r}}tu=1,Fu(),Iu(),Lu()}}function Fu(){if(tu===1){tu=0;var e=nu,t=ru,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=$;$|=4;try{ul(t,e);var a=zd,o=br(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&yr(s.ownerDocument.documentElement,s)){if(c!==null&&xr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=vr(s,h),v=vr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{$=i,N.p=r,M.T=n}}e.current=t,tu=2}}function Iu(){if(tu===2){tu=0;var e=nu,t=ru,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=$;$|=4;try{Qc(e,t.alternate,t)}finally{$=i,N.p=r,M.T=n}}tu=3}}function Lu(){if(tu===4||tu===3){tu=0,Ce();var e=nu,t=ru,n=iu,r=su;t.subtreeFlags&10256||t.flags&10256?tu=5:(tu=0,ru=nu=null,Ru(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(eu=null),et(n),t=t.stateNode,Pe&&typeof Pe.onCommitFiberRoot==`function`)try{Pe.onCommitFiberRoot(Ne,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=M.T,i=N.p,N.p=2,M.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{M.T=t,N.p=i}}iu&3&&zu(),td(e),i=e.pendingLanes,n&261930&&i&42?e===lu?cu++:(cu=0,lu=e):cu=0,nd(0,!1)}}function Ru(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ea(t)))}function zu(){return Fu(),Iu(),Lu(),Bu()}function Bu(){if(tu!==5)return!1;var e=nu,t=au;au=0;var n=et(iu),r=M.T,a=N.p;try{N.p=32>n?32:n,M.T=null,n=ou,ou=null;var o=nu,s=iu;if(tu=0,ru=nu=null,iu=0,$&6)throw Error(i(331));var c=$;if($|=4,Dl(o.current),yl(o,o.current,s,n),$=c,nd(0,!1),Pe&&typeof Pe.onPostCommitFiberRoot==`function`)try{Pe.onPostCommitFiberRoot(Ne,o)}catch{}return!0}finally{N.p=a,M.T=r,Ru(e,t)}}function Vu(e,t,n){t=ci(n,t),t=Us(e.stateNode,t,2),e=Fa(e,t,2),e!==null&&(Je(e,2),td(e))}function Hu(e,t,n){if(e.tag===3)Vu(e,e,n);else for(;t!==null;){if(t.tag===3){Vu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(eu===null||!eu.has(r))){e=ci(n,e),n=Ws(2),r=Fa(t,n,2),r!==null&&(Gs(n,r,t,e),Je(r,2),td(r));break}}t=t.return}}function Uu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new jl;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)||(zl=!0,i.add(n),e=Wu.bind(null,e,t,n),t.then(e,e))}function Wu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ml===e&&(Pl&n)===n&&(Vl===4||Vl===3&&(Pl&62914560)===Pl&&300>we()-Xl?!($&2)&&yu(e,0):Wl|=n,Kl===Pl&&(Kl=0)),td(e)}function Gu(e,t){t===0&&(t=Ke()),e=Yr(e,t),e!==null&&(Je(e,t),td(e))}function Ku(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gu(e,n)}function qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Gu(e,n)}function Ju(e,t){return be(e,t)}var Yu=null,Xu=null,Zu=!1,Qu=!1,$u=!1,ed=0;function td(e){e!==Xu&&e.next===null&&(Xu===null?Yu=Xu=e:Xu=Xu.next=e),Qu=!0,Zu||(Zu=!0,cd())}function nd(e,t){if(!$u&&Qu){$u=!0;do for(var n=!1,r=Yu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ie(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,sd(r,a))}else a=Pl,a=B(r,r===Ml?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||We(r,a)||(n=!0,sd(r,a))}r=r.next}while(n);$u=!1}}function rd(){id()}function id(){Qu=Zu=!1;var e=0;ed!==0&&Gd()&&(e=ed);for(var t=we(),n=null,r=Yu;r!==null;){var i=r.next,a=ad(r,t);a===0?(r.next=null,n===null?Yu=i:n.next=i,i===null&&(Xu=n)):(n=r,(e!==0||a&3)&&(Qu=!0)),r=i}tu!==0&&tu!==5||nd(e,!1),ed!==0&&(ed=0)}function ad(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ie(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ge(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ml,n=Pl,n=B(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Fl===2||Fl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&xe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||We(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&xe(r),et(n)){case 2:case 8:n=De;break;case 32:n=Oe;break;case 268435456:n=Ae;break;default:n=Oe}return r=od.bind(null,e),n=be(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&xe(r),e.callbackPriority=2,e.callbackNode=null,2}function od(e,t){if(tu!==0&&tu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(zu()&&e.callbackNode!==n)return null;var r=Pl;return r=B(e,e===Ml?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(pu(e,r,t),ad(e,we()),e.callbackNode!=null&&e.callbackNode===n?od.bind(null,e):null)}function sd(e,t){if(zu())return null;pu(e,t,!0)}function cd(){Yd(function(){$&6?be(Ee,rd):id()})}function ld(){if(ed===0){var e=ra;e===0&&(e=Be,Be<<=1,!(Be&261888)&&(Be=256)),ed=e}return ed}function ud(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Jt(``+e)}function dd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function fd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=ud((i[at]||null).action),o=r.submitter;o&&(t=(t=o[at]||null)?ud(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new mn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ed!==0){var e=o?dd(i,o):new FormData(i);hs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?dd(i,o):new FormData(i),hs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var pd=0;pd<Br.length;pd++){var md=Br[pd];Vr(md.toLowerCase(),`on`+(md[0].toUpperCase()+md.slice(1)))}Vr(Nr,`onAnimationEnd`),Vr(K,`onAnimationIteration`),Vr(Pr,`onAnimationStart`),Vr(`dblclick`,`onDoubleClick`),Vr(`focusin`,`onFocus`),Vr(`focusout`,`onBlur`),Vr(Fr,`onTransitionRun`),Vr(Ir,`onTransitionStart`),Vr(Lr,`onTransitionCancel`),Vr(Rr,`onTransitionEnd`),bt(`onMouseEnter`,[`mouseout`,`mouseover`]),bt(`onMouseLeave`,[`mouseout`,`mouseover`]),bt(`onPointerEnter`,[`pointerout`,`pointerover`]),bt(`onPointerLeave`,[`pointerout`,`pointerover`]),yt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),yt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),yt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),yt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var hd=`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(` `),gd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(hd));function _d(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Hr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Hr(e)}i.currentTarget=null,a=c}}}}function vd(e,t){var n=t[st];n===void 0&&(n=t[st]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,_t.forEach(function(t){t!==`selectionchange`&&(gd.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!rn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=pt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}tn(function(){var r=a,i=Zt(n),s=[];a:{var c=zr.get(e);if(c!==void 0){var l=mn,u=e;switch(e){case`keypress`:if(ln(n)===0)break a;case`keydown`:case`keyup`:l=Mn;break;case`focusin`:u=`focus`,l=Cn;break;case`focusout`:u=`blur`,l=Cn;break;case`beforeblur`:case`afterblur`:l=Cn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=xn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Sn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Pn;break;case Nr:case K:case Pr:l=wn;break;case Rr:l=Fn;break;case`scroll`:case`scrollend`:l=gn;break;case`wheel`:l=In;break;case`copy`:case`cut`:case`paste`:l=Tn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Nn;break;case`toggle`:case`beforetoggle`:l=Ln}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=W(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Xt&&(u=n.relatedTarget||n.fromElement)&&(pt(u)||u[ot]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?pt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=xn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Nn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ht(l),h=u==null?c:ht(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,pt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ed,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Dd(s,c,l,d,!1),u!==null&&f!==null&&Dd(s,f,u,d,!0)}}a:{if(c=r?ht(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=rr;else if(Zn(c)){if(ir)v=pr;else{v=dr;var y=ur}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Gt(r.elementType)&&(v=rr):v=fr;if(v&&=v(e,r)){Qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Rt(c,`number`,c.value)}switch(y=r?ht(r):window,e){case`focusin`:(Zn(y)||y.contentEditable===`true`)&&(Cr=y,wr=r,Tr=null);break;case`focusout`:Tr=wr=Cr=null;break;case`mousedown`:Er=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Er=!1,Dr(s,n,i);break;case`selectionchange`:if(Sr)break;case`keydown`:case`keyup`:Dr(s,n,i)}var b;if(zn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else qn?Gn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Hn&&n.locale!==`ko`&&(qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&qn&&(b=cn()):(on=i,G=`value`in on?on.value:on.textContent,qn=!0)),y=Td(r,x),0<y.length&&(x=new En(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Kn(n),b!==null&&(x.data=b)))),(b=Vn?Jn(e,n):Yn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new En(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),fd(s,e,r,n,i)}_d(s,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=W(e,n),i!=null&&r.unshift(wd(e,i,a)),i=W(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=W(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=W(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
|
|
9
9
|
`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ht(e,``+r);break;case`className`:Et(e,`class`,r);break;case`tabIndex`:Et(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Et(e,n,r);break;case`style`:Wt(e,r,o);break;case`data`:if(t!==`object`){Et(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Jt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:vd(`beforetoggle`,e),vd(`toggle`,e),Tt(e,`popover`,r);break;case`xlinkActuate`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Tt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Kt.get(n)||n,Tt(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Wt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ht(e,``+r);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!vt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[at]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Tt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:vd(`error`,e),vd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:vd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Md(e,t,r,d,n,null)}}Lt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in vd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&zt(e,!!r,n,!0):zt(e,!!r,t,!1);return;case`textarea`:for(s in vd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Md(e,t,s,c,n,null)}Vt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:vd(`beforetoggle`,e),vd(`toggle`,e),vd(`cancel`,e),vd(`close`,e);break;case`iframe`:case`object`:vd(`load`,e);break;case`video`:case`audio`:for(r=0;r<hd.length;r++)vd(hd[r],e);break;case`image`:vd(`error`,e),vd(`load`,e);break;case`details`:vd(`toggle`,e);break;case`embed`:case`source`:case`link`:vd(`error`,e),vd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Gt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}It(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?zt(e,!!n,n?[]:``,!1):zt(e,!!n,t,!0)):zt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Md(e,t,s,a,r,o)}Bt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Gt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(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===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[dt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),ft(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[dt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(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===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ft(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=N.d;N.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=_u();return e||t}function yf(e){var t=mt(e);t!==null&&t.tag===5&&t.type===`form`?_s(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Ft(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),V(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ft(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ft(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ft(n.imageSizes)+`"]`)):i+=`[href="`+Ft(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),V(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ft(r)+`"][href="`+Ft(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),V(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=gt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);V(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=gt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),V(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=gt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),V(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=L.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=gt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=gt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=gt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Ft(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),V(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Ft(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ft(n.href)+`"]`);if(r)return t.instance=r,V(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),V(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,V(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),V(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,V(a),a):(r=n,(a=mf.get(o))&&(r=m({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),V(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[dt]||a[it]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,V(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),V(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qe(0),this.hiddenUpdates=qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=J(3,null,null,t),e.current=a,a.stateNode=e,t=$i(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ma(a),e}function tp(e){return e?(e=Zr,e):Zr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Pa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Fa(e,r,t),n!==null&&(fu(n,e,t),Y(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Yr(e,67108864);t!==null&&fu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=uu();t=$e(t);var n=Yr(e,t);n!==null&&fu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,up(e,t,n,r)}finally{N.p=a,M.T=i}}function lp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,up(e,t,n,r)}finally{N.p=a,M.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ue(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ie(o);s.entanglements[1]|=c,o&=~c}td(a),!($&6)&&(Ql=we()+500,nd(0,!1))}}break;case 31:case 13:s=Yr(a,2),s!==null&&fu(s,a,2),_u(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Zt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=pt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 fp=e,null}function mp(e){switch(e){case`beforetoggle`: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`toggle`: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 2;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`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Te()){case Ee:return 2;case De:return 8;case Oe:case ke:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`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`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=mt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=pt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,nt(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,nt(e.priority,function(){op(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 Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=mt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=mt(n);a!==null&&(e.splice(t,3),t-=3,hs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[at]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,uu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),_u(),t[ot]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.8`)throw Error(i(527,Lp,`19.2.8`));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Ne=zp.inject(Rp),Pe=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Rs,s=zs,c=Bs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[ot]=t.current,xd(e),new Fp(t)}})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),y=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),b=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),x=e=>{let t=b(e);return t.charAt(0).toUpperCase()+t.slice(1)},S={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`},C=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},w=l(d(),1),T=(0,w.createContext)({}),E=()=>(0,w.useContext)(T),D=(0,w.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=E()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,w.createElement)(`svg`,{ref:c,...S,width:t??l??S.width,height:t??l??S.height,stroke:e??f,strokeWidth:m,className:v(`lucide`,p,i),...!a&&!C(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,w.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),O=(e,t)=>{let n=(0,w.forwardRef)(({className:n,...r},i)=>(0,w.createElement)(D,{ref:i,iconNode:t,className:v(`lucide-${y(x(e))}`,`lucide-${e}`,n),...r}));return n.displayName=x(e),n},k=O(`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`}]]),ee=O(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),te=O(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),A=O(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),j=O(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),ne=O(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),re=O(`book-open`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]),M=O(`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`}]]),N=O(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),P=O(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),ie=O(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),ae=O(`chart-no-axes-column`,[[`path`,{d:`M5 21v-6`,key:`1hz6c0`}],[`path`,{d:`M12 21V3`,key:`1lcnhd`}],[`path`,{d:`M19 21V9`,key:`unv183`}]]),F=O(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),I=O(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),oe=O(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),se=O(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ce=O(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),L=O(`circle-alert`,[[`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`}]]),R=O(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),le=O(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),z=O(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]]),ue=O(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),de=O(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),fe=O(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),pe=O(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),me=O(`code-xml`,[[`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`}]]),he=O(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),ge=O(`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`}]]),_e=O(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ve=O(`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`}]]),ye=O(`dollar-sign`,[[`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`}]]),be=O(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),xe=O(`ellipsis`,[[`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`}]]),Se=O(`external-link`,[[`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`}]]),Ce=O(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),we=O(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Te=O(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),Ee=O(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),De=O(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Oe=O(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),ke=O(`folder-open`,[[`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`}]]),Ae=O(`folder-search`,[[`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.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),je=O(`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`}]]),Me=O(`git-merge`,[[`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`}]]),Ne=O(`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`}]]),Pe=O(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Fe=O(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Ie=O(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),Le=O(`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`}]]),Re=O(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ze=O(`key`,[[`path`,{d:`m2 21 9.6-9.6`,key:`9l79m3`}],[`path`,{d:`m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19`,key:`fw8biw`}],[`circle`,{cx:`15.5`,cy:`7.5`,r:`5.5`,key:`4wxmhb`}]]),Be=O(`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:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Ve=O(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),He=O(`link-2`,[[`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`}]]),Ue=O(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),B=O(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),We=O(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Ge=O(`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`}]]),Ke=O(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),qe=O(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Je=O(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),Ye=O(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Xe=O(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Ze=O(`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`}]]),Qe=O(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),$e=O(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),et=O(`panel-left-close`,[[`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`}]]),tt=O(`panel-left-open`,[[`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`}]]),nt=O(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),rt=O(`party-popper`,[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]),it=O(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),at=O(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),ot=O(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),st=O(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),ct=O(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),lt=O(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ut=O(`refresh-cw`,[[`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`}]]),dt=O(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),ft=O(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),pt=O(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),mt=O(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),ht=O(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),gt=O(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),V=O(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),_t=O(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),vt=O(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),yt=O(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),bt=O(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),xt=O(`square-pen`,[[`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.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),St=O(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Ct=O(`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`}]]),wt=O(`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`}]]),Tt=O(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Et=O(`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`}]]),Dt=O(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ot=O(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),kt=O(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),At=O(`triangle-alert`,[[`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-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),jt=O(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Mt=O(`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`}]]),Nt=O(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Pt=O(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Ft=O(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),It=O(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),Lt=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Rt=(e=>e?Lt(e):Lt),zt=e=>e;function Bt(e,t=zt){let n=w.useSyncExternalStore(e.subscribe,w.useCallback(()=>t(e.getState()),[e,t]),w.useCallback(()=>t(e.getInitialState()),[e,t]));return w.useDebugValue(n),n}var Vt=e=>{let t=Rt(e),n=e=>Bt(t,e);return Object.assign(n,t),n},Ht=(e=>e?Vt(e):Vt),Ut=l(_(),1),H=Ht((e,t)=>({agents:[],activeAgentId:(()=>{try{return localStorage.getItem(`gaia-active-agent-id`)||`chat`}catch{return`chat`}})(),setAgents:t=>e({agents:t}),setActiveAgentId:t=>{try{localStorage.setItem(`gaia-active-agent-id`,t)}catch{}e({activeAgentId:t})},agentsError:null,setAgentsError:t=>e({agentsError:t}),activeDevice:(()=>{try{return localStorage.getItem(`gaia-active-device`)||`gpu`}catch{return`gpu`}})(),setActiveDevice:t=>{try{localStorage.setItem(`gaia-active-device`,t)}catch{}e({activeDevice:t})},detectedDevices:[`gpu`],setDetectedDevices:t=>e({detectedDevices:t}),activeModelTier:(()=>{try{return localStorage.getItem(`gaia-active-model-tier`)||`full`}catch{return`full`}})(),setActiveModelTier:t=>{try{localStorage.setItem(`gaia-active-model-tier`,t)}catch{}e({activeModelTier:t})},sessions:[],currentSessionId:null,pendingDeleteIds:[],runningSessionIds:[],setRunningSessions:t=>e(e=>{let n=e.runningSessionIds;return n.length===t.length&&n.every(e=>t.includes(e))?e:{runningSessionIds:t}}),setSessions:t=>e(e=>({sessions:t.filter(t=>!e.pendingDeleteIds.includes(t.id))})),setCurrentSession:t=>e(t?{currentSessionId:t,showHub:!1}:{currentSessionId:t}),addSession:t=>e(e=>({sessions:[t,...e.sessions]})),removeSession:t=>e(e=>({sessions:e.sessions.filter(e=>e.id!==t),currentSessionId:e.currentSessionId===t?null:e.currentSessionId,messages:e.currentSessionId===t?[]:e.messages})),updateSessionInList:(t,n)=>e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,...n}:e)})),addPendingDelete:t=>e(e=>({pendingDeleteIds:[...e.pendingDeleteIds,t]})),removePendingDelete:t=>e(e=>({pendingDeleteIds:e.pendingDeleteIds.filter(e=>e!==t)})),messages:[],setMessages:t=>e({messages:t}),addMessage:t=>e(e=>({messages:[...e.messages,t]})),removeMessage:t=>e(e=>({messages:e.messages.filter(e=>e.id!==t)})),removeMessagesFrom:t=>e(e=>{let n=e.messages.findIndex(e=>e.id===t);return n===-1?e:{messages:e.messages.slice(0,n)}}),isStreaming:!1,streamingContent:``,setStreaming:t=>e({isStreaming:t}),appendStreamContent:t=>e(e=>({streamingContent:e.streamingContent+t})),setStreamContent:t=>e({streamingContent:t}),clearStreamContent:()=>e({streamingContent:``}),resetStreaming:()=>e({isStreaming:!1,streamingContent:``,agentSteps:[],cards:[]}),agentSteps:[],addAgentStep:t=>e(e=>({agentSteps:[...e.agentSteps.map(e=>({...e,active:!1})),t]})),updateLastAgentStep:t=>e(e=>{if(e.agentSteps.length===0)return e;let n=[...e.agentSteps];return n[n.length-1]={...n[n.length-1],...t},{agentSteps:n}}),appendThinkingContent:t=>e(e=>{if(e.agentSteps.length===0)return e;let n=[...e.agentSteps],r=n[n.length-1];return r.type===`thinking`?(n[n.length-1]={...r,detail:(r.detail?r.detail+`
|
|
10
10
|
`:``)+t,active:!0},{agentSteps:n}):e}),updateLastToolStep:t=>e(e=>{if(e.agentSteps.length===0)return e;let n=[...e.agentSteps];for(let e=n.length-1;e>=0;e--)if(n[e].type===`tool`)return n[e]={...n[e],...t},{agentSteps:n};return e}),clearAgentSteps:()=>e({agentSteps:[]}),cards:[],appendCard:t=>e(e=>({cards:[...e.cards,t]})),clearCards:()=>e({cards:[]}),documents:[],setDocuments:t=>e({documents:t}),systemStatus:null,backendConnected:!0,setSystemStatus:t=>e({systemStatus:t}),setBackendConnected:t=>e({backendConnected:t}),theme:(()=>{try{return localStorage.getItem(`gaia-chat-theme`)||`dark`}catch{return`dark`}})(),showDocLibrary:!1,showFileBrowser:!1,showSettings:!1,showMemoryDashboard:!1,showSchedules:!1,showHub:!1,toggleTheme:()=>e(e=>{let t=e.theme===`dark`?`light`:`dark`;try{localStorage.setItem(`gaia-chat-theme`,t)}catch{}return document.documentElement.setAttribute(`data-theme`,t),{theme:t}}),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:t=>e({showDocLibrary:t}),setShowFileBrowser:t=>e({showFileBrowser:t}),setShowSettings:t=>e(t?{showSettings:!0,showMemoryDashboard:!1,showSchedules:!1,showHub:!1}:{showSettings:!1}),setShowMemoryDashboard:t=>e(t?{showMemoryDashboard:!0,showSettings:!1,showSchedules:!1,showHub:!1}:{showMemoryDashboard:!1}),setShowSchedules:t=>e(t?{showSchedules:!0,showSettings:!1,showMemoryDashboard:!1,showHub:!1}:{showSchedules:!1}),setShowHub:t=>e(t?{showHub:!0,showSettings:!1,showMemoryDashboard:!1,showSchedules:!1}:{showHub:!1}),toggleSidebar:()=>e(e=>({sidebarOpen:!e.sidebarOpen})),setSidebarOpen:t=>e({sidebarOpen:t}),toggleSidebarCollapsed:()=>e(e=>{let t=!e.sidebarCollapsed;try{localStorage.setItem(`gaia-chat-sidebar-collapsed`,String(t))}catch{}return{sidebarCollapsed:t}}),setSidebarCollapsed:t=>{try{localStorage.setItem(`gaia-chat-sidebar-collapsed`,String(t))}catch{}e({sidebarCollapsed:t})},setSidebarWidth:t=>{let n=Math.max(200,Math.min(500,t));try{localStorage.setItem(`gaia-chat-sidebar-width`,String(n))}catch{}e({sidebarWidth:n})},setLoadingMessages:t=>e({isLoadingMessages:t}),setPendingPrompt:t=>e({pendingPrompt:t})})),Wt=/^https?:\/\/(127\.0\.0\.1|localhost):\d+\/api$/,Gt=`http://localhost:4200/api`;function Kt(){if(typeof window>`u`)return`/api`;if(window.location.protocol===`file:`){let e=new URLSearchParams(window.location.search).get(`api`);return e&&Wt.test(e)?e:Gt}return`/api`}var qt={api:`#4fc3f7`,store:`#ce93d8`,chat:`#81c784`,stream:`#ffb74d`,ui:`#90a4ae`,doc:`#a1887f`,system:`#e57373`,nav:`#fff176`},Jt={api:`fetch`,store:`state`,chat:`chat`,stream:`stream`,ui:`ui`,doc:`docs`,system:`sys`,nav:`nav`},Yt=(()=>{try{if(localStorage.getItem(`gaia-debug`)===`true`)return!0;if(typeof location<`u`){let e=new URLSearchParams(location.search);if(e.has(`debug`)||e.has(`verbose`))return!0}}catch{}return!1})();function Xt(){let e=new Date;return e.toLocaleTimeString(`en-US`,{hour12:!1})+`.`+String(e.getMilliseconds()).padStart(3,`0`)}function Zt(e){let t=qt[e]||`#ccc`,n=`%c[${Jt[e]||e}]`,r=`color: ${t}; font-weight: bold;`,i=`color: #888; font-weight: normal;`;return{info:(e,...t)=>{if(!Yt)return;let a=Xt();t.length>0?console.log(`${n} %c${a} %c${e}`,r,i,`color: inherit;`,...t):console.log(`${n} %c${a} %c${e}`,r,i,`color: inherit;`)},warn:(e,...t)=>{let a=Xt();console.warn(`${n} %c${a} %c${e}`,r,i,`color: inherit;`,...t)},error:(e,...t)=>{let a=Xt();console.error(`${n} %c${a} %c${e}`,r,i,`color: inherit;`,...t)},debug:(e,...t)=>{if(!Yt)return;let a=Xt();console.debug(`${n} %c${a} %c${e}`,r,i,`color: #999;`,...t)},timed:(e,t,...a)=>{if(!Yt)return;let o=Math.round(performance.now()-t),s=Xt(),c=o>2e3?`color: #e57373;`:o>500?`color: #ffb74d;`:`color: #81c784;`;a.length>0?console.log(`${n} %c${s} %c${e} %c(${o}ms)`,r,i,`color: inherit;`,c,...a):console.log(`${n} %c${s} %c${e} %c(${o}ms)`,r,i,`color: inherit;`,c)},time:()=>performance.now()}}var U={api:Zt(`api`),store:Zt(`store`),chat:Zt(`chat`),stream:Zt(`stream`),ui:Zt(`ui`),doc:Zt(`doc`),system:Zt(`system`),nav:Zt(`nav`)};function Qt(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(Yt?`%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;`)}var $t=Kt();function en(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})`}}var tn={"x-gaia-ui":`1`};async function W(e,t,n,r){let i=`${$t}${t}`,a=U.api.time();U.api.info(`${e} ${i}`,n===void 0?``:{body:n});let o=n===void 0?{}:{"Content-Type":`application/json`},s={method:e,headers:{...tn,...r,...o},body:n===void 0?void 0:JSON.stringify(n)},c;try{c=await fetch(i,s)}catch(t){throw U.api.error(`${e} ${i} - network error`,t),t}if(!c.ok){let t=await c.text().catch(()=>``);U.api.error(`${e} ${i} - HTTP ${c.status}`,{errorText:t});let n=t;try{n=JSON.parse(t).detail||t}catch{}throw Error(en(c.status,n))}let l=c.headers.get(`content-type`)||``;if(!l.includes(`application/json`)){let n=await c.text().catch(()=>``);if(c.status===204||n.trim()===``){U.api.timed(`${e} ${i} -> ${c.status} (no body)`,a);return}throw U.api.error(`${e} ${i} -> ${c.status} (non-JSON body)`,{contentType:l,preview:n.slice(0,200)}),Error(`${e} ${t}: expected JSON, got ${l||`no Content-Type`} (HTTP ${c.status}: ${n.slice(0,120)})`)}let u=await c.json();return U.api.timed(`${e} ${i} -> ${c.status}`,a,u),u}async function nn(){return W(`GET`,`/system/status`)}async function rn(){return W(`GET`,`/settings`)}async function an(e){return W(`PUT`,`/settings`,e)}async function on(e,t){return W(`POST`,`/system/load-model`,{model_name:e,ctx_size:t})}async function G(e,t=!1){return W(`POST`,`/system/download-model`,{model_name:e,force:t})}async function sn(){return W(`GET`,`/onboarding/preflight`)}async function cn(){return W(`GET`,`/onboarding/status`)}async function ln(e){return W(`POST`,`/onboarding/complete`,{skipped:e,completed_at:new Date().toISOString()})}async function un(){return W(`GET`,`/agents`)}async function dn(){return W(`GET`,`/agents/disk`,void 0,{"x-gaia-ui":`1`})}async function fn(){return W(`GET`,`/agents/catalog`,void 0,{"x-gaia-ui":`1`})}async function pn(e,t,n){return W(`POST`,`/agents/install`,{id:e,...t?{device:t}:{},...n?{trust_native:!0}:{}},{"x-gaia-ui":`1`})}async function mn(e){return W(`GET`,`/agents/${encodeURIComponent(e)}/install-status`)}async function hn(e){await W(`DELETE`,`/agents/${encodeURIComponent(e)}`,void 0,{"x-gaia-ui":`1`})}async function gn(){return W(`GET`,`/connectors`)}async function _n(e){return W(`GET`,`/connectors/${e}`)}async function vn(e,t,n=[]){return W(`POST`,`/connectors/${e}/authorize`,{scopes:t,grant_agents:n},tn)}async function yn(e,t,n=[]){return W(`POST`,`/connectors/${e}/authorize-device`,{scopes:t,grant_agents:n},tn)}async function bn(e,t){return W(`POST`,`/connectors/${e}/configure`,{config:t},tn)}async function xn(e){await W(`DELETE`,`/connectors/${e}`,void 0,tn)}async function Sn(e){return W(`POST`,`/connectors/${e}/enable`,{},tn)}async function Cn(e){return W(`POST`,`/connectors/${e}/disable`,{},tn)}async function wn(){return W(`GET`,`/connectors/agent-mcps`)}async function Tn(e){return W(`GET`,`/connectors/${e}/grants`)}async function En(e,t,n){await W(`PUT`,`/connectors/${e}/grants/${encodeURIComponent(t)}`,{scopes:n},tn)}async function Dn(e,t){await W(`DELETE`,`/connectors/${e}/grants/${encodeURIComponent(t)}`,void 0,tn)}async function On(e){return W(`GET`,`/connectors/${e}/activations`)}async function kn(e,t,n){return W(`PUT`,`/connectors/${e}/activations/${encodeURIComponent(t)}`,n?{scopes:n}:{},tn)}async function An(e,t){await W(`DELETE`,`/connectors/${e}/activations/${encodeURIComponent(t)}`,void 0,tn)}async function jn(){return W(`GET`,`/sessions`)}async function Mn(e={}){return W(`POST`,`/sessions`,e)}async function Nn(e,t){return W(`PUT`,`/sessions/${e}`,t)}async function Pn(e){return W(`DELETE`,`/sessions/${e}`)}async function Fn(e){return W(`PATCH`,`/sessions/${e}/private`)}async function In(e){let{total:t}=await W(`GET`,`/sessions/${e}/messages?limit=1&offset=0`);return t}async function Ln(e){let t=`/sessions/${e}/messages`,n=await W(`GET`,`${t}?limit=100&offset=0`),r=[...n.messages],i=n.total;for(;r.length<i;){let e=await W(`GET`,`${t}?limit=${Math.min(100,i-r.length)}&offset=${r.length}`);if(e.messages.length===0)throw Error(`Incomplete transcript received. Please reload the conversation.`);r.push(...e.messages)}return{messages:r,total:i}}async function Rn(e){return W(`GET`,`/sessions/${e}/export?format=markdown`)}async function zn(e,t){return W(`DELETE`,`/sessions/${e}/messages/${t}`)}async function Bn(e,t){return W(`DELETE`,`/sessions/${e}/messages/${t}/and-below`)}var Vn=new Set([`status`,`step`,`thinking`,`plan`,`tool_start`,`tool_end`,`tool_result`,`tool_args`,`tool_confirm`,`agent_error`,`permission_request`,`needs_confirmation`,`needs_input`,`policy_alert`]);function Hn(e,t,n,r,i,a,o){let s;s=typeof n==`function`?{onChunk:n,onAgentEvent:()=>{},onDone:r||(()=>{}),onError:i||(e=>{U.stream.error(`Unhandled stream error`,e)})}:n;let c=new AbortController,l=U.stream.time();return U.stream.info(`Starting SSE stream for session=${e}`,{messageLength:t.length}),fetch(`${$t}/chat/send`,{method:`POST`,headers:{...tn,"Content-Type":`application/json`},body:JSON.stringify({session_id:e,message:t,stream:!0,...a?{agent_type:a}:{},...o?{device:o}:{}}),signal:c.signal}).then(e=>Un(e,s,l)).catch(e=>{e.name===`AbortError`?U.stream.warn(`Stream aborted by user`):(U.stream.error(`Stream fetch error`,e),s.onError(e))}),c}async function Un(e,t,n){if(U.stream.info(`SSE connection opened -> HTTP ${e.status}`),!e.ok){let n=await e.text().catch(()=>``);U.stream.error(`SSE connection failed: HTTP ${e.status}`,n),t.onError(Error(`HTTP ${e.status}: ${n}`));return}let r=e.body?.getReader();if(!r){U.stream.error(`No response body reader available`),t.onError(Error(`No response body`));return}let i=new TextDecoder,a=``,o=!1,s=0,c=0,l=0;try{for(;;){let{done:e,value:u}=await r.read();if(e){U.stream.debug(`SSE reader done (stream ended)`);break}a+=i.decode(u,{stream:!0});let d=a.split(`
|
|
11
|
-
`);a=d.pop()||``;for(let e of d)if(e.startsWith(`data: `)){let r=e.slice(6).trim();if(!r)continue;try{let e=JSON.parse(r);e.type===`chunk`?(s++,c+=(e.content||``).length,(s<=3||s%50==0)&&U.stream.debug(`Chunk #${s} (+${(e.content||``).length} chars)`),t.onChunk(e)):e.type===`answer`?t.onChunk(e):e.type===`done`?(o=!0,U.stream.timed(`Stream complete: ${s} chunks, ${c} chars, ${l} agent events`,n),t.onDone(e)):e.type===`error`?(U.stream.error(`Stream error event:`,e.content),t.onError(Error(e.content||`Unknown error`))):e.type===`agent_created`?(U.stream.info(`Agent created: ${e.agent_id}`),t.onAgentCreated?.(e)):Vn.has(e.type)?(l++,U.stream.debug(`Agent event: ${e.type}`,e),t.onAgentEvent(e)):U.stream.warn(`Unknown SSE event type: ${e.type}`,e)}catch{U.stream.warn(`Malformed SSE data, skipping`,{raw:r.slice(0,100)})}}}}finally{r.releaseLock()}o||(U.stream.timed(`SSE connection closed without done event: ${s} chunks, ${l} agent events`,n),t.onDone({type:`done`}))}function Wn(e,t){let n=new AbortController,r=U.stream.time();return U.stream.info(`Attaching to background run for session=${e}`),fetch(`${$t}/chat/attach?session_id=${encodeURIComponent(e)}`,{method:`GET`,signal:n.signal}).then(e=>Un(e,t,r)).catch(e=>{e.name===`AbortError`?U.stream.warn(`Run attach detached by client`):(U.stream.error(`Run attach fetch error`,e),t.onError(e))}),n}async function Gn(){return W(`GET`,`/chat/active`)}async function Kn(e,t,n,r){return W(`POST`,`/chat/confirm`,{session_id:e,confirm_id:t,action:n,remember:r})}async function qn(e,t){return W(`POST`,`/chat/confirm-tool`,{session_id:e,approved:t})}async function Jn(e,t,n){return W(`POST`,`/chat/user-input`,{session_id:e,request_id:t,value:n})}async function Yn(e){return W(`POST`,`/chat/cancel`,{session_id:e})}async function Xn(){return W(`GET`,`/documents`)}async function Zn(e){return W(`POST`,`/documents/upload-path`,{filepath:e})}async function Qn(e){let t=`${$t}/documents/upload`,n=U.api.time();U.api.info(`POST ${t}`,{fileName:e.name,size:e.size});let r=new FormData;r.append(`file`,e);let i;try{i=await fetch(t,{method:`POST`,headers:tn,body:r})}catch(e){throw U.api.error(`POST ${t} - network error`,e),e}if(!i.ok){let e=await i.text().catch(()=>``);U.api.error(`POST ${t} - HTTP ${i.status}`,{errorText:e});let n=e;try{n=JSON.parse(e).detail||e}catch{}throw Error(en(i.status,n))}let a=await i.json();return U.api.timed(`POST ${t} -> ${i.status}`,n,a),a}async function $n(e){return W(`DELETE`,`/documents/${e}`)}async function er(e){return W(`GET`,`/documents/${e}/status`)}async function tr(e){return W(`POST`,`/documents/${e}/cancel`)}async function nr(e){return W(`POST`,`/documents/${e}/reindex`)}async function rr(e,t){return W(`POST`,`/sessions/${e}/documents`,{document_id:t})}async function ir(e,t){return W(`DELETE`,`/sessions/${e}/documents/${t}`)}async function ar(e){return W(`GET`,`/files/browse${e?`?path=${encodeURIComponent(e)}`:``}`)}async function or(e,t=!0){return W(`POST`,`/documents/index-folder`,{folder_path:e,recursive:t})}async function sr(e,t=!0){return W(`POST`,`/files/open`,{path:e,reveal:t})}async function cr(e){let t=`${$t}/files/upload`,n=U.api.time();U.api.info(`POST ${t}`,{fileName:e.name,size:e.size});let r=new FormData;r.append(`file`,e);let i=await fetch(t,{method:`POST`,headers:tn,body:r});if(!i.ok){let e=await i.text().catch(()=>`Upload failed`);throw U.api.error(`POST ${t} - HTTP ${i.status}`,{errorText:e}),Error(`Upload failed: ${e}`)}let a=await i.json();return U.api.timed(`POST ${t} -> ${i.status}`,n,a),a}async function lr(e,t,n){let r=new URLSearchParams({query:e});return t&&r.set(`file_types`,t),n&&r.set(`max_results`,String(n)),W(`GET`,`/files/search?${r}`)}async function ur(e,t){let n=new URLSearchParams({path:e});return t&&n.set(`lines`,String(t)),W(`GET`,`/files/preview?${n}`)}async function dr(){return W(`POST`,`/tunnel/start`)}async function fr(){return W(`POST`,`/tunnel/stop`)}async function pr(){return W(`GET`,`/tunnel/status`)}async function mr(){return W(`GET`,`/mcp/status`)}async function hr(){return W(`GET`,`/schedules`)}async function gr(e,t,n){return W(`POST`,`/schedules`,{name:e,interval:t,prompt:n})}async function _r(e,t){return W(`PUT`,`/schedules/${encodeURIComponent(e)}`,{status:t})}async function vr(e){return W(`DELETE`,`/schedules/${encodeURIComponent(e)}`)}async function yr(e,t=20){return W(`GET`,`/schedules/${encodeURIComponent(e)}/results?limit=${t}`)}async function br(e){return W(`POST`,`/schedules/parse`,{input:e})}function xr(e){return e.replace(/-/g,``).slice(0,7)}function Sr(e,t){let n=t.replace(/^#/,``).toLowerCase();if(!n||n.length<4)return null;let r=e.find(e=>e.id.replace(/-/g,``).toLowerCase().startsWith(n));return r?r.id:null}function Cr(e){let t=new Date(e.updated_at).getTime();return Number.isNaN(t)?0:t}function wr(e,t){let n=new Map;for(let e of t)n.set(e.id,e);let r=new Map;for(let t of e){let e=t.agent_type||`chat`,n=r.get(e);n?n.push(t):r.set(e,[t])}let i=[];for(let[e,t]of r){let r=n.get(e);t.sort((e,t)=>Cr(t)-Cr(e)),i.push({agentId:e,name:r?.name||e,icon:r?.icon,unknown:r===void 0,sessions:t})}return i.sort((e,t)=>Cr(t.sessions[0])-Cr(e.sessions[0])),i}function Tr(e,t){let n=e.agent_type||`chat`;return t.find(e=>e.id===n)?.name||n}function Er(e,t){let n=e.agent_type||`chat`;return t.find(e=>e.id===n)?.icon}var Dr=`New Task`;function Or(e,t){let n=t.sessions.find(t=>t.id===e);return!(!n||n.title!==Dr||(n.message_count??0)!==0||t.runningSessionIds.includes(e)||t.currentSessionId===e&&(t.messages.length!==0||t.isStreaming))}async function kr(e){if(!e)return!1;let t=H.getState();if(!Or(e,{sessions:t.sessions,currentSessionId:t.currentSessionId,messages:t.messages,isStreaming:t.isStreaming,runningSessionIds:t.runningSessionIds}))return!1;U.chat.info(`Removing abandoned draft session ${e}`),t.addPendingDelete(e),t.removeSession(e);try{return await Pn(e),!0}catch(t){return U.chat.warn(`Failed to delete abandoned draft ${e}`,t),!1}finally{t.removePendingDelete(e)}}var Ar={"message-circle":Je,"file-text":Ee,"folder-search":Ae,table:wt,globe:Ne,mail:Ke,zap:It,plug:ct,wrench:Pt,cpu:_e,hammer:Pe,shield:vt,code:he,bot:M};function jr(e){return e&&Ar[e]||M}var Mr=``+new URL(`gaia-robot-NKaQnEIp.png`,import.meta.url).href,Nr=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),K=o(((e,t)=>{t.exports=Nr()}))();function Pr(e,t){e.stopPropagation(),e.preventDefault();let n=xr(t),r=`${window.location.origin}${window.location.pathname}#${n}`;navigator.clipboard.writeText(r).then(()=>{U.ui.info(`Copied session link: ${r}`)}).catch(()=>{U.ui.warn(`Clipboard write failed`)})}function Fr({session:e,isActive:t,isRunning:n,isPendingDelete:r,isDeleting:i,onSelect:a,onKeyDown:o,onDelete:s,formatTime:c,agentChip:l}){let[u,d]=(0,w.useState)(!1),f=(0,w.useCallback)(t=>{Pr(t,e.id),d(!0),setTimeout(()=>d(!1),1500)},[e.id]),p=l?jr(l.icon):null;return(0,K.jsxs)(`div`,{className:`session-item ${t?`active`:``} ${i?`session-deleting`:``}`,onClick:()=>a(e.id),onKeyDown:t=>o(t,e.id),role:`button`,tabIndex:0,"aria-label":`Open task: ${e.title}`,"aria-current":t?`true`:void 0,children:[(0,K.jsxs)(`span`,{className:`session-title`,children:[e.private&&(0,K.jsx)(Ce,{size:10,className:`session-private-icon`,"aria-label":`Private session`}),n&&(0,K.jsx)(B,{size:11,className:`session-running-spinner`,"aria-label":`Agent running`}),e.title]}),l&&p&&(0,K.jsxs)(`span`,{className:`session-agent-chip`,title:`Agent: ${l.name}`,children:[(0,K.jsx)(p,{size:10,className:`session-agent-chip-icon`}),(0,K.jsx)(`span`,{className:`session-agent-chip-name`,children:l.name})]}),(0,K.jsxs)(`a`,{className:`session-hash ${u?`copied`:``}`,href:`#${xr(e.id)}`,onClick:f,title:u?`Copied!`:`Copy link #${xr(e.id)}`,"aria-label":`Copy link for session ${xr(e.id)}`,children:[`#`,xr(e.id)]}),(0,K.jsx)(`span`,{className:`session-time`,children:c(e.updated_at)}),r?(0,K.jsxs)(`button`,{className:`session-delete confirm`,onClick:t=>s(t,e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&s(t,e.id)},title:`Click to confirm delete`,"aria-label":`Confirm delete: ${e.title}`,children:[(0,K.jsx)(Ot,{size:12}),(0,K.jsx)(`span`,{className:`confirm-label`,children:`Delete?`})]}):(0,K.jsx)(`button`,{className:`session-delete`,onClick:t=>s(t,e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&s(t,e.id)},title:`Delete`,"aria-label":`Delete: ${e.title}`,children:(0,K.jsx)(Ot,{size:13})})]})}function Ir({onNewTask:e,onHome:t,tunnelActive:n,tunnelLoading:r,onMobileToggle:i}){let{sessions:a,currentSessionId:o,setCurrentSession:s,removeSession:c,addSession:l,setMessages:u,theme:d,toggleTheme:f,setShowSettings:p,setShowMemoryDashboard:m,setShowSchedules:h,setShowHub:g,sidebarOpen:_,setSidebarOpen:v,setLoadingMessages:y,sidebarCollapsed:b,toggleSidebarCollapsed:x,sidebarWidth:S,setSidebarWidth:C,addPendingDelete:T,removePendingDelete:E,runningSessionIds:D,agents:O}=H(),[k,ee]=(0,w.useState)(``),[te,A]=(0,w.useState)(null),[j,ne]=(0,w.useState)(null),[re,M]=(0,w.useState)(!1),[P,ie]=(0,w.useState)(null),ae=(0,w.useRef)(null),F=(0,w.useRef)(null),I=(0,w.useRef)(null);(0,w.useEffect)(()=>{let e=()=>{b?(x(),requestAnimationFrame(()=>F.current?.focus())):F.current?.focus()};return window.addEventListener(`gaia:focus-search`,e),()=>window.removeEventListener(`gaia:focus-search`,e)},[b,x]);let oe=k?a.filter(e=>e.title.toLowerCase().includes(k.toLowerCase())):a,se=(0,w.useMemo)(()=>k?null:wr(oe,O),[oe,k,O]),ce=(0,w.useCallback)(async e=>{if(e===o)return;let t=a.find(t=>t.id===e)?.title||`?`;U.nav.info(`Selecting session: "${t}" (${e})`),kr(o),s(e),u([]),y(!0),window.innerWidth<=768&&v(!1);try{let n=await Ln(e);if(H.getState().currentSessionId!==e){U.nav.debug(`Discarding stale message load for session=${e} (user switched away)`);return}u(n.messages||[]),U.nav.info(`Loaded ${(n.messages||[]).length} message(s) for "${t}"`)}catch(t){U.nav.error(`Failed to load messages for session ${e}`,t),u([])}finally{y(!1)}},[o,a,s,u,v,y]),L=(0,w.useCallback)(async(e,t)=>{e.stopPropagation(),e.preventDefault();let n=a.find(e=>e.id===t),r=n?.title||`?`;if(te===t){U.chat.info(`Deleting session: "${r}" (${t})`),A(null),ne(t),T(t),Pn(t).then(()=>{U.chat.info(`Session deleted from backend: "${r}"`),E(t)}).catch(e=>{U.chat.warn(`Backend delete failed for "${r}"`,e),E(t)}),P?.timer&&clearTimeout(P.timer);let e=setTimeout(()=>{ie(null)},5e3);n&&ie({session:n,timer:e}),setTimeout(()=>{c(t),ne(null)},250);return}U.chat.debug(`Delete pending confirmation for: "${r}" (${t})`),A(t),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>A(e=>e===t?null:e),3e3)},[te,a,c,P,T,E]),R=(0,w.useCallback)(()=>{if(!P)return;clearTimeout(P.timer);let{session:e}=P;U.chat.info(`Undo delete: re-creating "${e.title}"`),E(e.id),Mn({title:e.title}).then(e=>{l(e),U.chat.info(`Undo delete: re-created "${e.title}" (new id=${e.id})`)}).catch(t=>{U.chat.warn(`Undo delete failed for "${e.title}"`,t)}),ie(null)},[P,l,E]);(0,w.useEffect)(()=>{if(!te)return;let e=()=>A(null);return window.addEventListener(`click`,e,{once:!0}),()=>window.removeEventListener(`click`,e)},[te]);let le=(0,w.useCallback)((e,t)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ce(t))},[ce]),z=(0,w.useRef)(null),ue=(0,w.useCallback)(e=>{e.preventDefault(),M(!0),U.ui.debug(`Sidebar resize started`);let t=e.clientX,n=S,r=e=>{let r=e.clientX-t;C(n+r)},i=()=>{M(!1),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,z.current=null,U.ui.debug(`Sidebar resize ended`)};z.current=i,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[S,C]);(0,w.useEffect)(()=>()=>{z.current&&z.current(),I.current&&clearTimeout(I.current)},[]);let de=e=>{let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<7?`${a}d`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})},fe=typeof window<`u`&&window.innerWidth<=768?void 0:{width:b?56:S,minWidth:b?56:S};return(0,K.jsxs)(`aside`,{ref:ae,className:`sidebar ${_?`open`:``} ${b?`collapsed`:``} ${re?`resizing`:``}`,style:fe,role:`complementary`,"aria-label":`Task sidebar`,children:[(0,K.jsxs)(`div`,{className:`sidebar-top`,children:[(0,K.jsxs)(`button`,{className:`sidebar-brand`,onClick:t,title:`Agent Hub`,"aria-label":`Go to Agent Hub`,children:[(0,K.jsx)(`div`,{className:`brand-icon`,"aria-hidden":`true`,children:(0,K.jsx)(`img`,{src:Mr,alt:``,width:28,height:28})}),(0,K.jsxs)(`div`,{className:`brand-text`,children:[(0,K.jsx)(`span`,{className:`brand-name`,children:`GAIA`}),(0,K.jsxs)(`span`,{className:`brand-version`,children:[`v`,`0.24.0`]}),(0,K.jsx)(`span`,{className:`beta-badge`,children:`BETA`})]})]}),(0,K.jsxs)(`div`,{className:`sidebar-top-actions`,children:[(0,K.jsx)(`button`,{className:`new-task-btn`,onClick:e,title:`New Task`,"aria-label":`New Task`,children:(0,K.jsx)(lt,{size:18})}),(0,K.jsx)(`button`,{className:`collapse-btn`,onClick:x,title:b?`Expand sidebar`:`Collapse sidebar`,"aria-label":b?`Expand sidebar`:`Collapse sidebar`,children:b?(0,K.jsx)(tt,{size:18}):(0,K.jsx)(et,{size:18})})]})]}),(0,K.jsxs)(`div`,{className:`sidebar-search`,children:[(0,K.jsx)(pt,{size:14,className:`search-icon`,"aria-hidden":`true`}),(0,K.jsx)(`input`,{ref:F,type:`text`,placeholder:`Search... (Ctrl+K)`,value:k,onChange:e=>ee(e.target.value),"aria-label":`Search tasks`})]}),(0,K.jsxs)(`nav`,{className:`session-list`,"aria-label":`Task sessions`,children:[oe.length===0&&(0,K.jsx)(`div`,{className:`empty-hint`,children:k?`No results`:`No tasks yet`}),se?se.map(e=>{let t=jr(e.icon);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`session-group-label session-agent-group-label`,children:[(0,K.jsx)(t,{size:12,className:`session-agent-group-icon`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`session-agent-group-name`,children:e.name}),(0,K.jsx)(`span`,{className:`session-agent-group-count`,children:e.sessions.length})]}),e.sessions.map(e=>(0,K.jsx)(Fr,{session:e,isActive:e.id===o,isRunning:D.includes(e.id),isPendingDelete:te===e.id,isDeleting:j===e.id,onSelect:ce,onKeyDown:le,onDelete:L,formatTime:de},e.id))]},e.agentId)}):oe.map(e=>(0,K.jsx)(Fr,{session:e,isActive:e.id===o,isRunning:D.includes(e.id),isPendingDelete:te===e.id,isDeleting:j===e.id,onSelect:ce,onKeyDown:le,onDelete:L,formatTime:de,agentChip:{name:Tr(e,O),icon:Er(e,O)}},e.id))]}),(0,K.jsxs)(`div`,{className:`sidebar-bottom`,children:[(0,K.jsxs)(`div`,{className:`privacy-badge`,children:[(0,K.jsx)(`span`,{className:`privacy-dot`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:`100% Local`}),(0,K.jsxs)(`span`,{className:`version-badge`,children:[`v`,`0.24.0`]})]}),(0,K.jsxs)(`div`,{className:`sidebar-actions`,children:[i&&(0,K.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:(0,K.jsx)(yt,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>g(!0),title:`Agent Hub`,"aria-label":`Open Agent Hub`,children:(0,K.jsx)(Ve,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>m(!0),title:`Memory Dashboard`,"aria-label":`Memory Dashboard`,children:(0,K.jsx)(N,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>h(!0),title:`Scheduled Tasks`,"aria-label":`Scheduled Tasks`,children:(0,K.jsx)(pe,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>p(!0),title:`Settings`,"aria-label":`Settings`,children:(0,K.jsx)(ht,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:f,title:`Toggle theme`,"aria-label":`Switch to ${d===`dark`?`light`:`dark`} theme`,children:d===`dark`?(0,K.jsx)(Ct,{size:17}):(0,K.jsx)(Qe,{size:17})})]})]}),!b&&(0,K.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:ue,title:`Drag to resize sidebar`,"aria-hidden":`true`}),P&&(0,K.jsxs)(`div`,{className:`toast toast-undo`,role:`status`,children:[`Deleted “`,P.session.title,`”`,(0,K.jsx)(`span`,{className:`toast-action`,onClick:R,children:`Undo`})]})]})}function Lr(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Rr=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zr=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Br={};function Vr(e,t){return((t||Br).jsx?zr:Rr).test(e)}var Hr=/[ \t\n\f\r]/g;function Ur(e){return typeof e==`object`?e.type===`text`&&Wr(e.value):Wr(e)}function Wr(e){return e.replace(Hr,``)===``}var Gr=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Gr.prototype.normal={},Gr.prototype.property={},Gr.prototype.space=void 0;function Kr(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Gr(n,r,t)}function qr(e){return e.toLowerCase()}var Jr=class{constructor(e,t){this.attribute=t,this.property=e}};Jr.prototype.attribute=``,Jr.prototype.booleanish=!1,Jr.prototype.boolean=!1,Jr.prototype.commaOrSpaceSeparated=!1,Jr.prototype.commaSeparated=!1,Jr.prototype.defined=!1,Jr.prototype.mustUseProperty=!1,Jr.prototype.number=!1,Jr.prototype.overloadedBoolean=!1,Jr.prototype.property=``,Jr.prototype.spaceSeparated=!1,Jr.prototype.space=void 0;var Yr=s({boolean:()=>q,booleanish:()=>Zr,commaOrSpaceSeparated:()=>ti,commaSeparated:()=>ei,number:()=>J,overloadedBoolean:()=>Qr,spaceSeparated:()=>$r}),Xr=0,q=ni(),Zr=ni(),Qr=ni(),J=ni(),$r=ni(),ei=ni(),ti=ni();function ni(){return 2**++Xr}var ri=Object.keys(Yr),ii=class extends Jr{constructor(e,t,n,r){let i=-1;if(super(e,t),ai(this,`space`,r),typeof n==`number`)for(;++i<ri.length;){let e=ri[i];ai(this,ri[i],(n&Yr[e])===Yr[e])}}};ii.prototype.defined=!0;function ai(e,t,n){n&&(e[t]=n)}function oi(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ii(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[qr(r)]=r,n[qr(a.attribute)]=r}return new Gr(t,n,e.space)}var si=oi({properties:{ariaActiveDescendant:null,ariaAtomic:Zr,ariaAutoComplete:null,ariaBusy:Zr,ariaChecked:Zr,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:$r,ariaCurrent:null,ariaDescribedBy:$r,ariaDetails:null,ariaDisabled:Zr,ariaDropEffect:$r,ariaErrorMessage:null,ariaExpanded:Zr,ariaFlowTo:$r,ariaGrabbed:Zr,ariaHasPopup:null,ariaHidden:Zr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:$r,ariaLevel:J,ariaLive:null,ariaModal:Zr,ariaMultiLine:Zr,ariaMultiSelectable:Zr,ariaOrientation:null,ariaOwns:$r,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:Zr,ariaReadOnly:Zr,ariaRelevant:null,ariaRequired:Zr,ariaRoleDescription:$r,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:Zr,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function ci(e,t){return t in e?e[t]:t}function li(e,t){return ci(e,t.toLowerCase())}var ui=oi({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:ei,acceptCharset:$r,accessKey:$r,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:$r,autoFocus:q,autoPlay:q,blocking:$r,capture:null,charSet:null,checked:q,cite:null,className:$r,cols:J,colSpan:null,content:null,contentEditable:Zr,controls:q,controlsList:$r,coords:J|ei,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:Qr,draggable:Zr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:$r,height:J,hidden:Qr,high:J,href:null,hrefLang:null,htmlFor:$r,httpEquiv:$r,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:$r,itemRef:$r,itemScope:q,itemType:$r,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:q,muted:q,name:null,nonce:null,noModule:q,noValidate:q,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:q,optimum:J,pattern:null,ping:$r,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:$r,required:q,reversed:q,rows:J,rowSpan:J,sandbox:$r,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:Zr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:Zr,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$r,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:q,declare:q,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:Zr,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:q,disableRemotePlayback:q,prefix:null,property:null,results:J,security:null,unselectable:null},space:`html`,transform:li}),di=oi({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:ti,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:$r,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:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ei,g2:ei,glyphName:ei,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:ti,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,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:J,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:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:$r,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ti,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ti,rev:ti,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ti,requiredFeatures:ti,requiredFonts:ti,requiredFormats:ti,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:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:ti,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ti,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ti,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:ci}),fi=oi({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()}}),pi=oi({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:li}),mi=oi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),hi={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`},gi=/[A-Z]/g,_i=/-[a-z]/g,vi=/^data[-\w.:]+$/i;function yi(e,t){let n=qr(t),r=t,i=Jr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&vi.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(_i,xi);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!_i.test(e)){let n=e.replace(gi,bi);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ii}return new i(r,t)}function bi(e){return`-`+e.toLowerCase()}function xi(e){return e.charAt(1).toUpperCase()}var Si=Kr([si,ui,fi,pi,mi],`html`),Ci=Kr([si,di,fi,pi,mi],`svg`);function wi(e){return e.join(` `).trim()}var Ti=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
11
|
+
`);a=d.pop()||``;for(let e of d)if(e.startsWith(`data: `)){let r=e.slice(6).trim();if(!r)continue;try{let e=JSON.parse(r);e.type===`chunk`?(s++,c+=(e.content||``).length,(s<=3||s%50==0)&&U.stream.debug(`Chunk #${s} (+${(e.content||``).length} chars)`),t.onChunk(e)):e.type===`answer`?t.onChunk(e):e.type===`done`?(o=!0,U.stream.timed(`Stream complete: ${s} chunks, ${c} chars, ${l} agent events`,n),t.onDone(e)):e.type===`error`?(U.stream.error(`Stream error event:`,e.content),t.onError(Error(e.content||`Unknown error`))):e.type===`agent_created`?(U.stream.info(`Agent created: ${e.agent_id}`),t.onAgentCreated?.(e)):Vn.has(e.type)?(l++,U.stream.debug(`Agent event: ${e.type}`,e),t.onAgentEvent(e)):U.stream.warn(`Unknown SSE event type: ${e.type}`,e)}catch{U.stream.warn(`Malformed SSE data, skipping`,{raw:r.slice(0,100)})}}}}finally{r.releaseLock()}o||(U.stream.timed(`SSE connection closed without done event: ${s} chunks, ${l} agent events`,n),t.onDone({type:`done`}))}function Wn(e,t){let n=new AbortController,r=U.stream.time();return U.stream.info(`Attaching to background run for session=${e}`),fetch(`${$t}/chat/attach?session_id=${encodeURIComponent(e)}`,{method:`GET`,signal:n.signal}).then(e=>Un(e,t,r)).catch(e=>{e.name===`AbortError`?U.stream.warn(`Run attach detached by client`):(U.stream.error(`Run attach fetch error`,e),t.onError(e))}),n}async function Gn(){return W(`GET`,`/chat/active`)}async function Kn(e,t,n,r){return W(`POST`,`/chat/confirm`,{session_id:e,confirm_id:t,action:n,remember:r})}async function qn(e,t){return W(`POST`,`/chat/confirm-tool`,{session_id:e,approved:t})}async function Jn(e,t,n){return W(`POST`,`/chat/user-input`,{session_id:e,request_id:t,value:n})}async function Yn(e){return W(`POST`,`/chat/cancel`,{session_id:e})}async function Xn(){return W(`GET`,`/documents`)}async function Zn(e){return W(`POST`,`/documents/upload-path`,{filepath:e})}async function Qn(e){let t=`${$t}/documents/upload`,n=U.api.time();U.api.info(`POST ${t}`,{fileName:e.name,size:e.size});let r=new FormData;r.append(`file`,e);let i;try{i=await fetch(t,{method:`POST`,headers:tn,body:r})}catch(e){throw U.api.error(`POST ${t} - network error`,e),e}if(!i.ok){let e=await i.text().catch(()=>``);U.api.error(`POST ${t} - HTTP ${i.status}`,{errorText:e});let n=e;try{n=JSON.parse(e).detail||e}catch{}throw Error(en(i.status,n))}let a=await i.json();return U.api.timed(`POST ${t} -> ${i.status}`,n,a),a}async function $n(e){return W(`DELETE`,`/documents/${e}`)}async function er(e){return W(`GET`,`/documents/${e}/status`)}async function tr(e){return W(`POST`,`/documents/${e}/cancel`)}async function nr(e){return W(`POST`,`/documents/${e}/reindex`)}async function rr(e,t){return W(`POST`,`/sessions/${e}/documents`,{document_id:t})}async function ir(e,t){return W(`DELETE`,`/sessions/${e}/documents/${t}`)}async function ar(e){return W(`GET`,`/files/browse${e?`?path=${encodeURIComponent(e)}`:``}`)}async function or(e,t=!0){return W(`POST`,`/documents/index-folder`,{folder_path:e,recursive:t})}async function sr(e,t=!0){return W(`POST`,`/files/open`,{path:e,reveal:t})}async function cr(e){let t=`${$t}/files/upload`,n=U.api.time();U.api.info(`POST ${t}`,{fileName:e.name,size:e.size});let r=new FormData;r.append(`file`,e);let i=await fetch(t,{method:`POST`,headers:tn,body:r});if(!i.ok){let e=await i.text().catch(()=>`Upload failed`);throw U.api.error(`POST ${t} - HTTP ${i.status}`,{errorText:e}),Error(`Upload failed: ${e}`)}let a=await i.json();return U.api.timed(`POST ${t} -> ${i.status}`,n,a),a}async function lr(e,t,n){let r=new URLSearchParams({query:e});return t&&r.set(`file_types`,t),n&&r.set(`max_results`,String(n)),W(`GET`,`/files/search?${r}`)}async function ur(e,t){let n=new URLSearchParams({path:e});return t&&n.set(`lines`,String(t)),W(`GET`,`/files/preview?${n}`)}async function dr(){return W(`POST`,`/tunnel/start`)}async function fr(){return W(`POST`,`/tunnel/stop`)}async function pr(){return W(`GET`,`/tunnel/status`)}async function mr(){return W(`GET`,`/mcp/status`)}async function hr(){return W(`GET`,`/schedules`)}async function gr(e,t,n){return W(`POST`,`/schedules`,{name:e,interval:t,prompt:n})}async function _r(e,t){return W(`PUT`,`/schedules/${encodeURIComponent(e)}`,{status:t})}async function vr(e){return W(`DELETE`,`/schedules/${encodeURIComponent(e)}`)}async function yr(e,t=20){return W(`GET`,`/schedules/${encodeURIComponent(e)}/results?limit=${t}`)}async function br(e){return W(`POST`,`/schedules/parse`,{input:e})}function xr(e){return e.replace(/-/g,``).slice(0,7)}function Sr(e,t){let n=t.replace(/^#/,``).toLowerCase();if(!n||n.length<4)return null;let r=e.find(e=>e.id.replace(/-/g,``).toLowerCase().startsWith(n));return r?r.id:null}function Cr(e){let t=new Date(e.updated_at).getTime();return Number.isNaN(t)?0:t}function wr(e,t){let n=new Map;for(let e of t)n.set(e.id,e);let r=new Map;for(let t of e){let e=t.agent_type||`chat`,n=r.get(e);n?n.push(t):r.set(e,[t])}let i=[];for(let[e,t]of r){let r=n.get(e);t.sort((e,t)=>Cr(t)-Cr(e)),i.push({agentId:e,name:r?.name||e,icon:r?.icon,unknown:r===void 0,sessions:t})}return i.sort((e,t)=>Cr(t.sessions[0])-Cr(e.sessions[0])),i}function Tr(e,t){let n=e.agent_type||`chat`;return t.find(e=>e.id===n)?.name||n}function Er(e,t){let n=e.agent_type||`chat`;return t.find(e=>e.id===n)?.icon}var Dr=`New Task`;function Or(e,t){let n=t.sessions.find(t=>t.id===e);return!(!n||n.title!==Dr||(n.message_count??0)!==0||t.runningSessionIds.includes(e)||t.currentSessionId===e&&(t.messages.length!==0||t.isStreaming))}async function kr(e){if(!e)return!1;let t=H.getState();if(!Or(e,{sessions:t.sessions,currentSessionId:t.currentSessionId,messages:t.messages,isStreaming:t.isStreaming,runningSessionIds:t.runningSessionIds}))return!1;U.chat.info(`Removing abandoned draft session ${e}`),t.addPendingDelete(e),t.removeSession(e);try{return await Pn(e),!0}catch(t){return U.chat.warn(`Failed to delete abandoned draft ${e}`,t),!1}finally{t.removePendingDelete(e)}}var Ar={"message-circle":Je,"file-text":Ee,"folder-search":Ae,table:wt,globe:Ne,mail:Ke,zap:It,plug:ct,wrench:Pt,cpu:_e,hammer:Pe,shield:vt,code:he,bot:M};function jr(e){return e&&Ar[e]||M}var Mr=``+new URL(`gaia-robot-NKaQnEIp.png`,import.meta.url).href,Nr=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),K=o(((e,t)=>{t.exports=Nr()}))();function Pr(e,t){e.stopPropagation(),e.preventDefault();let n=xr(t),r=`${window.location.origin}${window.location.pathname}#${n}`;navigator.clipboard.writeText(r).then(()=>{U.ui.info(`Copied session link: ${r}`)}).catch(()=>{U.ui.warn(`Clipboard write failed`)})}function Fr({session:e,isActive:t,isRunning:n,isPendingDelete:r,isDeleting:i,onSelect:a,onKeyDown:o,onDelete:s,formatTime:c,agentChip:l}){let[u,d]=(0,w.useState)(!1),f=(0,w.useCallback)(t=>{Pr(t,e.id),d(!0),setTimeout(()=>d(!1),1500)},[e.id]),p=l?jr(l.icon):null;return(0,K.jsxs)(`div`,{className:`session-item ${t?`active`:``} ${i?`session-deleting`:``}`,onClick:()=>a(e.id),onKeyDown:t=>o(t,e.id),role:`button`,tabIndex:0,"aria-label":`Open task: ${e.title}`,"aria-current":t?`true`:void 0,children:[(0,K.jsxs)(`span`,{className:`session-title`,children:[e.private&&(0,K.jsx)(Ce,{size:10,className:`session-private-icon`,"aria-label":`Private session`}),n&&(0,K.jsx)(B,{size:11,className:`session-running-spinner`,"aria-label":`Agent running`}),e.title]}),l&&p&&(0,K.jsxs)(`span`,{className:`session-agent-chip`,title:`Agent: ${l.name}`,children:[(0,K.jsx)(p,{size:10,className:`session-agent-chip-icon`}),(0,K.jsx)(`span`,{className:`session-agent-chip-name`,children:l.name})]}),(0,K.jsxs)(`a`,{className:`session-hash ${u?`copied`:``}`,href:`#${xr(e.id)}`,onClick:f,title:u?`Copied!`:`Copy link #${xr(e.id)}`,"aria-label":`Copy link for session ${xr(e.id)}`,children:[`#`,xr(e.id)]}),(0,K.jsx)(`span`,{className:`session-time`,children:c(e.updated_at)}),r?(0,K.jsxs)(`button`,{className:`session-delete confirm`,onClick:t=>s(t,e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&s(t,e.id)},title:`Click to confirm delete`,"aria-label":`Confirm delete: ${e.title}`,children:[(0,K.jsx)(Ot,{size:12}),(0,K.jsx)(`span`,{className:`confirm-label`,children:`Delete?`})]}):(0,K.jsx)(`button`,{className:`session-delete`,onClick:t=>s(t,e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&s(t,e.id)},title:`Delete`,"aria-label":`Delete: ${e.title}`,children:(0,K.jsx)(Ot,{size:13})})]})}function Ir({onNewTask:e,onHome:t,tunnelActive:n,tunnelLoading:r,onMobileToggle:i}){let{sessions:a,currentSessionId:o,setCurrentSession:s,removeSession:c,addSession:l,setMessages:u,theme:d,toggleTheme:f,setShowSettings:p,setShowMemoryDashboard:m,setShowSchedules:h,setShowHub:g,sidebarOpen:_,setSidebarOpen:v,setLoadingMessages:y,sidebarCollapsed:b,toggleSidebarCollapsed:x,sidebarWidth:S,setSidebarWidth:C,addPendingDelete:T,removePendingDelete:E,runningSessionIds:D,agents:O}=H(),[k,ee]=(0,w.useState)(``),[te,A]=(0,w.useState)(null),[j,ne]=(0,w.useState)(null),[re,M]=(0,w.useState)(!1),[P,ie]=(0,w.useState)(null),ae=(0,w.useRef)(null),F=(0,w.useRef)(null),I=(0,w.useRef)(null);(0,w.useEffect)(()=>{let e=()=>{b?(x(),requestAnimationFrame(()=>F.current?.focus())):F.current?.focus()};return window.addEventListener(`gaia:focus-search`,e),()=>window.removeEventListener(`gaia:focus-search`,e)},[b,x]);let oe=k?a.filter(e=>e.title.toLowerCase().includes(k.toLowerCase())):a,se=(0,w.useMemo)(()=>k?null:wr(oe,O),[oe,k,O]),ce=(0,w.useCallback)(async e=>{if(e===o)return;let t=a.find(t=>t.id===e)?.title||`?`;U.nav.info(`Selecting session: "${t}" (${e})`),kr(o),s(e),u([]),y(!0),window.innerWidth<=768&&v(!1);try{let n=await Ln(e);if(H.getState().currentSessionId!==e){U.nav.debug(`Discarding stale message load for session=${e} (user switched away)`);return}u(n.messages||[]),U.nav.info(`Loaded ${(n.messages||[]).length} message(s) for "${t}"`)}catch(t){U.nav.error(`Failed to load messages for session ${e}`,t),u([])}finally{y(!1)}},[o,a,s,u,v,y]),L=(0,w.useCallback)(async(e,t)=>{e.stopPropagation(),e.preventDefault();let n=a.find(e=>e.id===t),r=n?.title||`?`;if(te===t){U.chat.info(`Deleting session: "${r}" (${t})`),A(null),ne(t),T(t),Pn(t).then(()=>{U.chat.info(`Session deleted from backend: "${r}"`),E(t)}).catch(e=>{U.chat.warn(`Backend delete failed for "${r}"`,e),E(t)}),P?.timer&&clearTimeout(P.timer);let e=setTimeout(()=>{ie(null)},5e3);n&&ie({session:n,timer:e}),setTimeout(()=>{c(t),ne(null)},250);return}U.chat.debug(`Delete pending confirmation for: "${r}" (${t})`),A(t),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>A(e=>e===t?null:e),3e3)},[te,a,c,P,T,E]),R=(0,w.useCallback)(()=>{if(!P)return;clearTimeout(P.timer);let{session:e}=P;U.chat.info(`Undo delete: re-creating "${e.title}"`),E(e.id),Mn({title:e.title}).then(e=>{l(e),U.chat.info(`Undo delete: re-created "${e.title}" (new id=${e.id})`)}).catch(t=>{U.chat.warn(`Undo delete failed for "${e.title}"`,t)}),ie(null)},[P,l,E]);(0,w.useEffect)(()=>{if(!te)return;let e=()=>A(null);return window.addEventListener(`click`,e,{once:!0}),()=>window.removeEventListener(`click`,e)},[te]);let le=(0,w.useCallback)((e,t)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ce(t))},[ce]),z=(0,w.useRef)(null),ue=(0,w.useCallback)(e=>{e.preventDefault(),M(!0),U.ui.debug(`Sidebar resize started`);let t=e.clientX,n=S,r=e=>{let r=e.clientX-t;C(n+r)},i=()=>{M(!1),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,z.current=null,U.ui.debug(`Sidebar resize ended`)};z.current=i,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[S,C]);(0,w.useEffect)(()=>()=>{z.current&&z.current(),I.current&&clearTimeout(I.current)},[]);let de=e=>{let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<7?`${a}d`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})},fe=typeof window<`u`&&window.innerWidth<=768?void 0:{width:b?56:S,minWidth:b?56:S};return(0,K.jsxs)(`aside`,{ref:ae,className:`sidebar ${_?`open`:``} ${b?`collapsed`:``} ${re?`resizing`:``}`,style:fe,role:`complementary`,"aria-label":`Task sidebar`,children:[(0,K.jsxs)(`div`,{className:`sidebar-top`,children:[(0,K.jsxs)(`button`,{className:`sidebar-brand`,onClick:t,title:`Agent Hub`,"aria-label":`Go to Agent Hub`,children:[(0,K.jsx)(`div`,{className:`brand-icon`,"aria-hidden":`true`,children:(0,K.jsx)(`img`,{src:Mr,alt:``,width:28,height:28})}),(0,K.jsxs)(`div`,{className:`brand-text`,children:[(0,K.jsx)(`span`,{className:`brand-name`,children:`GAIA`}),(0,K.jsxs)(`span`,{className:`brand-version`,children:[`v`,`0.24.1`]}),(0,K.jsx)(`span`,{className:`beta-badge`,children:`BETA`})]})]}),(0,K.jsxs)(`div`,{className:`sidebar-top-actions`,children:[(0,K.jsx)(`button`,{className:`new-task-btn`,onClick:e,title:`New Task`,"aria-label":`New Task`,children:(0,K.jsx)(lt,{size:18})}),(0,K.jsx)(`button`,{className:`collapse-btn`,onClick:x,title:b?`Expand sidebar`:`Collapse sidebar`,"aria-label":b?`Expand sidebar`:`Collapse sidebar`,children:b?(0,K.jsx)(tt,{size:18}):(0,K.jsx)(et,{size:18})})]})]}),(0,K.jsxs)(`div`,{className:`sidebar-search`,children:[(0,K.jsx)(pt,{size:14,className:`search-icon`,"aria-hidden":`true`}),(0,K.jsx)(`input`,{ref:F,type:`text`,placeholder:`Search... (Ctrl+K)`,value:k,onChange:e=>ee(e.target.value),"aria-label":`Search tasks`})]}),(0,K.jsxs)(`nav`,{className:`session-list`,"aria-label":`Task sessions`,children:[oe.length===0&&(0,K.jsx)(`div`,{className:`empty-hint`,children:k?`No results`:`No tasks yet`}),se?se.map(e=>{let t=jr(e.icon);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`session-group-label session-agent-group-label`,children:[(0,K.jsx)(t,{size:12,className:`session-agent-group-icon`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`session-agent-group-name`,children:e.name}),(0,K.jsx)(`span`,{className:`session-agent-group-count`,children:e.sessions.length})]}),e.sessions.map(e=>(0,K.jsx)(Fr,{session:e,isActive:e.id===o,isRunning:D.includes(e.id),isPendingDelete:te===e.id,isDeleting:j===e.id,onSelect:ce,onKeyDown:le,onDelete:L,formatTime:de},e.id))]},e.agentId)}):oe.map(e=>(0,K.jsx)(Fr,{session:e,isActive:e.id===o,isRunning:D.includes(e.id),isPendingDelete:te===e.id,isDeleting:j===e.id,onSelect:ce,onKeyDown:le,onDelete:L,formatTime:de,agentChip:{name:Tr(e,O),icon:Er(e,O)}},e.id))]}),(0,K.jsxs)(`div`,{className:`sidebar-bottom`,children:[(0,K.jsxs)(`div`,{className:`privacy-badge`,children:[(0,K.jsx)(`span`,{className:`privacy-dot`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:`100% Local`}),(0,K.jsxs)(`span`,{className:`version-badge`,children:[`v`,`0.24.1`]})]}),(0,K.jsxs)(`div`,{className:`sidebar-actions`,children:[i&&(0,K.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:(0,K.jsx)(yt,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>g(!0),title:`Agent Hub`,"aria-label":`Open Agent Hub`,children:(0,K.jsx)(Ve,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>m(!0),title:`Memory Dashboard`,"aria-label":`Memory Dashboard`,children:(0,K.jsx)(N,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>h(!0),title:`Scheduled Tasks`,"aria-label":`Scheduled Tasks`,children:(0,K.jsx)(pe,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>p(!0),title:`Settings`,"aria-label":`Settings`,children:(0,K.jsx)(ht,{size:17})}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:f,title:`Toggle theme`,"aria-label":`Switch to ${d===`dark`?`light`:`dark`} theme`,children:d===`dark`?(0,K.jsx)(Ct,{size:17}):(0,K.jsx)(Qe,{size:17})})]})]}),!b&&(0,K.jsx)(`div`,{className:`sidebar-resize-handle`,onMouseDown:ue,title:`Drag to resize sidebar`,"aria-hidden":`true`}),P&&(0,K.jsxs)(`div`,{className:`toast toast-undo`,role:`status`,children:[`Deleted “`,P.session.title,`”`,(0,K.jsx)(`span`,{className:`toast-action`,onClick:R,children:`Undo`})]})]})}function Lr(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Rr=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zr=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Br={};function Vr(e,t){return((t||Br).jsx?zr:Rr).test(e)}var Hr=/[ \t\n\f\r]/g;function Ur(e){return typeof e==`object`?e.type===`text`&&Wr(e.value):Wr(e)}function Wr(e){return e.replace(Hr,``)===``}var Gr=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Gr.prototype.normal={},Gr.prototype.property={},Gr.prototype.space=void 0;function Kr(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Gr(n,r,t)}function qr(e){return e.toLowerCase()}var Jr=class{constructor(e,t){this.attribute=t,this.property=e}};Jr.prototype.attribute=``,Jr.prototype.booleanish=!1,Jr.prototype.boolean=!1,Jr.prototype.commaOrSpaceSeparated=!1,Jr.prototype.commaSeparated=!1,Jr.prototype.defined=!1,Jr.prototype.mustUseProperty=!1,Jr.prototype.number=!1,Jr.prototype.overloadedBoolean=!1,Jr.prototype.property=``,Jr.prototype.spaceSeparated=!1,Jr.prototype.space=void 0;var Yr=s({boolean:()=>q,booleanish:()=>Zr,commaOrSpaceSeparated:()=>ti,commaSeparated:()=>ei,number:()=>J,overloadedBoolean:()=>Qr,spaceSeparated:()=>$r}),Xr=0,q=ni(),Zr=ni(),Qr=ni(),J=ni(),$r=ni(),ei=ni(),ti=ni();function ni(){return 2**++Xr}var ri=Object.keys(Yr),ii=class extends Jr{constructor(e,t,n,r){let i=-1;if(super(e,t),ai(this,`space`,r),typeof n==`number`)for(;++i<ri.length;){let e=ri[i];ai(this,ri[i],(n&Yr[e])===Yr[e])}}};ii.prototype.defined=!0;function ai(e,t,n){n&&(e[t]=n)}function oi(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ii(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[qr(r)]=r,n[qr(a.attribute)]=r}return new Gr(t,n,e.space)}var si=oi({properties:{ariaActiveDescendant:null,ariaAtomic:Zr,ariaAutoComplete:null,ariaBusy:Zr,ariaChecked:Zr,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:$r,ariaCurrent:null,ariaDescribedBy:$r,ariaDetails:null,ariaDisabled:Zr,ariaDropEffect:$r,ariaErrorMessage:null,ariaExpanded:Zr,ariaFlowTo:$r,ariaGrabbed:Zr,ariaHasPopup:null,ariaHidden:Zr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:$r,ariaLevel:J,ariaLive:null,ariaModal:Zr,ariaMultiLine:Zr,ariaMultiSelectable:Zr,ariaOrientation:null,ariaOwns:$r,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:Zr,ariaReadOnly:Zr,ariaRelevant:null,ariaRequired:Zr,ariaRoleDescription:$r,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:Zr,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function ci(e,t){return t in e?e[t]:t}function li(e,t){return ci(e,t.toLowerCase())}var ui=oi({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:ei,acceptCharset:$r,accessKey:$r,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:$r,autoFocus:q,autoPlay:q,blocking:$r,capture:null,charSet:null,checked:q,cite:null,className:$r,cols:J,colSpan:null,content:null,contentEditable:Zr,controls:q,controlsList:$r,coords:J|ei,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:Qr,draggable:Zr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:$r,height:J,hidden:Qr,high:J,href:null,hrefLang:null,htmlFor:$r,httpEquiv:$r,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:$r,itemRef:$r,itemScope:q,itemType:$r,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:q,muted:q,name:null,nonce:null,noModule:q,noValidate:q,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:q,optimum:J,pattern:null,ping:$r,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:$r,required:q,reversed:q,rows:J,rowSpan:J,sandbox:$r,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:Zr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:Zr,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$r,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:q,declare:q,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:Zr,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:q,disableRemotePlayback:q,prefix:null,property:null,results:J,security:null,unselectable:null},space:`html`,transform:li}),di=oi({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:ti,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:$r,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:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ei,g2:ei,glyphName:ei,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:ti,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,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:J,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:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:$r,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ti,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ti,rev:ti,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ti,requiredFeatures:ti,requiredFonts:ti,requiredFormats:ti,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:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:ti,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ti,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ti,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:ci}),fi=oi({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()}}),pi=oi({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:li}),mi=oi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),hi={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`},gi=/[A-Z]/g,_i=/-[a-z]/g,vi=/^data[-\w.:]+$/i;function yi(e,t){let n=qr(t),r=t,i=Jr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&vi.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(_i,xi);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!_i.test(e)){let n=e.replace(gi,bi);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ii}return new i(r,t)}function bi(e){return`-`+e.toLowerCase()}function xi(e){return e.charAt(1).toUpperCase()}var Si=Kr([si,ui,fi,pi,mi],`html`),Ci=Kr([si,di,fi,pi,mi],`svg`);function wi(e){return e.join(` `).trim()}var Ti=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
12
12
|
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Ei=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Ti());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Di=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Oi=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Ei()),r=Di();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),ki=ji(`end`),Ai=ji(`start`);function ji(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Mi(e){let t=Ai(e),n=ki(e);if(t&&n)return{start:t,end:n}}function Ni(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Fi(e.position):`start`in e||`end`in e?Fi(e):`line`in e||`column`in e?Pi(e):``}function Pi(e){return Ii(e&&e.line)+`:`+Ii(e&&e.column)}function Fi(e){return Pi(e&&e.start)+`-`+Pi(e&&e.end)}function Ii(e){return e&&typeof e==`number`?e:1}var Li=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ni(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Li.prototype.file=``,Li.prototype.name=``,Li.prototype.reason=``,Li.prototype.message=``,Li.prototype.stack=``,Li.prototype.column=void 0,Li.prototype.line=void 0,Li.prototype.ancestors=void 0,Li.prototype.cause=void 0,Li.prototype.fatal=void 0,Li.prototype.place=void 0,Li.prototype.ruleId=void 0,Li.prototype.source=void 0;var Ri=l(Oi(),1),zi={}.hasOwnProperty,Bi=new Map,Vi=/[A-Z]/g,Hi=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Ui=new Set([`td`,`th`]),Wi=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Gi(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=na(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=ta(n,t.jsx,t.jsxs)}let 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`?Ci:Si,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Ki(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Ki(e,t,n){if(t.type===`element`)return qi(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ji(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Xi(e,t,n);if(t.type===`mdxjsEsm`)return Yi(e,t);if(t.type===`root`)return Zi(e,t,n);if(t.type===`text`)return Qi(e,t)}function qi(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Ci,e.schema=i),e.ancestors.push(t);let a=ca(e,t.tagName,!1),o=ra(e,t),s=aa(e,t);return Hi.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Ur(e)})),$i(e,o,a,t),ea(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ji(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}la(e,t.position)}function Yi(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);la(e,t.position)}function Xi(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Ci,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:ca(e,t.name,!0),o=ia(e,t),s=aa(e,t);return $i(e,o,a,t),ea(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Zi(e,t,n){let r={};return ea(r,aa(e,t)),e.create(t,e.Fragment,r,n)}function Qi(e,t){return t.value}function $i(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ea(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ta(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function na(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ai(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function ra(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&zi.call(t.properties,i)){let a=oa(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Ui.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ia(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else la(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else la(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function aa(e,t){let n=[],r=-1,i=e.passKeys?new Map:Bi;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Ki(e,a,o);s!==void 0&&n.push(s)}return n}function oa(e,t,n){let r=yi(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Lr(n):wi(n)),r.property===`style`){let t=typeof n==`object`?n:sa(e,String(n));return e.stylePropertyNameCase===`css`&&(t=ua(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?hi[r.property]||r.property:r.attribute,n]}}function sa(e,t){try{return(0,Ri.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Li("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Wi+`#cannot-parse-style-attribute`,r}}function ca(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Vr(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Vr(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return zi.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);la(e)}function la(e,t){let n=new Li("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=Wi+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function ua(e){let t={},n;for(n in e)zi.call(e,n)&&(t[da(n)]=e[n]);return t}function da(e){let t=e.replace(Vi,fa);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function fa(e){return`-`+e.toLowerCase()}var pa={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`]},ma={};function ha(e,t){let n=t||ma;return ga(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function ga(e,t,n){if(va(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 _a(e.children,t,n)}return Array.isArray(e)?_a(e,t,n):``}function _a(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ga(e[i],t,n);return r.join(``)}function va(e){return!!(e&&typeof e==`object`)}var ya=document.createElement(`i`);function ba(e){let t=`&`+e+`;`;ya.innerHTML=t;let n=ya.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function xa(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Sa(e,t){return e.length>0?(xa(e,e.length,0,t),e):t}var Ca={}.hasOwnProperty;function wa(e){let t={},n=-1;for(;++n<e.length;)Ta(t,e[n]);return t}function Ta(e,t){let n;for(n in t){let r=(Ca.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Ca.call(r,a)||(r[a]=[]);let e=i[a];Ea(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Ea(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);xa(e,0,0,r)}function Da(e,t){let 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 Oa(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var ka=za(/[A-Za-z]/),Aa=za(/[\dA-Za-z]/),ja=za(/[#-'*+\--9=?A-Z^-~]/);function Ma(e){return e!==null&&(e<32||e===127)}var Na=za(/\d/),Pa=za(/[\dA-Fa-f]/),Fa=za(/[!-/:-@[-`{-~]/);function Y(e){return e!==null&&e<-2}function Ia(e){return e!==null&&(e<0||e===32)}function X(e){return e===-2||e===-1||e===32}var La=za(/\p{P}|\p{S}/u),Ra=za(/\s/);function za(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Ba(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Aa(e.charCodeAt(n+1))&&Aa(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Z(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return X(r)?(e.enter(n),s(r)):t(r)}function s(r){return X(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Va={tokenize:Ha};function Ha(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Z(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Y(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Ua={tokenize:Ga},Wa={tokenize:Ka};function Ga(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return xa(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Wa,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Wa,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Y(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;xa(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ka(e,t,n){return Z(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function qa(e){if(e===null||Ia(e)||Ra(e))return 1;if(La(e))return 2}function Ja(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Ya={name:`attention`,resolveAll:Xa,tokenize:Za};function Xa(e,t){let n=-1,r,i,a,o,s,c,l,u;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;let d={...e[r][1].end},f={...e[n][1].start};Qa(d,-c),Qa(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Sa(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Sa(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Sa(l,Ja(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Sa(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Sa(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,xa(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Za(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=qa(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=qa(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Qa(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var $a={name:`autolink`,tokenize:eo};function eo(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return ka(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Aa(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Aa(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Ma(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):ja(t)?(e.consume(t),l):n(t)}function u(e){return Aa(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Aa(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Q={partial:!0,tokenize:to};function to(e,t,n){return r;function r(t){return X(t)?Z(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Y(e)?t(e):n(e)}}var no={continuation:{tokenize:io},exit:ao,name:`blockQuote`,tokenize:ro};function ro(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return X(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function io(e,t,n){let r=this;return i;function i(t){return X(t)?Z(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(no,t,n)(r)}}function ao(e){e.exit(`blockQuote`)}var oo={name:`characterEscape`,tokenize:so};function so(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Fa(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var co={name:`characterReference`,tokenize:lo};function lo(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Aa,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Pa,u):(e.enter(`characterReferenceValue`),a=7,o=Na,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Aa&&!ba(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var uo={partial:!0,tokenize:mo},fo={concrete:!0,name:`codeFenced`,tokenize:po};function po(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),X(t)?Z(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Y(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(uo,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):X(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Z(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Y(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&X(t)?Z(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Y(t)?e.check(uo,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),X(t)?Z(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),X(t)?Z(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Y(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function mo(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ho={name:`codeIndented`,tokenize:_o},go={partial:!0,tokenize:vo};function _o(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Z(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Y(t)?e.attempt(go,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function vo(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Z(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Y(e)?i(e):n(e)}}var yo={name:`codeText`,previous:xo,resolve:bo,tokenize:So};function bo(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 xo(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function So(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Y(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Co=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&wo(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),wo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wo(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);wo(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);wo(this.left,t.reverse())}}}};function wo(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 To(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Co(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Eo(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return xa(e,0,1/0,u.slice(0)),!l}function Eo(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Do={resolve:ko,tokenize:Ao},Oo={partial:!0,tokenize:jo};function ko(e){return To(e),e}function Ao(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Y(t)?e.check(Oo,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function jo(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Z(e,a,`linePrefix`)}function a(i){if(i===null||Y(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Mo(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Ma(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Y(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Ia(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Ma(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function No(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Y(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Y(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!X(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Po(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Z(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Y(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Fo(e,t){let n;return r;function r(i){return Y(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):X(i)?Z(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Io={name:`definition`,tokenize:Ro},Lo={partial:!0,tokenize:zo};function Ro(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return No.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Oa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Ia(t)?Fo(e,l)(t):l(t)}function l(t){return Mo(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Lo,d,d)(t)}function d(t){return X(t)?Z(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Y(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function zo(e,t,n){return r;function r(t){return Ia(t)?Fo(e,i)(t):n(t)}function i(t){return Po(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return X(t)?Z(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Y(e)?t(e):n(e)}}var Bo={name:`hardBreakEscape`,tokenize:Vo};function Vo(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Y(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Ho={name:`headingAtx`,resolve:Uo,tokenize:Wo};function Uo(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},xa(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Wo(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Ia(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Y(n)?(e.exit(`atxHeading`),t(n)):X(n)?Z(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Ia(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Go=`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`.split(`.`),Ko=[`pre`,`script`,`style`,`textarea`],qo={concrete:!0,name:`htmlFlow`,resolveTo:Xo,tokenize:Zo},Jo={partial:!0,tokenize:$o},Yo={partial:!0,tokenize:Qo};function Xo(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 Zo(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:M):ka(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):ka(a)?(e.consume(a),i=4,r.interrupt?t:M):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:M):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return ka(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Ia(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Ko.includes(l)?(i=1,r.interrupt?t(s):O(s)):Go.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Aa(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return X(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||ka(t)?(e.consume(t),b):X(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Aa(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):X(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):X(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Y(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Ia(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||X(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Y(t)?O(t):X(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),N):t===63&&i===3?(e.consume(t),M):t===93&&i===5?(e.consume(t),re):Y(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Jo,P,k)(t)):t===null||Y(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Yo,ee,P)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||Y(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),M):O(t)}function j(t){return t===47?(e.consume(t),o=``,ne):O(t)}function ne(t){if(t===62){let n=o.toLowerCase();return Ko.includes(n)?(e.consume(t),N):O(t)}return ka(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ne):O(t)}function re(t){return t===93?(e.consume(t),M):O(t)}function M(t){return t===62?(e.consume(t),N):t===45&&i===2?(e.consume(t),M):O(t)}function N(t){return t===null||Y(t)?(e.exit(`htmlFlowData`),P(t)):(e.consume(t),N)}function P(n){return e.exit(`htmlFlow`),t(n)}}function Qo(e,t,n){let r=this;return i;function i(t){return Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function $o(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Q,t,n)}}var es={name:`htmlText`,tokenize:ts};function ts(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):ka(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):ka(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Y(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Y(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):Y(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Y(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return ka(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Aa(t)?(e.consume(t),S):C(t)}function C(t){return Y(t)?(o=C,j(t)):X(t)?(e.consume(t),C):A(t)}function w(t){return t===45||Aa(t)?(e.consume(t),w):t===47||t===62||Ia(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||ka(t)?(e.consume(t),E):Y(t)?(o=T,j(t)):X(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||Aa(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Y(t)?(o=D,j(t)):X(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Y(t)?(o=O,j(t)):X(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):Y(t)?(o=k,j(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Ia(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||Ia(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return X(t)?Z(e,re,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):re(t)}function re(t){return e.enter(`htmlTextData`),o(t)}}var ns={name:`labelEnd`,resolveAll:os,resolveTo:ss,tokenize:cs},rs={tokenize:ls},is={tokenize:us},as={tokenize:ds};function os(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&xa(e,0,e.length,n),e}function ss(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Sa(s,e.slice(a+1,a+r+3)),s=Sa(s,[[`enter`,u,t]]),s=Sa(s,Ja(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Sa(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Sa(s,e.slice(o+1)),s=Sa(s,[[`exit`,c,t]]),xa(e,a,e.length,s),e}function cs(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Oa(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(rs,u,o?u:d)(t):t===91?e.attempt(is,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(as,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function ls(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Ia(t)?Fo(e,a)(t):a(t)}function a(t){return t===41?u(t):Mo(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Ia(t)?Fo(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Po(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Ia(t)?Fo(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function us(e,t,n){let r=this;return i;function i(t){return No.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Oa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function ds(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var fs={name:`labelStartImage`,resolveAll:ns.resolveAll,tokenize:ps};function ps(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var ms={name:`labelStartLink`,resolveAll:ns.resolveAll,tokenize:hs};function hs(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var gs={name:`lineEnding`,tokenize:_s};function _s(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Z(e,t,`linePrefix`)}}var vs={name:`thematicBreak`,tokenize:ys};function ys(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Y(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),X(t)?Z(e,s,`whitespace`)(t):s(t))}}var bs={continuation:{tokenize:ws},exit:Es,name:`list`,tokenize:Cs},xs={partial:!0,tokenize:Ds},Ss={partial:!0,tokenize:Ts};function Cs(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Na(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(vs,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Na(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Q,r.interrupt?n:u,e.attempt(xs,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return X(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function ws(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Q,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Z(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!X(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ss,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Z(e,e.attempt(bs,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ts(e,t,n){let r=this;return Z(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Es(e){e.exit(this.containerState.type)}function Ds(e,t,n){let r=this;return Z(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!X(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Os={name:`setextUnderline`,resolveTo:ks,tokenize:As};function ks(e,t){let n=e.length,r,i,a;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),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function As(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),X(t)?Z(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Y(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var js={tokenize:Ms};function Ms(e){let t=this,n=e.attempt(Q,r,e.attempt(this.parser.constructs.flowInitial,i,Z(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Do,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Ns={resolveAll:Ls()},Ps=Is(`string`),Fs=Is(`text`);function Is(e){return{resolveAll:Ls(e===`text`?Rs:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Ls(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Rs(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var zs=s({attentionMarkers:()=>qs,contentInitial:()=>Vs,disable:()=>Js,document:()=>Bs,flow:()=>Us,flowInitial:()=>Hs,insideSpan:()=>Ks,string:()=>Ws,text:()=>Gs}),Bs={42:bs,43:bs,45:bs,48:bs,49:bs,50:bs,51:bs,52:bs,53:bs,54:bs,55:bs,56:bs,57:bs,62:no},Vs={91:Io},Hs={[-2]:ho,[-1]:ho,32:ho},Us={35:Ho,42:vs,45:[Os,vs],60:qo,61:Os,95:vs,96:fo,126:fo},Ws={38:co,92:oo},Gs={[-5]:gs,[-4]:gs,[-3]:gs,33:fs,38:co,42:Ya,60:[$a,es],91:ms,92:[Bo,oo],93:ns,95:Ya,96:yo},Ks={null:[Ya,Ns]},qs={null:[42,95]},Js={null:[]};function Ys(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Sa(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Ja(a,l.events,l),l.events):[]}function f(e,t){return Zs(p(e),t)}function p(e){return Xs(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Y(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&xa(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Xs(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Zs(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
13
13
|
`;break;case-3:o=`\r
|
|
14
14
|
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Qs(e){let t={constructs:wa([zs,...(e||{}).extensions||[]]),content:n(Va),defined:[],document:n(Ua),flow:n(js),lazy:{},string:n(Ps),text:n(Fs)};return t;function n(e){return n;function n(n){return Ys(t,e,n)}}}function $s(e){for(;!To(e););return e}var ec=/[\0\t\n\r]/g;function tc(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(ec.lastIndex=u,c=ec.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var nc=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rc(e){return e.replace(nc,ic)}function ic(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Da(n.slice(t?2:1),t?16:10)}return ba(n)||e}var ac={}.hasOwnProperty;function oc(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),sc(n)($s(Qs(n).document().write(tc()(e,t,!0))))}function sc(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(he),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(de),blockQuote:a(L),characterEscape:T,characterReference:T,codeFenced:a(R),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(R,o),codeText:a(le,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(z),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ue),hardBreakEscape:a(fe),hardBreakTrailing:a(fe),htmlFlow:a(pe,o),htmlFlowData:T,htmlText:a(pe,o),htmlTextData:T,image:a(me),label:o,link:a(he),listItem:a(_e),listItemValue:f,listOrdered:a(ge,d),listUnordered:a(ge),paragraph:a(ve),reference:ie,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(de),strong:a(ye),thematicBreak:a(xe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ce,autolinkProtocol:se,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:F,characterReferenceMarkerNumeric:F,characterReferenceValue:I,characterReference:oe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(te),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(ee),htmlTextData:E,image:c(j),label:re,labelText:ne,lineEnding:D,link:c(A),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:M,resourceTitleString:N,resource:P,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};lc(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];ac.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||dc).call(a,void 0,e[0])}for(r.position={start:cc(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:cc(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:cc(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||dc).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Ni({start:e.start,end:e.end})+`): it’s not open`);n.position.end=cc(e.end)}function u(){return ha(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Oa(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=be(),n.position={start:cc(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=cc(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=cc(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ne(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=rc(t),n.identifier=Oa(t).toLowerCase()}function re(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function N(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function P(){this.data.inReference=void 0}function ie(){this.data.referenceType=`collapsed`}function ae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Oa(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function F(e){this.data.characterReferenceType=e.type}function I(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Da(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=ba(t);let i=this.stack[this.stack.length-1];i.value+=r}function oe(e){let t=this.stack.pop();t.position.end=cc(e.end)}function se(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function L(){return{type:`blockquote`,children:[]}}function R(){return{type:`code`,lang:null,meta:null,value:``}}function le(){return{type:`inlineCode`,value:``}}function z(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ue(){return{type:`emphasis`,children:[]}}function de(){return{type:`heading`,depth:0,children:[]}}function fe(){return{type:`break`}}function pe(){return{type:`html`,value:``}}function me(){return{type:`image`,title:null,url:``,alt:null}}function he(){return{type:`link`,title:null,url:``,children:[]}}function ge(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function _e(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function ve(){return{type:`paragraph`,children:[]}}function ye(){return{type:`strong`,children:[]}}function be(){return{type:`text`,value:``}}function xe(){return{type:`thematicBreak`}}}function cc(e){return{line:e.line,column:e.column,offset:e.offset}}function lc(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?lc(e,r):uc(e,r)}}function uc(e,t){let n;for(n in t)if(ac.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function dc(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Ni({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ni({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Ni({start:t.start,end:t.end})+`) is still open`)}function fc(e){let t=this;t.parser=n;function n(n){return oc(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function pc(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function mc(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
@@ -41,7 +41,7 @@ Error generating stack: `+e.message+`
|
|
|
41
41
|
`).filter(Boolean):e.split(`, `).filter(Boolean);return t.length<=1?(0,K.jsx)(`span`,{className:`arg-value`,children:e}):(0,K.jsx)(`div`,{className:`args-grid`,children:t.map((e,t)=>{let n=e.indexOf(`:`);if(n>0&&n<30){let r=e.slice(0,n).trim(),i=e.slice(n+1).trim();return(0,K.jsxs)(`div`,{className:`arg-row`,children:[(0,K.jsx)(`span`,{className:`arg-key`,children:r}),(0,K.jsx)(`span`,{className:`arg-value`,children:i})]},t)}return(0,K.jsx)(`div`,{className:`arg-row`,children:(0,K.jsx)(`span`,{className:`arg-value`,children:e})},t)})})}var Ip=`email`;function Lp(e,t){return e.filter(e=>e.id===Ip&&!!e.namespaced_agent_id&&(e.required_connections?.some(e=>e.connector_id===t)??!1)).map(e=>e.namespaced_agent_id)}function Rp(e){if(!e)return!1;if(e.includes(`NOT_CONNECTED:`)||e.includes(`AGENT_NOT_GRANTED:`)||e.includes(`AUTH_REQUIRED:`))return!0;let t=e.toLowerCase();return!!(t.includes(`connectors → google`)||t.includes(`connections → google`)||t.includes(`email agent needs additional google permissions`)||t.includes(`connectors → microsoft`)||t.includes(`connections → microsoft`)||t.includes(`microsoft is not currently connected`)||t.includes(`microsoft_work is not currently connected`))}function zp(e){if(!e)return`all`;let t=e.toLowerCase(),n=t.includes(`google`)||t.includes(`gmail`),r=t.includes(`microsoft_work`)||t.includes(`microsoft 365`)||t.includes(`office365`)||t.includes(`o365`);return[n,!r&&(t.includes(`microsoft`)||t.includes(`outlook`)),r].filter(Boolean).length===1?n?`google`:r?`microsoft_work`:`microsoft`:`all`}function Bp(e){let t=window;t.gaia?.openExternal?t.gaia.openExternal(e):window.open(e,`_blank`,`noopener`)}function Vp({connectorId:e,label:t,grantAgents:n,done:r,onDone:i}){let[a,o]=(0,w.useState)(!1),[s,c]=(0,w.useState)(null),l=(0,w.useCallback)(async()=>{o(!0),c(null);try{let t=await _n(e);Bp((await vn(e,t.available_scopes&&t.available_scopes.length>0?t.available_scopes:t.default_scopes,n)).authorization_url),i()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e,n,i]);return(0,K.jsxs)(`div`,{className:`email-connect-cta__provider-slot`,children:[(0,K.jsxs)(`button`,{className:`email-connect-cta__button`,onClick:()=>void l(),disabled:a,"aria-label":r?`Reopen ${t} sign-in`:`Connect ${t}`,children:[a?(0,K.jsx)(B,{size:12,className:`email-connect-cta__spinner`}):(0,K.jsx)(Se,{size:12}),(0,K.jsx)(`span`,{children:r?`Reopen ${t} sign-in`:`Connect ${t}`})]}),s&&(0,K.jsx)(`div`,{className:`email-connect-cta__error`,role:`alert`,children:s})]})}function Hp({content:e=``,connectorId:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),{agents:c}=H(),l=(0,w.useCallback)(e=>Lp(c,e),[c]),u=t===`google`||t===`microsoft`||t===`microsoft_work`?t:zp(e),d=u===`google`||u===`all`,f=u===`microsoft`||u===`all`,p=u===`microsoft_work`||u===`all`;return(0,K.jsxs)(`div`,{className:`email-connect-cta`,role:`region`,"aria-label":`Connect email account`,children:[(0,K.jsxs)(`div`,{className:`email-connect-cta__text`,children:[(0,K.jsx)(L,{size:14,className:`email-connect-cta__icon`}),(0,K.jsx)(`span`,{children:n||i||o?`A browser tab opened for sign-in. Return here when finished.`:`Connect your email account to use Email Triage.`})]}),(0,K.jsxs)(`div`,{className:`email-connect-cta__buttons`,children:[d&&(0,K.jsx)(Vp,{connectorId:`google`,label:`Google`,grantAgents:l(`google`),done:n,onDone:()=>r(!0)}),f&&(0,K.jsx)(Vp,{connectorId:`microsoft`,label:`Microsoft`,grantAgents:l(`microsoft`),done:i,onDone:()=>a(!0)}),p&&(0,K.jsx)(Vp,{connectorId:`microsoft_work`,label:`Microsoft 365`,grantAgents:l(`microsoft_work`),done:o,onDone:()=>s(!0)})]})]})}function Up(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`email_pre_scan`&&Array.isArray(t.urgent)&&Array.isArray(t.actionable)&&Array.isArray(t.suggested_archives)&&Array.isArray(t.suggested_drafts)&&typeof t.informational_count==`number`}function Wp(e){e&&window.dispatchEvent(new CustomEvent(`gaia:send-message`,{detail:{text:e}}))}function Gp(e){let t=e.thread_id||e.message_id;if(!t)return;let n=`https://mail.google.com/mail/u/0/#inbox/${encodeURIComponent(t)}`;window.open(n,`_blank`,`noopener,noreferrer`)}function Kp(e){if(!e)return`(unknown)`;let t=e.trim(),n=t.indexOf(`<`);return n>0?t.slice(0,n).trim().replace(/^"|"$/g,``):t}function qp({payload:e}){let[t,n]=(0,w.useState)(()=>new Set),r=(0,w.useCallback)(e=>{n(t=>{let n=new Set(t);return n.add(e),n})},[]),[i,a]=(0,w.useState)(null),o=(0,w.useRef)(null);(0,w.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=(0,w.useCallback)((e,t)=>{i||(a(e),o.current=setTimeout(()=>{a(t=>t===e?null:t)},5e3),Wp(t))},[i]),c=(0,w.useCallback)(e=>{s(e.message_id,`Archive message id ${e.message_id}.`)},[s]),l=(0,w.useCallback)(e=>{s(e.message_id,`Draft a reply to message id ${e.message_id}.`)},[s]),u=(0,w.useMemo)(()=>[{key:`urgent`,title:`Urgent`,icon:(0,K.jsx)(L,{size:14}),items:e.urgent.filter(e=>!t.has(e.message_id)),intent:`urgent`},{key:`actionable`,title:`Needs a response`,icon:(0,K.jsx)(Ke,{size:14}),items:e.actionable.filter(e=>!t.has(e.message_id)),intent:`actionable`},{key:`archives`,title:`Suggested archives`,icon:(0,K.jsx)(k,{size:14}),items:e.suggested_archives.filter(e=>!t.has(e.message_id)),intent:`archive`}],[e,t]),d=u.reduce((e,t)=>e+t.items.length,0),f=e.informational_count;return(0,K.jsxs)(`div`,{className:`email-pre-scan`,role:`region`,"aria-label":`Inbox pre-scan`,children:[(0,K.jsxs)(`div`,{className:`email-pre-scan__header`,children:[(0,K.jsx)(Le,{size:16,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`email-pre-scan__title`,children:`Inbox pre-scan`}),(0,K.jsxs)(`span`,{className:`email-pre-scan__totals`,children:[d,` surfaced`,f>0?` · ${f} informational`:``]})]}),u.map(e=>e.items.length>0?(0,K.jsx)(Jp,{def:e,pendingRow:i,onApproveArchive:c,onReply:l,onDismiss:r,onOpen:Gp},e.key):null),d===0&&(0,K.jsxs)(`div`,{className:`email-pre-scan__empty`,children:[(0,K.jsx)(z,{size:14}),(0,K.jsx)(`span`,{children:`Nothing to surface — your inbox looks quiet.`})]}),(0,K.jsx)(Xp,{applied:e.preferences_applied})]})}function Jp({def:e,pendingRow:t,onApproveArchive:n,onReply:r,onDismiss:i,onOpen:a}){return(0,K.jsxs)(`section`,{className:`email-pre-scan__section email-pre-scan__section--${e.intent}`,children:[(0,K.jsxs)(`header`,{className:`email-pre-scan__section-header`,children:[e.icon,(0,K.jsx)(`span`,{className:`email-pre-scan__section-title`,children:e.title}),(0,K.jsx)(`span`,{className:`email-pre-scan__section-count`,children:e.items.length})]}),(0,K.jsx)(`ul`,{className:`email-pre-scan__list`,children:e.items.map(o=>(0,K.jsx)(Yp,{item:o,intent:e.intent,isPending:t!==null,onApproveArchive:n,onReply:r,onDismiss:i,onOpen:a},o.message_id))})]})}function Yp({item:e,intent:t,isPending:n,onApproveArchive:r,onReply:i,onDismiss:a,onOpen:o}){let s=e.reason??e.why??``,c=Kp(e.sender);return(0,K.jsxs)(`li`,{className:`email-pre-scan__row`,children:[(0,K.jsxs)(`div`,{className:`email-pre-scan__row-text`,children:[(0,K.jsxs)(`div`,{className:`email-pre-scan__row-meta`,children:[(0,K.jsx)(`span`,{className:`email-pre-scan__row-sender`,title:e.sender,children:c}),(0,K.jsx)(`span`,{className:`email-pre-scan__row-subject`,title:e.subject,children:e.subject||`(no subject)`})]}),s&&(0,K.jsx)(`div`,{className:`email-pre-scan__row-reason`,title:s,children:s})]}),(0,K.jsxs)(`div`,{className:`email-pre-scan__row-actions`,role:`group`,"aria-label":`Actions for this email`,children:[t===`archive`?(0,K.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:[(0,K.jsx)(k,{size:12}),(0,K.jsx)(`span`,{children:`Archive`})]}):(0,K.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:[(0,K.jsx)(xt,{size:12}),(0,K.jsx)(`span`,{children:`Reply`})]}),(0,K.jsxs)(`button`,{className:`email-pre-scan__action`,onClick:()=>o(e),title:`Open in Gmail`,"aria-label":`Open "${e.subject}" in Gmail`,children:[(0,K.jsx)(Se,{size:12}),(0,K.jsx)(`span`,{children:`Open`})]}),(0,K.jsx)(`button`,{className:`email-pre-scan__action email-pre-scan__action--ghost`,onClick:()=>a(e.message_id),title:`Dismiss this row`,"aria-label":`Dismiss "${e.subject}"`,children:(0,K.jsx)(Ft,{size:12})})]})]})}function Xp({applied:e}){let t=e?.priority_senders??[],n=e?.low_priority_senders??[],r=e?.category_defaults??{};return t.length>0||n.length>0||Object.keys(r).length>0?(0,K.jsxs)(`div`,{className:`email-pre-scan__preferences`,"aria-label":`Active session preferences`,children:[(0,K.jsx)(`span`,{className:`email-pre-scan__preferences-label`,children:`Session preferences:`}),t.length>0&&(0,K.jsxs)(`span`,{className:`email-pre-scan__preferences-chip`,title:`Always urgent`,children:[`+ `,t.length,` priority sender`,t.length===1?``:`s`]}),n.length>0&&(0,K.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(([e,t])=>(0,K.jsxs)(`span`,{className:`email-pre-scan__preferences-chip`,title:`${e} → ${t}`,children:[e,` → `,t]},e))]}):null}var Zp=2e6;function Qp({variant:e,render:t,data:n}){let r;try{r=JSON.stringify(n)}catch{r=String(n)}let i=r.length>Zp,a=r;if(!i)try{a=JSON.stringify(n,null,2)}catch{a=r}let o=e===`unknown`?`Unsupported card type: "${t}"`:`Invalid ${t} payload`;return(0,K.jsxs)(`div`,{className:`render-unsupported`,children:[(0,K.jsx)(`p`,{className:`render-unsupported__message`,children:o}),(0,K.jsxs)(`details`,{className:`render-unsupported__details`,children:[(0,K.jsx)(`summary`,{children:`Raw payload`}),i?(0,K.jsxs)(`p`,{className:`render-unsupported__too-large`,children:[`Payload too large to display (`,r.length,` bytes)`]}):(0,K.jsx)(`pre`,{className:`render-unsupported__json`,children:a})]})]})}function $p(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function em(e){return e===null?``:String(e)}function tm(e){return e===void 0||typeof e==`string`}function nm(e){return`+${e-500} more (truncated)`}function rm(e){if(!e||typeof e!=`object`)return!1;let t=e;return tm(t.title)&&Array.isArray(t.columns)&&t.columns.every(e=>typeof e==`string`)&&Array.isArray(t.rows)&&t.rows.every(e=>Array.isArray(e)&&e.every($p))}function im({data:e}){if(!rm(e))return(0,K.jsx)(Qp,{variant:`invalid`,render:`table`,data:e});let t=e.rows.length>500,n=t?e.rows.slice(0,500):e.rows,r=e.columns.length>500,i=r?e.columns.slice(0,500):e.columns;return(0,K.jsxs)(`div`,{className:`render-table-card`,children:[e.title&&(0,K.jsx)(`div`,{className:`render-table-card__title`,children:e.title}),(0,K.jsx)(`div`,{className:`render-table`,children:(0,K.jsxs)(`table`,{children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[i.map((e,t)=>(0,K.jsx)(`th`,{children:e},t)),r&&(0,K.jsx)(`th`,{children:nm(e.columns.length)})]})}),(0,K.jsx)(`tbody`,{children:n.map((e,t)=>(0,K.jsx)(`tr`,{children:e.slice(0,i.length).map((e,t)=>(0,K.jsx)(`td`,{children:em(e)},t))},t))})]})}),t&&(0,K.jsx)(`div`,{className:`render-truncation`,children:nm(e.rows.length)})]})}function am(e){if(!e||typeof e!=`object`)return!1;let t=e;return tm(t.title)&&Array.isArray(t.items)&&t.items.every(e=>e&&typeof e==`object`&&typeof e.key==`string`&&$p(e.value))}function om({data:e}){if(!am(e))return(0,K.jsx)(Qp,{variant:`invalid`,render:`key_value`,data:e});let t=e.items.length>500,n=t?e.items.slice(0,500):e.items;return(0,K.jsxs)(`div`,{className:`render-kv`,children:[e.title&&(0,K.jsx)(`div`,{className:`render-kv__title`,children:e.title}),(0,K.jsx)(`dl`,{className:`render-kv__list`,children:n.map((e,t)=>(0,K.jsxs)(`div`,{className:`render-kv__row`,children:[(0,K.jsx)(`dt`,{className:`render-kv__key`,children:e.key}),(0,K.jsx)(`dd`,{className:`render-kv__value`,children:em(e.value)})]},t))}),t&&(0,K.jsx)(`div`,{className:`render-truncation`,children:nm(e.items.length)})]})}function sm(e){if(!e||typeof e!=`object`)return!1;let t=e;return tm(t.title)&&(t.ordered===void 0||typeof t.ordered==`boolean`)&&Array.isArray(t.items)&&t.items.every(e=>typeof e==`string`||typeof e==`number`)}function cm({data:e}){if(!sm(e))return(0,K.jsx)(Qp,{variant:`invalid`,render:`list`,data:e});let t=e.items.length>500,n=(t?e.items.slice(0,500):e.items).map((e,t)=>(0,K.jsx)(`li`,{children:String(e)},t));return(0,K.jsxs)(`div`,{className:`render-list`,children:[e.title&&(0,K.jsx)(`div`,{className:`render-list__title`,children:e.title}),e.ordered?(0,K.jsx)(`ol`,{className:`render-list__items`,children:n}):(0,K.jsx)(`ul`,{className:`render-list__items`,children:n}),t&&(0,K.jsx)(`div`,{className:`render-truncation`,children:nm(e.items.length)})]})}var lm=/^data:image\/(png|jpe?g|gif|webp);base64,/;function um(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.src==`string`&&lm.test(t.src)&&tm(t.alt)&&tm(t.caption)}function dm({data:e}){return um(e)?(0,K.jsxs)(`figure`,{className:`render-image`,children:[(0,K.jsx)(`img`,{className:`render-image__img`,src:e.src,alt:e.alt??``}),e.caption&&(0,K.jsx)(`figcaption`,{className:`render-image__caption`,children:e.caption})]}):(0,K.jsx)(Qp,{variant:`invalid`,render:`image`,data:e})}function fm(e){if(!e||typeof e!=`object`)return!1;let t=e;return tm(t.title)&&typeof t.unified==`string`}function pm(e){return e.startsWith(`@@`)?`render-diff__line render-diff__line--hunk`:e.startsWith(`+++`)||e.startsWith(`---`)||e.startsWith(`diff `)||e.startsWith(`index `)?`render-diff__line`:e.startsWith(`+`)?`render-diff__line render-diff__line--added`:e.startsWith(`-`)?`render-diff__line render-diff__line--removed`:`render-diff__line`}function mm({data:e}){return fm(e)?(0,K.jsxs)(`div`,{className:`render-diff`,children:[e.title&&(0,K.jsx)(`div`,{className:`render-diff__title`,children:e.title}),(0,K.jsx)(`pre`,{className:`render-diff__body`,children:e.unified.split(`
|
|
42
42
|
`).map((e,t)=>(0,K.jsx)(`div`,{className:pm(e),children:e},t))})]}):(0,K.jsx)(Qp,{variant:`invalid`,render:`diff`,data:e})}function hm(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.action==`string`&&typeof t.summary==`string`}function gm(e){let t=e.replace(/_/g,` `).trim();return t.length>0?t:`action`}function _m({data:e}){let[t,n]=(0,w.useState)(!1);return hm(e)?t?(0,K.jsx)(`div`,{className:`render-confirmation render-confirmation--dismissed`,children:(0,K.jsx)(`span`,{className:`render-confirmation__dismissed-note`,children:`Confirmation dismissed`})}):(0,K.jsxs)(`div`,{className:`render-confirmation`,children:[(0,K.jsxs)(`div`,{className:`render-confirmation__header`,children:[(0,K.jsx)(`span`,{className:`render-confirmation__badge`,children:`Approval needed`}),(0,K.jsx)(`span`,{className:`render-confirmation__label`,children:gm(e.action)}),(0,K.jsx)(`code`,{className:`render-confirmation__action`,children:e.action})]}),(0,K.jsx)(`pre`,{className:`render-confirmation__summary`,children:e.summary}),(0,K.jsxs)(`div`,{className:`render-confirmation__footer`,children:[(0,K.jsx)(`span`,{className:`render-confirmation__note`,children:`Nothing was executed. Follow the assistant's guidance below to approve this action.`}),(0,K.jsx)(`button`,{type:`button`,className:`render-confirmation__dismiss`,onClick:()=>n(!0),children:`Dismiss`})]})]}):(0,K.jsx)(Qp,{variant:`invalid`,render:`needs_confirmation`,data:e})}function vm(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.session_id==`string`&&typeof t.request_id==`string`&&typeof t.question==`string`&&Array.isArray(t.options)&&typeof t.allow_free_text==`boolean`&&typeof t.sensitive==`boolean`}var ym=`••••••`;function bm({data:e}){let[t,n]=(0,w.useState)({status:`pending`}),[r,i]=(0,w.useState)(``);if(!vm(e))return(0,K.jsx)(Qp,{variant:`invalid`,render:`needs_input`,data:e});let a=t.status===`submitting`,o=async t=>{if(!(!t.trim()||a)){n({status:`submitting`});try{await Jn(e.session_id,e.request_id,t),n({status:`answered`})}catch(e){n({status:`error`,message:e instanceof Error?e.message:`Failed to send the answer.`})}}};return t.status===`answered`?(0,K.jsx)(`div`,{className:`render-needs-input render-needs-input--answered`,children:(0,K.jsx)(`span`,{className:`render-needs-input__answered-note`,children:`Answered`})}):(0,K.jsxs)(`div`,{className:`render-needs-input`,children:[(0,K.jsxs)(`div`,{className:`render-needs-input__header`,children:[(0,K.jsx)(`span`,{className:`render-needs-input__badge`,children:`Question`}),e.sensitive&&(0,K.jsx)(`span`,{className:`render-needs-input__sensitive-badge`,children:`Sensitive`})]}),(0,K.jsx)(`p`,{className:`render-needs-input__question`,children:e.question}),e.options.length>0&&(0,K.jsx)(`div`,{className:`render-needs-input__options`,children:e.options.map(e=>(0,K.jsx)(`button`,{type:`button`,className:`render-needs-input__option`,disabled:a,title:e.description||void 0,onClick:()=>o(e.value),children:e.label},e.value))}),e.allow_free_text&&(0,K.jsxs)(`form`,{className:`render-needs-input__free-text`,onSubmit:e=>{e.preventDefault(),o(r)},children:[(0,K.jsx)(`input`,{type:e.sensitive?`password`:`text`,className:`render-needs-input__free-text-input`,value:r,disabled:a,placeholder:e.sensitive?`Type your answer (hidden as ${ym})`:`Type your answer…`,onChange:e=>i(e.target.value),autoComplete:`off`}),(0,K.jsx)(`button`,{type:`submit`,className:`render-needs-input__free-text-submit`,disabled:a||!r.trim(),children:`Send`})]}),t.status===`error`&&(0,K.jsx)(`p`,{className:`render-needs-input__error`,children:t.message})]})}function xm(e){if(e&&typeof e==`object`&&e.kind===`email_pre_scan`)return e;let t=e?.data;return t&&typeof t==`object`&&t.kind===`email_pre_scan`?t:e}function Sm({data:e}){let t=xm(e);return Up(t)?(0,K.jsx)(qp,{payload:t}):(0,K.jsx)(Qp,{variant:`invalid`,render:`email_pre_scan`,data:e})}var Cm={email_pre_scan:Sm,table:im,key_value:om,list:cm,image:dm,diff:mm,needs_confirmation:_m,needs_input:bm},wm=class extends w.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.error(`[CardErrorBoundary] card render failed:`,e)}render(){return this.state.hasError?(0,K.jsx)(`div`,{role:`alert`,className:`render-card-error`,children:`Card failed to render`}):this.props.children}};function Tm({render:e,data:t}){let n=Cm[e];return(0,K.jsx)(`div`,{className:`render-card`,children:n?(0,K.jsx)(wm,{children:(0,K.jsx)(n,{data:t})}):(0,K.jsx)(Qp,{variant:`unknown`,render:e,data:t})})}function Em({active:e}){let[t,n]=(0,w.useState)(0),[r,i]=(0,w.useState)(`typing`),a=(0,w.useRef)(e);return(0,w.useEffect)(()=>{if(r!==`typing`)return;if(t>=11){i(`idle`);return}let e=setTimeout(()=>n(e=>e+1),30);return()=>clearTimeout(e)},[r,t]),(0,w.useEffect)(()=>{a.current&&!e&&i(`erasing`),a.current=e},[e]),(0,w.useEffect)(()=>{if(r!==`erasing`)return;if(t<=0){i(`done`);return}let e=setTimeout(()=>n(e=>e-1),20);return()=>clearTimeout(e)},[r,t]),(0,w.useEffect)(()=>{e&&r===`done`&&(n(0),i(`typing`))},[e,r]),r===`done`?null:(0,K.jsxs)(`span`,{className:`thinking-indicator`,children:[(0,K.jsx)(`span`,{className:`thinking-indicator-text`,children:`Thinking...`.slice(0,t)}),e&&(0,K.jsx)(`span`,{className:`cursor`})]})}function Dm(e){if(!e)return!1;let 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`)}var Om=/\s*\{\s*"?tool"?\s*:\s*"[^"]+"\s*,\s*"?tool_args"?\s*:\s*\{[^}]*\}\s*\}/g,km=new Set([`thought`,`answer`,`tool`,`tool_args`,`goal`]),Am=/^\{\s*"(thought|answer|tool|tool_args|goal)"\s*:/;function jm(e,t){let n=0,r=!1,i=!1;for(let a=t;a<e.length;a++){let t=e[a];if(r){i?i=!1:t===`\\`?i=!0:t===`"`&&(r=!1);continue}if(t===`"`)r=!0;else if(t===`{`)n++;else if(t===`}`&&(n--,n===0))return a}return-1}function Mm(e){let t=e.indexOf(`"answer"`);if(t===-1)return null;let n=e.indexOf(`:`,t+8);if(n===-1)return null;let r=n+1;for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length||e[r]!==`"`)return null;let i=e.slice(r+1);return i.endsWith(`"}`)?i=i.slice(0,-2):i.endsWith(`"`)&&(i=i.slice(0,-1)),i.replace(/\\"/g,`"`).replace(/\\n/g,`
|
|
43
43
|
`).replace(/\\\\/g,`\\`)}function Nm(e){let t;try{t=JSON.parse(e)}catch{let t=Mm(e);return t===null?e.includes(`"tool_args"`)?{action:`drop`}:{action:`keep`}:{action:`answer`,text:t}}if(typeof t!=`object`||!t||Array.isArray(t))return{action:`keep`};let n=t,r=Object.keys(n),i=r.length>0&&r.every(e=>km.has(e));return typeof n.tool==`string`&&n.tool_args!==void 0?{action:`drop`}:typeof n.answer==`string`&&i?{action:`answer`,text:n.answer}:typeof n.thought==`string`&&n.answer===void 0&&i?{action:`drop`}:{action:`keep`}}function Pm(e,t){let n=``,r=0;for(;r<e.length;){let i=e.indexOf(`{`,r);if(i===-1){n+=e.slice(r);break}if(!Am.test(e.slice(i,i+40))){n+=e.slice(r,i+1),r=i+1;continue}let a=jm(e,i);if(a===-1){n+=t?e.slice(r,i):e.slice(r);break}n+=e.slice(r,i);let o=e.slice(i,a+1),s=Nm(o);s.action===`answer`?n+=s.text:s.action===`keep`&&(n+=o),r=a+1}return n}var Fm=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`.split(`.`));function Im(e){return e.replace(/```(\w*)[ \t]*\n([\s\S]*?)```/g,(e,t,n)=>{let r=t.toLowerCase();return r.length>0&&r.length<=2&&!Fm.has(r)?n.trim():e})}function Lm(e,t=!1){if(!e)return e;let n=e;n=n.replace(Om,``),n=Pm(n,t),n=n.replace(/<think>[\s\S]*?<\/think>/g,``);let r=(n.match(/\\n/g)||[]).length,i=(n.match(/\n/g)||[]).length;return r>2&&r>i*2&&(n=n.replace(/\\n/g,`
|
|
44
|
-
`),n=n.replace(/\\"/g,`"`)),n=Im(n).trim(),n}function Rm(e){if(!e)return``;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function zm(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 Bm(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Vm({message:e,isStreaming:t,showTerminalCursor:n,agentSteps:r,agentStepsActive:i,cards:a,onDelete:o,onResend:s,latencyMs:c,agentName:l}){let u=e.role===`assistant`&&Dm(e.content),d=(0,w.useMemo)(()=>e.role===`user`?e.content:Lm(e.content,!!t),[e.content,e.role,t]),[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(!1),g=(0,w.useRef)(null),_=(0,w.useRef)(null);(0,w.useEffect)(()=>()=>{g.current&&clearTimeout(g.current),_.current&&clearTimeout(_.current)},[]);let v=(0,w.useCallback)(()=>{if(navigator.clipboard?.writeText)navigator.clipboard.writeText(e.content).catch(()=>{});else{let t=document.createElement(`textarea`);t.value=e.content,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}p(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>p(!1),2e3)},[e.content]),y=(0,w.useCallback)(()=>{if(!m){h(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>h(!1),3e3);return}h(!1),_.current&&clearTimeout(_.current),o?.(e.id)},[m,e.id,o]),b=(0,w.useCallback)(()=>{s?.(e)},[e,s]),x=e.created_at?`${e.role===`user`?`Sent`:`Replied`} ${zm(e.created_at)}`:void 0;return(0,K.jsx)(`div`,{className:`msg msg-${e.role} ${u?`msg-error`:``}`,title:x,children:(0,K.jsxs)(`div`,{className:`msg-inner`,children:[(0,K.jsxs)(`div`,{className:`msg-header`,children:[(0,K.jsx)(`div`,{className:`msg-header-left`,children:e.role===`assistant`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`msg-avatar msg-avatar-assistant`,"aria-hidden":`true`,children:(0,K.jsx)(`img`,{src:``+new URL(`gaia-robot-NKaQnEIp.png`,import.meta.url).href,alt:``})}),(0,K.jsx)(`span`,{className:`msg-role-brand`,children:`GAIA`}),(()=>{let e=(l?.trim()??``).replace(/^gaia\b\s*/i,``);return e?(0,K.jsx)(`span`,{className:`msg-role-agent`,children:e}):null})(),(t||e.created_at)&&(0,K.jsx)(`span`,{className:`msg-header-sep`,children:`|`}),t&&(0,K.jsx)(Em,{active:!!i||!d}),!t&&e.created_at&&(0,K.jsx)(`span`,{className:`msg-timestamp`,children:Rm(e.created_at)})]})}),!t&&(0,K.jsxs)(`div`,{className:`msg-actions`,children:[e.role===`user`&&s&&(0,K.jsx)(`button`,{className:`msg-action-btn`,onClick:b,title:`Resend message`,"aria-label":`Resend message`,children:(0,K.jsx)(ut,{size:12})}),(0,K.jsx)(`button`,{className:`msg-copy ${f?`copied`:``}`,onClick:v,title:f?`Copied!`:`Copy message`,"aria-label":f?`Copied to clipboard`:`Copy message`,children:f?(0,K.jsx)(F,{size:12}):(0,K.jsx)(ge,{size:12})}),o&&(0,K.jsx)(`button`,{className:`msg-action-btn msg-delete ${m?`confirm`:``}`,onClick:y,title:m?`Click again to confirm`:`Delete message`,"aria-label":m?`Confirm delete message`:`Delete message`,children:(0,K.jsx)(Ot,{size:12})})]})]}),(0,K.jsxs)(`div`,{className:`msg-body`,children:[r&&r.length>0&&(0,K.jsx)(wp,{steps:r,isActive:i??!1,variant:i?`inline`:`summary`}),u&&(0,K.jsxs)(`div`,{className:`error-banner`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsx)(`span`,{children:`Something went wrong`})]}),(e.cards??a)?.map((e,t)=>(0,K.jsx)(Tm,{render:e.render,data:e.data},t)),(0,K.jsx)(Jm,{content:d,showCursor:(t||n)&&!!d&&!i}),e.role===`assistant`&&!t&&Rp(d)&&(0,K.jsx)(Hp,{content:d}),e.role===`assistant`&&!t&&(e.stats||c!=null||e.created_at)&&(0,K.jsxs)(`div`,{className:`msg-stats`,"aria-label":`Message performance stats`,children:[e.created_at&&(0,K.jsx)(`span`,{className:`msg-stats-ts`,title:`Message timestamp`,children:zm(e.created_at)}),c!=null&&c>0&&(0,K.jsx)(`span`,{title:`Total response time`,children:Bm(c)}),e.stats?.tokens_per_second!=null&&e.stats.tokens_per_second>0&&(0,K.jsxs)(`span`,{title:`Tokens per second`,children:[e.stats.tokens_per_second,` tok/s`]}),e.stats?.time_to_first_token!=null&&e.stats.time_to_first_token>0&&(0,K.jsxs)(`span`,{title:`Time to first token`,children:[(e.stats.time_to_first_token*1e3).toFixed(0),`ms TTFT`]}),e.stats?.output_tokens!=null&&e.stats.output_tokens>0&&(0,K.jsxs)(`span`,{title:`Input → output tokens`,children:[(e.stats.input_tokens??0).toLocaleString(),` → `,e.stats.output_tokens.toLocaleString(),` tokens`]})]})]})]})})}function Hm({lang:e,code:t}){let[n,r]=(0,w.useState)(!1),i=(0,w.useRef)(null);(0,w.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let a=(0,w.useCallback)(()=>{if(navigator.clipboard?.writeText)navigator.clipboard.writeText(t).catch(()=>{});else{let e=document.createElement(`textarea`);e.value=t,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}r(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>r(!1),2e3)},[t]);return(0,K.jsxs)(`div`,{className:`code-block`,children:[(0,K.jsxs)(`div`,{className:`code-header`,children:[(0,K.jsx)(`span`,{className:`code-lang`,children:e||`code`}),(0,K.jsxs)(`button`,{className:`code-copy ${n?`copied`:``}`,onClick:a,title:n?`Copied!`:`Copy`,"aria-label":n?`Copied to clipboard`:`Copy code`,children:[n?(0,K.jsx)(F,{size:13}):(0,K.jsx)(ge,{size:13}),(0,K.jsx)(`span`,{children:n?`Copied`:`Copy`})]})]}),(0,K.jsx)(`pre`,{children:(0,K.jsx)(`code`,{children:t})})]})}var Um=/[A-Z]:[\\/](?:[^\s*?"<>|,;)}\]\\/]+[\\/])*[^\s*?"<>|,;)}\]\\/]*\.\w{1,5}/gi,Wm=/[A-Z]:[\\/](?:[^\s*?"<>|,;)}\]\\/]+[\\/])+/gi;function Gm({path:e}){let t=t=>{t.preventDefault(),sr(e).catch(e=>{U.ui.error(`Failed to open path`,e)})};return(0,K.jsxs)(`span`,{className:`file-path-link`,onClick:t,title:`Open in file explorer: ${e}`,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t(e))},children:[(0,K.jsx)(ke,{size:12,className:`file-path-icon`}),e]})}function Km(e){let t=RegExp(`(${Um.source}|${Wm.source})`,`gi`),n=[],r=0,i;for(;(i=t.exec(e))!==null;)i.index>r&&n.push(e.slice(r,i.index)),n.push((0,K.jsx)(Gm,{path:i[0]},i.index)),r=t.lastIndex;return n.length===0?e:(r<e.length&&n.push(e.slice(r)),(0,K.jsx)(K.Fragment,{children:n}))}function qm(e){return w.Children.map(e,e=>typeof e==`string`?Km(e):e)}function Jm({content:e,showCursor:t}){return!e&&!t?null:!e&&t?(0,K.jsx)(`span`,{className:`cursor`}):(0,K.jsxs)(`div`,{className:`md-content`,children:[(0,K.jsx)(pu,{remarkPlugins:[bp],disallowedElements:[...vu],urlTransform:yu,components:{code({className:e,children:t,...n}){return(0,K.jsx)(`code`,{className:`inline-code`,...n,children:t})},pre({children:e}){let t=w.Children.toArray(e)[0];if(w.isValidElement(t)&&(t.type===`code`||t.props?.className!==void 0||typeof t.props?.children==`string`)){let e=t.props,n=e?.className||``,r=/language-([\w-]+)/.exec(n),i=String(e?.children||``).replace(/\n$/,``),a=r?.[1]||``;return(0,K.jsx)(Hm,{lang:a,code:i})}return(0,K.jsx)(`pre`,{children:e})},table({children:e}){return(0,K.jsx)(`div`,{className:`md-table-wrap`,children:(0,K.jsx)(`table`,{className:`md-table`,children:e})})},a({href:e,children:t}){return(0,K.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`md-link`,children:t})},p({children:e}){return(0,K.jsx)(`p`,{className:`md-p`,children:qm(e)})},h1({children:e}){return(0,K.jsx)(`h2`,{className:`md-h2`,children:qm(e)})},h2({children:e}){return(0,K.jsx)(`h3`,{className:`md-h3`,children:qm(e)})},h3({children:e}){return(0,K.jsx)(`h4`,{className:`md-h4`,children:qm(e)})},ul({children:e}){return(0,K.jsx)(`ul`,{className:`md-ul`,children:e})},ol({children:e}){return(0,K.jsx)(`ol`,{className:`md-ol`,children:e})},li({children:e}){return(0,K.jsx)(`li`,{className:`md-li`,children:qm(e)})},blockquote({children:e}){return(0,K.jsx)(`blockquote`,{className:`md-blockquote`,children:qm(e)})},hr(){return(0,K.jsx)(`hr`,{className:`md-hr`})},td({children:e}){return(0,K.jsx)(`td`,{children:qm(e)})},th({children:e}){return(0,K.jsx)(`th`,{children:qm(e)})}},children:e}),t&&(0,K.jsx)(`span`,{className:`cursor`})]})}var Ym=500,Xm=`gaia_always_allow_tools`,Zm=Ht((e,t)=>({notifications:[],showPanel:!1,typeFilter:null,addNotification:t=>e(e=>({notifications:[t,...e.notifications].slice(0,Ym)})),dismiss:t=>e(e=>({notifications:e.notifications.map(e=>e.id===t?{...e,dismissed:!0}:e)})),markRead:t=>e(e=>({notifications:e.notifications.map(e=>e.id===t?{...e,read:!0}:e)})),markAllRead:()=>e(e=>({notifications:e.notifications.map(e=>({...e,read:!0}))})),clearAll:()=>e({notifications:[]}),setShowPanel:t=>e({showPanel:t}),setTypeFilter:t=>e({typeFilter:t}),respondToPermission:async(n,r,i)=>{let a=t().notifications.find(e=>e.id===n),o=a?.agentId,s=window.gaiaAPI;if(s?.notification?.respondPermission)try{await s.notification.respondPermission(n,r,i)}catch(e){console.error(`[notificationStore] Failed to send permission response via IPC:`,e);return}else if(o)try{await qn(o,r===`allow`)}catch(e){console.error(`[notificationStore] Failed to send permission response via REST:`,e);return}if(r===`allow`&&i&&a?.tool){let e=JSON.parse(localStorage.getItem(`gaia_always_allow_tools`)||`[]`);e.includes(a.tool)||(e.push(a.tool),localStorage.setItem(Xm,JSON.stringify(e)))}e(e=>({notifications:e.notifications.map(e=>e.id===n?{...e,response:r,respondedAt:Date.now(),read:!0}:e)}))}})),Qm=e=>e.notifications.filter(e=>!e.read&&!e.dismissed).length,$m=e=>{let t=e.notifications.filter(e=>!e.dismissed);return e.typeFilter?t.filter(t=>t.type===e.typeFilter):t},eh=e=>e.notifications.find(e=>e.type===`permission_request`&&!e.response&&!e.dismissed)??null,th=`https://github.com/amd/gaia/issues/new`,nh=[{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`,`.ppt`,`.xls`]),message:`Legacy Office formats (.doc, legacy PowerPoint .ppt, legacy Excel .xls) are not supported — GAIA reads only the modern XML-based formats. Modern Word (.docx), PowerPoint (.pptx), and Excel (.xlsx) are supported.`,alternatives:[`Re-save as .docx — GAIA indexes modern Word documents directly`,`Save modern PowerPoint as .pptx — GAIA indexes .pptx directly`,`Re-save legacy .xls workbooks as .xlsx — GAIA supports modern Excel files`],featureTitle:`Support legacy Microsoft Office (doc, ppt, xls) indexing`}];function rh(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;for(let e of nh)if(e.extensions.has(t))return e;return null}var ih=new Set(`.pdf,.pptx,.docx,.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`.split(`,`));function ah(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;return ih.has(t)}function oh(){let e=navigator.userAgent;return`**Environment:**\n- GAIA Version: 0.24.0\n- Platform: ${navigator.platform||`unknown`}\n- User Agent: ${e}\n- Interface: Agent UI (Web)`}function sh(e,t){let n=[`## Feature Description`,``,t||`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?_`,``,`---`,oh(),``,`_Submitted from GAIA Agent UI_`].join(`
|
|
44
|
+
`),n=n.replace(/\\"/g,`"`)),n=Im(n).trim(),n}function Rm(e){if(!e)return``;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function zm(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 Bm(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Vm({message:e,isStreaming:t,showTerminalCursor:n,agentSteps:r,agentStepsActive:i,cards:a,onDelete:o,onResend:s,latencyMs:c,agentName:l}){let u=e.role===`assistant`&&Dm(e.content),d=(0,w.useMemo)(()=>e.role===`user`?e.content:Lm(e.content,!!t),[e.content,e.role,t]),[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(!1),g=(0,w.useRef)(null),_=(0,w.useRef)(null);(0,w.useEffect)(()=>()=>{g.current&&clearTimeout(g.current),_.current&&clearTimeout(_.current)},[]);let v=(0,w.useCallback)(()=>{if(navigator.clipboard?.writeText)navigator.clipboard.writeText(e.content).catch(()=>{});else{let t=document.createElement(`textarea`);t.value=e.content,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}p(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>p(!1),2e3)},[e.content]),y=(0,w.useCallback)(()=>{if(!m){h(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>h(!1),3e3);return}h(!1),_.current&&clearTimeout(_.current),o?.(e.id)},[m,e.id,o]),b=(0,w.useCallback)(()=>{s?.(e)},[e,s]),x=e.created_at?`${e.role===`user`?`Sent`:`Replied`} ${zm(e.created_at)}`:void 0;return(0,K.jsx)(`div`,{className:`msg msg-${e.role} ${u?`msg-error`:``}`,title:x,children:(0,K.jsxs)(`div`,{className:`msg-inner`,children:[(0,K.jsxs)(`div`,{className:`msg-header`,children:[(0,K.jsx)(`div`,{className:`msg-header-left`,children:e.role===`assistant`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`msg-avatar msg-avatar-assistant`,"aria-hidden":`true`,children:(0,K.jsx)(`img`,{src:``+new URL(`gaia-robot-NKaQnEIp.png`,import.meta.url).href,alt:``})}),(0,K.jsx)(`span`,{className:`msg-role-brand`,children:`GAIA`}),(()=>{let e=(l?.trim()??``).replace(/^gaia\b\s*/i,``);return e?(0,K.jsx)(`span`,{className:`msg-role-agent`,children:e}):null})(),(t||e.created_at)&&(0,K.jsx)(`span`,{className:`msg-header-sep`,children:`|`}),t&&(0,K.jsx)(Em,{active:!!i||!d}),!t&&e.created_at&&(0,K.jsx)(`span`,{className:`msg-timestamp`,children:Rm(e.created_at)})]})}),!t&&(0,K.jsxs)(`div`,{className:`msg-actions`,children:[e.role===`user`&&s&&(0,K.jsx)(`button`,{className:`msg-action-btn`,onClick:b,title:`Resend message`,"aria-label":`Resend message`,children:(0,K.jsx)(ut,{size:12})}),(0,K.jsx)(`button`,{className:`msg-copy ${f?`copied`:``}`,onClick:v,title:f?`Copied!`:`Copy message`,"aria-label":f?`Copied to clipboard`:`Copy message`,children:f?(0,K.jsx)(F,{size:12}):(0,K.jsx)(ge,{size:12})}),o&&(0,K.jsx)(`button`,{className:`msg-action-btn msg-delete ${m?`confirm`:``}`,onClick:y,title:m?`Click again to confirm`:`Delete message`,"aria-label":m?`Confirm delete message`:`Delete message`,children:(0,K.jsx)(Ot,{size:12})})]})]}),(0,K.jsxs)(`div`,{className:`msg-body`,children:[r&&r.length>0&&(0,K.jsx)(wp,{steps:r,isActive:i??!1,variant:i?`inline`:`summary`}),u&&(0,K.jsxs)(`div`,{className:`error-banner`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsx)(`span`,{children:`Something went wrong`})]}),(e.cards??a)?.map((e,t)=>(0,K.jsx)(Tm,{render:e.render,data:e.data},t)),(0,K.jsx)(Jm,{content:d,showCursor:(t||n)&&!!d&&!i}),e.role===`assistant`&&!t&&Rp(d)&&(0,K.jsx)(Hp,{content:d}),e.role===`assistant`&&!t&&(e.stats||c!=null||e.created_at)&&(0,K.jsxs)(`div`,{className:`msg-stats`,"aria-label":`Message performance stats`,children:[e.created_at&&(0,K.jsx)(`span`,{className:`msg-stats-ts`,title:`Message timestamp`,children:zm(e.created_at)}),c!=null&&c>0&&(0,K.jsx)(`span`,{title:`Total response time`,children:Bm(c)}),e.stats?.tokens_per_second!=null&&e.stats.tokens_per_second>0&&(0,K.jsxs)(`span`,{title:`Tokens per second`,children:[e.stats.tokens_per_second,` tok/s`]}),e.stats?.time_to_first_token!=null&&e.stats.time_to_first_token>0&&(0,K.jsxs)(`span`,{title:`Time to first token`,children:[(e.stats.time_to_first_token*1e3).toFixed(0),`ms TTFT`]}),e.stats?.output_tokens!=null&&e.stats.output_tokens>0&&(0,K.jsxs)(`span`,{title:`Input → output tokens`,children:[(e.stats.input_tokens??0).toLocaleString(),` → `,e.stats.output_tokens.toLocaleString(),` tokens`]})]})]})]})})}function Hm({lang:e,code:t}){let[n,r]=(0,w.useState)(!1),i=(0,w.useRef)(null);(0,w.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let a=(0,w.useCallback)(()=>{if(navigator.clipboard?.writeText)navigator.clipboard.writeText(t).catch(()=>{});else{let e=document.createElement(`textarea`);e.value=t,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}r(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>r(!1),2e3)},[t]);return(0,K.jsxs)(`div`,{className:`code-block`,children:[(0,K.jsxs)(`div`,{className:`code-header`,children:[(0,K.jsx)(`span`,{className:`code-lang`,children:e||`code`}),(0,K.jsxs)(`button`,{className:`code-copy ${n?`copied`:``}`,onClick:a,title:n?`Copied!`:`Copy`,"aria-label":n?`Copied to clipboard`:`Copy code`,children:[n?(0,K.jsx)(F,{size:13}):(0,K.jsx)(ge,{size:13}),(0,K.jsx)(`span`,{children:n?`Copied`:`Copy`})]})]}),(0,K.jsx)(`pre`,{children:(0,K.jsx)(`code`,{children:t})})]})}var Um=/[A-Z]:[\\/](?:[^\s*?"<>|,;)}\]\\/]+[\\/])*[^\s*?"<>|,;)}\]\\/]*\.\w{1,5}/gi,Wm=/[A-Z]:[\\/](?:[^\s*?"<>|,;)}\]\\/]+[\\/])+/gi;function Gm({path:e}){let t=t=>{t.preventDefault(),sr(e).catch(e=>{U.ui.error(`Failed to open path`,e)})};return(0,K.jsxs)(`span`,{className:`file-path-link`,onClick:t,title:`Open in file explorer: ${e}`,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t(e))},children:[(0,K.jsx)(ke,{size:12,className:`file-path-icon`}),e]})}function Km(e){let t=RegExp(`(${Um.source}|${Wm.source})`,`gi`),n=[],r=0,i;for(;(i=t.exec(e))!==null;)i.index>r&&n.push(e.slice(r,i.index)),n.push((0,K.jsx)(Gm,{path:i[0]},i.index)),r=t.lastIndex;return n.length===0?e:(r<e.length&&n.push(e.slice(r)),(0,K.jsx)(K.Fragment,{children:n}))}function qm(e){return w.Children.map(e,e=>typeof e==`string`?Km(e):e)}function Jm({content:e,showCursor:t}){return!e&&!t?null:!e&&t?(0,K.jsx)(`span`,{className:`cursor`}):(0,K.jsxs)(`div`,{className:`md-content`,children:[(0,K.jsx)(pu,{remarkPlugins:[bp],disallowedElements:[...vu],urlTransform:yu,components:{code({className:e,children:t,...n}){return(0,K.jsx)(`code`,{className:`inline-code`,...n,children:t})},pre({children:e}){let t=w.Children.toArray(e)[0];if(w.isValidElement(t)&&(t.type===`code`||t.props?.className!==void 0||typeof t.props?.children==`string`)){let e=t.props,n=e?.className||``,r=/language-([\w-]+)/.exec(n),i=String(e?.children||``).replace(/\n$/,``),a=r?.[1]||``;return(0,K.jsx)(Hm,{lang:a,code:i})}return(0,K.jsx)(`pre`,{children:e})},table({children:e}){return(0,K.jsx)(`div`,{className:`md-table-wrap`,children:(0,K.jsx)(`table`,{className:`md-table`,children:e})})},a({href:e,children:t}){return(0,K.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`md-link`,children:t})},p({children:e}){return(0,K.jsx)(`p`,{className:`md-p`,children:qm(e)})},h1({children:e}){return(0,K.jsx)(`h2`,{className:`md-h2`,children:qm(e)})},h2({children:e}){return(0,K.jsx)(`h3`,{className:`md-h3`,children:qm(e)})},h3({children:e}){return(0,K.jsx)(`h4`,{className:`md-h4`,children:qm(e)})},ul({children:e}){return(0,K.jsx)(`ul`,{className:`md-ul`,children:e})},ol({children:e}){return(0,K.jsx)(`ol`,{className:`md-ol`,children:e})},li({children:e}){return(0,K.jsx)(`li`,{className:`md-li`,children:qm(e)})},blockquote({children:e}){return(0,K.jsx)(`blockquote`,{className:`md-blockquote`,children:qm(e)})},hr(){return(0,K.jsx)(`hr`,{className:`md-hr`})},td({children:e}){return(0,K.jsx)(`td`,{children:qm(e)})},th({children:e}){return(0,K.jsx)(`th`,{children:qm(e)})}},children:e}),t&&(0,K.jsx)(`span`,{className:`cursor`})]})}var Ym=500,Xm=`gaia_always_allow_tools`,Zm=Ht((e,t)=>({notifications:[],showPanel:!1,typeFilter:null,addNotification:t=>e(e=>({notifications:[t,...e.notifications].slice(0,Ym)})),dismiss:t=>e(e=>({notifications:e.notifications.map(e=>e.id===t?{...e,dismissed:!0}:e)})),markRead:t=>e(e=>({notifications:e.notifications.map(e=>e.id===t?{...e,read:!0}:e)})),markAllRead:()=>e(e=>({notifications:e.notifications.map(e=>({...e,read:!0}))})),clearAll:()=>e({notifications:[]}),setShowPanel:t=>e({showPanel:t}),setTypeFilter:t=>e({typeFilter:t}),respondToPermission:async(n,r,i)=>{let a=t().notifications.find(e=>e.id===n),o=a?.agentId,s=window.gaiaAPI;if(s?.notification?.respondPermission)try{await s.notification.respondPermission(n,r,i)}catch(e){console.error(`[notificationStore] Failed to send permission response via IPC:`,e);return}else if(o)try{await qn(o,r===`allow`)}catch(e){console.error(`[notificationStore] Failed to send permission response via REST:`,e);return}if(r===`allow`&&i&&a?.tool){let e=JSON.parse(localStorage.getItem(`gaia_always_allow_tools`)||`[]`);e.includes(a.tool)||(e.push(a.tool),localStorage.setItem(Xm,JSON.stringify(e)))}e(e=>({notifications:e.notifications.map(e=>e.id===n?{...e,response:r,respondedAt:Date.now(),read:!0}:e)}))}})),Qm=e=>e.notifications.filter(e=>!e.read&&!e.dismissed).length,$m=e=>{let t=e.notifications.filter(e=>!e.dismissed);return e.typeFilter?t.filter(t=>t.type===e.typeFilter):t},eh=e=>e.notifications.find(e=>e.type===`permission_request`&&!e.response&&!e.dismissed)??null,th=`https://github.com/amd/gaia/issues/new`,nh=[{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`,`.ppt`,`.xls`]),message:`Legacy Office formats (.doc, legacy PowerPoint .ppt, legacy Excel .xls) are not supported — GAIA reads only the modern XML-based formats. Modern Word (.docx), PowerPoint (.pptx), and Excel (.xlsx) are supported.`,alternatives:[`Re-save as .docx — GAIA indexes modern Word documents directly`,`Save modern PowerPoint as .pptx — GAIA indexes .pptx directly`,`Re-save legacy .xls workbooks as .xlsx — GAIA supports modern Excel files`],featureTitle:`Support legacy Microsoft Office (doc, ppt, xls) indexing`}];function rh(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;for(let e of nh)if(e.extensions.has(t))return e;return null}var ih=new Set(`.pdf,.pptx,.docx,.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`.split(`,`));function ah(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;return ih.has(t)}function oh(){let e=navigator.userAgent;return`**Environment:**\n- GAIA Version: 0.24.1\n- Platform: ${navigator.platform||`unknown`}\n- User Agent: ${e}\n- Interface: Agent UI (Web)`}function sh(e,t){let n=[`## Feature Description`,``,t||`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?_`,``,`---`,oh(),``,`_Submitted from GAIA Agent UI_`].join(`
|
|
45
45
|
`);return`${th}?${new URLSearchParams({title:`[Feature] ${e}`,body:n,labels:`enhancement,agent-ui`}).toString()}`}function ch(e,t){let n=[`## Bug Description`,``,t||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?_`,``,`---`,oh(),``,`_Submitted from GAIA Agent UI_`].join(`
|
|
46
46
|
`);return`${th}?${new URLSearchParams({title:`[Bug] ${e}`,body:n,labels:`bug,agent-ui`}).toString()}`}function lh({filename:e,error:t,onDismiss:n,timeout:r=15e3}){let i=(0,w.useRef)(null);(0,w.useEffect)(()=>(r>0&&(i.current=setTimeout(n,r)),()=>{i.current&&clearTimeout(i.current)}),[n,r]);let a=e.includes(`.`)?`.`+e.split(`.`).pop()?.toLowerCase():``,o=a?rh(a):null,s=t.toLowerCase().includes(`unsupported file type`)||t.toLowerCase().includes(`not supported for indexing`)||o!==null,c=t.toLowerCase().includes(`fetch`)||t.toLowerCase().includes(`network`)||t.toLowerCase().includes(`connect`),l,u,d,f=L;return s&&o?(l=`${o.label} files not supported`,u=o.message,d=sh(o.featureTitle),f=At):s?(l=`File type not supported: ${a}`,u=`This file format cannot be indexed. Supported: PDF, PPTX, TXT, MD, CSV, JSON, XLSX, HTML, XML, YAML, and 30+ code file formats.`,d=sh(`Support ${a} file indexing`),f=At):c?(l=`Connection error`,u=`Could not reach the GAIA server. Make sure the backend is running.`,d=ch(`Upload connection error for ${e}`),f=L):(l=`Failed to index "${e}"`,u=t||`An unexpected error occurred during indexing.`,d=ch(`Indexing error: ${t.slice(0,80)}`),f=P),(0,K.jsxs)(`div`,{className:`upload-error-toast`,role:`alert`,children:[(0,K.jsx)(f,{size:16}),(0,K.jsxs)(`div`,{className:`upload-error-content`,children:[(0,K.jsx)(`div`,{className:`upload-error-title`,children:l}),(0,K.jsxs)(`div`,{className:`upload-error-detail`,children:[u,` `,s?(0,K.jsx)(`a`,{href:d,target:`_blank`,rel:`noopener noreferrer`,children:`Request this feature →`}):(0,K.jsx)(`a`,{href:d,target:`_blank`,rel:`noopener noreferrer`,children:`Report this issue →`})]})]}),(0,K.jsx)(`button`,{className:`upload-error-dismiss`,onClick:n,"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}function uh(e,t){let n=e=>t.some(t=>t.id===e&&t.configured),r=zp(e);return r===`google`?n(`google`):r===`microsoft`?n(`microsoft`):r===`microsoft_work`?n(`microsoft_work`):n(`google`)||n(`microsoft`)||n(`microsoft_work`)}function dh(e,t){let n=e=>t.some(t=>t.id===e&&t.configured),r=zp(e);return r===`google`?`Google`:r===`microsoft`?`Microsoft`:r===`microsoft_work`?`Microsoft 365`:n(`google`)?`Google`:n(`microsoft`)?`Microsoft`:n(`microsoft_work`)?`Microsoft 365`:`Google`}var fh=4e3;function ph({content:e,onRetry:t}){let[n,r]=(0,w.useState)([]),[i,a]=(0,w.useState)(!1),o=(0,w.useCallback)(()=>{gn().then(e=>r(e.connectors||[])).catch(e=>U.ui.warn(`ConnectorRetryBanner: connector fetch failed`,e))},[]),s=uh(e,n);if((0,w.useEffect)(()=>{o();let e=()=>o();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[o]),(0,w.useEffect)(()=>{if(s)return;let e=setInterval(o,fh);return()=>clearInterval(e)},[s,o]),!s||i)return null;let c=dh(e,n);return(0,K.jsxs)(`div`,{className:`connector-retry-banner`,role:`status`,children:[(0,K.jsx)(z,{size:14,className:`connector-retry-banner__icon`}),(0,K.jsxs)(`span`,{className:`connector-retry-banner__text`,children:[c,` connected since this reply — ask again to run it now.`]}),(0,K.jsxs)(`button`,{type:`button`,className:`connector-retry-banner__btn`,onClick:()=>{a(!0),t()},children:[(0,K.jsx)(ut,{size:12}),(0,K.jsx)(`span`,{children:`Ask again`})]}),(0,K.jsx)(`button`,{type:`button`,className:`connector-retry-banner__dismiss`,onClick:()=>a(!0),"aria-label":`Dismiss`,children:`×`})]})}function mh({sessionId:e,onClose:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)([]),[o,s]=(0,w.useState)([]),c=(0,w.useRef)(0),l=(0,w.useRef)(null),u=(0,w.useCallback)(e=>{a(t=>[...t,e])},[]);(0,w.useEffect)(()=>()=>{l.current&&=(l.current.abort(),null)},[]);let d=(0,w.useCallback)(()=>{if(n)return;r(!0),a([]),s([]);let t=Hn(e,`dashboard:refresh`,{onChunk:e=>{},onAgentEvent:e=>{let t=++c.current,n=Date.now();e.type===`tool_start`?u({id:t,type:`tool`,label:`Using tool`,tool:e.tool,detail:e.detail,active:!0,timestamp:n}):e.type===`thinking`?u({id:t,type:`thinking`,label:`Thinking`,detail:e.content,active:!0,timestamp:n}):e.type===`tool_result`?(u({id:t,type:`tool`,label:e.title||`Tool result`,detail:e.summary,active:!1,success:e.success,timestamp:n}),s(n=>[...n,{id:t,title:e.title,summary:e.summary}])):e.type===`status`&&u({id:t,type:`status`,label:e.message||`Working`,detail:e.message,active:e.status===`working`,timestamp:n})},onDone:e=>{U.stream.info(`Dashboard stream done`,e),r(!1)},onError:e=>{U.stream.error(`Dashboard stream error`,e),r(!1)}});l.current=t},[e,n,u]),f=(0,w.useCallback)(async()=>{try{await Yn(e),r(!1),l.current&&=(l.current.abort(),null)}catch(e){U.stream.error(`Cancel request failed`,e)}},[e]);return(0,K.jsxs)(`div`,{className:`dashboard-progress`,children:[(0,K.jsxs)(`div`,{className:`dashboard-progress-bar`,children:[(0,K.jsxs)(`div`,{className:`dashboard-progress-left`,children:[(0,K.jsx)(B,{className:`spin ${n?`visible`:`hidden`}`}),(0,K.jsx)(`strong`,{className:`dashboard-title`,children:`Refresh progress`})]}),(0,K.jsxs)(`div`,{className:`dashboard-controls`,children:[(0,K.jsx)(`button`,{className:`btn btn-plain`,onClick:()=>d(),disabled:n,title:`Start refresh`,children:`Start`}),(0,K.jsx)(`button`,{className:`btn btn-plain`,onClick:f,disabled:!n,title:`Cancel refresh`,children:`Cancel`}),(0,K.jsx)(`button`,{className:`btn btn-plain`,onClick:()=>{t&&t()},title:`Close`,children:`Close`})]})]}),(0,K.jsxs)(`div`,{className:`dashboard-body`,children:[(0,K.jsx)(`div`,{className:`dashboard-steps`,children:(0,K.jsx)(wp,{steps:i,isActive:n,variant:`inline`})}),(0,K.jsxs)(`div`,{className:`dashboard-surfaced`,children:[(0,K.jsx)(`h4`,{children:`Surfaced`}),(0,K.jsx)(`div`,{className:`surfaced-list`,children:o.map(e=>(0,K.jsx)(`div`,{className:`surfaced-card`,children:(0,K.jsxs)(`div`,{className:`surfaced-card-body`,children:[(0,K.jsx)(`div`,{className:`surfaced-card-title`,children:e.title||`Result`}),(0,K.jsx)(`div`,{className:`surfaced-card-summary`,children:e.summary})]})},e.id))})]})]})]})}var hh=[`Summarize a document`,`Find a file on my computer`,`Analyze a spreadsheet`,`Show my recent files`];function gh(e){if(!e)return``;let t=[];typeof e.tools_count==`number`&&e.tools_count>0&&t.push(`${e.tools_count} ${e.tools_count===1?`tool`:`tools`}`);let n=(e.tags??[]).filter(Boolean).slice(0,3);return n.length>0&&t.push(n.join(`, `)),t.join(` | `)}var _h=/\s*\{\s*"?(?:tool|thought|goal)"?\s*:\s*"[^"]*"[^}]*(?:"?tool_args"?\s*:\s*\{[^}]*\})?\s*\}/g;function vh(e){let t=e.trim();if(!t.startsWith(`{`)||!t.includes(`"thought"`)&&!t.includes(`"answer"`)&&!t.includes(`"goal"`))return e;try{let e=JSON.parse(t);if(e.answer!==void 0)return String(e.answer)}catch{}let n=t.indexOf(`"answer"`);if(n===-1)return``;let 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 a=t.slice(i+1);return a.endsWith(`"}`)?a=a.slice(0,-2):a.endsWith(`"`)&&(a=a.slice(0,-1)),a.replace(/\\"/g,`"`).replace(/\\n/g,`
|
|
47
47
|
`).replace(/\\\\/g,`\\`)}function yh(e,t){let 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 e.message?.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`:{let t=e.tool||`unknown tool`,i=e.reason||e.message||e.content||`Tool execution was blocked by governance policy.`;return{id:n,type:`policy_alert`,label:`Policy blocked ${t}`,detail:i,tool:t,decision:e.decision||`BLOCK`,reason:i,ruleIds:e.rule_ids??[],policyVersion:e.policy_version,receiptId:e.receipt_id,success:!1,active:!1,timestamp:r}}default:return null}}function bh(e){return`policy-receipt-${encodeURIComponent(e)}`}function xh({sessionId:e,onCreateAgent:t,onAgentChange:n}){let{sessions:r,messages:i,setMessages:a,addMessage:o,removeMessage:s,removeMessagesFrom:c,updateSessionInList:l,isStreaming:u,streamingContent:d,setStreaming:f,setStreamContent:p,clearStreamContent:m,agentSteps:h,addAgentStep:g,updateLastAgentStep:_,appendThinkingContent:v,updateLastToolStep:y,clearAgentSteps:b,cards:x,appendCard:S,clearCards:C,documents:T,setDocuments:E,setShowDocLibrary:D,setShowFileBrowser:O,setShowMemoryDashboard:k,isLoadingMessages:te,setLoadingMessages:A,systemStatus:j,agents:re,activeAgentId:P,setActiveAgentId:ie}=H(),ae=Zm(e=>e.addNotification),F=Zm(e=>e.showPanel),oe=Zm(e=>e.setShowPanel),se=Zm(e=>e.setTypeFilter),ce=Zm(Qm),L=H(e=>e.pendingPrompt),R=r.find(t=>t.id===e),le=new Set(R?.document_ids??[]),ue=T.filter(e=>le.has(e.id)),[de,fe]=(0,w.useState)(``),[pe,me]=(0,w.useState)(!1),[he,ge]=(0,w.useState)(``),[_e,ve]=(0,w.useState)(!1),[ye,xe]=(0,w.useState)(!1),[Se,we]=(0,w.useState)([]),[Te,De]=(0,w.useState)([]),[Oe,ke]=(0,w.useState)(!1),[je,Me]=(0,w.useState)(null),[Ne,Pe]=(0,w.useState)(null),[Fe,Ie]=(0,w.useState)(!1),[Le,Re]=(0,w.useState)(!1),ze=(0,w.useRef)(null),Be=R?.agent_type||P,Ve=re.find(e=>e.id===R?.agent_type)?.name,He=re.find(e=>e.id===P)?.name,Ue=(0,w.useMemo)(()=>re.find(e=>e.id===Be),[re,Be]),B=(0,w.useMemo)(()=>gh(Ue),[Ue]),We=jr(Ue?.icon);(0,w.useEffect)(()=>{if(!Le)return;let e=e=>{ze.current&&!ze.current.contains(e.target)&&Re(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[Le]);let Ke=(0,w.useCallback)(async t=>{if(Re(!1),t===Be)return;let r=Be;if(ie(t),i.length===0){l(e,{agent_type:t});try{await Nn(e,{agent_type:t})}catch{l(e,{agent_type:r}),ie(r)}}else n?.(t)},[Be,i.length,e,ie,l,n]),[qe,Je]=(0,w.useState)(!1),Xe=(0,w.useRef)(``),Ze=(0,w.useRef)([]),Qe=(0,w.useRef)([]),$e=(0,w.useRef)(!1);(0,w.useEffect)(()=>{d&&(Xe.current=d)},[d]),(0,w.useEffect)(()=>{h.length>0&&(Ze.current=h.map(e=>({...e,active:!1})))},[h]),(0,w.useEffect)(()=>{x.length>0&&(Qe.current=[...x])},[x]),(0,w.useEffect)(()=>{if(!u&&$e.current){Je(!0);let e=setTimeout(()=>{Je(!1),Xe.current=``,Ze.current=[],Qe.current=[]},350);return()=>clearTimeout(e)}$e.current=u},[u]);let et=(0,w.useRef)(null),tt=(0,w.useRef)(null),rt=(0,w.useRef)(null),it=(0,w.useRef)(null),ot=(0,w.useRef)(0),st=(0,w.useRef)(!1),ct=(0,w.useRef)(()=>{}),ut=(0,w.useRef)(``),dt=(0,w.useRef)(null),ft=(0,w.useRef)(null),pt=(0,w.useRef)(null),ht=(0,w.useRef)(0),gt=(0,w.useRef)(!0),V=(0,w.useCallback)(()=>H.getState().currentSessionId!==e,[e]),_t=(0,w.useCallback)(()=>{dt.current=null,!V()&&ut.current&&p(ut.current)},[p,V]),vt=(0,w.useRef)(null),yt=(0,w.useRef)(0);(0,w.useEffect)(()=>{U.chat.info(`ChatView mounted for session=${e}, loading messages...`);let t=U.chat.time();A(!0);let n=!1,r=!1,i=async(i=!1)=>{if(!(n||r)){r=!0;try{if(!i){if(H.getState().isStreaming)return;let t=await In(e);if(n||t===yt.current||H.getState().isStreaming)return}let r=await Ln(e);if(n)return;let o=(r.messages||[]).map(e=>({...e,agentSteps:e.agentSteps||e.agent_steps||void 0,stats:e.stats||e.inference_stats||void 0}));i?(a(o),yt.current=o.length,U.chat.timed(`Loaded ${o.length} message(s) for session=${e}`,t)):o.length!==yt.current&&!H.getState().isStreaming&&(U.chat.info(`Messages changed externally: ${yt.current} -> ${o.length}`),a(o),yt.current=o.length)}catch(t){if(n)return;i&&(U.chat.error(`Failed to load messages for session=${e}`,t),a([]))}finally{r=!1,!n&&i&&A(!1)}}};return i(!0),vt.current=setInterval(()=>i(!1),3e3),()=>{n=!0,vt.current&&clearInterval(vt.current)}},[e,a,A]),(0,w.useEffect)(()=>{Xn().then(e=>E(e.documents||[])).catch(()=>{})},[E]),(0,w.useEffect)(()=>{let e=H.getState().pendingPrompt;if(!e)return;U.chat.info(`Consuming pending prompt: "${e.slice(0,60)}"`),H.getState().setPendingPrompt(null),fe(e);let t=!1;return requestAnimationFrame(()=>{t||ct.current(e)}),()=>{t=!0}},[L]),(0,w.useEffect)(()=>{if(!gt.current)return;let e=Date.now()-ht.current,t=()=>{ht.current=Date.now(),et.current?.scrollIntoView({behavior:`smooth`})};e>=100&&t(),pt.current&&clearTimeout(pt.current),pt.current=setTimeout(t,100)},[i,d,h]),(0,w.useEffect)(()=>{rt.current?.focus()},[e]),(0,w.useEffect)(()=>()=>{it.current&&=(it.current.abort(),null),dt.current!==null&&(cancelAnimationFrame(dt.current),dt.current=null),pt.current&&=(clearTimeout(pt.current),null),ft.current&&=(clearTimeout(ft.current),null),Pe(null),ut.current=``,De(e=>(e.forEach(e=>{e.url&&URL.revokeObjectURL(e.url)}),[]))},[e]);let bt=(0,w.useCallback)(()=>{let e=tt.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;gt.current=t<=80,xe(t>200)},[]),xt=(0,w.useCallback)(()=>{gt.current=!0,et.current?.scrollIntoView({behavior:`smooth`})},[]),Ct=(0,w.useCallback)(()=>{U.stream.warn(`User stopped generation`),Yn(e).catch(()=>{}),it.current&&=(it.current.abort(),null),dt.current!==null&&(cancelAnimationFrame(dt.current),dt.current=null);let t=H.getState(),n=ut.current||t.streamingContent;if(n){U.stream.info(`Saving partial response (${n.length} chars)`);let r=t.agentSteps,i=t.cards,a={id:Date.now()+1,session_id:e,role:`assistant`,content:n,created_at:new Date().toISOString(),rag_sources:null,agentSteps:r.length>0?[...r]:void 0,cards:i.length>0?[...i]:void 0};o(a)}ut.current=``,f(!1),m(),we([]),b(),C()},[e,o,f,m,b,C]);(0,w.useEffect)(()=>{let e=e=>{e.key===`Escape`&&u&&(e.preventDefault(),Ct()),e.key===`k`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),window.dispatchEvent(new CustomEvent(`gaia:focus-search`)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u,Ct]);let wt=e=>{fe(e.target.value);let t=e.target;t.style.height=`auto`,t.style.height=Math.min(t.scrollHeight,200)+`px`},Tt=(0,w.useCallback)(async e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of Array.from(t))e.type.startsWith(`image/`)&&n.push(e);if(n.length!==0){e.preventDefault();for(let e of n){let t=e.getAsFile();if(!t)continue;let n=`attach-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,r=URL.createObjectURL(t),i={id:n,file:t,name:t.name||`screenshot-${new Date().toISOString().slice(0,19).replace(/[T:]/g,`-`)}.png`,url:r,uploading:!0,uploaded:!1,isImage:!0};De(e=>[...e,i]),U.chat.info(`Pasted image: ${i.name} (${t.size} bytes)`);try{let e=await cr(t);De(t=>t.map(t=>t.id===n?{...t,uploading:!1,uploaded:!0,serverUrl:e.url}:t)),U.chat.info(`Upload complete: ${i.name} -> ${e.url}`)}catch(e){U.chat.error(`Upload failed: ${i.name}`,e),De(e=>e.map(e=>e.id===n?{...e,uploading:!1,error:`Upload failed`}:e))}}}},[]),Et=(0,w.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),ve(!1);let t=e.dataTransfer?.files;if(!(!t||t.length===0))for(let e of Array.from(t)){let t=e.type.startsWith(`image/`),n=`attach-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,r=t?URL.createObjectURL(e):``,i={id:n,file:e,name:e.name,url:r,uploading:!0,uploaded:!1,isImage:t};De(e=>[...e,i]),U.chat.info(`Dropped file: ${e.name} (${e.size} bytes, image=${t})`);try{let t=await cr(e);De(e=>e.map(e=>e.id===n?{...e,uploading:!1,uploaded:!0,serverUrl:t.url}:e)),U.chat.info(`Upload complete: ${e.name} -> ${t.url}`)}catch(t){U.chat.error(`Upload failed: ${e.name}`,t),De(e=>e.map(e=>e.id===n?{...e,uploading:!1,error:`Upload failed`}:e))}}},[]),Dt=(0,w.useCallback)(e=>{De(t=>{let n=t.find(t=>t.id===e);return n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)})},[]),Ot=(0,w.useCallback)(async(t,n)=>{let r=n?.attach===!0,i=(t||de).trim(),s=Te.length>0&&Te.some(e=>e.uploaded);gt.current=!0;let c=j?.init_state===`initializing`;if(r){if(u)return}else if(!i&&!s||u||c){!i&&!s&&U.chat.debug(`Send blocked: empty message`),u&&U.chat.debug(`Send blocked: already streaming`),c&&U.chat.debug(`Send blocked: system initializing`);return}let d=i;if(r)U.chat.info(`Re-attaching to background run for session=${e}`);else{let t=Te.filter(e=>e.uploaded&&e.serverUrl);if(t.length>0){let e=t.map(e=>e.isImage?``:`[${e.name}](${e.serverUrl})`).join(`
|
|
@@ -55,7 +55,7 @@ Error generating stack: `+e.message+`
|
|
|
55
55
|
Start Lemonade Server — Settings shows how to start it on this machine.`+i:r.includes(`timed out`)||r.includes(`timeout`)||r.includes(`Timeout`)?`The request timed out. The query may be too complex — try breaking it into simpler questions.
|
|
56
56
|
|
|
57
57
|
If Lemonade Server is running but responses are slow, the model may need more resources.`+i:`Error: ${r}`+i;let a={id:Date.now()+2,session_id:e,role:`assistant`,content:n,created_at:new Date().toISOString(),rag_sources:null};o(a),f(!1),m(),b(),C()},onAgentCreated:()=>{un().then(e=>H.getState().setAgents(e.agents||[])).catch(()=>{})}},T=r?Wn(e,w):Hn(e,d,w,void 0,void 0,Be);it.current=T},[de,Te,u,e,R,o,a,f,_t,m,l,g,_,v,y,b,S,C,Be,ae,V]);ct.current=Ot;let kt=(0,w.useRef)(!1);(0,w.useEffect)(()=>{kt.current=!1},[e]),(0,w.useEffect)(()=>{let t=()=>{kt.current||H.getState().isStreaming||(kt.current=!0,U.chat.info(`Resuming live view of background run for session=${e}`),ct.current(void 0,{attach:!0}))};if(H.getState().runningSessionIds.includes(e)){t();return}let n=!1;return Gn().then(({session_ids:r})=>{n||r.includes(e)&&t()}).catch(()=>{}),()=>{n=!0}},[e]),(0,w.useEffect)(()=>{let e=e=>{let t=e.detail?.text;typeof t==`string`&&t.trim()&&ct.current(t)};return window.addEventListener(`gaia:send-message`,e),()=>window.removeEventListener(`gaia:send-message`,e)},[]),(0,w.useEffect)(()=>{!u&&rt.current&&rt.current.focus()},[u]);let At=(0,w.useCallback)(async t=>{u||(U.chat.info(`Deleting message ${t} from session=${e}`),Me(t),setTimeout(async()=>{s(t),Me(null);try{await zn(e,t)}catch(n){U.chat.error(`Failed to delete message ${t}`,n),Ln(e).then(e=>{V()||a(e.messages||[])}).catch(()=>{})}},250))},[e,u,s,a,V]),Mt=(0,w.useCallback)(async t=>{if(u||t.role!==`user`)return;let n=t.content;U.chat.info(`Resending message ${t.id} from session=${e}`,{preview:n.slice(0,80)}),c(t.id);try{await Bn(e,t.id)}catch(n){U.chat.error(`Failed to delete messages from ${t.id}`,n),Ln(e).then(e=>{V()||a(e.messages||[])}).catch(()=>{});return}Ot(n)},[e,u,c,a,Ot,V]),Nt=(0,w.useCallback)(()=>{for(let e=i.length-1;e>=0;e--)if(i[e].role===`user`){Mt(i[e]);return}},[i,Mt]),Pt=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Ot())},It=()=>{ge(R?.title||``),me(!0)},Lt=async()=>{he.trim()&&he!==R?.title&&(await Nn(e,{title:he.trim(),title_is_custom:!0}),l(e,{title:he.trim()})),me(!1)},Rt=(0,w.useCallback)(async()=>{if(e)try{let t=await Fn(e);l(e,{private:t.private})}catch(e){U.ui.warn(`Failed to toggle private mode`,e)}},[e,l]),zt=async()=>{try{let t=await Rn(e),n=new Blob([t.content],{type:`text/markdown`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${(R?.title||`chat`).replace(/[/\\:*?"<>|]/g,`_`).slice(0,100)}.md`,i.click(),URL.revokeObjectURL(r)}catch(e){U.chat.error(`Export failed`,e)}},Bt=(0,w.useCallback)(async(t,n)=>{t.stopPropagation();let r=T.find(e=>e.id===n);U.doc.info(`Detaching document from session: ${r?.filename||n}`);try{await ir(e,n);let t=(H.getState().sessions.find(t=>t.id===e)?.document_ids??[]).filter(e=>e!==n);l(e,{document_ids:t}),t.length<=3&&ke(!1),U.doc.info(`Detached document from session: ${r?.filename||n}`)}catch(e){U.doc.error(`Failed to detach document: ${r?.filename||n}`,e)}},[T,e,l]),Vt=(0,w.useCallback)(async t=>{if(t.preventDefault(),t.stopPropagation(),ve(!1),t.dataTransfer.files.length!==0)for(let n of Array.from(t.dataTransfer.files)){U.doc.info(`Dropped on chat view: ${n.name}`);try{let t=await Qn(n);if(e&&t?.id)try{await rr(e,t.id);let r=H.getState().sessions.find(t=>t.id===e)?.document_ids??[];r.includes(t.id)||l(e,{document_ids:[...r,t.id]}),U.doc.info(`Auto-attached "${n.name}" to session ${e}`)}catch(e){U.doc.warn(`Could not attach dropped document to session: ${e}`)}}catch(e){U.doc.error(`Upload failed: ${n.name}`,e)}}},[e,l]),Ht=e=>{e.preventDefault(),e.stopPropagation(),ve(!0)},Ut=e=>{e.preventDefault(),e.stopPropagation(),ve(!1)},Wt=e=>{fe(e),Ot(e)},Gt=!te&&i.length===0&&!u,Kt=i.length>0?i[i.length-1]:void 0,qt=!u&&!te&&Kt?.role===`assistant`&&Rp(Kt.content),Jt=Ue?.conversation_starters?.length?Ue.conversation_starters:hh,Yt=(0,w.useMemo)(()=>{let e=new Map,t;for(let n of i)if(n.role===`user`&&n.created_at)t=new Date(n.created_at).getTime();else if(n.role===`assistant`&&n.created_at&&t!==void 0){let r=new Date(n.created_at).getTime();r>t&&e.set(n.id,r-t),t=void 0}return e},[i]);return(0,K.jsxs)(`main`,{className:`task-view ${_e?`drag-active`:``}`,onDrop:Vt,onDragOver:Ht,onDragLeave:Ut,children:[Fe&&(0,K.jsx)(`div`,{className:`dashboard-overlay`,children:(0,K.jsx)(mh,{sessionId:e,onClose:()=>Ie(!1)})}),(0,K.jsxs)(`header`,{className:`task-header`,children:[(0,K.jsx)(`div`,{className:`task-header-left`,children:pe?(0,K.jsx)(`input`,{className:`title-edit`,value:he,onChange:e=>ge(e.target.value),onBlur:Lt,onKeyDown:e=>e.key===`Enter`&&Lt(),autoFocus:!0,"aria-label":`Edit task title`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h3`,{className:`task-title`,children:R?.title||`New Task`}),(0,K.jsx)(`button`,{className:`btn-icon-sm`,onClick:It,title:`Rename`,"aria-label":`Rename task`,children:(0,K.jsx)(at,{size:13})})]})}),(0,K.jsxs)(`div`,{className:`task-header-right`,children:[Ue&&(0,K.jsxs)(`div`,{className:`active-agent-indicator`,"aria-label":`Active agent`,title:B?`${Ue.name}: ${B}`:Ue.name,children:[(0,K.jsx)(We,{size:13,className:`active-agent-icon`}),(0,K.jsxs)(`span`,{className:`active-agent-copy`,children:[(0,K.jsx)(`span`,{className:`active-agent-name`,children:Ue.name}),B&&(0,K.jsx)(`span`,{className:`active-agent-capabilities`,children:B})]})]}),(0,K.jsxs)(`span`,{className:`model-badge ${j?.model_loaded?``:`no-model`}`,title:j?.model_loaded&&j?.model_context_size?`${j.model_loaded} · context window: ${j.model_context_size.toLocaleString()} tokens`:j?.model_loaded||`No model loaded`,children:[j?.model_loaded||`No model loaded`,j?.model_loaded&&j?.model_context_size!=null&&(0,K.jsxs)(`span`,{className:`model-ctx-size`,children:[` · `,j.model_context_size%1024==0?`${j.model_context_size/1024}K`:j.model_context_size.toLocaleString()]})]}),(0,K.jsx)(`button`,{className:`btn-icon-sm`,onClick:()=>D(!0),title:`Documents`,"aria-label":`Attach documents`,children:(0,K.jsx)(nt,{size:15})}),(0,K.jsx)(`button`,{className:`btn-icon-sm`,onClick:()=>O(!0),title:`Browse files`,"aria-label":`Browse files`,children:(0,K.jsx)(Ae,{size:15})}),(0,K.jsx)(`button`,{className:`btn-icon-sm${R?.private?` active`:``}`,onClick:Rt,title:R?.private?`Private mode on — click to disable`:`Enable private mode (nothing saved to memory)`,"aria-label":R?.private?`Disable private mode`:`Enable private mode`,"aria-pressed":!!R?.private,children:(0,K.jsx)(Ce,{size:15})}),(0,K.jsx)(`button`,{className:`btn-icon-sm`,onClick:()=>k(!0),title:`Memory`,"aria-label":`Open memory dashboard`,children:(0,K.jsx)(N,{size:15})}),(0,K.jsx)(`button`,{className:`btn-icon-sm`,onClick:zt,title:`Export`,"aria-label":`Export task`,children:(0,K.jsx)(be,{size:15})}),(0,K.jsx)(`button`,{className:`btn-icon-sm`,onClick:()=>Ie(e=>!e),title:`Refresh dashboard`,"aria-label":`Refresh dashboard`,children:(0,K.jsx)(ee,{size:15})}),(0,K.jsxs)(`button`,{className:`notification-center-trigger ${ce>0?`has-unread`:``}`,onClick:()=>oe(!F),"aria-label":`Open notification center`,"aria-expanded":F,title:`Notifications`,children:[(0,K.jsx)(ne,{size:15}),ce>0&&(0,K.jsx)(`span`,{className:`notification-center-trigger-badge`,children:ce>99?`99+`:ce})]})]})]}),ue.length>0&&(()=>{let e=[...ue].sort((e,t)=>{let n=e.last_accessed_at||e.indexed_at||``;return(t.last_accessed_at||t.indexed_at||``).localeCompare(n)}),t=Oe?e:e.slice(0,3),n=e.length-3;return(0,K.jsxs)(`div`,{className:`doc-context-bar${Oe?` doc-context-expanded`:``}`,"aria-label":`${ue.length} indexed document${ue.length===1?``:`s`}`,children:[(0,K.jsx)(z,{size:12,className:`doc-context-icon`}),(0,K.jsxs)(`span`,{className:`doc-context-label`,onClick:()=>D(!0),title:`Click to manage documents`,role:`button`,tabIndex:0,children:[ue.length,` indexed`]}),(0,K.jsxs)(`div`,{className:`doc-context-pills${Oe?` doc-context-pills-expanded`:``}`,children:[t.map(e=>(0,K.jsxs)(`span`,{className:`doc-pill`,title:e.filepath||e.filename,children:[(0,K.jsx)(Ee,{size:9,className:`doc-pill-icon`}),(0,K.jsx)(`span`,{className:`doc-pill-name`,children:e.filename}),(0,K.jsx)(`button`,{className:`doc-pill-remove`,onClick:t=>Bt(t,e.id),title:`Remove ${e.filename} from this session`,"aria-label":`Remove ${e.filename} from this session`,children:(0,K.jsx)(Ft,{size:10})})]},e.id)),!Oe&&n>0&&(0,K.jsxs)(`button`,{className:`doc-pill-more`,onClick:e=>{e.stopPropagation(),ke(!0)},title:`Show all indexed files`,"aria-label":`Show ${n} more files`,children:[`+`,n,` more`]}),Oe&&n>0&&(0,K.jsx)(`button`,{className:`doc-pill-collapse`,onClick:e=>{e.stopPropagation(),ke(!1)},title:`Show fewer files`,"aria-label":`Collapse file list`,children:`show less`})]})]})})(),(0,K.jsxs)(`div`,{className:`messages-scroll`,ref:tt,onScroll:bt,children:[te&&(0,K.jsx)(`div`,{className:`skeleton-messages`,"aria-label":`Loading messages`,children:[0,1,2].map(e=>(0,K.jsxs)(`div`,{className:`skeleton-msg`,children:[(0,K.jsxs)(`div`,{className:`skeleton-header`,children:[(0,K.jsx)(`div`,{className:`skeleton-avatar`}),(0,K.jsx)(`div`,{className:`skeleton-role`})]}),(0,K.jsxs)(`div`,{className:`skeleton-lines`,children:[(0,K.jsx)(`div`,{className:`skeleton-line`}),(0,K.jsx)(`div`,{className:`skeleton-line`}),e!==2&&(0,K.jsx)(`div`,{className:`skeleton-line`})]})]},e))}),Gt&&(0,K.jsxs)(`div`,{className:`empty-task`,children:[(0,K.jsx)(`div`,{className:`empty-task-icon${Ue?` agent-aware`:``}`,children:Ue?(0,K.jsx)(We,{size:36,strokeWidth:1.2}):(0,K.jsx)(Ye,{size:36,strokeWidth:1.2})}),(0,K.jsx)(`h4`,{className:`empty-task-title`,children:Ue?.name||`What can I help you with?`}),(0,K.jsx)(`p`,{className:`empty-task-desc${B?``:` empty-task-desc-spaced`}`,children:Ue?.description||(0,K.jsx)(K.Fragment,{children:`Ask about your documents, search files, or analyze data — powered by local AI.`})}),B&&(0,K.jsx)(`div`,{className:`empty-task-capabilities`,children:B}),(0,K.jsx)(`div`,{className:`empty-task-suggestions`,children:Jt.map(e=>(0,K.jsx)(`button`,{className:`empty-task-chip`,onClick:()=>Wt(e),children:e},e))})]}),i.map((e,t)=>{let n=!u&&!qe&&e.role===`assistant`&&i.slice(t+1).every(e=>e.role!==`assistant`);if(qe&&e.role===`assistant`&&t===i.length-1)return null;let r=Yt.get(e.id);return(0,K.jsx)(`div`,{className:je===e.id?`msg-deleting`:void 0,children:(0,K.jsx)(Vm,{message:e,showTerminalCursor:n,agentSteps:e.role===`assistant`?e.agentSteps:void 0,onDelete:u?void 0:At,onResend:!u&&e.role===`user`?Mt:void 0,latencyMs:r,agentName:e.role===`assistant`?Ve:void 0})},e.id)}),(u||qe)&&(0,K.jsx)(`div`,{className:`streaming-bubble ${qe?`stream-ending`:`stream-active`}`,children:(0,K.jsx)(Vm,{message:{id:-1,session_id:e,role:`assistant`,content:(u?d:Xe.current)||``,created_at:``,rag_sources:null},isStreaming:u,showTerminalCursor:qe,agentSteps:u?h:Ze.current,agentStepsActive:u&&h.some(e=>e.active),cards:u?x:Qe.current,agentName:He})}),(0,K.jsx)(`div`,{ref:et})]}),ye&&(0,K.jsx)(`button`,{className:`scroll-bottom-btn`,onClick:xt,title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:(0,K.jsx)(ee,{size:16})}),_e&&(0,K.jsxs)(`div`,{className:`drag-overlay`,children:[(0,K.jsx)(jt,{size:32,strokeWidth:1.5}),(0,K.jsx)(`span`,{children:`Drop files to index`})]}),Ne&&(0,K.jsxs)(`div`,{className:`toast policy-alert-toast`,role:`alert`,children:[(0,K.jsxs)(`span`,{children:[`Blocked: `,Ne.tool,` is restricted by policy.`]}),Ne.receiptId?(0,K.jsx)(`button`,{type:`button`,className:`policy-alert-toast-link`,onClick:()=>{let e=Ne.receiptId;e&&(se(`policy_alert`),oe(!0),window.setTimeout(()=>{document.getElementById(bh(e))?.scrollIntoView({behavior:`smooth`,block:`center`})},80))},children:`View receipt`}):(0,K.jsx)(`span`,{className:`policy-alert-toast-missing`,children:`Receipt unavailable`})]}),qt&&Kt&&(0,K.jsx)(ph,{content:Kt.content,onRetry:Nt}),(0,K.jsxs)(`div`,{className:`input-area`,children:[(0,K.jsxs)(`div`,{className:`input-box ${Te.length>0?`has-attachments`:``}`,onDrop:Et,onDragOver:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,K.jsxs)(`div`,{className:`input-content`,children:[Te.length>0&&(0,K.jsx)(`div`,{className:`attachment-strip`,children:Te.map(e=>(0,K.jsxs)(`div`,{className:`attachment-preview ${e.error?`attachment-error`:``}`,children:[e.isImage&&e.url?(0,K.jsx)(`img`,{src:e.url,alt:e.name,className:`attachment-thumb`}):(0,K.jsx)(`div`,{className:`attachment-file-icon`,children:(0,K.jsx)(Ee,{size:16})}),(0,K.jsx)(`span`,{className:`attachment-name`,title:e.name,children:e.name.length>20?e.name.slice(0,17)+`...`:e.name}),e.uploading&&(0,K.jsx)(`span`,{className:`attachment-spinner`}),e.error&&(0,K.jsx)(`span`,{className:`attachment-error-text`,children:e.error}),(0,K.jsx)(`button`,{className:`attachment-remove`,onClick:()=>Dt(e.id),title:`Remove`,"aria-label":`Remove ${e.name}`,children:(0,K.jsx)(Ft,{size:12})})]},e.id))}),(0,K.jsx)(`textarea`,{ref:rt,className:`msg-input`,value:de,onChange:wt,onKeyDown:Pt,onPaste:Tt,placeholder:`Type a message or paste an image... (Shift+Enter for new line)`,rows:1,disabled:u||j?.init_state===`initializing`,"aria-label":`Message input`})]}),(0,K.jsxs)(`div`,{className:`input-btns`,children:[(0,K.jsx)(`button`,{className:`btn-icon-sm`,onClick:()=>D(!0),title:`Upload document`,"aria-label":`Upload document`,children:(0,K.jsx)(jt,{size:15})}),(0,K.jsx)(`button`,{className:`btn-icon-sm`,onClick:()=>O(!0),title:`Browse files`,"aria-label":`Browse files`,children:(0,K.jsx)(Ae,{size:15})}),u?(0,K.jsx)(`button`,{className:`stop-btn`,onClick:Ct,title:`Stop generating`,"aria-label":`Stop generating`,children:(0,K.jsx)(St,{size:14})}):(0,K.jsx)(`button`,{className:`send-btn`,onClick:()=>Ot(),disabled:!de.trim()&&!Te.some(e=>e.uploaded),title:`Send (Enter)`,"aria-label":`Send message`,children:(0,K.jsx)(mt,{size:16})})]})]}),(0,K.jsxs)(`div`,{className:`input-footer`,children:[t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{className:`create-agent-btn`,onClick:t,title:`Build a custom agent template`,"aria-label":`Build a custom agent template`,children:(0,K.jsx)(lt,{size:10})}),re.length>1&&(0,K.jsx)(`span`,{className:`input-footer-sep`})]}),re.length>1&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`agent-picker`,ref:ze,children:[(0,K.jsxs)(`button`,{className:`agent-picker-btn`,onClick:()=>!u&&Re(e=>!e),title:`Switch agent`,"aria-label":`Switch agent`,disabled:u,children:[(0,K.jsx)(M,{size:10}),(0,K.jsx)(`span`,{children:re.find(e=>e.id===Be)?.name||`Agent`}),(0,K.jsx)(I,{size:10})]}),Le&&(0,K.jsx)(`div`,{className:`agent-picker-dropdown`,children:re.map(e=>(0,K.jsxs)(`button`,{className:`agent-picker-option${e.id===Be?` active`:``}`,onClick:()=>Ke(e.id),children:[(0,K.jsx)(M,{size:12}),(0,K.jsx)(`span`,{children:e.name})]},e.id))})]}),(0,K.jsx)(`span`,{className:`input-footer-sep`})]}),(0,K.jsxs)(`span`,{className:`input-footer-item`,children:[(0,K.jsx)(Ge,{size:10}),(0,K.jsx)(`span`,{children:`100% local & private`})]}),(0,K.jsx)(`span`,{className:`input-footer-sep`}),(0,K.jsxs)(`span`,{className:`input-footer-item`,children:[(0,K.jsx)(`kbd`,{className:`kbd-hint`,children:`Enter`}),(0,K.jsx)(`span`,{children:`send`})]}),(0,K.jsxs)(`span`,{className:`input-footer-item`,children:[(0,K.jsx)(`kbd`,{className:`kbd-hint`,children:`Shift+Enter`}),(0,K.jsx)(`span`,{children:`new line`})]}),u&&(0,K.jsxs)(`span`,{className:`input-footer-item`,children:[(0,K.jsx)(`kbd`,{className:`kbd-hint`,children:`Esc`}),(0,K.jsx)(`span`,{children:`stop`})]}),(0,K.jsx)(`span`,{className:`input-footer-sep`}),(0,K.jsxs)(`span`,{className:`input-footer-item`,children:[(0,K.jsx)(`kbd`,{className:`kbd-hint`,children:`Ctrl+K`}),(0,K.jsx)(`span`,{children:`search`})]}),(0,K.jsxs)(`span`,{className:`input-footer-item`,children:[(0,K.jsx)(`kbd`,{className:`kbd-hint`,children:`Ctrl+V`}),(0,K.jsx)(`span`,{children:`paste image`})]})]})]})]})}function Sh(e){if(e==null||!Number.isFinite(e)||e<=0)return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;let i=+(r>=2);return`${n.toFixed(i)} ${t[r]}`}function Ch(e){return e?e.state===`downloading`||e.state===`verifying`||e.state===`installing`:!1}function wh(e){return e.compatibility?.level??`compatible`}function Th(e){switch(e){case`compatible`:return`Compatible with your system`;case`warning`:return`May run with limitations`;case`incompatible`:return`Not compatible with your system`}}function Eh(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);if(!t)return e;let r=t.status===`update_available`;return{...e,version:t.installed_version??e.version,latest_version:t.latest_version,compatibility:t.compatibility??e.compatibility,security_tier:t.security_tier??e.security_tier,deprecated:t.deprecated??e.deprecated,status:r?`update_available`:`installed`}})}function Dh(e){return e===`builtin`?(0,K.jsx)(`span`,{className:`agent-badge agent-badge-builtin`,children:`Built-in`}):e===`native`?(0,K.jsx)(`span`,{className:`agent-badge agent-badge-native`,children:`Native`}):e===`installed`?(0,K.jsx)(`span`,{className:`agent-badge agent-badge-installed`,children:`Installed`}):(0,K.jsx)(`span`,{className:`agent-badge agent-badge-custom`,children:`Custom`})}var Oh={verified:{Icon:z,label:`Verified`},community:{Icon:vt,label:`Community`},experimental:{Icon:Oe,label:`Experimental`}};function kh(e){let t=e?Oh[e]:void 0;if(!t)return null;let{Icon:n,label:r}=t;return(0,K.jsxs)(`span`,{className:`agent-badge agent-badge-tier-${e}`,title:`${r} security tier`,children:[(0,K.jsx)(n,{size:10}),` `,r]})}var Ah={cpu:`CPU`,gpu:`GPU`,npu:`NPU`},jh={downloading:`Downloading…`,verifying:`Verifying…`,installing:`Installing…`,installed:`Installed`,failed:`Failed`};function Mh({agent:e,variant:t,isActive:n,isElectron:r,onSelect:i,onStartChat:a,onViewDetails:o,installStatus:s,onInstall:c,onCancelInstall:l,onUninstall:u}){let d=t===`available`,f=e.source!==`native`||r,p=e.models?.[0],m=e.tools_count??0,h=e.conversation_starters?.[0],g=e.required_connections??[],_=jr(e.icon),v=Ch(s),y=s?.state===`failed`,b=e.status===`update_available`,x=wh(e),S=x===`incompatible`,C=H(e=>e.activeDevice),w=H(e=>e.setActiveDevice),T=H(e=>e.detectedDevices),E=(e.device_configs??[]).filter(e=>T.includes(e.device)),D=E.find(e=>e.device===C),O=E.length>1,k=H(e=>e.activeModelTier),ee=H(e=>e.setActiveModelTier),te=e.model_tiers??[],A=!d&&te.length>1,j=!d&&f,ne=[`agent-hub-card`,n&&!d&&`active`,!f&&!d&&`disabled`,d&&`available-card`].filter(Boolean).join(` `),re=v?(0,K.jsxs)(`button`,{className:`btn-install-cancel`,onClick:t=>{t.stopPropagation(),l?.(e.id)},children:[(0,K.jsx)(Ft,{size:14}),` Cancel`]}):(0,K.jsx)(`button`,{className:`btn-install`,disabled:S,title:S?[Th(x),...e.compatibility?.reasons??[]].join(` `):`${b?`Update`:`Install`} ${e.name}`,onClick:t=>{t.stopPropagation(),c?.(e.id)},children:y?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ut,{size:14}),` Retry`]}):b?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(R,{size:14}),` Update`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(be,{size:14}),` Install`]})});return(0,K.jsxs)(`div`,{className:ne,role:j?`button`:void 0,tabIndex:j?0:-1,onClick:()=>j&&i(e.id),onKeyDown:t=>{j&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),i(e.id))},children:[(0,K.jsxs)(`div`,{className:`agent-hub-card-header`,children:[(0,K.jsx)(`div`,{className:`agent-hub-card-icon`,children:(0,K.jsx)(_,{size:18})}),(0,K.jsxs)(`div`,{className:`agent-hub-card-info`,children:[(0,K.jsx)(`h3`,{className:`agent-hub-card-name`,children:e.name}),(0,K.jsxs)(`div`,{className:`agent-hub-card-badges`,children:[!d&&Dh(e.source),b&&(0,K.jsxs)(`span`,{className:`agent-badge agent-badge-update`,children:[(0,K.jsx)(R,{size:10}),` Update`]}),e.version&&!d&&(0,K.jsxs)(`span`,{className:`agent-badge agent-badge-version`,children:[`v`,e.version]}),kh(e.security_tier),e.deprecated&&(0,K.jsxs)(`span`,{className:`agent-badge agent-badge-deprecated`,title:`Deprecated by the publisher — may be unmaintained`,children:[(0,K.jsx)(At,{size:10}),` Deprecated`]}),e.language&&e.language!==`python`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-native`,children:e.language.toUpperCase()}),e.category&&e.category!==`general`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-category`,children:e.category})]})]}),e.compatibility&&(0,K.jsx)(`span`,{className:`agent-compat-dot agent-compat-${x}`,title:[Th(x),...e.compatibility.reasons??[]].join(`
|
|
58
|
-
`),"aria-label":Th(x)})]}),(0,K.jsx)(`p`,{className:`agent-hub-card-desc`,children:e.description||`Custom agent`}),(0,K.jsxs)(`div`,{className:`agent-hub-card-meta`,children:[p&&(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(_e,{size:12}),p]}),m>0&&(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(Pt,{size:12}),m,` tools`]}),d&&e.download_size_bytes!=null?(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(be,{size:12}),Sh(e.download_size_bytes)]}):g.length>0?(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(vt,{size:12}),g.map(e=>e.connector_id).join(`, `)]}):(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(vt,{size:12}),`No special permissions`]})]}),!d&&E.length>0&&(0,K.jsxs)(`div`,{className:`agent-hub-card-device`,children:[O?(0,K.jsx)(`select`,{className:`agent-hub-device-select`,"aria-label":`Device for ${e.name}`,value:C,onChange:e=>{e.stopPropagation(),w(e.target.value)},onClick:e=>e.stopPropagation(),children:E.map(e=>(0,K.jsxs)(`option`,{value:e.device,children:[Ah[e.device]??e.device.toUpperCase(),e.verified?``:` ⚠`]},e.device))}):(0,K.jsx)(`span`,{className:`agent-hub-device-label`,children:Ah[E[0].device]??E[0].device.toUpperCase()}),D&&(0,K.jsx)(`span`,{className:`agent-hub-device-verified ${D.verified?`verified`:`unverified`}`,children:D.verified?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(z,{size:11}),` Verified`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(At,{size:11}),` Unverified`]})})]}),A&&(0,K.jsxs)(`div`,{className:`agent-hub-card-tier`,children:[(0,K.jsx)(_e,{size:12}),(0,K.jsx)(`select`,{className:`agent-hub-tier-select`,"aria-label":`Model size for ${e.name}`,value:k,onChange:e=>{e.stopPropagation(),ee(e.target.value)},onClick:e=>e.stopPropagation(),children:te.map(e=>(0,K.jsx)(`option`,{value:e.name,children:e.label},e.name))})]}),!d&&h&&(0,K.jsx)(`div`,{className:`agent-hub-card-starter`,children:h}),v&&(0,K.jsxs)(`div`,{className:`agent-install-progress`,children:[(0,K.jsxs)(`div`,{className:`agent-install-progress-head`,children:[(0,K.jsx)(`span`,{children:jh[s.state]??`Installing…`}),(0,K.jsxs)(`span`,{children:[Math.round(s.progress),`%`]})]}),(0,K.jsx)(`div`,{className:`agent-install-bar`,role:`progressbar`,"aria-valuenow":Math.round(s.progress),"aria-valuemin":0,"aria-valuemax":100,children:(0,K.jsx)(`div`,{className:`agent-install-bar-fill`,style:{width:`${Math.max(2,s.progress)}%`}})})]}),y&&(0,K.jsxs)(`div`,{className:`agent-install-error`,role:`alert`,children:[(0,K.jsx)(At,{size:12}),(0,K.jsx)(`span`,{children:s?.error||`Install failed.`})]}),(0,K.jsxs)(`div`,{className:`agent-hub-card-actions`,children:[d?re:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{className:`btn-start-chat`,disabled:!f,title:f?`Start chat with ${e.name}`:`Available in GAIA Desktop`,onClick:t=>{t.stopPropagation(),a(e.id)},children:`Start Chat`}),(b||v||y)&&(c||l)&&re]}),(0,K.jsx)(`button`,{className:`btn-details`,onClick:t=>{t.stopPropagation(),o(e)},children:`Details`}),!d&&u&&e.source===`installed`&&(0,K.jsx)(`button`,{className:`btn-uninstall`,title:`Uninstall ${e.name}`,"aria-label":`Uninstall ${e.name}`,onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,K.jsx)(Ot,{size:14})})]})]})}var Nh=typeof window<`u`&&!!window.electronAPI,Ph={verified:{Icon:z,label:`Verified`},community:{Icon:vt,label:`Community`},experimental:{Icon:Oe,label:`Experimental`}};function Fh(e){let t=e?Ph[e]:void 0;if(!t)return null;let{Icon:n,label:r}=t;return(0,K.jsxs)(`span`,{className:`agent-badge agent-badge-tier-${e}`,title:`${r} security tier`,children:[(0,K.jsx)(n,{size:10}),` `,r]})}function Ih({agent:e,onClose:t,onStartChat:n}){let r=e.required_connections??[],i=e.tags??[],a=e.conversation_starters??[],o=e.models??[],s=e.tools_count??0,c=e.source!==`native`||Nh,l=jr(e.icon),u=!!e.version||o.length>0||s>0||e.min_memory_gb!=null,d=(0,w.useCallback)(e=>{e.key===`Escape`&&t()},[t]);return(0,w.useEffect)(()=>(document.addEventListener(`keydown`,d),()=>document.removeEventListener(`keydown`,d)),[d]),(0,K.jsx)(`div`,{className:`agent-detail-overlay`,onClick:t,children:(0,K.jsxs)(`div`,{className:`agent-detail-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agent-detail-title`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`agent-detail-header`,children:[(0,K.jsx)(`div`,{className:`agent-detail-icon`,children:(0,K.jsx)(l,{size:24})}),(0,K.jsxs)(`div`,{className:`agent-detail-title-area`,children:[(0,K.jsx)(`h2`,{id:`agent-detail-title`,className:`agent-detail-name`,children:e.name}),(0,K.jsxs)(`div`,{className:`agent-hub-card-badges`,children:[e.source===`builtin`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-builtin`,children:`Built-in`}),e.source===`native`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-native`,children:`Native`}),e.source===`custom_python`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-custom`,children:`Custom`}),e.source===`installed`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-installed`,children:`Installed`}),Fh(e.security_tier),e.deprecated&&(0,K.jsxs)(`span`,{className:`agent-badge agent-badge-deprecated`,title:`Deprecated by the publisher — may be unmaintained`,children:[(0,K.jsx)(At,{size:10}),` Deprecated`]}),e.language&&e.language!==`python`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-native`,children:e.language.toUpperCase()}),e.category&&e.category!==`general`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-category`,children:e.category})]})]}),(0,K.jsx)(`button`,{className:`agent-detail-close`,onClick:t,"aria-label":`Close`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`agent-detail-body`,children:[(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`About`}),(0,K.jsx)(`p`,{className:`agent-detail-desc`,children:e.description||`No description available.`})]}),u&&(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Details`}),(0,K.jsxs)(`div`,{className:`agent-detail-meta-grid`,children:[e.version&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(Tt,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Version`}),(0,K.jsx)(`div`,{className:`agent-detail-meta-value`,children:e.version})]})]}),o.length>0&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(_e,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Model`}),(0,K.jsx)(`div`,{className:`agent-detail-meta-value`,children:o[0]})]})]}),s>0&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(Pt,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Tools`}),(0,K.jsx)(`div`,{className:`agent-detail-meta-value`,children:s})]})]}),e.min_memory_gb!=null&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(Fe,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Min Memory`}),(0,K.jsxs)(`div`,{className:`agent-detail-meta-value`,children:[e.min_memory_gb,` GB`]})]})]}),o.length>1&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(_e,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Fallback`}),(0,K.jsx)(`div`,{className:`agent-detail-meta-value`,children:o[1]})]})]})]})]}),(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Access Rights`}),r.length>0?(0,K.jsx)(`div`,{className:`agent-detail-permissions`,children:r.map((e,t)=>(0,K.jsxs)(`div`,{className:`agent-detail-permission`,children:[(0,K.jsx)(vt,{size:14}),(0,K.jsx)(`span`,{children:e.connector_id}),e.reason&&(0,K.jsxs)(`span`,{style:{color:`var(--text-muted)`,fontSize:12},children:[` — `,e.reason]})]},t))}):(0,K.jsx)(`p`,{className:`agent-detail-no-permissions`,children:`No special permissions required.`})]}),i.length>0&&(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Tags`}),(0,K.jsx)(`div`,{className:`agent-detail-tags`,children:i.map(e=>(0,K.jsx)(`span`,{className:`agent-detail-tag`,children:e},e))})]}),e.eval_score!=null&&(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Eval scorecard`}),(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(ae,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Eval score`}),(0,K.jsxs)(`div`,{className:`agent-detail-meta-value`,children:[e.eval_score,` / 100`,e.eval_scorecard_url&&(0,K.jsxs)(K.Fragment,{children:[` — `,(0,K.jsx)(`a`,{href:e.eval_scorecard_url,target:`_blank`,rel:`noopener noreferrer`,style:{color:`var(--accent)`,textDecoration:`underline`,fontSize:12},children:`View scorecard`})]})]}),e.eval_score_version&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-label`,style:{marginTop:2},children:[`measured on v`,e.eval_score_version,e.version&&e.version!==e.eval_score_version&&(0,K.jsxs)(K.Fragment,{children:[` (current: v`,e.version,`)`]})]})]})]})]}),a.length>0&&(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Try asking`}),(0,K.jsx)(`div`,{className:`agent-detail-starters`,children:a.map(r=>(0,K.jsx)(`button`,{className:`agent-detail-starter-chip`,disabled:!c,title:c?void 0:`Available in GAIA Desktop`,onClick:()=>{n(e.id,r),t()},children:r},r))})]})]})]})})}var Lh={verified:`AMD Verified`,community:`Community`,experimental:`Experimental`};function Rh({agent:e,gate:t,onConfirm:n,onCancel:r}){let[i,a]=(0,w.useState)(!1),o=!t.requiresOverride||i,s=(0,w.useCallback)(e=>{e.key===`Escape`&&r()},[r]);(0,w.useEffect)(()=>(document.addEventListener(`keydown`,s),()=>document.removeEventListener(`keydown`,s)),[s]);let c=t.tier===`verified`?V:gt;return(0,K.jsx)(`div`,{className:`agent-detail-overlay`,onClick:r,children:(0,K.jsxs)(`div`,{className:`agent-detail-modal trust-gate-modal`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`trust-gate-title`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`agent-detail-header`,children:[(0,K.jsx)(`div`,{className:`agent-detail-icon trust-gate-icon trust-gate-icon-${t.tier}`,children:(0,K.jsx)(c,{size:24})}),(0,K.jsxs)(`div`,{className:`agent-detail-title-area`,children:[(0,K.jsxs)(`h2`,{id:`trust-gate-title`,className:`agent-detail-name`,children:[`Install `,e.name,`?`]}),(0,K.jsxs)(`p`,{className:`trust-gate-subtitle`,children:[(0,K.jsx)(`span`,{className:`trust-gate-tier-badge trust-gate-tier-${t.tier}`,children:Lh[t.tier]}),e.latest_version?` · v${e.latest_version}`:``]})]}),(0,K.jsx)(`button`,{className:`agent-detail-close`,onClick:r,"aria-label":`Cancel`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`agent-detail-body`,children:[t.reasons.length>0&&(0,K.jsx)(`ul`,{className:`trust-gate-reasons`,"aria-label":`Trust warnings`,children:t.reasons.map(e=>(0,K.jsxs)(`li`,{className:`trust-gate-reason`,children:[(0,K.jsx)(gt,{size:15,className:`trust-gate-reason-icon`}),(0,K.jsx)(`span`,{children:e})]},e))}),(0,K.jsxs)(`div`,{className:`trust-gate-section`,children:[(0,K.jsxs)(`div`,{className:`trust-gate-section-title`,children:[(0,K.jsx)(ze,{size:14}),` Permissions`]}),t.permissions.length>0?(0,K.jsx)(`ul`,{className:`trust-gate-perm-list`,children:t.permissions.map(e=>(0,K.jsx)(`li`,{className:`trust-gate-perm`,children:(0,K.jsx)(`code`,{children:e})},e))}):(0,K.jsx)(`p`,{className:`trust-gate-empty`,children:`No special permissions declared.`})]}),(0,K.jsxs)(`div`,{className:`trust-gate-section`,children:[(0,K.jsxs)(`div`,{className:`trust-gate-section-title`,children:[(0,K.jsx)(Xe,{size:14}),` Requirements`]}),t.platforms.length>0?(0,K.jsxs)(`p`,{className:`trust-gate-requirements`,children:[`Platforms: `,t.platforms.join(`, `)]}):(0,K.jsx)(`p`,{className:`trust-gate-empty`,children:`No platform restrictions.`})]}),t.requiresOverride&&(0,K.jsxs)(`label`,{className:`trust-gate-ack`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked),"aria-label":`I understand and want to install this agent`}),(0,K.jsx)(`span`,{children:`I understand this agent isn't AMD-verified and I want to install it anyway.`})]}),(0,K.jsxs)(`div`,{className:`trust-gate-actions`,children:[(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:r,children:`Cancel`}),(0,K.jsxs)(`button`,{className:`btn-install trust-gate-proceed`,onClick:()=>n(t.trustNative),disabled:!o,title:o?void 0:`Acknowledge the warning above to enable install`,children:[(0,K.jsx)(be,{size:14}),` `,t.requiresOverride?`Trust & Install`:`Install`]})]})]})]})})}var zh=[{key:`app`,title:`Apps`,subtitle:`Full experiences you can launch`},{key:`component`,title:`Components`,subtitle:`Reusable building blocks`},{key:`agent`,title:`Agents`,subtitle:`Task-focused AI agents`},{key:`skill`,title:`Skills`,subtitle:`Capabilities any agent can compose`}],Bh=[`app`,`component`,`agent`,`skill`];function Vh(e){return Bh.includes(e.type)?e.type:`agent`}function Hh(e){let t={app:[],component:[],agent:[],skill:[]};for(let n of e)t[Vh(n)].push(n);return t}function Uh(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.name.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)||(e.category??``).toLowerCase().includes(n)||(e.tags??[]).some(e=>e.toLowerCase().includes(n))):e}function Wh(e){let t=e.security_tier;return t===`verified`||t===`community`?t:`experimental`}function Gh(e){let t=Wh(e),n=e.language===`cpp`&&t!==`verified`,r=[];t!==`verified`&&r.push(t===`community`?`Community-published — not audited by AMD.`:`Experimental — unreviewed and may be unstable.`),n&&r.push(`Ships a native binary that runs on your machine without sandboxing.`),e.deprecated&&r.push(`Deprecated by the publisher — may be unmaintained or superseded.`);let i=t!==`verified`||n||!!e.deprecated;return{tier:t,requiresOverride:i,trustNative:i,permissions:e.permissions??[],platforms:e.requirements?.platforms??[],reasons:r}}var Kh=typeof window<`u`&&!!window.electronAPI,qh=1200;function Jh({agents:e,activeAgentId:t,onSelect:n,onStartChat:r,onCreateAgent:i}){let[a,o]=(0,w.useState)(``),[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)([]),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(!1),[y,b]=(0,w.useState)({}),x=(0,w.useRef)({}),S=H(e=>e.activeDevice),C=H(e=>e.setAgents),T=H(e=>e.agentsError),E=(0,w.useCallback)(async()=>{v(!0),g(null);try{let e=await fn();f(e.agents||[]),m(!!e.offline)}catch(e){let t=e instanceof Error?e.message:`Could not load the agent catalog.`;U.api.warn(`[HubPage] catalog fetch failed`,e),g(t)}finally{v(!1)}},[]);(0,w.useEffect)(()=>{E()},[E]);let D=(0,w.useCallback)(async()=>{try{let e=await un();C(e.agents||[])}catch(e){U.api.warn(`[HubPage] agent list refresh failed`,e)}},[C]),O=(0,w.useCallback)(e=>{let t=x.current[e];t&&(clearInterval(t),delete x.current[e])},[]),k=(0,w.useCallback)(e=>{O(e),x.current[e]=setInterval(async()=>{try{let t=await mn(e);b(n=>({...n,[e]:t})),t.state===`installed`?(O(e),await E(),await D()):t.state===`failed`&&O(e)}catch(t){O(e);let n=t instanceof Error?t.message:`Install status check failed.`;b(t=>({...t,[e]:{agent_id:e,state:`failed`,progress:0,error:n}}))}},qh)},[O,E,D]);(0,w.useEffect)(()=>()=>{Object.values(x.current).forEach(clearInterval),x.current={}},[]);let ee=(0,w.useCallback)(async(e,t)=>{b(t=>({...t,[e]:{agent_id:e,state:`downloading`,progress:0}}));try{let n=await pn(e,S,t);b(t=>({...t,[e]:n})),n.state===`installed`?(await E(),await D()):n.state===`failed`||k(e)}catch(t){let n=t instanceof Error?t.message:`Install failed.`;b(t=>({...t,[e]:{agent_id:e,state:`failed`,progress:0,error:n}}))}},[S,k,E,D]),te=(0,w.useCallback)(t=>{let n=d.find(e=>e.id===t)??e.find(e=>e.id===t);n&&u({agent:n,gate:Gh(n)})},[d,e]),A=(0,w.useCallback)(e=>{if(!l)return;let t=l.agent.id;u(null),ee(t,e)},[l,ee]),j=(0,w.useCallback)(async e=>{O(e);try{await hn(e),b(t=>{let n={...t};return delete n[e],n}),await E()}catch(t){let n=t instanceof Error?t.message:`Cancel failed.`;b(t=>({...t,[e]:{agent_id:e,state:`failed`,progress:0,error:`Cancel failed: ${n}`}}))}},[O,E]),ne=(0,w.useCallback)(async t=>{let n=e.find(e=>e.id===t)?.name??t;if(window.confirm(`Uninstall ${n}? You can reinstall it from the hub.`))try{await hn(t),await D(),await E()}catch(e){U.api.warn(`[HubPage] uninstall failed`,e),window.alert(e instanceof Error?e.message:`Uninstall failed.`)}},[e,D,E]),re=(0,w.useMemo)(()=>Eh(e,d),[e,d]),M=(0,w.useMemo)(()=>Uh(re,a),[re,a]),N=(0,w.useMemo)(()=>new Set(e.map(e=>e.id)),[e]),P=(0,w.useMemo)(()=>d.filter(e=>e.status===`available`&&!N.has(e.id)),[d,N]),ie=(0,w.useMemo)(()=>Uh(P,a),[P,a]),ae=(0,w.useMemo)(()=>Hh(ie),[ie]),F=ie.length;return(0,K.jsxs)(`div`,{className:`agent-hub hub-page`,children:[(0,K.jsxs)(`div`,{className:`agent-hub-header hub-page-header`,children:[(0,K.jsxs)(`div`,{className:`hub-page-title-area`,children:[(0,K.jsx)(`h1`,{className:`hub-page-title`,children:`Agent Hub`}),(0,K.jsx)(`p`,{className:`hub-page-subtitle`,children:`Browse and install apps, components, and agents.`})]}),(0,K.jsx)(`div`,{className:`agent-hub-controls`,children:(0,K.jsxs)(`div`,{className:`agent-hub-search`,children:[(0,K.jsx)(pt,{size:14}),(0,K.jsx)(`input`,{type:`text`,placeholder:`Search the hub...`,"aria-label":`Search the hub`,value:a,onChange:e=>o(e.target.value)})]})})]}),T&&(0,K.jsxs)(`div`,{className:`agent-hub-banner agent-hub-banner-error`,role:`alert`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsxs)(`span`,{children:[`Couldn’t load installed agents: `,T]}),(0,K.jsxs)(`button`,{className:`agent-hub-retry`,onClick:D,children:[(0,K.jsx)(ft,{size:13}),` Retry`]})]}),p&&(0,K.jsxs)(`div`,{className:`agent-hub-banner agent-hub-banner-offline`,role:`status`,children:[(0,K.jsx)(Nt,{size:14}),(0,K.jsx)(`span`,{children:`Showing cached catalog — the Agent Hub is currently unreachable.`})]}),_&&d.length===0&&(0,K.jsxs)(`div`,{className:`agent-hub-loading`,children:[(0,K.jsx)(`div`,{className:`agent-hub-spinner`}),(0,K.jsx)(`span`,{children:`Loading catalog…`})]}),h&&d.length===0&&!_&&(0,K.jsxs)(`div`,{className:`agent-hub-banner agent-hub-banner-error`,role:`alert`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsx)(`span`,{children:h}),(0,K.jsxs)(`button`,{className:`agent-hub-retry`,onClick:E,children:[(0,K.jsx)(ft,{size:13}),` Retry`]})]}),(M.length>0||i)&&(0,K.jsxs)(`section`,{className:`hub-lane`,"aria-label":`Installed`,children:[(0,K.jsxs)(`div`,{className:`hub-lane-header`,children:[(0,K.jsxs)(`h2`,{className:`hub-lane-title`,children:[`Installed `,(0,K.jsx)(`span`,{className:`hub-lane-count`,children:M.length})]}),(0,K.jsx)(`span`,{className:`hub-lane-subtitle`,children:`Agents ready to use`})]}),(0,K.jsxs)(`div`,{className:`agent-hub-grid hub-lane-grid`,children:[M.map(e=>(0,K.jsx)(Mh,{agent:e,variant:`installed`,isActive:e.id===t,isElectron:Kh,onSelect:n,onStartChat:e=>r(e),onViewDetails:c,installStatus:y[e.id],onInstall:te,onCancelInstall:j,onUninstall:ne},e.id)),i&&(0,K.jsxs)(`div`,{className:`agent-hub-card create-new`,role:`button`,tabIndex:0,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,K.jsx)(`div`,{className:`create-icon`,children:(0,K.jsx)(lt,{size:22})}),(0,K.jsxs)(`div`,{className:`create-title`,children:[`Build a Custom Agent Template`,` `,(0,K.jsx)(`span`,{className:`create-alpha-badge`,children:`Alpha`})]}),(0,K.jsx)(`div`,{className:`create-desc`,children:`Create a new agent through conversation`})]})]})]}),!_&&!h&&F===0&&M.length===0&&(0,K.jsxs)(`div`,{className:`agent-hub-empty`,children:[(0,K.jsx)($e,{size:28,strokeWidth:1.5}),(0,K.jsx)(`p`,{children:a?`No hub items match your search.`:`All catalog items are installed.`})]}),!h&&zh.map(e=>{let i=ae[e.key];return i.length===0?null:(0,K.jsxs)(`section`,{className:`hub-lane`,"aria-label":e.title,children:[(0,K.jsxs)(`div`,{className:`hub-lane-header`,children:[(0,K.jsxs)(`h2`,{className:`hub-lane-title`,children:[e.title,` `,(0,K.jsx)(`span`,{className:`hub-lane-count`,children:i.length})]}),(0,K.jsx)(`span`,{className:`hub-lane-subtitle`,children:e.subtitle})]}),(0,K.jsx)(`div`,{className:`agent-hub-grid hub-lane-grid`,children:i.map(e=>(0,K.jsx)(Mh,{agent:e,variant:`available`,isActive:e.id===t,isElectron:Kh,onSelect:n,onStartChat:e=>r(e),onViewDetails:c,installStatus:y[e.id],onInstall:te,onCancelInstall:j},e.id))})]},e.key)}),s&&(0,K.jsx)(Ih,{agent:s,onClose:()=>c(null),onStartChat:r}),l&&(0,K.jsx)(Rh,{agent:l.agent,gate:l.gate,onConfirm:A,onCancel:()=>u(null)})]})}function Yh(e){return e!==null&&e.lemonade_running&&!!e.model_loaded}function Xh(e){return e!==null&&!e.initialized&&!Yh(e)}function Zh(e){return!Xh(e)&&e!==null&&e.lemonade_running&&!e.model_loaded}var Qh=`GAIA`,$h=`Your private AI assistant, running 100% locally on AMD Ryzen AI`,eg=65,tg=350;function ng(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}var rg=[`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 ig({onNewTask:e,onSendPrompt:t,onCreateAgent:n}){let{systemStatus:r,agents:i,activeAgentId:a,setActiveAgentId:o}=H(),s=(0,w.useMemo)(()=>{let e=i.find(e=>e.id===a);return e?.conversation_starters?.length?e.conversation_starters:rg},[i,a]),[c,l]=(0,w.useState)(``),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(`title`),[v,y]=(0,w.useState)(!1),b=r?.init_state===`initializing`,x=Xh(r),S=Zh(r);return(0,w.useEffect)(()=>{let e=0,t=setInterval(()=>{e++,e<=4?l(Qh.slice(0,e)):(clearInterval(t),d(!0))},eg);return()=>clearInterval(t)},[]),(0,w.useEffect)(()=>{if(!u)return;let e=!1,t=setTimeout(()=>{if(e)return;_(`subtitle`);let t=0,r=()=>{if(!e){if(t++,t<=63){p($h.slice(0,t));let e=$h[t-1],i=ng(e,t>1?$h[t-2]:``);n.current=setTimeout(r,i)}else h(!0),_(`done`)}};r()},tg),n={current:null};return()=>{e=!0,clearTimeout(t),n.current&&clearTimeout(n.current)}},[u]),(0,w.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>y(!0),200);return()=>clearTimeout(e)},[m]),(0,K.jsx)(`main`,{className:`welcome`,children:(0,K.jsxs)(`div`,{className:`welcome-inner ${v?`content-revealed`:``}`,children:[(0,K.jsxs)(`h1`,{className:`welcome-title${u?` typing-done`:``}`,children:[c.length>=4?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`gaia-glow`,children:c.slice(0,4)}),(0,K.jsx)(`span`,{children:c.slice(4)})]}):c,g===`title`&&(0,K.jsx)(`span`,{className:`terminal-cursor${u?` blink`:``}`})]}),(0,K.jsx)(`p`,{className:`welcome-sub`,children:(0,K.jsxs)(`span`,{className:`typewriter-text`,children:[f,(g===`subtitle`||g===`done`)&&(0,K.jsx)(`span`,{className:`terminal-cursor terminal-cursor-sub${g===`done`?` blink`:``}`})]})}),(0,K.jsxs)(`span`,{className:`welcome-version`,children:[`v`,`0.24.0`,` `,(0,K.jsx)(`span`,{className:`beta-badge`,children:`BETA`})]}),(0,K.jsxs)(`div`,{className:`features`,children:[(0,K.jsx)(ag,{icon:(0,K.jsx)(Ge,{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.`}),(0,K.jsx)(ag,{icon:(0,K.jsx)(It,{size:22}),title:`Fast`,desc:`NPU acceleration`,codeHint:`> npu.accelerate()`,expandedDesc:`Hardware-accelerated with AMD Ryzen AI NPU for real-time local inference.`}),(0,K.jsx)(ag,{icon:(0,K.jsx)(Ee,{size:22}),title:`Smart`,desc:`Document Q&A`,codeHint:`> rag.query("...")`,expandedDesc:`RAG-powered document Q&A — index files and chat with their contents.`}),(0,K.jsx)(ag,{icon:(0,K.jsx)(ye,{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&&(0,K.jsx)(Jh,{agents:i,activeAgentId:a,onSelect:o,onStartChat:(n,r)=>{o(n),r?t(r):e()},onCreateAgent:n}),x&&(0,K.jsxs)(`div`,{className:`welcome-setup-hint`,children:[(0,K.jsx)(Dt,{size:14}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:`First time?`}),` Run `,(0,K.jsx)(`code`,{children:`gaia init`}),` in a terminal to install Lemonade Server and download the required AI model`,r?.default_model_size_gb?` (~${r.default_model_size_gb.toFixed(1)} GB).`:`.`]})]}),!x&&S&&(0,K.jsxs)(`div`,{className:`welcome-setup-hint`,children:[(0,K.jsx)(Dt,{size:14}),(0,K.jsxs)(`span`,{children:[`No model loaded. Run `,(0,K.jsx)(`code`,{children:`gaia init`}),` to download`,r?.default_model_size_gb?` (~${r.default_model_size_gb.toFixed(1)} GB).`:`.`]})]}),(0,K.jsx)(`div`,{className:`welcome-actions`,children:(0,K.jsx)(`button`,{className:`btn-primary start-btn`,onClick:e,disabled:b,children:`Start a New Task`})}),(0,K.jsxs)(`div`,{className:`suggestions`,children:[(0,K.jsx)(`span`,{className:`suggestions-label`,children:`Try asking:`}),(0,K.jsx)(`div`,{className:`suggestion-chips`,children:s.map(e=>(0,K.jsx)(`button`,{className:`chip`,onClick:()=>t(e),disabled:b,children:e},e))})]}),(0,K.jsx)(`p`,{className:`welcome-copyright`,children:`© 2025–2026 Advanced Micro Devices, Inc. All rights reserved.`})]})})}function ag({icon:e,title:t,desc:n,expandedDesc:r,codeHint:i}){let[a,o]=(0,w.useState)(`idle`),[s,c]=(0,w.useState)(i),[l,u]=(0,w.useState)(``),d=(0,w.useRef)(null);return(0,w.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]),(0,K.jsxs)(`div`,{className:`feature-card ${a===`idle`?``:`feature-hovered`}`,onMouseEnter:()=>{o(`erasing`),u(``);let e=i.length,t=()=>{if(e--,e>=0)c(i.slice(0,e)),d.current=setTimeout(t,15+Math.random()*20);else{o(`typing`),c(``);let e=0,t=()=>{if(e++,e<=r.length){u(r.slice(0,e));let n=r[e-1],i=e>1?r[e-2]:``;d.current=setTimeout(t,ng(n,i))}else o(`done`)};t()}};t()},onMouseLeave:()=>{d.current&&clearTimeout(d.current),o(`idle`),c(i),u(``)},children:[(0,K.jsx)(`div`,{className:`feature-icon`,children:e}),(0,K.jsx)(`h3`,{children:t}),(0,K.jsx)(`p`,{children:n}),(0,K.jsxs)(`div`,{className:`feature-terminal`,children:[a===`idle`&&(0,K.jsx)(`span`,{className:`feature-code-hint`,children:i}),a===`erasing`&&(0,K.jsxs)(`span`,{className:`feature-inline`,children:[(0,K.jsx)(`span`,{className:`feature-code-hint feature-code-erasing`,children:s}),(0,K.jsx)(`span`,{className:`terminal-cursor terminal-cursor-sm`})]}),(a===`typing`||a===`done`)&&(0,K.jsxs)(`span`,{className:`feature-inline`,children:[(0,K.jsx)(`span`,{className:`feature-expanded-text`,children:l}),(0,K.jsx)(`span`,{className:`terminal-cursor terminal-cursor-sm${a===`done`?` blink`:``}`})]})]})]})}function og(e){let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function sg(e){try{let t=new Date(e);if(isNaN(t.getTime()))return``;let n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i}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 cg(e){try{let 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 lg(){let{documents:e,setDocuments:t,setShowDocLibrary:n,setShowFileBrowser:r,currentSessionId:i,sessions:a,updateSessionInList:o}=H(),s=a.find(e=>e.id===i)??null,[c,l]=(0,w.useState)(!1),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(``),[g,_]=(0,w.useState)(null),[v,y]=(0,w.useState)(new Set),b=(0,w.useRef)(new Map),[,x]=(0,w.useState)(0);(0,w.useEffect)(()=>{U.doc.info(`Loading document library...`);let e=U.doc.time();Xn().then(n=>{let r=n.documents||[];t(r),U.doc.timed(`Loaded ${r.length} document(s), ${n.total_chunks||0} chunks, ${n.total_size_bytes||0} bytes total`,e)}).catch(e=>{U.doc.error(`Failed to load documents`,e),t([])})},[t]);let S=e.some(e=>e.indexing_status===`indexing`||e.indexing_status===`pending`);(0,w.useEffect)(()=>{if(!S)return;let e=H.getState().documents;for(let t of e)(t.indexing_status===`indexing`||t.indexing_status===`pending`)&&!b.current.has(t.id)&&b.current.set(t.id,Date.now());let n=!1,r=setInterval(async()=>{if(x(e=>e+1),!n){n=!0;try{let e=H.getState().documents.filter(e=>e.indexing_status===`indexing`||e.indexing_status===`pending`);for(let n of e)try{let e=await er(n.id);if(e.indexing_status!==`indexing`&&e.indexing_status!==`pending`){b.current.delete(n.id);let e=await Xn();t(e.documents||[]);break}}catch{}}finally{n=!1}}},2e3);return()=>clearInterval(r)},[S,t]),(0,w.useEffect)(()=>{let t=new Set(e.filter(e=>e.indexing_status===`indexing`||e.indexing_status===`pending`).map(e=>e.id));for(let e of b.current.keys())t.has(e)||b.current.delete(e)},[e]),(0,w.useEffect)(()=>{let e=setInterval(async()=>{try{let e=(await Xn()).documents||[],n=H.getState().documents;(e.length!==n.length||e.some((e,t)=>{let r=n.find(t=>t.id===e.id);return!r||r.indexing_status!==e.indexing_status||r.indexed_at!==e.indexed_at||r.chunk_count!==e.chunk_count}))&&(t(e),U.doc.debug(`Document list refreshed (server-side changes detected)`))}catch{}},15e3);return()=>clearInterval(e)},[t]);let C=e.reduce((e,t)=>e+t.file_size,0),T=e.reduce((e,t)=>e+t.chunk_count,0),E=e=>{if(e<=0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/t**r).toFixed(1))+` `+n[r]},D=(0,w.useCallback)(async(e,n)=>{let r=e.includes(`.`)?`.`+e.split(`.`).pop()?.toLowerCase():``;if(r&&!ah(r)){let t=rh(r),n=t?t.message:`The file type "${r}" is not supported for indexing.`;U.doc.warn(`Unsupported file type: ${e} (${r})`),_({filename:e,error:n});return}U.doc.info(`Indexing document: ${e}`);let a=U.doc.time();d(!0),p(`Indexing ${e}...`),_(null);try{let r=await n();if(U.doc.timed(`Indexed "${e}": ${r?.chunk_count||`?`} chunks`,a),i&&r?.id)try{await rr(i,r.id);let t=H.getState().sessions.find(e=>e.id===i)?.document_ids??[];t.includes(r.id)||o(i,{document_ids:[...t,r.id]}),U.doc.info(`Auto-attached "${e}" to session ${i}`)}catch(e){U.doc.warn(`Could not attach document to session: ${e}`)}let s=await Xn();t(s.documents||[]),p(``)}catch(t){U.doc.error(`Failed to index "${e}"`,t);let n=t instanceof Error?t.message:`Upload failed`;_({filename:e,error:n}),p(``)}finally{d(!1)}},[i,o,t]),O=(0,w.useCallback)(async(e,t)=>{await D(t,()=>Zn(e))},[D]),k=(0,w.useCallback)(async e=>{await D(e.name,()=>Qn(e))},[D]),ee=(0,w.useCallback)(async e=>{e.preventDefault(),l(!1);let t=Array.from(e.dataTransfer.files);U.doc.info(`Dropped ${t.length} file(s) into Document Library`);for(let e of t)await k(e)},[k]),te=(0,w.useCallback)(async n=>{let r=e.find(e=>e.id===n);U.doc.info(`Deleting document: ${r?.filename||n}`);try{await $n(n),b.current.delete(n),t(e.filter(e=>e.id!==n)),U.doc.info(`Deleted document: ${r?.filename||n}`)}catch(e){U.doc.error(`Failed to delete document: ${r?.filename||n}`,e)}},[e,t]),A=(0,w.useCallback)(async(e,t)=>{U.doc.info(`Opening folder for: ${e}`);try{await sr(e,!0)}catch(e){U.doc.error(`Failed to open folder for: ${t}`,e)}},[]),j=(0,w.useCallback)(async n=>{let r=e.find(e=>e.id===n);U.doc.info(`Cancelling indexing for: ${r?.filename||n}`);try{await tr(n),b.current.delete(n);let e=await Xn();t(e.documents||[]),U.doc.info(`Cancelled indexing for: ${r?.filename||n}`)}catch(e){U.doc.error(`Failed to cancel indexing: ${r?.filename||n}`,e)}},[e,t]),ne=(0,w.useCallback)(async n=>{if(v.has(n))return;let r=e.find(e=>e.id===n);U.doc.info(`Reindexing document: ${r?.filename||n}`),y(e=>new Set(e).add(n));try{await nr(n),U.doc.info(`Reindex complete for: ${r?.filename||n}`)}catch(e){let t=e instanceof Error?e.message:String(e);U.doc.error(`Reindex failed for: ${r?.filename||n}`,e),_({filename:r?.filename||n,error:t})}finally{try{let e=await Xn();t(e.documents||[])}catch(e){U.doc.error(`Failed to refresh documents after reindex`,e)}y(e=>{let t=new Set(e);return t.delete(n),t})}},[e,t,v]),re=(0,w.useCallback)(async t=>{if(!i)return;let n=e.find(e=>e.id===t);U.doc.info(`Attaching document to session: ${n?.filename||t}`);try{await rr(i,t);let e=H.getState().sessions.find(e=>e.id===i)?.document_ids??[];e.includes(t)||o(i,{document_ids:[...e,t]}),U.doc.info(`Attached "${n?.filename||t}" to session ${i}`)}catch(e){U.doc.error(`Failed to attach document to session: ${n?.filename||t}`,e)}},[i,e,o]),M=(0,w.useCallback)(async e=>{e.preventDefault(),m.trim()&&(U.doc.info(`Indexing from path input: ${m.trim()}`),await O(m.trim(),m.trim().split(/[\\/]/).pop()||`file`),h(``))},[m,O]),N=e=>{let t=e.indexing_status||`complete`,n=b.current.get(e.id),r=e.indexed_at?sg(e.indexed_at):``,i=e.indexed_at?cg(e.indexed_at):``;switch(t){case`indexing`:case`pending`:return(0,K.jsxs)(`div`,{className:`doc-indexing-status`,children:[(0,K.jsxs)(`div`,{className:`doc-indexing-bar`,children:[(0,K.jsx)(`div`,{className:`doc-indexing-bar-track`,children:(0,K.jsx)(`div`,{className:`doc-indexing-bar-fill`})}),(0,K.jsxs)(`span`,{className:`doc-indexing-label`,children:[(0,K.jsx)(We,{size:12,className:`doc-spin`}),`Indexing`,n?` (${og(n)})`:`...`]})]}),(0,K.jsxs)(`button`,{className:`btn-cancel`,onClick:t=>{t.stopPropagation(),j(e.id)},title:`Cancel indexing`,"aria-label":`Cancel indexing ${e.filename}`,children:[(0,K.jsx)(ue,{size:14}),`Cancel`]})]});case`failed`:return(0,K.jsxs)(`div`,{className:`doc-indexing-status`,children:[(0,K.jsxs)(`span`,{className:`doc-status-badge doc-status-failed`,title:e.last_error||void 0,"aria-label":e.last_error?`Failed: ${e.last_error}`:`Indexing failed`,children:[(0,K.jsx)(L,{size:12}),` Failed`]}),(0,K.jsxs)(`button`,{className:`btn-retry`,onClick:t=>{t.stopPropagation(),ne(e.id)},title:`Retry indexing`,"aria-label":`Retry indexing ${e.filename}`,disabled:v.has(e.id),children:[(0,K.jsx)(dt,{size:14}),v.has(e.id)?`Retrying…`:`Retry`]})]});case`cancelled`:return(0,K.jsxs)(`span`,{className:`doc-status-badge doc-status-cancelled`,children:[(0,K.jsx)(ue,{size:12}),` Cancelled`]});case`missing`:return(0,K.jsxs)(`span`,{className:`doc-status-badge doc-status-missing`,children:[(0,K.jsx)(L,{size:12}),` File missing`]});default:return(0,K.jsxs)(`span`,{className:`doc-meta`,children:[E(e.file_size),` · `,e.chunk_count,` chunks`,r&&(0,K.jsxs)(`span`,{className:`doc-timestamp`,title:`Indexed: ${i}`,children:[(0,K.jsx)(pe,{size:10}),r]})]})}};return(0,K.jsx)(`div`,{className:`modal-overlay`,onClick:()=>n(!1),role:`dialog`,"aria-modal":`true`,"aria-label":`Document Library`,children:(0,K.jsxs)(`div`,{className:`modal-panel doc-modal`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`modal-header`,children:[(0,K.jsx)(`h3`,{children:`Document Library`}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>n(!1),"aria-label":`Close document library`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`modal-body`,children:[(0,K.jsx)(`div`,{className:`drop-zone ${c?`drag-over`:``} ${u?`uploading`:``}`,onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:ee,children:u?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`upload-spinner`}),(0,K.jsx)(`p`,{children:f})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jt,{size:32,strokeWidth:1.5}),(0,K.jsx)(`p`,{children:`Drop files here to index`}),(0,K.jsx)(`span`,{className:`drop-hint`,children:`PDF, TXT, MD, code files, and 50+ formats`})]})}),(0,K.jsxs)(`form`,{className:`path-input-form`,onSubmit:M,children:[(0,K.jsx)(ke,{size:16,className:`path-icon`}),(0,K.jsx)(`input`,{type:`text`,className:`path-input`,value:m,onChange:e=>h(e.target.value),placeholder:`Or enter file path: C:\\docs\\manual.pdf`,"aria-label":`File path to index`}),(0,K.jsx)(`button`,{type:`submit`,className:`btn-secondary`,disabled:!m.trim()||u,children:`Index`}),(0,K.jsxs)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{n(!1),r(!0)},title:`Browse files on this computer`,children:[(0,K.jsx)(pt,{size:14}),`Browse Files`]})]}),g&&(0,K.jsx)(lh,{filename:g.filename,error:g.error,onDismiss:()=>_(null)}),e.length>0&&(0,K.jsxs)(`div`,{className:`doc-stats`,children:[(0,K.jsxs)(`span`,{children:[e.length,` document`,e.length===1?``:`s`]}),(0,K.jsx)(`span`,{children:`·`}),(0,K.jsxs)(`span`,{children:[T,` chunks`]}),(0,K.jsx)(`span`,{children:`·`}),(0,K.jsx)(`span`,{children:E(C)})]}),(0,K.jsxs)(`div`,{className:`doc-list`,children:[e.length===0&&!u&&(0,K.jsxs)(`div`,{className:`empty-docs`,children:[(0,K.jsx)(Ee,{size:32,strokeWidth:1}),(0,K.jsx)(`p`,{children:`No documents indexed yet`}),(0,K.jsx)(`span`,{children:`Drop files above or enter a file path`})]}),e.map(e=>(0,K.jsxs)(`div`,{className:`doc-row ${e.indexing_status===`indexing`?`doc-row-indexing`:``}`,children:[(0,K.jsxs)(`div`,{className:`doc-info`,children:[(0,K.jsx)(`span`,{className:`doc-name`,children:e.filename}),N(e)]}),(0,K.jsxs)(`div`,{className:`doc-row-actions`,children:[e.filepath&&(0,K.jsx)(`button`,{className:`btn-icon-sm doc-open-folder`,onClick:()=>A(e.filepath,e.filename),title:`Open folder: ${e.filepath}`,"aria-label":`Open containing folder for ${e.filename}`,children:(0,K.jsx)(ke,{size:14})}),i&&e.indexing_status===`complete`&&!s?.document_ids?.includes(e.id)&&(0,K.jsx)(`button`,{className:`btn-icon-sm doc-attach`,onClick:()=>re(e.id),title:`Use in current session`,"aria-label":`Attach ${e.filename} to current session`,children:(0,K.jsx)(He,{size:14})}),e.indexing_status!==`indexing`&&e.indexing_status!==`pending`&&(0,K.jsx)(`button`,{className:`btn-icon-sm doc-delete`,onClick:()=>te(e.id),title:`Remove`,"aria-label":`Remove ${e.filename}`,children:(0,K.jsx)(Ot,{size:14})})]})]},e.id))]})]})]})})}function ug(e){if(e.type===`folder`)return(0,K.jsx)(je,{size:16});let t=(e.extension||``).toLowerCase();return[`.csv`,`.xlsx`,`.xls`,`.tsv`].includes(t)?(0,K.jsx)(wt,{size:16}):[`.py`,`.js`,`.ts`,`.java`,`.c`,`.cpp`,`.go`,`.rs`].includes(t)?(0,K.jsx)(he,{size:16}):[`.pdf`,`.doc`,`.docx`,`.txt`,`.md`].includes(t)?(0,K.jsx)(Ee,{size:16}):(0,K.jsx)(De,{size:16})}function dg(e){if(e<=0)return``;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/t**r).toFixed(1))+` `+n[r]}function fg(e){if(!e)return``;let 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`;let a=Math.floor(i/24);return a<7?`${a}d ago`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:t.getFullYear()===n.getFullYear()?void 0:`numeric`})}function pg(e){if(e.length===0)return``;let[t,...n]=e;return n.length>0?`${t} (+${n.length} more)`:t}function mg(e){switch(e){case`home`:return(0,K.jsx)(Ie,{size:14});case`desktop`:return(0,K.jsx)(Ze,{size:14});case`documents`:return(0,K.jsx)(Ee,{size:14});case`download`:return(0,K.jsx)(be,{size:14});default:return(0,K.jsx)(je,{size:14})}}var hg=[{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 gg(e,t,n,r){let i=[],a=[];for(let t of e){let e=t.includes(`.`)?`.`+t.split(`.`).pop()?.toLowerCase():``;e&&!ah(e)?a.push(t):i.push(t)}let o=[],s=[],c=0,l=``,u=new Set(t.filter(e=>e.type===`folder`).map(e=>e.path));for(let e of i)try{if(u.has(e)){let t=await or(e),n=[];t.documents.forEach(e=>{e.id&&n.push(e.id)}),n.length>0&&(n.forEach(e=>o.push(e)),s.push(e))}else{let t=await Zn(e);t?.id&&(o.push(t.id),s.push(e))}}catch(e){c++,l=e instanceof Error?e.message:`Unknown error`}if(n&&o.length>0){for(let e of o)try{await rr(n,e)}catch(e){U.doc.warn(`Could not attach document to session: ${e}`)}let e=H.getState().sessions.find(e=>e.id===n)?.document_ids??[],t=o.filter(t=>!e.includes(t));t.length>0&&r(n,{document_ids:[...e,...t]})}return{docIds:o,supported:i,succeededFiles:s,unsupported:a,failed:c,lastError:l}}function _g(){let{setShowFileBrowser:e,currentSessionId:t,updateSessionInList:n,setPendingPrompt:r}=H(),[i,a]=(0,w.useState)(``),[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)([]),[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(null),[g,_]=(0,w.useState)(``),[v,y]=(0,w.useState)(null),[b,x]=(0,w.useState)([]),[S,C]=(0,w.useState)(!1),[T,E]=(0,w.useState)(``),[D,O]=(0,w.useState)(new Set),[k,ee]=(0,w.useState)(null),[te,A]=(0,w.useState)(!1),[ne,re]=(0,w.useState)(new Set),[M,P]=(0,w.useState)(null),ie=(0,w.useRef)(null),[ae,F]=(0,w.useState)(null),I=(0,w.useCallback)(async e=>{p(!0),h(null),y(null),_(``),x([]);try{let t=await ar(e);a(t.current_path),s(t.parent_path),l(t.entries),t.quick_links.length>0&&d(t.quick_links),U.ui.info(`Browsing: ${t.current_path} (${t.entries.length} items)`)}catch(e){let t=e instanceof Error?e.message:`Failed to load directory`;h(t),U.ui.error(`Browse failed`,e)}finally{p(!1)}},[]);(0,w.useEffect)(()=>{I()},[I]),(0,w.useEffect)(()=>()=>{ie.current&&clearTimeout(ie.current)},[]);let oe=(0,w.useCallback)(async()=>{if(!g.trim()){y(null),x([]);return}C(!0),h(null);try{let e=await lr(g.trim(),T||void 0,30);y(e.results),x(e.searched_locations??[]),U.ui.info(`Search "${g}": ${e.total} results`)}catch(e){let t=e instanceof Error?e.message:`Search failed`;h(t),U.ui.error(`Search failed`,e)}finally{C(!1)}},[g,T]),ce=e=>{e.key===`Enter`&&oe()},L=(0,w.useCallback)(e=>{e.type===`folder`&&(I(e.path),O(new Set),ee(null))},[I]),R=(0,w.useCallback)(async e=>{A(!0);try{let t=await ur(e);ee(t)}catch(e){U.ui.error(`Preview failed`,e)}finally{A(!1)}},[]),le=(0,w.useCallback)(e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),z=(0,w.useCallback)(async()=>{if(D.size===0)return;let e=Array.from(D);if(F(null),!e.some(e=>{let t=e.includes(`.`)?`.`+e.split(`.`).pop()?.toLowerCase():``;return!t||ah(t)})){let t=e[0],n=t.lastIndexOf(`.`),r=n>0?t.slice(n).toLowerCase():``,i=rh(r);F({filename:e.length===1?t.split(/[\\/]/).pop()||t:`${e.length} files`,error:i?i.message:`File type "${r}" is not supported for indexing.`});return}re(new Set(e)),P(`Indexing ${e.length} file(s)...`);try{let r=await gg(e,c,t,n);if(r.failed>0)P(`Done: ${r.docIds.length} indexed, ${r.failed} failed`),F({filename:`${r.failed} file(s)`,error:r.lastError||`Indexing failed for some files`});else{let e=r.unsupported.length>0?` (${r.unsupported.length} skipped — unsupported type)`:``;P(`Successfully indexed ${r.docIds.length} file(s)${e}`)}ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>P(null),5e3),O(new Set)}catch(t){U.doc.error(`Index selected failed`,t),F({filename:e.length===1?e[0].split(/[\\/]/).pop()||e[0]:`${e.length} files`,error:t instanceof Error?t.message:`An unexpected error occurred.`})}finally{re(new Set)}},[D,t,n,c]),ue=(0,w.useCallback)(async()=>{if(D.size===0)return;let i=Array.from(D);F(null),re(new Set(i)),P(`Indexing ${i.length} file(s) for analysis...`);try{let a=await gg(i,c,t,n);if(a.supported.length===0){let e=i[0].lastIndexOf(`.`),t=e>0?i[0].slice(e).toLowerCase():``,n=rh(t);F({filename:i.length===1?i[0].split(/[\\/]/).pop()||i[0]:`${i.length} files`,error:n?.message??`File type "${t}" is not supported for indexing.`});return}if(a.docIds.length===0){F({filename:a.supported.length===1?a.supported[0].split(/[\\/]/).pop()||a.supported[0]:`${a.supported.length} files`,error:`Failed to index selected file(s). Please try again.`});return}a.failed>0&&P(`Warning: ${a.failed} file(s) failed to index and will be excluded.`);let o=(a.succeededFiles.length>0?a.succeededFiles:a.supported).map(e=>e.split(/[\\/]/).pop()||e),s=o.length===1?`Please analyze this document for me: ${o[0]}`:`Please analyze these documents for me:\n${o.map(e=>`- ${e}`).join(`
|
|
58
|
+
`),"aria-label":Th(x)})]}),(0,K.jsx)(`p`,{className:`agent-hub-card-desc`,children:e.description||`Custom agent`}),(0,K.jsxs)(`div`,{className:`agent-hub-card-meta`,children:[p&&(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(_e,{size:12}),p]}),m>0&&(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(Pt,{size:12}),m,` tools`]}),d&&e.download_size_bytes!=null?(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(be,{size:12}),Sh(e.download_size_bytes)]}):g.length>0?(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(vt,{size:12}),g.map(e=>e.connector_id).join(`, `)]}):(0,K.jsxs)(`span`,{className:`agent-hub-card-meta-item`,children:[(0,K.jsx)(vt,{size:12}),`No special permissions`]})]}),!d&&E.length>0&&(0,K.jsxs)(`div`,{className:`agent-hub-card-device`,children:[O?(0,K.jsx)(`select`,{className:`agent-hub-device-select`,"aria-label":`Device for ${e.name}`,value:C,onChange:e=>{e.stopPropagation(),w(e.target.value)},onClick:e=>e.stopPropagation(),children:E.map(e=>(0,K.jsxs)(`option`,{value:e.device,children:[Ah[e.device]??e.device.toUpperCase(),e.verified?``:` ⚠`]},e.device))}):(0,K.jsx)(`span`,{className:`agent-hub-device-label`,children:Ah[E[0].device]??E[0].device.toUpperCase()}),D&&(0,K.jsx)(`span`,{className:`agent-hub-device-verified ${D.verified?`verified`:`unverified`}`,children:D.verified?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(z,{size:11}),` Verified`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(At,{size:11}),` Unverified`]})})]}),A&&(0,K.jsxs)(`div`,{className:`agent-hub-card-tier`,children:[(0,K.jsx)(_e,{size:12}),(0,K.jsx)(`select`,{className:`agent-hub-tier-select`,"aria-label":`Model size for ${e.name}`,value:k,onChange:e=>{e.stopPropagation(),ee(e.target.value)},onClick:e=>e.stopPropagation(),children:te.map(e=>(0,K.jsx)(`option`,{value:e.name,children:e.label},e.name))})]}),!d&&h&&(0,K.jsx)(`div`,{className:`agent-hub-card-starter`,children:h}),v&&(0,K.jsxs)(`div`,{className:`agent-install-progress`,children:[(0,K.jsxs)(`div`,{className:`agent-install-progress-head`,children:[(0,K.jsx)(`span`,{children:jh[s.state]??`Installing…`}),(0,K.jsxs)(`span`,{children:[Math.round(s.progress),`%`]})]}),(0,K.jsx)(`div`,{className:`agent-install-bar`,role:`progressbar`,"aria-valuenow":Math.round(s.progress),"aria-valuemin":0,"aria-valuemax":100,children:(0,K.jsx)(`div`,{className:`agent-install-bar-fill`,style:{width:`${Math.max(2,s.progress)}%`}})})]}),y&&(0,K.jsxs)(`div`,{className:`agent-install-error`,role:`alert`,children:[(0,K.jsx)(At,{size:12}),(0,K.jsx)(`span`,{children:s?.error||`Install failed.`})]}),(0,K.jsxs)(`div`,{className:`agent-hub-card-actions`,children:[d?re:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{className:`btn-start-chat`,disabled:!f,title:f?`Start chat with ${e.name}`:`Available in GAIA Desktop`,onClick:t=>{t.stopPropagation(),a(e.id)},children:`Start Chat`}),(b||v||y)&&(c||l)&&re]}),(0,K.jsx)(`button`,{className:`btn-details`,onClick:t=>{t.stopPropagation(),o(e)},children:`Details`}),!d&&u&&e.source===`installed`&&(0,K.jsx)(`button`,{className:`btn-uninstall`,title:`Uninstall ${e.name}`,"aria-label":`Uninstall ${e.name}`,onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,K.jsx)(Ot,{size:14})})]})]})}var Nh=typeof window<`u`&&!!window.electronAPI,Ph={verified:{Icon:z,label:`Verified`},community:{Icon:vt,label:`Community`},experimental:{Icon:Oe,label:`Experimental`}};function Fh(e){let t=e?Ph[e]:void 0;if(!t)return null;let{Icon:n,label:r}=t;return(0,K.jsxs)(`span`,{className:`agent-badge agent-badge-tier-${e}`,title:`${r} security tier`,children:[(0,K.jsx)(n,{size:10}),` `,r]})}function Ih({agent:e,onClose:t,onStartChat:n}){let r=e.required_connections??[],i=e.tags??[],a=e.conversation_starters??[],o=e.models??[],s=e.tools_count??0,c=e.source!==`native`||Nh,l=jr(e.icon),u=!!e.version||o.length>0||s>0||e.min_memory_gb!=null,d=(0,w.useCallback)(e=>{e.key===`Escape`&&t()},[t]);return(0,w.useEffect)(()=>(document.addEventListener(`keydown`,d),()=>document.removeEventListener(`keydown`,d)),[d]),(0,K.jsx)(`div`,{className:`agent-detail-overlay`,onClick:t,children:(0,K.jsxs)(`div`,{className:`agent-detail-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agent-detail-title`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`agent-detail-header`,children:[(0,K.jsx)(`div`,{className:`agent-detail-icon`,children:(0,K.jsx)(l,{size:24})}),(0,K.jsxs)(`div`,{className:`agent-detail-title-area`,children:[(0,K.jsx)(`h2`,{id:`agent-detail-title`,className:`agent-detail-name`,children:e.name}),(0,K.jsxs)(`div`,{className:`agent-hub-card-badges`,children:[e.source===`builtin`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-builtin`,children:`Built-in`}),e.source===`native`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-native`,children:`Native`}),e.source===`custom_python`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-custom`,children:`Custom`}),e.source===`installed`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-installed`,children:`Installed`}),Fh(e.security_tier),e.deprecated&&(0,K.jsxs)(`span`,{className:`agent-badge agent-badge-deprecated`,title:`Deprecated by the publisher — may be unmaintained`,children:[(0,K.jsx)(At,{size:10}),` Deprecated`]}),e.language&&e.language!==`python`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-native`,children:e.language.toUpperCase()}),e.category&&e.category!==`general`&&(0,K.jsx)(`span`,{className:`agent-badge agent-badge-category`,children:e.category})]})]}),(0,K.jsx)(`button`,{className:`agent-detail-close`,onClick:t,"aria-label":`Close`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`agent-detail-body`,children:[(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`About`}),(0,K.jsx)(`p`,{className:`agent-detail-desc`,children:e.description||`No description available.`})]}),u&&(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Details`}),(0,K.jsxs)(`div`,{className:`agent-detail-meta-grid`,children:[e.version&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(Tt,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Version`}),(0,K.jsx)(`div`,{className:`agent-detail-meta-value`,children:e.version})]})]}),o.length>0&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(_e,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Model`}),(0,K.jsx)(`div`,{className:`agent-detail-meta-value`,children:o[0]})]})]}),s>0&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(Pt,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Tools`}),(0,K.jsx)(`div`,{className:`agent-detail-meta-value`,children:s})]})]}),e.min_memory_gb!=null&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(Fe,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Min Memory`}),(0,K.jsxs)(`div`,{className:`agent-detail-meta-value`,children:[e.min_memory_gb,` GB`]})]})]}),o.length>1&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(_e,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Fallback`}),(0,K.jsx)(`div`,{className:`agent-detail-meta-value`,children:o[1]})]})]})]})]}),(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Access Rights`}),r.length>0?(0,K.jsx)(`div`,{className:`agent-detail-permissions`,children:r.map((e,t)=>(0,K.jsxs)(`div`,{className:`agent-detail-permission`,children:[(0,K.jsx)(vt,{size:14}),(0,K.jsx)(`span`,{children:e.connector_id}),e.reason&&(0,K.jsxs)(`span`,{style:{color:`var(--text-muted)`,fontSize:12},children:[` — `,e.reason]})]},t))}):(0,K.jsx)(`p`,{className:`agent-detail-no-permissions`,children:`No special permissions required.`})]}),i.length>0&&(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Tags`}),(0,K.jsx)(`div`,{className:`agent-detail-tags`,children:i.map(e=>(0,K.jsx)(`span`,{className:`agent-detail-tag`,children:e},e))})]}),e.eval_score!=null&&(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Eval scorecard`}),(0,K.jsxs)(`div`,{className:`agent-detail-meta-item`,children:[(0,K.jsx)(ae,{size:14}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`agent-detail-meta-label`,children:`Eval score`}),(0,K.jsxs)(`div`,{className:`agent-detail-meta-value`,children:[e.eval_score,` / 100`,e.eval_scorecard_url&&(0,K.jsxs)(K.Fragment,{children:[` — `,(0,K.jsx)(`a`,{href:e.eval_scorecard_url,target:`_blank`,rel:`noopener noreferrer`,style:{color:`var(--accent)`,textDecoration:`underline`,fontSize:12},children:`View scorecard`})]})]}),e.eval_score_version&&(0,K.jsxs)(`div`,{className:`agent-detail-meta-label`,style:{marginTop:2},children:[`measured on v`,e.eval_score_version,e.version&&e.version!==e.eval_score_version&&(0,K.jsxs)(K.Fragment,{children:[` (current: v`,e.version,`)`]})]})]})]})]}),a.length>0&&(0,K.jsxs)(`div`,{className:`agent-detail-section`,children:[(0,K.jsx)(`div`,{className:`agent-detail-section-title`,children:`Try asking`}),(0,K.jsx)(`div`,{className:`agent-detail-starters`,children:a.map(r=>(0,K.jsx)(`button`,{className:`agent-detail-starter-chip`,disabled:!c,title:c?void 0:`Available in GAIA Desktop`,onClick:()=>{n(e.id,r),t()},children:r},r))})]})]})]})})}var Lh={verified:`AMD Verified`,community:`Community`,experimental:`Experimental`};function Rh({agent:e,gate:t,onConfirm:n,onCancel:r}){let[i,a]=(0,w.useState)(!1),o=!t.requiresOverride||i,s=(0,w.useCallback)(e=>{e.key===`Escape`&&r()},[r]);(0,w.useEffect)(()=>(document.addEventListener(`keydown`,s),()=>document.removeEventListener(`keydown`,s)),[s]);let c=t.tier===`verified`?V:gt;return(0,K.jsx)(`div`,{className:`agent-detail-overlay`,onClick:r,children:(0,K.jsxs)(`div`,{className:`agent-detail-modal trust-gate-modal`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`trust-gate-title`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`agent-detail-header`,children:[(0,K.jsx)(`div`,{className:`agent-detail-icon trust-gate-icon trust-gate-icon-${t.tier}`,children:(0,K.jsx)(c,{size:24})}),(0,K.jsxs)(`div`,{className:`agent-detail-title-area`,children:[(0,K.jsxs)(`h2`,{id:`trust-gate-title`,className:`agent-detail-name`,children:[`Install `,e.name,`?`]}),(0,K.jsxs)(`p`,{className:`trust-gate-subtitle`,children:[(0,K.jsx)(`span`,{className:`trust-gate-tier-badge trust-gate-tier-${t.tier}`,children:Lh[t.tier]}),e.latest_version?` · v${e.latest_version}`:``]})]}),(0,K.jsx)(`button`,{className:`agent-detail-close`,onClick:r,"aria-label":`Cancel`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`agent-detail-body`,children:[t.reasons.length>0&&(0,K.jsx)(`ul`,{className:`trust-gate-reasons`,"aria-label":`Trust warnings`,children:t.reasons.map(e=>(0,K.jsxs)(`li`,{className:`trust-gate-reason`,children:[(0,K.jsx)(gt,{size:15,className:`trust-gate-reason-icon`}),(0,K.jsx)(`span`,{children:e})]},e))}),(0,K.jsxs)(`div`,{className:`trust-gate-section`,children:[(0,K.jsxs)(`div`,{className:`trust-gate-section-title`,children:[(0,K.jsx)(ze,{size:14}),` Permissions`]}),t.permissions.length>0?(0,K.jsx)(`ul`,{className:`trust-gate-perm-list`,children:t.permissions.map(e=>(0,K.jsx)(`li`,{className:`trust-gate-perm`,children:(0,K.jsx)(`code`,{children:e})},e))}):(0,K.jsx)(`p`,{className:`trust-gate-empty`,children:`No special permissions declared.`})]}),(0,K.jsxs)(`div`,{className:`trust-gate-section`,children:[(0,K.jsxs)(`div`,{className:`trust-gate-section-title`,children:[(0,K.jsx)(Xe,{size:14}),` Requirements`]}),t.platforms.length>0?(0,K.jsxs)(`p`,{className:`trust-gate-requirements`,children:[`Platforms: `,t.platforms.join(`, `)]}):(0,K.jsx)(`p`,{className:`trust-gate-empty`,children:`No platform restrictions.`})]}),t.requiresOverride&&(0,K.jsxs)(`label`,{className:`trust-gate-ack`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked),"aria-label":`I understand and want to install this agent`}),(0,K.jsx)(`span`,{children:`I understand this agent isn't AMD-verified and I want to install it anyway.`})]}),(0,K.jsxs)(`div`,{className:`trust-gate-actions`,children:[(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:r,children:`Cancel`}),(0,K.jsxs)(`button`,{className:`btn-install trust-gate-proceed`,onClick:()=>n(t.trustNative),disabled:!o,title:o?void 0:`Acknowledge the warning above to enable install`,children:[(0,K.jsx)(be,{size:14}),` `,t.requiresOverride?`Trust & Install`:`Install`]})]})]})]})})}var zh=[{key:`app`,title:`Apps`,subtitle:`Full experiences you can launch`},{key:`component`,title:`Components`,subtitle:`Reusable building blocks`},{key:`agent`,title:`Agents`,subtitle:`Task-focused AI agents`},{key:`skill`,title:`Skills`,subtitle:`Capabilities any agent can compose`}],Bh=[`app`,`component`,`agent`,`skill`];function Vh(e){return Bh.includes(e.type)?e.type:`agent`}function Hh(e){let t={app:[],component:[],agent:[],skill:[]};for(let n of e)t[Vh(n)].push(n);return t}function Uh(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.name.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)||(e.category??``).toLowerCase().includes(n)||(e.tags??[]).some(e=>e.toLowerCase().includes(n))):e}function Wh(e){let t=e.security_tier;return t===`verified`||t===`community`?t:`experimental`}function Gh(e){let t=Wh(e),n=e.language===`cpp`&&t!==`verified`,r=[];t!==`verified`&&r.push(t===`community`?`Community-published — not audited by AMD.`:`Experimental — unreviewed and may be unstable.`),n&&r.push(`Ships a native binary that runs on your machine without sandboxing.`),e.deprecated&&r.push(`Deprecated by the publisher — may be unmaintained or superseded.`);let i=t!==`verified`||n||!!e.deprecated;return{tier:t,requiresOverride:i,trustNative:i,permissions:e.permissions??[],platforms:e.requirements?.platforms??[],reasons:r}}var Kh=typeof window<`u`&&!!window.electronAPI,qh=1200;function Jh({agents:e,activeAgentId:t,onSelect:n,onStartChat:r,onCreateAgent:i}){let[a,o]=(0,w.useState)(``),[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)([]),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(!1),[y,b]=(0,w.useState)({}),x=(0,w.useRef)({}),S=H(e=>e.activeDevice),C=H(e=>e.setAgents),T=H(e=>e.agentsError),E=(0,w.useCallback)(async()=>{v(!0),g(null);try{let e=await fn();f(e.agents||[]),m(!!e.offline)}catch(e){let t=e instanceof Error?e.message:`Could not load the agent catalog.`;U.api.warn(`[HubPage] catalog fetch failed`,e),g(t)}finally{v(!1)}},[]);(0,w.useEffect)(()=>{E()},[E]);let D=(0,w.useCallback)(async()=>{try{let e=await un();C(e.agents||[])}catch(e){U.api.warn(`[HubPage] agent list refresh failed`,e)}},[C]),O=(0,w.useCallback)(e=>{let t=x.current[e];t&&(clearInterval(t),delete x.current[e])},[]),k=(0,w.useCallback)(e=>{O(e),x.current[e]=setInterval(async()=>{try{let t=await mn(e);b(n=>({...n,[e]:t})),t.state===`installed`?(O(e),await E(),await D()):t.state===`failed`&&O(e)}catch(t){O(e);let n=t instanceof Error?t.message:`Install status check failed.`;b(t=>({...t,[e]:{agent_id:e,state:`failed`,progress:0,error:n}}))}},qh)},[O,E,D]);(0,w.useEffect)(()=>()=>{Object.values(x.current).forEach(clearInterval),x.current={}},[]);let ee=(0,w.useCallback)(async(e,t)=>{b(t=>({...t,[e]:{agent_id:e,state:`downloading`,progress:0}}));try{let n=await pn(e,S,t);b(t=>({...t,[e]:n})),n.state===`installed`?(await E(),await D()):n.state===`failed`||k(e)}catch(t){let n=t instanceof Error?t.message:`Install failed.`;b(t=>({...t,[e]:{agent_id:e,state:`failed`,progress:0,error:n}}))}},[S,k,E,D]),te=(0,w.useCallback)(t=>{let n=d.find(e=>e.id===t)??e.find(e=>e.id===t);n&&u({agent:n,gate:Gh(n)})},[d,e]),A=(0,w.useCallback)(e=>{if(!l)return;let t=l.agent.id;u(null),ee(t,e)},[l,ee]),j=(0,w.useCallback)(async e=>{O(e);try{await hn(e),b(t=>{let n={...t};return delete n[e],n}),await E()}catch(t){let n=t instanceof Error?t.message:`Cancel failed.`;b(t=>({...t,[e]:{agent_id:e,state:`failed`,progress:0,error:`Cancel failed: ${n}`}}))}},[O,E]),ne=(0,w.useCallback)(async t=>{let n=e.find(e=>e.id===t)?.name??t;if(window.confirm(`Uninstall ${n}? You can reinstall it from the hub.`))try{await hn(t),await D(),await E()}catch(e){U.api.warn(`[HubPage] uninstall failed`,e),window.alert(e instanceof Error?e.message:`Uninstall failed.`)}},[e,D,E]),re=(0,w.useMemo)(()=>Eh(e,d),[e,d]),M=(0,w.useMemo)(()=>Uh(re,a),[re,a]),N=(0,w.useMemo)(()=>new Set(e.map(e=>e.id)),[e]),P=(0,w.useMemo)(()=>d.filter(e=>e.status===`available`&&!N.has(e.id)),[d,N]),ie=(0,w.useMemo)(()=>Uh(P,a),[P,a]),ae=(0,w.useMemo)(()=>Hh(ie),[ie]),F=ie.length;return(0,K.jsxs)(`div`,{className:`agent-hub hub-page`,children:[(0,K.jsxs)(`div`,{className:`agent-hub-header hub-page-header`,children:[(0,K.jsxs)(`div`,{className:`hub-page-title-area`,children:[(0,K.jsx)(`h1`,{className:`hub-page-title`,children:`Agent Hub`}),(0,K.jsx)(`p`,{className:`hub-page-subtitle`,children:`Browse and install apps, components, and agents.`})]}),(0,K.jsx)(`div`,{className:`agent-hub-controls`,children:(0,K.jsxs)(`div`,{className:`agent-hub-search`,children:[(0,K.jsx)(pt,{size:14}),(0,K.jsx)(`input`,{type:`text`,placeholder:`Search the hub...`,"aria-label":`Search the hub`,value:a,onChange:e=>o(e.target.value)})]})})]}),T&&(0,K.jsxs)(`div`,{className:`agent-hub-banner agent-hub-banner-error`,role:`alert`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsxs)(`span`,{children:[`Couldn’t load installed agents: `,T]}),(0,K.jsxs)(`button`,{className:`agent-hub-retry`,onClick:D,children:[(0,K.jsx)(ft,{size:13}),` Retry`]})]}),p&&(0,K.jsxs)(`div`,{className:`agent-hub-banner agent-hub-banner-offline`,role:`status`,children:[(0,K.jsx)(Nt,{size:14}),(0,K.jsx)(`span`,{children:`Showing cached catalog — the Agent Hub is currently unreachable.`})]}),_&&d.length===0&&(0,K.jsxs)(`div`,{className:`agent-hub-loading`,children:[(0,K.jsx)(`div`,{className:`agent-hub-spinner`}),(0,K.jsx)(`span`,{children:`Loading catalog…`})]}),h&&d.length===0&&!_&&(0,K.jsxs)(`div`,{className:`agent-hub-banner agent-hub-banner-error`,role:`alert`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsx)(`span`,{children:h}),(0,K.jsxs)(`button`,{className:`agent-hub-retry`,onClick:E,children:[(0,K.jsx)(ft,{size:13}),` Retry`]})]}),(M.length>0||i)&&(0,K.jsxs)(`section`,{className:`hub-lane`,"aria-label":`Installed`,children:[(0,K.jsxs)(`div`,{className:`hub-lane-header`,children:[(0,K.jsxs)(`h2`,{className:`hub-lane-title`,children:[`Installed `,(0,K.jsx)(`span`,{className:`hub-lane-count`,children:M.length})]}),(0,K.jsx)(`span`,{className:`hub-lane-subtitle`,children:`Agents ready to use`})]}),(0,K.jsxs)(`div`,{className:`agent-hub-grid hub-lane-grid`,children:[M.map(e=>(0,K.jsx)(Mh,{agent:e,variant:`installed`,isActive:e.id===t,isElectron:Kh,onSelect:n,onStartChat:e=>r(e),onViewDetails:c,installStatus:y[e.id],onInstall:te,onCancelInstall:j,onUninstall:ne},e.id)),i&&(0,K.jsxs)(`div`,{className:`agent-hub-card create-new`,role:`button`,tabIndex:0,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,K.jsx)(`div`,{className:`create-icon`,children:(0,K.jsx)(lt,{size:22})}),(0,K.jsxs)(`div`,{className:`create-title`,children:[`Build a Custom Agent Template`,` `,(0,K.jsx)(`span`,{className:`create-alpha-badge`,children:`Alpha`})]}),(0,K.jsx)(`div`,{className:`create-desc`,children:`Create a new agent through conversation`})]})]})]}),!_&&!h&&F===0&&M.length===0&&(0,K.jsxs)(`div`,{className:`agent-hub-empty`,children:[(0,K.jsx)($e,{size:28,strokeWidth:1.5}),(0,K.jsx)(`p`,{children:a?`No hub items match your search.`:`All catalog items are installed.`})]}),!h&&zh.map(e=>{let i=ae[e.key];return i.length===0?null:(0,K.jsxs)(`section`,{className:`hub-lane`,"aria-label":e.title,children:[(0,K.jsxs)(`div`,{className:`hub-lane-header`,children:[(0,K.jsxs)(`h2`,{className:`hub-lane-title`,children:[e.title,` `,(0,K.jsx)(`span`,{className:`hub-lane-count`,children:i.length})]}),(0,K.jsx)(`span`,{className:`hub-lane-subtitle`,children:e.subtitle})]}),(0,K.jsx)(`div`,{className:`agent-hub-grid hub-lane-grid`,children:i.map(e=>(0,K.jsx)(Mh,{agent:e,variant:`available`,isActive:e.id===t,isElectron:Kh,onSelect:n,onStartChat:e=>r(e),onViewDetails:c,installStatus:y[e.id],onInstall:te,onCancelInstall:j},e.id))})]},e.key)}),s&&(0,K.jsx)(Ih,{agent:s,onClose:()=>c(null),onStartChat:r}),l&&(0,K.jsx)(Rh,{agent:l.agent,gate:l.gate,onConfirm:A,onCancel:()=>u(null)})]})}function Yh(e){return e!==null&&e.lemonade_running&&!!e.model_loaded}function Xh(e){return e!==null&&!e.initialized&&!Yh(e)}function Zh(e){return!Xh(e)&&e!==null&&e.lemonade_running&&!e.model_loaded}var Qh=`GAIA`,$h=`Your private AI assistant, running 100% locally on AMD Ryzen AI`,eg=65,tg=350;function ng(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}var rg=[`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 ig({onNewTask:e,onSendPrompt:t,onCreateAgent:n}){let{systemStatus:r,agents:i,activeAgentId:a,setActiveAgentId:o}=H(),s=(0,w.useMemo)(()=>{let e=i.find(e=>e.id===a);return e?.conversation_starters?.length?e.conversation_starters:rg},[i,a]),[c,l]=(0,w.useState)(``),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(`title`),[v,y]=(0,w.useState)(!1),b=r?.init_state===`initializing`,x=Xh(r),S=Zh(r);return(0,w.useEffect)(()=>{let e=0,t=setInterval(()=>{e++,e<=4?l(Qh.slice(0,e)):(clearInterval(t),d(!0))},eg);return()=>clearInterval(t)},[]),(0,w.useEffect)(()=>{if(!u)return;let e=!1,t=setTimeout(()=>{if(e)return;_(`subtitle`);let t=0,r=()=>{if(!e){if(t++,t<=63){p($h.slice(0,t));let e=$h[t-1],i=ng(e,t>1?$h[t-2]:``);n.current=setTimeout(r,i)}else h(!0),_(`done`)}};r()},tg),n={current:null};return()=>{e=!0,clearTimeout(t),n.current&&clearTimeout(n.current)}},[u]),(0,w.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>y(!0),200);return()=>clearTimeout(e)},[m]),(0,K.jsx)(`main`,{className:`welcome`,children:(0,K.jsxs)(`div`,{className:`welcome-inner ${v?`content-revealed`:``}`,children:[(0,K.jsxs)(`h1`,{className:`welcome-title${u?` typing-done`:``}`,children:[c.length>=4?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`gaia-glow`,children:c.slice(0,4)}),(0,K.jsx)(`span`,{children:c.slice(4)})]}):c,g===`title`&&(0,K.jsx)(`span`,{className:`terminal-cursor${u?` blink`:``}`})]}),(0,K.jsx)(`p`,{className:`welcome-sub`,children:(0,K.jsxs)(`span`,{className:`typewriter-text`,children:[f,(g===`subtitle`||g===`done`)&&(0,K.jsx)(`span`,{className:`terminal-cursor terminal-cursor-sub${g===`done`?` blink`:``}`})]})}),(0,K.jsxs)(`span`,{className:`welcome-version`,children:[`v`,`0.24.1`,` `,(0,K.jsx)(`span`,{className:`beta-badge`,children:`BETA`})]}),(0,K.jsxs)(`div`,{className:`features`,children:[(0,K.jsx)(ag,{icon:(0,K.jsx)(Ge,{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.`}),(0,K.jsx)(ag,{icon:(0,K.jsx)(It,{size:22}),title:`Fast`,desc:`NPU acceleration`,codeHint:`> npu.accelerate()`,expandedDesc:`Hardware-accelerated with AMD Ryzen AI NPU for real-time local inference.`}),(0,K.jsx)(ag,{icon:(0,K.jsx)(Ee,{size:22}),title:`Smart`,desc:`Document Q&A`,codeHint:`> rag.query("...")`,expandedDesc:`RAG-powered document Q&A — index files and chat with their contents.`}),(0,K.jsx)(ag,{icon:(0,K.jsx)(ye,{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&&(0,K.jsx)(Jh,{agents:i,activeAgentId:a,onSelect:o,onStartChat:(n,r)=>{o(n),r?t(r):e()},onCreateAgent:n}),x&&(0,K.jsxs)(`div`,{className:`welcome-setup-hint`,children:[(0,K.jsx)(Dt,{size:14}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:`First time?`}),` Run `,(0,K.jsx)(`code`,{children:`gaia init`}),` in a terminal to install Lemonade Server and download the required AI model`,r?.default_model_size_gb?` (~${r.default_model_size_gb.toFixed(1)} GB).`:`.`]})]}),!x&&S&&(0,K.jsxs)(`div`,{className:`welcome-setup-hint`,children:[(0,K.jsx)(Dt,{size:14}),(0,K.jsxs)(`span`,{children:[`No model loaded. Run `,(0,K.jsx)(`code`,{children:`gaia init`}),` to download`,r?.default_model_size_gb?` (~${r.default_model_size_gb.toFixed(1)} GB).`:`.`]})]}),(0,K.jsx)(`div`,{className:`welcome-actions`,children:(0,K.jsx)(`button`,{className:`btn-primary start-btn`,onClick:e,disabled:b,children:`Start a New Task`})}),(0,K.jsxs)(`div`,{className:`suggestions`,children:[(0,K.jsx)(`span`,{className:`suggestions-label`,children:`Try asking:`}),(0,K.jsx)(`div`,{className:`suggestion-chips`,children:s.map(e=>(0,K.jsx)(`button`,{className:`chip`,onClick:()=>t(e),disabled:b,children:e},e))})]}),(0,K.jsx)(`p`,{className:`welcome-copyright`,children:`© 2025–2026 Advanced Micro Devices, Inc. All rights reserved.`})]})})}function ag({icon:e,title:t,desc:n,expandedDesc:r,codeHint:i}){let[a,o]=(0,w.useState)(`idle`),[s,c]=(0,w.useState)(i),[l,u]=(0,w.useState)(``),d=(0,w.useRef)(null);return(0,w.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]),(0,K.jsxs)(`div`,{className:`feature-card ${a===`idle`?``:`feature-hovered`}`,onMouseEnter:()=>{o(`erasing`),u(``);let e=i.length,t=()=>{if(e--,e>=0)c(i.slice(0,e)),d.current=setTimeout(t,15+Math.random()*20);else{o(`typing`),c(``);let e=0,t=()=>{if(e++,e<=r.length){u(r.slice(0,e));let n=r[e-1],i=e>1?r[e-2]:``;d.current=setTimeout(t,ng(n,i))}else o(`done`)};t()}};t()},onMouseLeave:()=>{d.current&&clearTimeout(d.current),o(`idle`),c(i),u(``)},children:[(0,K.jsx)(`div`,{className:`feature-icon`,children:e}),(0,K.jsx)(`h3`,{children:t}),(0,K.jsx)(`p`,{children:n}),(0,K.jsxs)(`div`,{className:`feature-terminal`,children:[a===`idle`&&(0,K.jsx)(`span`,{className:`feature-code-hint`,children:i}),a===`erasing`&&(0,K.jsxs)(`span`,{className:`feature-inline`,children:[(0,K.jsx)(`span`,{className:`feature-code-hint feature-code-erasing`,children:s}),(0,K.jsx)(`span`,{className:`terminal-cursor terminal-cursor-sm`})]}),(a===`typing`||a===`done`)&&(0,K.jsxs)(`span`,{className:`feature-inline`,children:[(0,K.jsx)(`span`,{className:`feature-expanded-text`,children:l}),(0,K.jsx)(`span`,{className:`terminal-cursor terminal-cursor-sm${a===`done`?` blink`:``}`})]})]})]})}function og(e){let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function sg(e){try{let t=new Date(e);if(isNaN(t.getTime()))return``;let n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i}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 cg(e){try{let 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 lg(){let{documents:e,setDocuments:t,setShowDocLibrary:n,setShowFileBrowser:r,currentSessionId:i,sessions:a,updateSessionInList:o}=H(),s=a.find(e=>e.id===i)??null,[c,l]=(0,w.useState)(!1),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(``),[g,_]=(0,w.useState)(null),[v,y]=(0,w.useState)(new Set),b=(0,w.useRef)(new Map),[,x]=(0,w.useState)(0);(0,w.useEffect)(()=>{U.doc.info(`Loading document library...`);let e=U.doc.time();Xn().then(n=>{let r=n.documents||[];t(r),U.doc.timed(`Loaded ${r.length} document(s), ${n.total_chunks||0} chunks, ${n.total_size_bytes||0} bytes total`,e)}).catch(e=>{U.doc.error(`Failed to load documents`,e),t([])})},[t]);let S=e.some(e=>e.indexing_status===`indexing`||e.indexing_status===`pending`);(0,w.useEffect)(()=>{if(!S)return;let e=H.getState().documents;for(let t of e)(t.indexing_status===`indexing`||t.indexing_status===`pending`)&&!b.current.has(t.id)&&b.current.set(t.id,Date.now());let n=!1,r=setInterval(async()=>{if(x(e=>e+1),!n){n=!0;try{let e=H.getState().documents.filter(e=>e.indexing_status===`indexing`||e.indexing_status===`pending`);for(let n of e)try{let e=await er(n.id);if(e.indexing_status!==`indexing`&&e.indexing_status!==`pending`){b.current.delete(n.id);let e=await Xn();t(e.documents||[]);break}}catch{}}finally{n=!1}}},2e3);return()=>clearInterval(r)},[S,t]),(0,w.useEffect)(()=>{let t=new Set(e.filter(e=>e.indexing_status===`indexing`||e.indexing_status===`pending`).map(e=>e.id));for(let e of b.current.keys())t.has(e)||b.current.delete(e)},[e]),(0,w.useEffect)(()=>{let e=setInterval(async()=>{try{let e=(await Xn()).documents||[],n=H.getState().documents;(e.length!==n.length||e.some((e,t)=>{let r=n.find(t=>t.id===e.id);return!r||r.indexing_status!==e.indexing_status||r.indexed_at!==e.indexed_at||r.chunk_count!==e.chunk_count}))&&(t(e),U.doc.debug(`Document list refreshed (server-side changes detected)`))}catch{}},15e3);return()=>clearInterval(e)},[t]);let C=e.reduce((e,t)=>e+t.file_size,0),T=e.reduce((e,t)=>e+t.chunk_count,0),E=e=>{if(e<=0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/t**r).toFixed(1))+` `+n[r]},D=(0,w.useCallback)(async(e,n)=>{let r=e.includes(`.`)?`.`+e.split(`.`).pop()?.toLowerCase():``;if(r&&!ah(r)){let t=rh(r),n=t?t.message:`The file type "${r}" is not supported for indexing.`;U.doc.warn(`Unsupported file type: ${e} (${r})`),_({filename:e,error:n});return}U.doc.info(`Indexing document: ${e}`);let a=U.doc.time();d(!0),p(`Indexing ${e}...`),_(null);try{let r=await n();if(U.doc.timed(`Indexed "${e}": ${r?.chunk_count||`?`} chunks`,a),i&&r?.id)try{await rr(i,r.id);let t=H.getState().sessions.find(e=>e.id===i)?.document_ids??[];t.includes(r.id)||o(i,{document_ids:[...t,r.id]}),U.doc.info(`Auto-attached "${e}" to session ${i}`)}catch(e){U.doc.warn(`Could not attach document to session: ${e}`)}let s=await Xn();t(s.documents||[]),p(``)}catch(t){U.doc.error(`Failed to index "${e}"`,t);let n=t instanceof Error?t.message:`Upload failed`;_({filename:e,error:n}),p(``)}finally{d(!1)}},[i,o,t]),O=(0,w.useCallback)(async(e,t)=>{await D(t,()=>Zn(e))},[D]),k=(0,w.useCallback)(async e=>{await D(e.name,()=>Qn(e))},[D]),ee=(0,w.useCallback)(async e=>{e.preventDefault(),l(!1);let t=Array.from(e.dataTransfer.files);U.doc.info(`Dropped ${t.length} file(s) into Document Library`);for(let e of t)await k(e)},[k]),te=(0,w.useCallback)(async n=>{let r=e.find(e=>e.id===n);U.doc.info(`Deleting document: ${r?.filename||n}`);try{await $n(n),b.current.delete(n),t(e.filter(e=>e.id!==n)),U.doc.info(`Deleted document: ${r?.filename||n}`)}catch(e){U.doc.error(`Failed to delete document: ${r?.filename||n}`,e)}},[e,t]),A=(0,w.useCallback)(async(e,t)=>{U.doc.info(`Opening folder for: ${e}`);try{await sr(e,!0)}catch(e){U.doc.error(`Failed to open folder for: ${t}`,e)}},[]),j=(0,w.useCallback)(async n=>{let r=e.find(e=>e.id===n);U.doc.info(`Cancelling indexing for: ${r?.filename||n}`);try{await tr(n),b.current.delete(n);let e=await Xn();t(e.documents||[]),U.doc.info(`Cancelled indexing for: ${r?.filename||n}`)}catch(e){U.doc.error(`Failed to cancel indexing: ${r?.filename||n}`,e)}},[e,t]),ne=(0,w.useCallback)(async n=>{if(v.has(n))return;let r=e.find(e=>e.id===n);U.doc.info(`Reindexing document: ${r?.filename||n}`),y(e=>new Set(e).add(n));try{await nr(n),U.doc.info(`Reindex complete for: ${r?.filename||n}`)}catch(e){let t=e instanceof Error?e.message:String(e);U.doc.error(`Reindex failed for: ${r?.filename||n}`,e),_({filename:r?.filename||n,error:t})}finally{try{let e=await Xn();t(e.documents||[])}catch(e){U.doc.error(`Failed to refresh documents after reindex`,e)}y(e=>{let t=new Set(e);return t.delete(n),t})}},[e,t,v]),re=(0,w.useCallback)(async t=>{if(!i)return;let n=e.find(e=>e.id===t);U.doc.info(`Attaching document to session: ${n?.filename||t}`);try{await rr(i,t);let e=H.getState().sessions.find(e=>e.id===i)?.document_ids??[];e.includes(t)||o(i,{document_ids:[...e,t]}),U.doc.info(`Attached "${n?.filename||t}" to session ${i}`)}catch(e){U.doc.error(`Failed to attach document to session: ${n?.filename||t}`,e)}},[i,e,o]),M=(0,w.useCallback)(async e=>{e.preventDefault(),m.trim()&&(U.doc.info(`Indexing from path input: ${m.trim()}`),await O(m.trim(),m.trim().split(/[\\/]/).pop()||`file`),h(``))},[m,O]),N=e=>{let t=e.indexing_status||`complete`,n=b.current.get(e.id),r=e.indexed_at?sg(e.indexed_at):``,i=e.indexed_at?cg(e.indexed_at):``;switch(t){case`indexing`:case`pending`:return(0,K.jsxs)(`div`,{className:`doc-indexing-status`,children:[(0,K.jsxs)(`div`,{className:`doc-indexing-bar`,children:[(0,K.jsx)(`div`,{className:`doc-indexing-bar-track`,children:(0,K.jsx)(`div`,{className:`doc-indexing-bar-fill`})}),(0,K.jsxs)(`span`,{className:`doc-indexing-label`,children:[(0,K.jsx)(We,{size:12,className:`doc-spin`}),`Indexing`,n?` (${og(n)})`:`...`]})]}),(0,K.jsxs)(`button`,{className:`btn-cancel`,onClick:t=>{t.stopPropagation(),j(e.id)},title:`Cancel indexing`,"aria-label":`Cancel indexing ${e.filename}`,children:[(0,K.jsx)(ue,{size:14}),`Cancel`]})]});case`failed`:return(0,K.jsxs)(`div`,{className:`doc-indexing-status`,children:[(0,K.jsxs)(`span`,{className:`doc-status-badge doc-status-failed`,title:e.last_error||void 0,"aria-label":e.last_error?`Failed: ${e.last_error}`:`Indexing failed`,children:[(0,K.jsx)(L,{size:12}),` Failed`]}),(0,K.jsxs)(`button`,{className:`btn-retry`,onClick:t=>{t.stopPropagation(),ne(e.id)},title:`Retry indexing`,"aria-label":`Retry indexing ${e.filename}`,disabled:v.has(e.id),children:[(0,K.jsx)(dt,{size:14}),v.has(e.id)?`Retrying…`:`Retry`]})]});case`cancelled`:return(0,K.jsxs)(`span`,{className:`doc-status-badge doc-status-cancelled`,children:[(0,K.jsx)(ue,{size:12}),` Cancelled`]});case`missing`:return(0,K.jsxs)(`span`,{className:`doc-status-badge doc-status-missing`,children:[(0,K.jsx)(L,{size:12}),` File missing`]});default:return(0,K.jsxs)(`span`,{className:`doc-meta`,children:[E(e.file_size),` · `,e.chunk_count,` chunks`,r&&(0,K.jsxs)(`span`,{className:`doc-timestamp`,title:`Indexed: ${i}`,children:[(0,K.jsx)(pe,{size:10}),r]})]})}};return(0,K.jsx)(`div`,{className:`modal-overlay`,onClick:()=>n(!1),role:`dialog`,"aria-modal":`true`,"aria-label":`Document Library`,children:(0,K.jsxs)(`div`,{className:`modal-panel doc-modal`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`modal-header`,children:[(0,K.jsx)(`h3`,{children:`Document Library`}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>n(!1),"aria-label":`Close document library`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`modal-body`,children:[(0,K.jsx)(`div`,{className:`drop-zone ${c?`drag-over`:``} ${u?`uploading`:``}`,onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:ee,children:u?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`upload-spinner`}),(0,K.jsx)(`p`,{children:f})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jt,{size:32,strokeWidth:1.5}),(0,K.jsx)(`p`,{children:`Drop files here to index`}),(0,K.jsx)(`span`,{className:`drop-hint`,children:`PDF, TXT, MD, code files, and 50+ formats`})]})}),(0,K.jsxs)(`form`,{className:`path-input-form`,onSubmit:M,children:[(0,K.jsx)(ke,{size:16,className:`path-icon`}),(0,K.jsx)(`input`,{type:`text`,className:`path-input`,value:m,onChange:e=>h(e.target.value),placeholder:`Or enter file path: C:\\docs\\manual.pdf`,"aria-label":`File path to index`}),(0,K.jsx)(`button`,{type:`submit`,className:`btn-secondary`,disabled:!m.trim()||u,children:`Index`}),(0,K.jsxs)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{n(!1),r(!0)},title:`Browse files on this computer`,children:[(0,K.jsx)(pt,{size:14}),`Browse Files`]})]}),g&&(0,K.jsx)(lh,{filename:g.filename,error:g.error,onDismiss:()=>_(null)}),e.length>0&&(0,K.jsxs)(`div`,{className:`doc-stats`,children:[(0,K.jsxs)(`span`,{children:[e.length,` document`,e.length===1?``:`s`]}),(0,K.jsx)(`span`,{children:`·`}),(0,K.jsxs)(`span`,{children:[T,` chunks`]}),(0,K.jsx)(`span`,{children:`·`}),(0,K.jsx)(`span`,{children:E(C)})]}),(0,K.jsxs)(`div`,{className:`doc-list`,children:[e.length===0&&!u&&(0,K.jsxs)(`div`,{className:`empty-docs`,children:[(0,K.jsx)(Ee,{size:32,strokeWidth:1}),(0,K.jsx)(`p`,{children:`No documents indexed yet`}),(0,K.jsx)(`span`,{children:`Drop files above or enter a file path`})]}),e.map(e=>(0,K.jsxs)(`div`,{className:`doc-row ${e.indexing_status===`indexing`?`doc-row-indexing`:``}`,children:[(0,K.jsxs)(`div`,{className:`doc-info`,children:[(0,K.jsx)(`span`,{className:`doc-name`,children:e.filename}),N(e)]}),(0,K.jsxs)(`div`,{className:`doc-row-actions`,children:[e.filepath&&(0,K.jsx)(`button`,{className:`btn-icon-sm doc-open-folder`,onClick:()=>A(e.filepath,e.filename),title:`Open folder: ${e.filepath}`,"aria-label":`Open containing folder for ${e.filename}`,children:(0,K.jsx)(ke,{size:14})}),i&&e.indexing_status===`complete`&&!s?.document_ids?.includes(e.id)&&(0,K.jsx)(`button`,{className:`btn-icon-sm doc-attach`,onClick:()=>re(e.id),title:`Use in current session`,"aria-label":`Attach ${e.filename} to current session`,children:(0,K.jsx)(He,{size:14})}),e.indexing_status!==`indexing`&&e.indexing_status!==`pending`&&(0,K.jsx)(`button`,{className:`btn-icon-sm doc-delete`,onClick:()=>te(e.id),title:`Remove`,"aria-label":`Remove ${e.filename}`,children:(0,K.jsx)(Ot,{size:14})})]})]},e.id))]})]})]})})}function ug(e){if(e.type===`folder`)return(0,K.jsx)(je,{size:16});let t=(e.extension||``).toLowerCase();return[`.csv`,`.xlsx`,`.xls`,`.tsv`].includes(t)?(0,K.jsx)(wt,{size:16}):[`.py`,`.js`,`.ts`,`.java`,`.c`,`.cpp`,`.go`,`.rs`].includes(t)?(0,K.jsx)(he,{size:16}):[`.pdf`,`.doc`,`.docx`,`.txt`,`.md`].includes(t)?(0,K.jsx)(Ee,{size:16}):(0,K.jsx)(De,{size:16})}function dg(e){if(e<=0)return``;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/t**r).toFixed(1))+` `+n[r]}function fg(e){if(!e)return``;let 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`;let a=Math.floor(i/24);return a<7?`${a}d ago`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:t.getFullYear()===n.getFullYear()?void 0:`numeric`})}function pg(e){if(e.length===0)return``;let[t,...n]=e;return n.length>0?`${t} (+${n.length} more)`:t}function mg(e){switch(e){case`home`:return(0,K.jsx)(Ie,{size:14});case`desktop`:return(0,K.jsx)(Ze,{size:14});case`documents`:return(0,K.jsx)(Ee,{size:14});case`download`:return(0,K.jsx)(be,{size:14});default:return(0,K.jsx)(je,{size:14})}}var hg=[{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 gg(e,t,n,r){let i=[],a=[];for(let t of e){let e=t.includes(`.`)?`.`+t.split(`.`).pop()?.toLowerCase():``;e&&!ah(e)?a.push(t):i.push(t)}let o=[],s=[],c=0,l=``,u=new Set(t.filter(e=>e.type===`folder`).map(e=>e.path));for(let e of i)try{if(u.has(e)){let t=await or(e),n=[];t.documents.forEach(e=>{e.id&&n.push(e.id)}),n.length>0&&(n.forEach(e=>o.push(e)),s.push(e))}else{let t=await Zn(e);t?.id&&(o.push(t.id),s.push(e))}}catch(e){c++,l=e instanceof Error?e.message:`Unknown error`}if(n&&o.length>0){for(let e of o)try{await rr(n,e)}catch(e){U.doc.warn(`Could not attach document to session: ${e}`)}let e=H.getState().sessions.find(e=>e.id===n)?.document_ids??[],t=o.filter(t=>!e.includes(t));t.length>0&&r(n,{document_ids:[...e,...t]})}return{docIds:o,supported:i,succeededFiles:s,unsupported:a,failed:c,lastError:l}}function _g(){let{setShowFileBrowser:e,currentSessionId:t,updateSessionInList:n,setPendingPrompt:r}=H(),[i,a]=(0,w.useState)(``),[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)([]),[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(null),[g,_]=(0,w.useState)(``),[v,y]=(0,w.useState)(null),[b,x]=(0,w.useState)([]),[S,C]=(0,w.useState)(!1),[T,E]=(0,w.useState)(``),[D,O]=(0,w.useState)(new Set),[k,ee]=(0,w.useState)(null),[te,A]=(0,w.useState)(!1),[ne,re]=(0,w.useState)(new Set),[M,P]=(0,w.useState)(null),ie=(0,w.useRef)(null),[ae,F]=(0,w.useState)(null),I=(0,w.useCallback)(async e=>{p(!0),h(null),y(null),_(``),x([]);try{let t=await ar(e);a(t.current_path),s(t.parent_path),l(t.entries),t.quick_links.length>0&&d(t.quick_links),U.ui.info(`Browsing: ${t.current_path} (${t.entries.length} items)`)}catch(e){let t=e instanceof Error?e.message:`Failed to load directory`;h(t),U.ui.error(`Browse failed`,e)}finally{p(!1)}},[]);(0,w.useEffect)(()=>{I()},[I]),(0,w.useEffect)(()=>()=>{ie.current&&clearTimeout(ie.current)},[]);let oe=(0,w.useCallback)(async()=>{if(!g.trim()){y(null),x([]);return}C(!0),h(null);try{let e=await lr(g.trim(),T||void 0,30);y(e.results),x(e.searched_locations??[]),U.ui.info(`Search "${g}": ${e.total} results`)}catch(e){let t=e instanceof Error?e.message:`Search failed`;h(t),U.ui.error(`Search failed`,e)}finally{C(!1)}},[g,T]),ce=e=>{e.key===`Enter`&&oe()},L=(0,w.useCallback)(e=>{e.type===`folder`&&(I(e.path),O(new Set),ee(null))},[I]),R=(0,w.useCallback)(async e=>{A(!0);try{let t=await ur(e);ee(t)}catch(e){U.ui.error(`Preview failed`,e)}finally{A(!1)}},[]),le=(0,w.useCallback)(e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),z=(0,w.useCallback)(async()=>{if(D.size===0)return;let e=Array.from(D);if(F(null),!e.some(e=>{let t=e.includes(`.`)?`.`+e.split(`.`).pop()?.toLowerCase():``;return!t||ah(t)})){let t=e[0],n=t.lastIndexOf(`.`),r=n>0?t.slice(n).toLowerCase():``,i=rh(r);F({filename:e.length===1?t.split(/[\\/]/).pop()||t:`${e.length} files`,error:i?i.message:`File type "${r}" is not supported for indexing.`});return}re(new Set(e)),P(`Indexing ${e.length} file(s)...`);try{let r=await gg(e,c,t,n);if(r.failed>0)P(`Done: ${r.docIds.length} indexed, ${r.failed} failed`),F({filename:`${r.failed} file(s)`,error:r.lastError||`Indexing failed for some files`});else{let e=r.unsupported.length>0?` (${r.unsupported.length} skipped — unsupported type)`:``;P(`Successfully indexed ${r.docIds.length} file(s)${e}`)}ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>P(null),5e3),O(new Set)}catch(t){U.doc.error(`Index selected failed`,t),F({filename:e.length===1?e[0].split(/[\\/]/).pop()||e[0]:`${e.length} files`,error:t instanceof Error?t.message:`An unexpected error occurred.`})}finally{re(new Set)}},[D,t,n,c]),ue=(0,w.useCallback)(async()=>{if(D.size===0)return;let i=Array.from(D);F(null),re(new Set(i)),P(`Indexing ${i.length} file(s) for analysis...`);try{let a=await gg(i,c,t,n);if(a.supported.length===0){let e=i[0].lastIndexOf(`.`),t=e>0?i[0].slice(e).toLowerCase():``,n=rh(t);F({filename:i.length===1?i[0].split(/[\\/]/).pop()||i[0]:`${i.length} files`,error:n?.message??`File type "${t}" is not supported for indexing.`});return}if(a.docIds.length===0){F({filename:a.supported.length===1?a.supported[0].split(/[\\/]/).pop()||a.supported[0]:`${a.supported.length} files`,error:`Failed to index selected file(s). Please try again.`});return}a.failed>0&&P(`Warning: ${a.failed} file(s) failed to index and will be excluded.`);let o=(a.succeededFiles.length>0?a.succeededFiles:a.supported).map(e=>e.split(/[\\/]/).pop()||e),s=o.length===1?`Please analyze this document for me: ${o[0]}`:`Please analyze these documents for me:\n${o.map(e=>`- ${e}`).join(`
|
|
59
59
|
`)}`;r(s),e(!1),O(new Set)}catch(e){U.doc.error(`Ask Agent failed`,e),F({filename:i.length===1?i[0].split(/[\\/]/).pop()||i[0]:`${i.length} files`,error:e instanceof Error?e.message:`An unexpected error occurred.`})}finally{re(new Set),P(null)}},[D,t,n,c,r,e]),de=i?i.replace(/\\/g,`/`).split(`/`).filter(Boolean):[],fe=de.map((e,t)=>({label:e,path:de.slice(0,t+1).join(`/`)+(t===0&&e.includes(`:`)?`/`:``)})),pe=pg(b),me=v?v.map(e=>({name:e.name,path:e.path,type:`file`,size:e.size,extension:e.extension||``,modified:e.modified||``})):c;return(0,K.jsx)(`div`,{className:`modal-overlay`,onClick:()=>e(!1),role:`dialog`,"aria-modal":`true`,"aria-label":`File Browser`,children:(0,K.jsxs)(`div`,{className:`modal-panel file-browser-modal ${k?`has-preview`:``}`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`modal-header`,children:[(0,K.jsxs)(`h3`,{children:[(0,K.jsx)(ke,{size:18}),` File Browser`]}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>e(!1),"aria-label":`Close`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`file-browser-body`,children:[(0,K.jsx)(`div`,{className:`fb-quick-links`,children:u.map(e=>(0,K.jsxs)(`button`,{className:`fb-quick-link`,onClick:()=>I(e.path),title:e.path,children:[mg(e.icon),(0,K.jsx)(`span`,{children:e.name})]},e.path))}),(0,K.jsxs)(`div`,{className:`fb-search-bar`,children:[(0,K.jsxs)(`div`,{className:`fb-search-input-wrap`,children:[(0,K.jsx)(pt,{size:14,className:`fb-search-icon`}),(0,K.jsx)(`input`,{type:`text`,className:`fb-search-input`,placeholder:`Search files on your PC...`,value:g,onChange:e=>_(e.target.value),onKeyDown:ce,"aria-label":`Search files`}),g&&(0,K.jsx)(`button`,{className:`fb-search-clear`,onClick:()=>{_(``),y(null),x([])},"aria-label":`Clear search`,children:(0,K.jsx)(Ft,{size:12})})]}),(0,K.jsx)(`select`,{className:`fb-type-filter`,value:T,onChange:e=>E(e.target.value),"aria-label":`File type filter`,children:hg.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,K.jsx)(`button`,{className:`fb-search-btn`,onClick:oe,disabled:!g.trim()||S,children:S?`Searching...`:`Search`})]}),!v&&(0,K.jsxs)(`div`,{className:`fb-breadcrumb`,children:[(0,K.jsx)(`button`,{className:`fb-crumb`,onClick:()=>I(`/`),children:(0,K.jsx)(Fe,{size:12})}),fe.map((e,t)=>(0,K.jsxs)(`span`,{className:`fb-crumb-item`,children:[(0,K.jsx)(se,{size:12,className:`fb-crumb-sep`}),(0,K.jsx)(`button`,{className:`fb-crumb`,onClick:()=>I(e.path),children:e.label})]},t)),o&&(0,K.jsx)(`button`,{className:`fb-up-btn`,onClick:()=>I(o),title:`Go up`,children:(0,K.jsx)(j,{size:14})})]}),v&&(0,K.jsxs)(`div`,{className:`fb-search-header`,children:[(0,K.jsxs)(`div`,{className:`fb-search-summary`,children:[(0,K.jsxs)(`span`,{children:[`Found `,v.length,` result(s) for "`,g,`"`]}),pe&&(0,K.jsxs)(`span`,{className:`fb-search-scope`,title:b.join(`
|
|
60
60
|
`),children:[`Searching in: `,(0,K.jsx)(`code`,{children:pe})]})]}),(0,K.jsx)(`button`,{className:`fb-back-btn`,onClick:()=>{y(null),_(``),x([])},children:`Back to browsing`})]}),m&&(0,K.jsx)(`div`,{className:`fb-error`,children:m}),(0,K.jsxs)(`div`,{className:`fb-content`,children:[(0,K.jsxs)(`div`,{className:`fb-file-list`,children:[f&&(0,K.jsx)(`div`,{className:`fb-loading`,children:`Loading...`}),!f&&me.length===0&&(0,K.jsx)(`div`,{className:`fb-empty`,children:v?`No files found`:`This folder is empty`}),!f&&me.map(e=>{let t=e.extension||(e.name.includes(`.`)?`.`+e.name.split(`.`).pop()?.toLowerCase():``),n=e.type===`file`&&t&&!ah(t),r=n?rh(t):null;return(0,K.jsxs)(`div`,{className:`fb-entry ${e.type} ${D.has(e.path)?`selected`:``} ${n?`unsupported`:``}`,onClick:()=>e.type===`folder`?L(e):le(e.path),onDoubleClick:()=>e.type===`folder`?L(e):void 0,title:n?`${r?.label||`This`} file type cannot be indexed`:e.path,children:[(0,K.jsx)(`input`,{type:`checkbox`,className:`fb-entry-checkbox`,checked:D.has(e.path),onChange:()=>le(e.path),onClick:e=>e.stopPropagation(),"aria-label":`Select ${e.name}`}),(0,K.jsx)(`span`,{className:`fb-entry-icon`,children:ug(e)}),(0,K.jsx)(`span`,{className:`fb-entry-name`,title:e.path,children:e.name}),n&&(0,K.jsx)(`span`,{className:`fb-unsupported-badge`,children:`Not indexable`}),e.type===`file`&&(0,K.jsx)(`button`,{type:`button`,className:`fb-entry-preview-btn`,onClick:t=>{t.stopPropagation(),R(e.path)},"aria-label":`Preview ${e.name}`,title:`Preview file`,children:(0,K.jsx)(we,{size:14})}),(0,K.jsx)(`span`,{className:`fb-entry-size`,children:e.type===`file`?dg(e.size):``}),(0,K.jsx)(`span`,{className:`fb-entry-date`,children:fg(e.modified)})]},e.path)})]}),k&&(0,K.jsxs)(`div`,{className:`fb-preview`,children:[(0,K.jsxs)(`div`,{className:`fb-preview-header`,children:[(0,K.jsx)(`span`,{className:`fb-preview-name`,children:k.name}),(0,K.jsx)(`button`,{className:`btn-icon-sm`,onClick:()=>ee(null),"aria-label":`Close preview`,children:(0,K.jsx)(Ft,{size:14})})]}),(0,K.jsxs)(`div`,{className:`fb-preview-meta`,children:[(0,K.jsx)(`span`,{children:k.size_display}),k.total_lines&&(0,K.jsxs)(`span`,{children:[k.total_lines,` lines`]}),k.columns&&(0,K.jsxs)(`span`,{children:[k.columns.length,` columns`]}),k.row_count!==null&&(0,K.jsxs)(`span`,{children:[k.row_count,` rows`]})]}),k.columns&&(0,K.jsxs)(`div`,{className:`fb-preview-columns`,children:[(0,K.jsx)(`strong`,{children:`Columns:`}),` `,k.columns.join(`, `)]}),te?(0,K.jsx)(`div`,{className:`fb-preview-loading`,children:`Loading preview...`}):k.is_text&&k.preview_lines.length>0?(0,K.jsx)(`pre`,{className:`fb-preview-content`,children:k.preview_lines.slice(0,30).join(`
|
|
61
61
|
`)}):(0,K.jsx)(`div`,{className:`fb-preview-binary`,children:`Binary file - no preview available`})]})]}),ae&&(0,K.jsx)(lh,{filename:ae.filename,error:ae.error,onDismiss:()=>F(null)}),(0,K.jsxs)(`div`,{className:`fb-actions`,children:[(0,K.jsx)(`div`,{className:`fb-selection-info`,children:D.size>0?`${D.size} item(s) selected`:`Select files to index or analyze`}),M&&(0,K.jsx)(`span`,{className:`fb-index-status`,children:M}),(0,K.jsxs)(`div`,{className:`fb-action-btns`,children:[(0,K.jsxs)(`button`,{className:`fb-action-btn secondary`,onClick:z,disabled:D.size===0||ne.size>0,title:`Index selected files for RAG search`,children:[(0,K.jsx)(jt,{size:14}),`Index Selected`]}),(0,K.jsxs)(`button`,{className:`fb-action-btn primary`,onClick:ue,disabled:D.size===0||ne.size>0,title:`Index and send selected files to the chat agent for analysis`,children:[(0,K.jsx)(N,{size:14}),`Ask Agent`]})]})]})]})]})})}var vg=Kt();async function yg(e,t,n){let r=`${vg}${t}`,i={};e!==`GET`&&(i[`X-Gaia-UI`]=`1`),n!==void 0&&(i[`Content-Type`]=`application/json`);let a={method:e,headers:Object.keys(i).length>0?i:void 0,body:n===void 0?void 0:JSON.stringify(n)},o=await fetch(r,a);if(!o.ok){let e=await o.text().catch(()=>``),t=e;try{t=JSON.parse(e).detail||e}catch{}throw Error(t||`Memory API error (HTTP ${o.status})`)}if((o.headers.get(`content-type`)||``).includes(`application/json`))return o.json()}function bg(e){let t=[];for(let[n,r]of Object.entries(e))if(r!=null&&r!==``){if(Array.isArray(r))for(let e of r)t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(e))}`);else t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`)}return t.length?`?${t.join(`&`)}`:``}function xg(){return yg(`GET`,`/memory/stats`)}function Sg(e=30){return yg(`GET`,`/memory/activity?days=${e}`)}function Cg(e={}){return yg(`GET`,`/memory/knowledge${bg(e)}`)}function wg(e){return yg(`POST`,`/memory/knowledge`,e)}function Tg(e,t){return yg(`PUT`,`/memory/knowledge/${encodeURIComponent(e)}`,t)}function Eg(e){return yg(`DELETE`,`/memory/knowledge/${encodeURIComponent(e)}`)}function Dg(){return yg(`GET`,`/memory/entities`)}function Og(){return yg(`GET`,`/memory/tools`)}function kg(e=20){return yg(`GET`,`/memory/conversations?limit=${e}`)}function Ag(e,t=20){return yg(`GET`,`/memory/conversations/search?query=${encodeURIComponent(e)}&limit=${t}`)}function jg(e){return yg(`GET`,`/memory/conversations/${encodeURIComponent(e)}`)}function Mg(e=7){return yg(`GET`,`/memory/upcoming?days=${e}`)}function Ng(){return yg(`GET`,`/memory/embedding-coverage`)}function Pg(){return yg(`POST`,`/memory/consolidate`)}function Fg(){return yg(`POST`,`/memory/rebuild-embeddings`)}function Ig(){return yg(`POST`,`/memory/reconcile`)}function Lg(){return yg(`POST`,`/memory/rebuild-fts`)}function Rg(){return yg(`POST`,`/memory/refresh-system-context`)}function zg(){return new EventSource(`${vg}/memory/stream-discovery`)}function Bg(e){return new EventSource(`${vg}/memory/stream-inference?include_browser=${e}`)}function Vg(e){return yg(`POST`,`/memory/commit-discovery`,{items:e})}function Hg(e){return yg(`POST`,`/memory/commit-inference`,{insights:e})}function Ug(){return yg(`GET`,`/memory/settings`)}function Wg(e){return yg(`PUT`,`/memory/settings`,e)}function Gg(){return yg(`DELETE`,`/memory/all`)}function Kg(){return yg(`POST`,`/memory/reinitialize`)}function qg(){return yg(`GET`,`/goals/stats`)}function Jg(e={}){return yg(`GET`,`/goals${bg(e)}`)}function Yg(e){return yg(`POST`,`/goals`,e)}function Xg(e){return yg(`PUT`,`/goals/${encodeURIComponent(e)}/approve`)}function Zg(e){return yg(`PUT`,`/goals/${encodeURIComponent(e)}/reject`)}function Qg(e){return yg(`PUT`,`/goals/${encodeURIComponent(e)}/cancel`)}function $g(e){return yg(`DELETE`,`/goals/${encodeURIComponent(e)}`)}function e_(e){if(!e)return`—`;try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n={month:`short`,day:`numeric`};return t.getFullYear()!==new Date().getFullYear()&&(n.year=`numeric`),t.toLocaleDateString(void 0,n)}catch{return`—`}}function t_(e){if(!e)return``;try{let 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 n_(e){if(!e)return`—`;try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=Date.now(),r=t.getTime()-n,i=Math.abs(r),a=Math.floor(i/1e3),o=Math.floor(i/6e4),s=Math.floor(i/36e5),c=Math.floor(i/864e5);return r<0?a<5?`just now`:a<60?`${a}s ago`:s===0?`${o}m ago`:c===0?`${s}h ago`:c===1?`yesterday`:c<30?`${c}d ago`:t_(e):a<5?`now`:a<60?`in ${a}s`:s===0?`in ${o}m`:c===0?`in ${s}h`:c===1?`tomorrow`:c<30?`in ${c}d`:t_(e)}catch{return`—`}}function r_(e){if(e<=0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/t**r).toFixed(1))+` `+n[r]}function i_(e){return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function a_(e){try{return new Date(e).getTime()<Date.now()}catch{return!1}}function o_(e){return e>=.7?`high`:e>=.4?`medium`:`low`}function s_(e){return e>=.9?`high`:e>=.7?`medium`:`low`}function c_(e,t){let n=e_(e),r=e_(t);return n===`—`&&r===`—`?``:n===r?n:`${n} \u2013 ${r}`}function l_(e){if(e.length===0)return 0;let t=new Date().toISOString().slice(0,10),n=e.find(e=>e.date===t);return n?n.knowledge_added:0}var u_=[`fact`,`preference`,`error`,`skill`,`note`,`reminder`],d_={work:`blue`,technical:`purple`,personal:`green`,general:`gray`};function f_(){let{setShowMemoryDashboard:e}=H(),[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)([]),[a,o]=(0,w.useState)(null),[s,c]=(0,w.useState)([]),[l,u]=(0,w.useState)([]),[d,f]=(0,w.useState)([]),[p,m]=(0,w.useState)(null),[h,g]=(0,w.useState)([]),[_,v]=(0,w.useState)(!0),[y,b]=(0,w.useState)(null),[x,S]=(0,w.useState)(null),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(null),[O,k]=(0,w.useState)([]),ee=(0,w.useRef)(0),[A,j]=(0,w.useState)([]),[ne,re]=(0,w.useState)(``),[M,P]=(0,w.useState)(``),[ie,ae]=(0,w.useState)(``),[F,ce]=(0,w.useState)(`updated_at`),[L,R]=(0,w.useState)(`desc`),[z,ue]=(0,w.useState)(0),[de,me]=(0,w.useState)(!1),[he,ye]=(0,w.useState)(``),[be,xe]=(0,w.useState)(null),Se=(0,w.useRef)(null),[Ce,we]=(0,w.useState)(null),[Te,Ee]=(0,w.useState)(!1),[De,Oe]=(0,w.useState)(null),[ke,Ae]=(0,w.useState)({content:``,category:`fact`,domain:``,context:`global`,entity:``,sensitive:!1,due_at:``}),[je,Ne]=(0,w.useState)(new Set),[Pe,Fe]=(0,w.useState)(!1),[Ie,Le]=(0,w.useState)(!1),[Re,ze]=(0,w.useState)(!1),[Be,Ve]=(0,w.useState)(!1),[He,B]=(0,w.useState)(!1),[We,Ge]=(0,w.useState)(!1),[Ke,qe]=(0,w.useState)(null),[Je,Xe]=(0,w.useState)(`dashboard`),[Ze,Qe]=(0,w.useState)([]),[$e,et]=(0,w.useState)(null),[tt,nt]=(0,w.useState)(!1),[rt,it]=(0,w.useState)(null),[at,st]=(0,w.useState)(!1),[ct,dt]=(0,w.useState)({title:``,description:``,priority:`medium`}),[ft,mt]=(0,w.useState)(`idle`),[ht,gt]=(0,w.useState)([]),[V,yt]=(0,w.useState)([]),[xt,St]=(0,w.useState)(null),Ct=(0,w.useRef)(null),wt=(0,w.useRef)(null),[Tt,Dt]=(0,w.useState)(`idle`),[jt,Nt]=(0,w.useState)([]),[Lt,Rt]=(0,w.useState)([]),[zt,Bt]=(0,w.useState)(null),[Vt,Ht]=(0,w.useState)(!1),Ut=(0,w.useRef)(null),Wt=(0,w.useRef)(null),[Gt,Kt]=(0,w.useState)(30),[qt,Jt]=(0,w.useState)(!1),[Yt,Xt]=(0,w.useState)(!1),[Zt,Qt]=(0,w.useState)(!1),[$t,en]=(0,w.useState)(!1),[tn,W]=(0,w.useState)(!1),[nn,rn]=(0,w.useState)(!1),an=(0,w.useRef)(null),on=(0,w.useRef)(null),G=(0,w.useCallback)((e,t=`info`)=>{let n=++ee.current;k(r=>[...r,{id:n,text:e,type:t}]),setTimeout(()=>{k(e=>e.filter(e=>e.id!==n))},4e3)},[]);(0,w.useEffect)(()=>{if(!C)return;let e=e=>{on.current&&!on.current.contains(e.target)&&T(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[C]),(0,w.useEffect)(()=>{let t=t=>{t.key===`Escape`&&(Ke?qe(null):He?B(!1):We?Ge(!1):Ce?we(null):C?T(!1):Te||De?(Ee(!1),Oe(null)):E?D(null):e(!1))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[Ce,C,Te,De,E,e,Ke,He,We]);let sn=(0,w.useCallback)(async()=>{try{let e=await xg();n(e)}catch(e){U.system.warn(`Failed to load memory stats`,e)}},[]),cn=(0,w.useCallback)(async()=>{try{let e=await Sg(Gt);i(e)}catch(e){U.system.warn(`Failed to load memory activity`,e)}},[Gt]),ln=(0,w.useCallback)(async()=>{try{let e=await Cg({category:A.length>0?A:void 0,context:ne||void 0,entity:M||void 0,search:ie||void 0,sort_by:F,order:L,offset:z,limit:15,include_sensitive:!0,include_superseded:de});o(e)}catch(e){U.system.warn(`Failed to load knowledge`,e)}},[A,ne,M,ie,F,L,z,de]),un=(0,w.useCallback)(async()=>{try{let e=await Og();c(e)}catch(e){U.system.warn(`Failed to load tool summary`,e)}},[]),dn=(0,w.useCallback)(async()=>{try{let e=await kg(20);u(e)}catch(e){U.system.warn(`Failed to load conversations`,e)}},[]),fn=(0,w.useCallback)(async()=>{try{let e=await Mg(7);f(e)}catch(e){U.system.warn(`Failed to load upcoming items`,e)}},[]),pn=(0,w.useCallback)(async()=>{try{let e=await Ng();m(e)}catch(e){U.system.warn(`Failed to load embedding coverage`,e)}},[]),mn=(0,w.useCallback)(async()=>{try{let e=await Dg();g(e||[])}catch(e){U.system.warn(`Failed to load entities`,e)}},[]),hn=(0,w.useCallback)(async()=>{try{let e=await Ug();Le(e.mcp_memory_enabled),Fe(e.memory_enabled),ze(e.system_discovery_consent)}catch(e){U.system.warn(`Failed to load memory settings`,e)}},[]),gn=(0,w.useCallback)(async()=>{nt(!0);try{let[e,t]=await Promise.all([Jg(),qg()]);Qe(e.goals),et(t)}catch(e){U.system.warn(`Failed to load goals`,e)}finally{nt(!1)}},[]),_n=(0,w.useCallback)(async()=>{v(!0),b(null);try{await Promise.all([sn(),cn(),ln(),un(),dn(),fn(),pn(),mn(),hn(),gn()])}catch(e){b(`Failed to load memory data. Is the backend running?`),U.system.error(`Memory dashboard load failed`,e)}finally{v(!1)}},[sn,cn,ln,un,dn,fn,pn,mn,hn,gn]);(0,w.useEffect)(()=>{_n()},[_n]),(0,w.useEffect)(()=>{ln()},[ln]);let vn=(0,w.useRef)(!0);(0,w.useEffect)(()=>{if(vn.current){vn.current=!1;return}cn()},[cn]);let yn=(0,w.useCallback)(e=>{ae(e),rn(!0),an.current&&clearTimeout(an.current),an.current=setTimeout(()=>{ue(0),rn(!1)},300)},[]),bn=(0,w.useCallback)(async()=>{if(ke.content.trim())try{await wg({content:ke.content,category:ke.category,domain:ke.domain||void 0,context:ke.context,entity:ke.entity||void 0,sensitive:ke.sensitive,due_at:ke.due_at||void 0}),Ee(!1),Ae({content:``,category:`fact`,domain:``,context:`global`,entity:``,sensitive:!1,due_at:``}),ln(),sn(),pn(),U.ui.info(`Created new knowledge entry`),G(`Memory created successfully`,`success`)}catch(e){U.system.error(`Failed to create knowledge`,e),G(`Failed to create memory`,`error`)}},[ke,ln,sn,pn,G]),xn=(0,w.useCallback)(async()=>{if(!(!De||!ke.content.trim()))try{await Tg(De,{content:ke.content,category:ke.category,domain:ke.domain||void 0,context:ke.context,entity:ke.entity||void 0,sensitive:ke.sensitive,due_at:ke.due_at||void 0}),Oe(null),Ae({content:``,category:`fact`,domain:``,context:`global`,entity:``,sensitive:!1,due_at:``}),ln(),U.ui.info(`Updated knowledge ${De}`),G(`Memory updated`,`success`)}catch(e){U.system.error(`Failed to update knowledge`,e),G(`Failed to update memory`,`error`)}},[De,ke,ln,G]),Sn=(0,w.useCallback)(async e=>{try{await Eg(e),ln(),sn(),pn(),U.ui.info(`Deleted knowledge ${e}`),G(`Memory deleted`,`info`)}catch(e){U.system.error(`Failed to delete knowledge`,e),G(`Failed to delete memory`,`error`)}},[ln,sn,pn,G]),Cn=(0,w.useCallback)(async e=>{try{await Tg(e.id,{sensitive:!e.sensitive}),ln(),U.ui.info(`Toggled sensitive for ${e.id}: ${!e.sensitive}`),G(e.sensitive?`Unmarked as sensitive`:`Marked as sensitive`,`info`)}catch(e){U.system.error(`Failed to toggle sensitive`,e),G(`Failed to toggle sensitive flag`,`error`)}},[ln,G]),wn=(0,w.useCallback)(e=>{Oe(e.id),Ee(!1),Ae({content:e.content,category:e.category,domain:e.domain||``,context:e.context,entity:e.entity||``,sensitive:e.sensitive,due_at:e.due_at||``})},[]),Tn=(0,w.useCallback)(e=>{navigator.clipboard.writeText(e).catch(()=>{}),U.ui.info(`Copied knowledge ID: ${e}`),G(`ID copied to clipboard`,`info`)},[G]),En=(0,w.useCallback)(e=>{if(ye(e),Se.current&&clearTimeout(Se.current),!e.trim()){xe(null);return}Se.current=setTimeout(async()=>{try{let t=await Ag(e.trim(),20);xe(t)}catch(e){U.system.warn(`Conversation search failed`,e)}},300)},[]),Dn=(0,w.useCallback)(async e=>{try{let t=await jg(e);we({sessionId:e,turns:t})}catch(e){U.system.error(`Failed to load conversation detail`,e)}},[]),On=(0,w.useCallback)(e=>{j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),ue(0)},[]),kn=(0,w.useCallback)(e=>{F===e?R(e=>e===`desc`?`asc`:`desc`):(ce(e),R(`desc`)),ue(0)},[F]),An=(0,w.useCallback)(async()=>{Jt(!0),T(!1);try{let e=await Pg();await _n(),G(`Consolidated ${e.consolidated??0} sessions, extracted ${e.extracted_items??0} items`,`success`)}catch(e){U.system.error(`Failed to consolidate sessions`,e),G(`Failed to consolidate sessions`,`error`)}finally{Jt(!1)}},[_n,G]),jn=(0,w.useCallback)(async()=>{Xt(!0),T(!1);try{let e=await Fg();await pn(),G(`Backfilled ${e.backfilled??0} embeddings${e.total_without?` (${e.total_without} were missing)`:``}`,`success`)}catch(e){U.system.error(`Failed to rebuild embeddings`,e),G(`Failed to rebuild embeddings`,`error`)}finally{Xt(!1)}},[pn,G]),Mn=(0,w.useCallback)(async()=>{Qt(!0),T(!1);try{let e=await Ig();await _n(),G(`Checked ${e.pairs_checked??0} pairs: ${e.reinforced??0} reinforced, ${e.contradicted??0} contradicted`,`success`)}catch(e){U.system.error(`Failed to reconcile memory`,e),G(`Failed to reconcile memory`,`error`)}finally{Qt(!1)}},[_n,G]),Nn=(0,w.useCallback)(async()=>{en(!0),T(!1);try{await Lg(),await _n(),G(`FTS indexes rebuilt successfully`,`success`)}catch(e){U.system.error(`Failed to rebuild FTS index`,e),G(`Failed to rebuild FTS indexes`,`error`)}finally{en(!1)}},[_n,G]),Pn=(0,w.useCallback)(async()=>{W(!0),T(!1);try{let e=await Rg();await _n(),e.skipped?G(`System context collection is disabled — enable it in settings`,`error`):G(`System context refreshed: ${e.stored} facts updated`,`success`)}catch(e){U.system.error(`Failed to refresh system context`,e),G(`Failed to refresh system context`,`error`)}finally{W(!1)}},[_n,G]),Fn=qt||Yt||Zt||$t||tn,In=(0,w.useCallback)(()=>{mt(`running`),gt([]),yt([]),St(null);let e=zg();wt.current=e,e.onmessage=t=>{try{let n=JSON.parse(t.data);if(n.type===`log`)gt(e=>[...e,{text:n.message,kind:`log`}]);else if(n.type===`finding`){let e=n.item;gt(t=>[...t,{text:` Found: ${e.content}`,kind:`finding`}]),yt(t=>[...t,{...e,_checked:!0}])}else n.type===`error`?gt(e=>[...e,{text:` Error: ${n.message}`,kind:`error`}]):n.type===`done`&&(e.close(),wt.current=null,gt(e=>[...e,{text:`Done. ${n.total??0} items discovered.`,kind:`log`}]),mt(`review`))}catch{gt(e=>[...e,{text:`Failed to parse event data.`,kind:`error`}])}},e.onerror=()=>{e.close(),wt.current=null,gt(e=>[...e,{text:`Connection error. Is the GAIA server running?`,kind:`error`}]),yt(e=>(mt(e.length>0?`review`:`idle`),e))}},[]),Ln=(0,w.useCallback)(async()=>{let e=V.filter(e=>e._checked);if(e.length!==0){mt(`saving`);try{let t=await Vg(e.map(({_checked:e,...t})=>t));St(t.stored),mt(`done`),G(`Saved ${t.stored} items to memory`,`success`)}catch(e){U.system.error(`Failed to commit discovery items`,e),G(`Failed to save discovery items`,`error`),mt(`review`)}}},[V,G]),Rn=(0,w.useCallback)(()=>{Dt(`running`),Nt([]),Rt([]),Bt(null);let e=Bg(Vt);Wt.current=e,e.onmessage=t=>{try{let n=JSON.parse(t.data);if(n.type===`log`)Nt(e=>[...e,{text:n.message,kind:`log`}]);else if(n.type===`insight`){let e=n.item;Nt(t=>[...t,{text:` Insight: ${e.content}`,kind:`finding`}]),Rt(t=>[...t,{...e,_checked:!0}])}else n.type===`error`?Nt(e=>[...e,{text:` Error: ${n.message}`,kind:`error`}]):n.type===`done`&&(e.close(),Wt.current=null,Nt(e=>[...e,{text:`Done. ${n.total??0} insights generated.`,kind:`log`}]),Dt(`review`))}catch{Nt(e=>[...e,{text:`Failed to parse event data.`,kind:`error`}])}},e.onerror=()=>{e.close(),Wt.current=null,Nt(e=>[...e,{text:`Connection error. Is Lemonade Server running?`,kind:`error`}]),Rt(e=>(Dt(e.length>0?`review`:`idle`),e))}},[Vt]),zn=(0,w.useCallback)(async()=>{let e=Lt.filter(e=>e._checked);if(e.length!==0){Dt(`saving`);try{let t=await Hg(e.map(({_checked:e,...t})=>t));Bt(t.stored),Dt(`done`),G(`Saved ${t.stored} insights to memory`,`success`)}catch(e){U.system.error(`Failed to commit inference insights`,e),G(`Failed to save inference insights`,`error`),Dt(`review`)}}},[Lt,G]);(0,w.useEffect)(()=>{Ct.current&&(Ct.current.scrollTop=Ct.current.scrollHeight)},[ht]),(0,w.useEffect)(()=>{Ut.current&&(Ut.current.scrollTop=Ut.current.scrollHeight)},[jt]),(0,w.useEffect)(()=>()=>{wt.current&&=(wt.current.close(),null),Wt.current&&=(Wt.current.close(),null)},[]);let Bn=e=>F===e?(0,K.jsx)(`span`,{className:`mem-sort-arrow`,children:L===`desc`?`↓`:`↑`}):null,Vn=Math.max(1,...r.map(e=>e.conversations+e.tool_calls+e.knowledge_added+e.errors)),Hn=t?.knowledge?.by_context?Object.keys(t.knowledge.by_context):[];return(0,K.jsxs)(`div`,{className:`memory-dashboard-page`,children:[(0,K.jsxs)(`div`,{className:`memory-dashboard-header`,children:[(0,K.jsxs)(`div`,{className:`memory-dashboard-header-left`,children:[(0,K.jsx)(`button`,{className:`btn-icon settings-back-btn`,onClick:()=>e(!1),"aria-label":`Back`,children:(0,K.jsx)(te,{size:18})}),(0,K.jsxs)(`h3`,{children:[`Memory Dashboard `,(0,K.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`})]})]}),(0,K.jsxs)(`div`,{className:`memory-dashboard-header-actions`,children:[p&&p.total_items>0&&(0,K.jsxs)(`div`,{className:`mem-embedding-coverage`,title:`${p.with_embedding} of ${p.total_items} entries embedded`,children:[(0,K.jsx)(`div`,{className:`mem-embedding-bar`,children:(0,K.jsx)(`div`,{className:`mem-embedding-fill`,style:{width:`${Math.round(p.coverage_pct)}%`}})}),(0,K.jsxs)(`span`,{className:`mem-embedding-label`,children:[Math.round(p.coverage_pct),`% embedded`]})]}),(0,K.jsxs)(`div`,{className:`mem-maintenance-wrap`,ref:on,children:[(0,K.jsxs)(`button`,{className:`btn-icon ${Fn?`mem-spinning`:``}`,onClick:()=>T(e=>!e),title:`Maintenance actions`,"aria-label":`Maintenance actions`,"aria-expanded":C,children:[Fn?(0,K.jsx)(`div`,{className:`mem-spinner-sm`}):(0,K.jsx)(ve,{size:16}),(0,K.jsx)(I,{size:10,style:{marginLeft:2}})]}),C&&(0,K.jsxs)(`div`,{className:`mem-maintenance-menu`,role:`menu`,children:[(0,K.jsxs)(`button`,{className:`mem-maintenance-item`,onClick:An,disabled:qt,role:`menuitem`,children:[(0,K.jsx)(Me,{size:14}),qt?`Consolidating...`:`Consolidate Sessions`]}),(0,K.jsxs)(`button`,{className:`mem-maintenance-item`,onClick:jn,disabled:Yt,role:`menuitem`,children:[(0,K.jsx)(It,{size:14}),Yt?`Rebuilding...`:`Rebuild Embeddings`]}),(0,K.jsxs)(`button`,{className:`mem-maintenance-item`,onClick:Mn,disabled:Zt,role:`menuitem`,children:[(0,K.jsx)(le,{size:14}),Zt?`Reconciling...`:`Reconcile Memory`]}),(0,K.jsx)(`div`,{className:`mem-maintenance-divider`}),(0,K.jsxs)(`button`,{className:`mem-maintenance-item`,onClick:Pn,disabled:tn,role:`menuitem`,children:[(0,K.jsx)(ut,{size:14}),tn?`Refreshing...`:`Refresh System Context`]}),(0,K.jsx)(`div`,{className:`mem-maintenance-divider`}),(0,K.jsxs)(`button`,{className:`mem-maintenance-item`,onClick:Nn,disabled:$t,role:`menuitem`,children:[(0,K.jsx)(pt,{size:14}),$t?`Rebuilding...`:`Rebuild FTS Indexes`]})]})]}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:_n,title:`Refresh`,"aria-label":`Refresh dashboard`,children:(0,K.jsx)(ut,{size:16})})]})]}),(0,K.jsxs)(`div`,{className:`mem-tab-bar`,role:`tablist`,children:[(0,K.jsxs)(`button`,{className:`mem-tab-btn${Je===`dashboard`?` mem-tab-active`:``}`,onClick:()=>Xe(`dashboard`),role:`tab`,"aria-selected":Je===`dashboard`,children:[(0,K.jsx)(N,{size:14}),` Dashboard`]}),(0,K.jsxs)(`button`,{className:`mem-tab-btn${Je===`goals`?` mem-tab-active`:``}`,onClick:()=>{Xe(`goals`),gn()},role:`tab`,"aria-selected":Je===`goals`,children:[(0,K.jsx)(Et,{size:14}),` Goals`,$e&&($e.goals.pending_approval??0)>0&&(0,K.jsx)(`span`,{className:`mem-tab-badge`,children:$e.goals.pending_approval})]}),(0,K.jsxs)(`button`,{className:`mem-tab-btn${Je===`profile`?` mem-tab-active`:``}`,onClick:()=>Xe(`profile`),role:`tab`,"aria-selected":Je===`profile`,children:[(0,K.jsx)(Mt,{size:14}),` Profile`]})]}),(0,K.jsxs)(`div`,{className:`memory-dashboard-body`,children:[Je===`dashboard`&&(0,K.jsx)(K.Fragment,{children:_&&!t?(0,K.jsxs)(`div`,{className:`mem-loading`,children:[(0,K.jsx)(`div`,{className:`mem-spinner`}),`Loading memory data...`]}):y?(0,K.jsxs)(`div`,{className:`mem-empty`,children:[(0,K.jsx)(`div`,{className:`mem-empty-icon`,children:(0,K.jsx)(At,{size:32})}),(0,K.jsx)(`p`,{children:y}),(0,K.jsxs)(`button`,{className:`btn-secondary`,onClick:_n,style:{marginTop:12},children:[(0,K.jsx)(ut,{size:14}),` Retry`]})]}):(0,K.jsxs)(K.Fragment,{children:[!Pe&&(0,K.jsxs)(`div`,{className:`mem-empty-state`,style:{margin:`40px 0`},children:[(0,K.jsx)(`div`,{className:`mem-empty-icon`,style:{opacity:.5},children:(0,K.jsx)(vt,{size:32})}),(0,K.jsx)(`p`,{style:{color:`#888`,fontSize:14},children:`Memory is disabled. Enable it in Settings below to start storing knowledge, conversations, and preferences.`})]}),Pe&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mem-stat-cards`,children:[(0,K.jsxs)(`div`,{className:`mem-stat-card`,"data-accent":`purple`,children:[(0,K.jsx)(`div`,{className:`mem-stat-value`,children:t?.knowledge?.total??0}),(0,K.jsx)(`div`,{className:`mem-stat-label`,children:`Stored`}),(0,K.jsx)(`div`,{className:`mem-stat-sub`,children:(()=>{let e=l_(r);return e>0?`+${e} today`:t?.knowledge?.by_category?Object.entries(t.knowledge.by_category).slice(0,3).map(([e,t])=>`${t} ${e}s`).join(`, `):`No entries`})()})]}),(0,K.jsxs)(`div`,{className:`mem-stat-card`,"data-accent":`gold`,children:[(0,K.jsx)(`div`,{className:`mem-stat-value`,children:t?.knowledge?.total_retrievals??0}),(0,K.jsx)(`div`,{className:`mem-stat-label`,children:`Retrieved`}),(0,K.jsx)(`div`,{className:`mem-stat-sub`,children:t?.knowledge?.total&&t?.knowledge?.total_retrievals?`avg ${(t.knowledge.total_retrievals/t.knowledge.total).toFixed(1)}x per memory`:`No recalls yet`})]}),(0,K.jsxs)(`div`,{className:`mem-stat-card`,"data-accent":`blue`,children:[(0,K.jsx)(`div`,{className:`mem-stat-value`,children:t?.conversations?.total_sessions??0}),(0,K.jsx)(`div`,{className:`mem-stat-label`,children:`Sessions`}),(0,K.jsx)(`div`,{className:`mem-stat-sub`,children:c_(t?.conversations?.first_session??null,t?.conversations?.last_session??null)||`${t?.conversations?.total_turns??0} total turns`})]}),(0,K.jsxs)(`div`,{className:`mem-stat-card`,"data-accent":`green`,children:[(0,K.jsx)(`div`,{className:`mem-stat-value`,children:t?.tools?.total_calls??0}),(0,K.jsx)(`div`,{className:`mem-stat-label`,children:`Tool Calls`}),(0,K.jsxs)(`div`,{className:`mem-stat-sub`,children:[t?.tools?.unique_tools??0,` tools`]})]}),(0,K.jsxs)(`div`,{className:`mem-stat-card`,"data-accent":`red`,children:[(0,K.jsx)(`div`,{className:`mem-stat-value`,children:t?.tools?.overall_success_rate==null?`—`:`${Math.round(t.tools.overall_success_rate*100)}%`}),(0,K.jsx)(`div`,{className:`mem-stat-label`,children:`Success Rate`}),(0,K.jsxs)(`div`,{className:`mem-stat-sub`,children:[t?.tools?.total_errors??0,` errors`]})]})]}),(0,K.jsxs)(`div`,{className:`mem-section`,children:[(0,K.jsxs)(`div`,{className:`mem-section-title mem-section-title-row`,children:[(0,K.jsxs)(`span`,{className:`mem-section-title-left`,children:[(0,K.jsx)(kt,{size:14}),` Activity`]}),(0,K.jsx)(`div`,{className:`mem-range-tabs`,role:`group`,"aria-label":`Activity range`,children:[1,7,30].map(e=>(0,K.jsx)(`button`,{className:`mem-range-tab${Gt===e?` active`:``}`,onClick:()=>Kt(e),children:e===1?`1D`:e===7?`7D`:`30D`},e))})]}),r.length>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mem-activity-chart`,children:r.map((e,t)=>{let n=e.conversations+e.tool_calls+e.knowledge_added+e.errors,i=t===0||t===r.length-1||t%7==0,a=new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{month:`short`,day:`numeric`});return(0,K.jsxs)(`div`,{className:`mem-activity-bar-group`,onMouseEnter:()=>S(t),onMouseLeave:()=>S(null),children:[e.errors>0&&(0,K.jsx)(`div`,{className:`mem-activity-bar errors`,style:{height:`${e.errors/Vn*100}%`}}),e.knowledge_added>0&&(0,K.jsx)(`div`,{className:`mem-activity-bar knowledge`,style:{height:`${e.knowledge_added/Vn*100}%`}}),e.tool_calls>0&&(0,K.jsx)(`div`,{className:`mem-activity-bar tool_calls`,style:{height:`${e.tool_calls/Vn*100}%`}}),e.conversations>0&&(0,K.jsx)(`div`,{className:`mem-activity-bar conversations`,style:{height:`${e.conversations/Vn*100}%`}}),i&&(0,K.jsx)(`span`,{className:`mem-activity-date-label`,children:a}),x===t&&n>0&&(0,K.jsxs)(`div`,{className:`mem-activity-tooltip`,children:[(0,K.jsx)(`strong`,{children:a}),(0,K.jsx)(`br`,{}),e.conversations>0&&(0,K.jsxs)(K.Fragment,{children:[e.conversations,` conversations`,(0,K.jsx)(`br`,{})]}),e.tool_calls>0&&(0,K.jsxs)(K.Fragment,{children:[e.tool_calls,` tool calls`,(0,K.jsx)(`br`,{})]}),e.knowledge_added>0&&(0,K.jsxs)(K.Fragment,{children:[e.knowledge_added,` learned`,(0,K.jsx)(`br`,{})]}),e.errors>0&&(0,K.jsxs)(K.Fragment,{children:[e.errors,` errors`]})]})]},e.date)})}),(0,K.jsxs)(`div`,{className:`mem-activity-legend`,children:[(0,K.jsxs)(`span`,{className:`mem-activity-legend-item`,children:[(0,K.jsx)(`span`,{className:`mem-activity-legend-dot conversations`}),` Conversations`]}),(0,K.jsxs)(`span`,{className:`mem-activity-legend-item`,children:[(0,K.jsx)(`span`,{className:`mem-activity-legend-dot tool_calls`}),` Tool Calls`]}),(0,K.jsxs)(`span`,{className:`mem-activity-legend-item`,children:[(0,K.jsx)(`span`,{className:`mem-activity-legend-dot knowledge`}),` Knowledge`]}),(0,K.jsxs)(`span`,{className:`mem-activity-legend-item`,children:[(0,K.jsx)(`span`,{className:`mem-activity-legend-dot errors`}),` Errors`]})]})]}):(0,K.jsxs)(`div`,{className:`mem-empty`,children:[(0,K.jsx)(`div`,{className:`mem-empty-icon`,children:(0,K.jsx)(kt,{size:28})}),(0,K.jsx)(`p`,{children:`No activity data yet`})]})]}),(0,K.jsxs)(`div`,{className:`mem-section`,children:[(0,K.jsxs)(`div`,{className:`mem-section-title mem-section-title-row`,children:[(0,K.jsxs)(`span`,{className:`mem-section-title-left`,children:[(0,K.jsx)(N,{size:14}),` Knowledge Browser`,a&&a.total>0&&(0,K.jsx)(`span`,{className:`mem-section-count`,children:a.total})]}),!Te&&!De&&(0,K.jsxs)(`button`,{className:`mem-section-add-btn`,onClick:()=>Ee(!0),title:`Add a memory entry`,children:[(0,K.jsx)(lt,{size:13}),` Add`]})]}),(0,K.jsxs)(`div`,{className:`mem-filters`,children:[(0,K.jsxs)(`div`,{className:`mem-category-pills`,role:`group`,"aria-label":`Filter by category`,children:[u_.map(e=>(0,K.jsx)(`button`,{className:`mem-category-pill ${e}${A.includes(e)?` active`:``}`,onClick:()=>On(e),"aria-pressed":A.includes(e),children:e},e)),A.length>0&&(0,K.jsx)(`button`,{className:`mem-category-pill clear`,onClick:()=>{j([]),ue(0)},"aria-label":`Clear category filters`,children:`✕ Clear`})]}),(0,K.jsxs)(`select`,{className:`mem-filter-select`,value:ne,onChange:e=>{re(e.target.value),ue(0)},"aria-label":`Filter by context`,children:[(0,K.jsx)(`option`,{value:``,children:`All Contexts`}),Hn.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]}),(0,K.jsxs)(`select`,{className:`mem-filter-select`,value:M,onChange:e=>{P(e.target.value),ue(0)},"aria-label":`Filter by entity`,children:[(0,K.jsx)(`option`,{value:``,children:`All Entities`}),h.map(e=>(0,K.jsxs)(`option`,{value:e.entity,children:[e.entity,` (`,e.count,`)`]},e.entity))]}),(0,K.jsxs)(`div`,{className:`mem-filter-search-wrap`,children:[nn?(0,K.jsx)(`div`,{className:`mem-spinner-sm search-icon`,style:{width:12,height:12,borderWidth:1.5}}):(0,K.jsx)(pt,{size:13,className:`search-icon`}),(0,K.jsx)(`input`,{className:`mem-filter-search`,type:`text`,placeholder:`Search memories...`,value:ie,onChange:e=>yn(e.target.value),"aria-label":`Search memories`})]}),(0,K.jsxs)(`label`,{className:`mem-filter-toggle`,title:`Show entries that have been superseded by newer versions`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:de,onChange:e=>me(e.target.checked)}),(0,K.jsx)(`span`,{children:`Superseded`})]})]}),(Te||De)&&(0,K.jsxs)(`div`,{className:`mem-inline-form`,children:[(0,K.jsxs)(`div`,{className:`mem-inline-form-row`,children:[(0,K.jsx)(`label`,{children:`Content`}),(0,K.jsx)(`textarea`,{value:ke.content,onChange:e=>Ae(t=>({...t,content:e.target.value})),placeholder:`What should the agent remember?`})]}),(0,K.jsxs)(`div`,{className:`mem-inline-form-row`,children:[(0,K.jsx)(`label`,{children:`Category`}),(0,K.jsx)(`select`,{value:ke.category,onChange:e=>Ae(t=>({...t,category:e.target.value})),children:u_.map(e=>(0,K.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,K.jsxs)(`div`,{className:`mem-inline-form-row`,children:[(0,K.jsx)(`label`,{children:`Context`}),(0,K.jsx)(`input`,{type:`text`,value:ke.context,onChange:e=>Ae(t=>({...t,context:e.target.value})),placeholder:`global`})]}),(0,K.jsxs)(`div`,{className:`mem-inline-form-row`,children:[(0,K.jsx)(`label`,{children:`Domain`}),(0,K.jsx)(`input`,{type:`text`,value:ke.domain,onChange:e=>Ae(t=>({...t,domain:e.target.value})),placeholder:`e.g., python, frontend`})]}),(0,K.jsxs)(`div`,{className:`mem-inline-form-row`,children:[(0,K.jsx)(`label`,{children:`Entity`}),(0,K.jsx)(`input`,{type:`text`,value:ke.entity,onChange:e=>Ae(t=>({...t,entity:e.target.value})),placeholder:`e.g., person:sarah_chen`})]}),(0,K.jsxs)(`div`,{className:`mem-inline-form-row`,children:[(0,K.jsx)(`label`,{children:`Due At`}),(0,K.jsx)(`input`,{type:`text`,value:ke.due_at,onChange:e=>Ae(t=>({...t,due_at:e.target.value})),placeholder:`ISO 8601 (e.g., 2026-03-25T09:00:00-07:00)`})]}),(0,K.jsxs)(`div`,{className:`mem-inline-form-row`,children:[(0,K.jsx)(`label`,{children:`Sensitive`}),(0,K.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,cursor:`pointer`,fontSize:12},children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:ke.sensitive,onChange:e=>Ae(t=>({...t,sensitive:e.target.checked}))}),`Mark as sensitive (excluded from system prompt)`]})]}),(0,K.jsxs)(`div`,{className:`mem-inline-form-actions`,children:[(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:()=>{Ee(!1),Oe(null)},children:`Cancel`}),(0,K.jsx)(`button`,{className:`btn-primary`,onClick:De?xn:bn,style:{padding:`8px 20px`,fontSize:13},children:De?`Update`:`Save`})]})]}),a&&a.items.length>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{style:{overflowX:`auto`},children:(0,K.jsxs)(`table`,{className:`mem-knowledge-table`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsxs)(`th`,{onClick:()=>kn(`category`),className:F===`category`?`sorted`:``,children:[`Category`,Bn(`category`)]}),(0,K.jsx)(`th`,{children:`Content`}),(0,K.jsxs)(`th`,{onClick:()=>kn(`context`),className:F===`context`?`sorted`:``,children:[`Context`,Bn(`context`)]}),(0,K.jsx)(`th`,{children:`Entity`}),(0,K.jsxs)(`th`,{onClick:()=>kn(`confidence`),className:F===`confidence`?`sorted`:``,children:[`Confidence`,Bn(`confidence`)]}),(0,K.jsx)(`th`,{children:`Source`}),(0,K.jsxs)(`th`,{onClick:()=>kn(`updated_at`),className:F===`updated_at`?`sorted`:``,children:[`Updated`,Bn(`updated_at`)]}),(0,K.jsxs)(`th`,{onClick:()=>kn(`created_at`),className:F===`created_at`?`sorted`:``,children:[`Created`,Bn(`created_at`)]}),(0,K.jsx)(`th`,{children:`Due`}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:a.items.map(e=>{let t=E===e.id,n=e.has_embedding;return(0,K.jsxs)(w.Fragment,{children:[(0,K.jsxs)(`tr`,{className:`${e.superseded_by?`mem-superseded-row`:``} ${t?`mem-expanded-row`:``}`,onClick:()=>D(t?null:e.id),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),D(t?null:e.id))},tabIndex:0,role:`row`,"aria-expanded":t,style:{cursor:`pointer`},children:[(0,K.jsx)(`td`,{children:(0,K.jsx)(`span`,{className:`mem-cat-badge ${e.category}`,children:e.category})}),(0,K.jsx)(`td`,{children:(0,K.jsxs)(`div`,{className:`mem-content-cell`,title:e.content,children:[n!==void 0&&(0,K.jsx)(`span`,{className:`mem-embed-dot ${n?`embedded`:`missing`}`,title:n?`Embedded`:`Embedding missing`,children:(0,K.jsx)(fe,{size:6,fill:`currentColor`})}),e.sensitive&&(0,K.jsx)(`span`,{className:`mem-sensitive-badge`,title:`Sensitive`,children:(0,K.jsx)(vt,{size:11})}),(0,K.jsx)(`span`,{className:e.sensitive&&!je.has(e.id)?`mem-sensitive-blur`:e.superseded_by?`mem-superseded-text`:``,onClick:t=>{e.sensitive&&(t.stopPropagation(),Ne(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}))},children:e.content})]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(`span`,{className:`mem-date-cell`,children:e.context})}),(0,K.jsx)(`td`,{children:e.entity?(0,K.jsx)(`span`,{className:`mem-entity-link`,onClick:t=>{t.stopPropagation(),P(e.entity),ue(0)},title:`Filter by ${e.entity}`,children:e.entity}):(0,K.jsx)(`span`,{className:`mem-date-cell`,children:`—`})}),(0,K.jsx)(`td`,{children:(0,K.jsxs)(`div`,{className:`mem-confidence`,children:[(0,K.jsx)(`div`,{className:`mem-confidence-bar`,children:(0,K.jsx)(`div`,{className:`mem-confidence-fill ${o_(e.confidence)}`,style:{width:`${e.confidence*100}%`}})}),e.confidence.toFixed(2)]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(`span`,{className:`mem-date-cell`,children:e.source||`—`})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(`span`,{className:`mem-date-cell`,title:t_(e.updated_at),children:n_(e.updated_at)})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(`span`,{className:`mem-date-cell`,title:t_(e.created_at),children:n_(e.created_at)})}),(0,K.jsx)(`td`,{children:e.due_at?(0,K.jsx)(`span`,{className:`mem-due-badge ${a_(e.due_at)?`overdue`:`upcoming`}`,title:t_(e.due_at),children:n_(e.due_at)}):(0,K.jsx)(`span`,{className:`mem-due-badge none`,children:`—`})}),(0,K.jsx)(`td`,{children:(0,K.jsxs)(`div`,{className:`mem-row-actions`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`button`,{className:`mem-row-action-btn`,onClick:()=>wn(e),title:`Edit`,children:(0,K.jsx)(ot,{size:13})}),(0,K.jsx)(`button`,{className:`mem-row-action-btn`,onClick:()=>Cn(e),title:e.sensitive?`Unmark sensitive`:`Mark sensitive`,children:e.sensitive?(0,K.jsx)(_t,{size:13}):(0,K.jsx)(vt,{size:13})}),(0,K.jsx)(`button`,{className:`mem-row-action-btn`,onClick:()=>Tn(e.id),title:`Copy ID`,children:(0,K.jsx)(ge,{size:13})}),(0,K.jsx)(`button`,{className:`mem-row-action-btn delete`,onClick:()=>Sn(e.id),title:`Delete`,children:(0,K.jsx)(Ot,{size:13})})]})})]}),t&&(0,K.jsx)(`tr`,{className:`mem-detail-row`,children:(0,K.jsx)(`td`,{colSpan:10,children:(0,K.jsxs)(`div`,{className:`mem-detail-panel`,children:[(0,K.jsxs)(`div`,{className:`mem-detail-grid`,children:[(0,K.jsxs)(`div`,{className:`mem-detail-field`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`ID`}),(0,K.jsx)(`span`,{className:`mem-detail-value`,children:e.id})]}),(0,K.jsxs)(`div`,{className:`mem-detail-field`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Domain`}),(0,K.jsx)(`span`,{className:`mem-detail-value`,children:e.domain||`—`})]}),(0,K.jsxs)(`div`,{className:`mem-detail-field`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Source`}),(0,K.jsx)(`span`,{className:`mem-detail-value`,children:e.source||`—`})]}),(0,K.jsxs)(`div`,{className:`mem-detail-field`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Use Count`}),(0,K.jsx)(`span`,{className:`mem-detail-value`,children:e.use_count??0})]}),(0,K.jsxs)(`div`,{className:`mem-detail-field`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Created`}),(0,K.jsx)(`span`,{className:`mem-detail-value`,children:t_(e.created_at)})]}),(0,K.jsxs)(`div`,{className:`mem-detail-field`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Updated`}),(0,K.jsx)(`span`,{className:`mem-detail-value`,children:t_(e.updated_at)})]}),(0,K.jsxs)(`div`,{className:`mem-detail-field`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Last Used`}),(0,K.jsx)(`span`,{className:`mem-detail-value`,children:t_(e.last_used)})]}),(0,K.jsxs)(`div`,{className:`mem-detail-field`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Reminded At`}),(0,K.jsx)(`span`,{className:`mem-detail-value`,children:t_(e.reminded_at)})]}),e.superseded_by&&(0,K.jsxs)(`div`,{className:`mem-detail-field`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Superseded By`}),(0,K.jsx)(`span`,{className:`mem-detail-value mem-detail-chain`,children:e.superseded_by})]}),e.metadata&&(0,K.jsxs)(`div`,{className:`mem-detail-field mem-detail-full`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Metadata`}),(0,K.jsx)(`span`,{className:`mem-detail-value`,children:typeof e.metadata==`object`?JSON.stringify(e.metadata,null,2):e.metadata})]})]}),(0,K.jsxs)(`div`,{className:`mem-detail-content-full`,children:[(0,K.jsx)(`span`,{className:`mem-detail-label`,children:`Full Content`}),(0,K.jsx)(`div`,{className:`mem-detail-content-text`,children:e.content})]})]})})})]},e.id)})})]})}),(0,K.jsxs)(`div`,{className:`mem-pagination`,children:[(0,K.jsxs)(`span`,{children:[z+1,`–`,Math.min(z+15,a.total),` of `,a.total]}),(0,K.jsxs)(`div`,{className:`mem-pagination-btns`,children:[(0,K.jsx)(`button`,{className:`mem-page-btn`,disabled:z===0,onClick:()=>ue(Math.max(0,z-15)),children:(0,K.jsx)(oe,{size:14})}),(0,K.jsx)(`button`,{className:`mem-page-btn`,disabled:z+15>=a.total,onClick:()=>ue(z+15),children:(0,K.jsx)(se,{size:14})})]})]})]}):(0,K.jsxs)(`div`,{className:`mem-empty`,children:[(0,K.jsx)(`div`,{className:`mem-empty-icon`,children:(0,K.jsx)(N,{size:28})}),(0,K.jsx)(`p`,{children:ie||A.length>0||ne||M?`No matching memories`:`No memories stored yet`})]})]}),(0,K.jsxs)(`div`,{className:`mem-two-col`,children:[(0,K.jsxs)(`div`,{className:`mem-section`,children:[(0,K.jsxs)(`div`,{className:`mem-section-title`,children:[(0,K.jsx)(Pt,{size:14}),` Tool Performance`]}),s.length>0?(0,K.jsx)(`div`,{style:{overflowX:`auto`},children:(0,K.jsxs)(`table`,{className:`mem-tool-table`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:`Tool`}),(0,K.jsx)(`th`,{children:`Calls`}),(0,K.jsx)(`th`,{children:`Success`}),(0,K.jsx)(`th`,{children:`Avg Time`}),(0,K.jsx)(`th`,{children:`Last Used`}),(0,K.jsx)(`th`,{children:`Last Error`})]})}),(0,K.jsx)(`tbody`,{children:s.map(e=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsx)(`span`,{className:`mem-tool-name`,children:e.tool_name})}),(0,K.jsx)(`td`,{children:e.total_calls}),(0,K.jsx)(`td`,{children:(0,K.jsxs)(`div`,{className:`mem-confidence`,children:[(0,K.jsx)(`div`,{className:`mem-confidence-bar`,style:{width:40},children:(0,K.jsx)(`div`,{className:`mem-confidence-fill ${s_(e.success_rate)}`,style:{width:`${e.success_rate*100}%`}})}),(0,K.jsxs)(`span`,{className:`mem-success-rate ${s_(e.success_rate)}`,children:[Math.round(e.success_rate*100),`%`]})]})}),(0,K.jsx)(`td`,{children:i_(e.avg_duration_ms)}),(0,K.jsx)(`td`,{children:(0,K.jsx)(`span`,{className:`mem-date-cell`,title:t_(e.last_used),children:n_(e.last_used)})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(`span`,{className:`mem-tool-error`,title:e.last_error||``,children:e.last_error||`—`})})]},e.tool_name))})]})}):(0,K.jsxs)(`div`,{className:`mem-empty`,children:[(0,K.jsx)(`div`,{className:`mem-empty-icon`,children:(0,K.jsx)(Pt,{size:28})}),(0,K.jsx)(`p`,{children:`No tool calls recorded yet`})]})]}),(0,K.jsxs)(`div`,{className:`mem-section`,children:[(0,K.jsxs)(`div`,{className:`mem-section-title`,children:[(0,K.jsx)(pe,{size:14}),` Upcoming & Overdue`]}),d.length>0?(0,K.jsx)(`div`,{className:`mem-temporal-list`,children:d.map(e=>{let t=a_(e.due_at);return(0,K.jsxs)(`div`,{className:`mem-temporal-item ${t?`overdue`:`upcoming`}`,children:[(0,K.jsx)(`span`,{className:`mem-temporal-icon`,children:t?(0,K.jsx)(At,{size:16}):(0,K.jsx)(pe,{size:16})}),(0,K.jsxs)(`div`,{className:`mem-temporal-content`,children:[(0,K.jsx)(`div`,{className:`mem-temporal-text`,children:e.content}),(0,K.jsxs)(`div`,{className:`mem-temporal-date`,children:[t?`OVERDUE`:`Due`,`: `,n_(e.due_at),e.context!==`global`&&` \u00B7 ${e.context}`]})]})]},e.id)})}):(0,K.jsxs)(`div`,{className:`mem-empty`,children:[(0,K.jsx)(`div`,{className:`mem-empty-icon`,children:(0,K.jsx)(le,{size:28})}),(0,K.jsx)(`p`,{children:`Nothing upcoming or overdue`})]})]})]}),(0,K.jsxs)(`div`,{className:`mem-section`,children:[(0,K.jsxs)(`div`,{className:`mem-section-title`,children:[(0,K.jsx)(Ye,{size:14}),` Conversation History`]}),(0,K.jsxs)(`div`,{className:`mem-conv-search`,children:[(0,K.jsx)(pt,{size:13,className:`search-icon`}),(0,K.jsx)(`input`,{type:`text`,placeholder:`Search conversations...`,value:he,onChange:e=>En(e.target.value),"aria-label":`Search conversations`}),he&&(0,K.jsx)(`button`,{className:`mem-search-clear`,onClick:()=>{ye(``),xe(null)},"aria-label":`Clear search`,children:(0,K.jsx)(Ft,{size:12})})]}),be===null?l.length>0?(0,K.jsx)(`div`,{className:`mem-conv-list`,children:l.map(e=>(0,K.jsxs)(`div`,{className:`mem-conv-item`,onClick:()=>Dn(e.session_id),children:[(0,K.jsxs)(`div`,{className:`mem-conv-info`,children:[(0,K.jsxs)(`div`,{className:`mem-conv-session-id`,children:[e.session_id.slice(0,8),`...`,e.consolidated&&(0,K.jsx)(`span`,{className:`mem-consolidated-badge`,title:`Consolidated`,children:(0,K.jsx)(Me,{size:11})})]}),e.first_message&&(0,K.jsx)(`div`,{className:`mem-conv-preview`,children:e.first_message})]}),(0,K.jsxs)(`div`,{className:`mem-conv-meta`,children:[(0,K.jsxs)(`span`,{children:[e.turn_count,` turns`]}),(0,K.jsx)(`span`,{children:n_(e.last_activity)})]})]},e.session_id))}):(0,K.jsxs)(`div`,{className:`mem-empty`,children:[(0,K.jsx)(`div`,{className:`mem-empty-icon`,children:(0,K.jsx)(Ye,{size:28})}),(0,K.jsx)(`p`,{children:`No conversation history in memory`})]}):be.length>0?(0,K.jsx)(`div`,{className:`mem-conv-list`,children:be.map(e=>(0,K.jsxs)(`div`,{className:`mem-conv-item`,onClick:()=>Dn(e.session_id),children:[(0,K.jsxs)(`div`,{className:`mem-conv-info`,children:[(0,K.jsxs)(`div`,{className:`mem-conv-session-id`,children:[(0,K.jsx)(`span`,{className:`mem-conv-turn-role ${e.role}`,children:e.role}),` `,e.session_id.slice(0,8),`...`]}),(0,K.jsx)(`div`,{className:`mem-conv-preview`,children:e.content})]}),(0,K.jsx)(`div`,{className:`mem-conv-meta`,children:(0,K.jsx)(`span`,{children:n_(e.timestamp)})})]},e.id))}):(0,K.jsx)(`div`,{className:`mem-empty`,children:(0,K.jsxs)(`p`,{children:[`No conversations match “`,he,`”`]})})]}),Ce&&(0,K.jsxs)(`div`,{className:`mem-conv-detail-overlay`,children:[(0,K.jsxs)(`div`,{className:`mem-conv-detail-header`,children:[(0,K.jsxs)(`h4`,{children:[`Session: `,Ce.sessionId.slice(0,12),`...`]}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>we(null),children:(0,K.jsx)(Ft,{size:16})})]}),(0,K.jsxs)(`div`,{className:`mem-conv-detail-body`,children:[Ce.turns.map(e=>(0,K.jsxs)(`div`,{className:`mem-conv-turn`,children:[(0,K.jsxs)(`div`,{className:`mem-conv-turn-header`,children:[(0,K.jsx)(`div`,{className:`mem-conv-turn-role ${e.role}`,children:e.role}),(0,K.jsx)(`span`,{className:`mem-conv-turn-time`,title:t_(e.timestamp),children:n_(e.timestamp)})]}),(0,K.jsx)(`div`,{className:`mem-conv-turn-content`,children:e.content})]},e.id)),Ce.turns.length===0&&(0,K.jsx)(`div`,{className:`mem-empty`,children:`No turns found`})]})]})]}),(0,K.jsxs)(`div`,{className:`mem-section`,children:[(0,K.jsxs)(`div`,{className:`mem-section-title`,children:[(0,K.jsx)(vt,{size:14}),` Settings `,(0,K.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`})]}),(0,K.jsxs)(`div`,{className:`mem-setting-row`,children:[(0,K.jsxs)(`div`,{className:`mem-setting-info`,children:[(0,K.jsx)(`span`,{className:`mem-setting-label`,children:`Memory enabled`}),(0,K.jsx)(`span`,{className:`mem-setting-desc`,children:`When disabled, no knowledge or conversation data is stored during any session (global incognito).`})]}),(0,K.jsx)(`button`,{className:`mem-toggle${Pe?` mem-toggle-on`:``}`,disabled:Be,onClick:async()=>{if(!Pe){qe(`memory`);return}Ve(!0);try{let e=await Wg({memory_enabled:!1});Fe(e.memory_enabled)}catch(e){U.system.warn(`Failed to disable memory`,e)}finally{Ve(!1)}},"aria-pressed":Pe,"aria-label":`Memory is ${Pe?`enabled`:`disabled`}`,children:Pe?`On`:`Off`})]}),Ke&&(()=>{let e={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()=>{let e=await Wg({memory_enabled:!0});Fe(e.memory_enabled),G(`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()=>{let e=await Wg({mcp_memory_enabled:!0});Le(e.mcp_memory_enabled),G(`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()=>{let e=await Wg({system_discovery_consent:!0});if(ze(e.system_discovery_consent),e.system_context_error)G(`System discovery enabled but scan failed: ${e.system_context_error}`,`error`);else{let t=e.system_context_refresh?.stored??0;G(`System discovery enabled — ${t} system facts collected`,`info`)}_n()}}}[Ke];return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.6)`,zIndex:9998,backdropFilter:`blur(4px)`},onClick:()=>qe(null)}),(0,K.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:[(0,K.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:16},children:[(0,K.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`}),(0,K.jsx)(`span`,{style:{fontSize:16,fontWeight:600,color:`#e0e0e0`},children:e.title})]}),(0,K.jsx)(`p`,{style:{fontSize:13,lineHeight:1.6,color:`#999`,margin:`0 0 8px`},children:e.description}),(0,K.jsx)(`ul`,{style:{fontSize:13,lineHeight:1.7,color:`#999`,margin:`0 0 24px`,paddingLeft:20},children:e.bullets.map((e,t)=>(0,K.jsx)(`li`,{children:e.map((e,t)=>t%2==1?(0,K.jsx)(`strong`,{style:{color:`#ccc`},children:e},t):(0,K.jsx)(`span`,{children:e},t))},t))}),(0,K.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:10},children:[(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:()=>qe(null),style:{padding:`8px 20px`,fontSize:13,borderRadius:6},children:`Cancel`}),(0,K.jsx)(`button`,{disabled:Be,onClick:async()=>{Ve(!0);try{await e.onConfirm()}catch(e){U.system.warn(`Failed to update setting`,e),G(`Failed to update setting. Please try again.`,`error`)}finally{Ve(!1),qe(null)}},style:{padding:`8px 24px`,fontSize:13,fontWeight:600,borderRadius:6,border:`none`,cursor:`pointer`,background:`linear-gradient(135deg, #f59e0b, #d97706)`,color:`#000`},children:e.buttonLabel})]})]})]})})(),(0,K.jsxs)(`div`,{className:`mem-setting-row`,children:[(0,K.jsxs)(`div`,{className:`mem-setting-info`,children:[(0,K.jsx)(`span`,{className:`mem-setting-label`,children:`MCP memory access`}),(0,K.jsx)(`span`,{className:`mem-setting-desc`,children:`Expose read-only memory tools to MCP clients (for debug/troubleshooting). Requires MCP server restart.`})]}),(0,K.jsx)(`button`,{className:`mem-toggle${Ie?` mem-toggle-on`:``}`,disabled:Be,onClick:async()=>{if(!Ie){qe(`mcp`);return}Ve(!0);try{let e=await Wg({mcp_memory_enabled:!1});Le(e.mcp_memory_enabled)}catch(e){U.system.warn(`Failed to update memory settings`,e)}finally{Ve(!1)}},"aria-label":`Toggle MCP memory access`,"aria-pressed":Ie,children:Ie?`On`:`Off`})]}),(0,K.jsxs)(`div`,{className:`mem-setting-row`,children:[(0,K.jsxs)(`div`,{className:`mem-setting-info`,children:[(0,K.jsx)(`span`,{className:`mem-setting-label`,children:`System discovery`}),(0,K.jsx)(`span`,{className:`mem-setting-desc`,children:`Allow GAIA to scan your system for hardware, software, and environment information to personalize responses.`})]}),(0,K.jsx)(`button`,{className:`mem-toggle${Re?` mem-toggle-on`:``}`,disabled:Be,onClick:async()=>{if(!Re){qe(`discovery`);return}Ve(!0);try{let e=await Wg({system_discovery_consent:!1});ze(e.system_discovery_consent)}catch(e){U.system.warn(`Failed to update system discovery setting`,e)}finally{Ve(!1)}},"aria-label":`Toggle system discovery`,"aria-pressed":Re,children:Re?`On`:`Off`})]}),(0,K.jsxs)(`div`,{className:`mem-setting-row mem-setting-row-danger`,children:[(0,K.jsxs)(`div`,{className:`mem-setting-info`,children:[(0,K.jsx)(`span`,{className:`mem-setting-label`,children:`Re-initialize memory`}),(0,K.jsx)(`span`,{className:`mem-setting-desc`,children:`Wipe all memories, conversations, and tool logs, then re-collect system information. This cannot be undone.`})]}),We?(0,K.jsxs)(`div`,{className:`mem-delete-confirm`,children:[(0,K.jsx)(`span`,{className:`mem-delete-confirm-label`,children:`Are you sure?`}),(0,K.jsx)(`button`,{className:`mem-btn-danger`,disabled:Be,onClick:async()=>{Ve(!0);try{let e=await Kg();G(`Re-initialized: cleared ${e.cleared.knowledge} entries, restored ${e.system_context.stored} system facts`,`info`),_n()}catch(e){U.system.warn(`Failed to reinitialize memory`,e),G(`Failed to re-initialize memory`,`error`)}finally{Ve(!1),Ge(!1)}},children:`Yes, re-initialize`}),(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:()=>Ge(!1),style:{padding:`6px 14px`,fontSize:12},children:`Cancel`})]}):(0,K.jsx)(`button`,{className:`mem-btn-danger`,disabled:Be,onClick:()=>Ge(!0),children:`Re-initialize`})]}),(0,K.jsxs)(`div`,{className:`mem-setting-row mem-setting-row-danger`,children:[(0,K.jsxs)(`div`,{className:`mem-setting-info`,children:[(0,K.jsx)(`span`,{className:`mem-setting-label`,children:`Delete all memories`}),(0,K.jsx)(`span`,{className:`mem-setting-desc`,children:`Permanently wipe all knowledge entries, conversation history, and tool logs. This cannot be undone.`})]}),He?(0,K.jsxs)(`div`,{className:`mem-delete-confirm`,children:[(0,K.jsx)(`span`,{className:`mem-delete-confirm-label`,children:`Are you sure?`}),(0,K.jsx)(`button`,{className:`mem-btn-danger`,disabled:Be,onClick:async()=>{Ve(!0);try{let e=await Gg();G(`Deleted ${e.knowledge} knowledge entries, ${e.conversations} conversations`,`info`),_n()}catch(e){U.system.warn(`Failed to clear memory`,e),G(`Failed to clear memory`,`error`)}finally{Ve(!1),B(!1)}},children:`Yes, delete all`}),(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:()=>B(!1),style:{padding:`6px 14px`,fontSize:12},children:`Cancel`})]}):(0,K.jsx)(`button`,{className:`mem-btn-danger`,disabled:Be,onClick:()=>B(!0),children:`Delete All`})]})]}),t&&(0,K.jsxs)(`div`,{className:`mem-db-footer`,children:[(0,K.jsxs)(`span`,{children:[`Database: `,r_(t.db_size_bytes),t.knowledge?.avg_confidence!=null&&` \u00B7 Avg confidence: ${t.knowledge.avg_confidence.toFixed(2)}`]}),(0,K.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[t.knowledge?.entity_count!=null&&t.knowledge.entity_count>0&&(0,K.jsxs)(`span`,{children:[t.knowledge.entity_count,` entities`]}),t.knowledge?.sensitive_count!=null&&t.knowledge.sensitive_count>0&&(0,K.jsxs)(`span`,{children:[(0,K.jsx)(vt,{size:10}),` `,t.knowledge.sensitive_count,` sensitive`]})]})]})]})}),Je===`profile`&&(0,K.jsxs)(`div`,{className:`mem-profile-grid`,children:[(0,K.jsxs)(`div`,{className:`mem-profile-card`,children:[(0,K.jsxs)(`div`,{className:`mem-profile-card-title`,children:[(0,K.jsx)(_e,{size:16}),` System Discovery`]}),(0,K.jsx)(`p`,{className:`mem-profile-desc`,children:`Scan your system to discover apps, projects, and usage patterns.`}),(0,K.jsx)(`button`,{className:`btn-primary mem-profile-run-btn`,disabled:ft===`running`||ft===`saving`,onClick:In,children:ft===`running`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mem-spinner-sm`}),` Running...`]}):`Run Discovery`}),ht.length>0&&(0,K.jsx)(`div`,{className:`mem-log`,ref:Ct,children:ht.map((e,t)=>(0,K.jsx)(`div`,{className:`mem-log-line ${e.kind}`,children:e.text},t))}),(ft===`review`||ft===`saving`||ft===`done`)&&V.length>0&&(0,K.jsxs)(`div`,{className:`mem-review-section`,children:[(0,K.jsx)(`div`,{className:`mem-review-header`,children:`Review & Save`}),(0,K.jsx)(`div`,{className:`mem-review-list`,children:V.map((e,t)=>(0,K.jsxs)(`label`,{className:`mem-review-item`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:e._checked,disabled:ft===`saving`||ft===`done`,onChange:()=>{yt(e=>e.map((e,n)=>n===t?{...e,_checked:!e._checked}:e))}}),(0,K.jsx)(`span`,{className:`mem-review-content`,children:e.content}),(0,K.jsx)(`span`,{className:`mem-source-badge`,children:e._source_name||e.category}),(0,K.jsxs)(`span`,{className:`mem-conf-badge`,children:[Math.round(e.confidence*100),`%`]})]},t))}),(0,K.jsxs)(`div`,{className:`mem-review-actions`,children:[(0,K.jsx)(`button`,{className:`btn-primary`,disabled:ft===`saving`||ft===`done`||V.filter(e=>e._checked).length===0,onClick:Ln,children:ft===`saving`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mem-spinner-sm`}),` Saving...`]}):`Save Selected (${V.filter(e=>e._checked).length})`}),(0,K.jsxs)(`span`,{className:`mem-review-select-links`,children:[(0,K.jsx)(`a`,{onClick:()=>yt(e=>e.map(e=>({...e,_checked:!0}))),children:`Select All`}),` / `,(0,K.jsx)(`a`,{onClick:()=>yt(e=>e.map(e=>({...e,_checked:!1}))),children:`None`})]})]})]}),ft===`done`&&xt!==null&&(0,K.jsxs)(`div`,{className:`mem-profile-success`,children:[(0,K.jsx)(le,{size:14}),` Saved `,xt,` items to memory`]}),ft===`review`&&V.length===0&&(0,K.jsx)(`div`,{className:`mem-profile-empty`,children:`No items discovered.`})]}),(0,K.jsxs)(`div`,{className:`mem-profile-card`,children:[(0,K.jsxs)(`div`,{className:`mem-profile-card-title`,children:[(0,K.jsx)(bt,{size:16}),` AI Profile Inference`]}),(0,K.jsx)(`p`,{className:`mem-profile-desc`,children:`Use the local LLM to generate profile insights from your data.`}),(0,K.jsx)(`p`,{className:`mem-profile-note`,children:`Requires Lemonade Server running.`}),(0,K.jsxs)(`label`,{className:`mem-profile-checkbox`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:Vt,onChange:e=>Ht(e.target.checked),disabled:Tt===`running`||Tt===`saving`}),`Include browser history`]}),(0,K.jsx)(`button`,{className:`btn-primary mem-profile-run-btn`,disabled:Tt===`running`||Tt===`saving`,onClick:Rn,children:Tt===`running`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mem-spinner-sm`}),` Running...`]}):`Run Inference`}),jt.length>0&&(0,K.jsx)(`div`,{className:`mem-log`,ref:Ut,children:jt.map((e,t)=>(0,K.jsx)(`div`,{className:`mem-log-line ${e.kind}`,children:e.text},t))}),(Tt===`review`||Tt===`saving`||Tt===`done`)&&Lt.length>0&&(0,K.jsxs)(`div`,{className:`mem-review-section`,children:[(0,K.jsx)(`div`,{className:`mem-review-header`,children:`Review & Save`}),(0,K.jsx)(`div`,{className:`mem-review-list`,children:Lt.map((e,t)=>(0,K.jsxs)(`label`,{className:`mem-review-item`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:e._checked,disabled:Tt===`saving`||Tt===`done`,onChange:()=>{Rt(e=>e.map((e,n)=>n===t?{...e,_checked:!e._checked}:e))}}),(0,K.jsx)(`span`,{className:`mem-review-content`,children:e.content}),(0,K.jsx)(`span`,{className:`mem-domain-badge ${d_[e.domain]||`gray`}`,children:e.domain}),(0,K.jsxs)(`span`,{className:`mem-conf-badge`,children:[Math.round(e.confidence*100),`%`]})]},t))}),(0,K.jsxs)(`div`,{className:`mem-review-actions`,children:[(0,K.jsx)(`button`,{className:`btn-primary`,disabled:Tt===`saving`||Tt===`done`||Lt.filter(e=>e._checked).length===0,onClick:zn,children:Tt===`saving`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mem-spinner-sm`}),` Saving...`]}):`Save Selected (${Lt.filter(e=>e._checked).length})`}),(0,K.jsxs)(`span`,{className:`mem-review-select-links`,children:[(0,K.jsx)(`a`,{onClick:()=>Rt(e=>e.map(e=>({...e,_checked:!0}))),children:`Select All`}),` / `,(0,K.jsx)(`a`,{onClick:()=>Rt(e=>e.map(e=>({...e,_checked:!1}))),children:`None`})]})]})]}),Tt===`done`&&zt!==null&&(0,K.jsxs)(`div`,{className:`mem-profile-success`,children:[(0,K.jsx)(le,{size:14}),` Saved `,zt,` insights to memory`]}),Tt===`review`&&Lt.length===0&&(0,K.jsx)(`div`,{className:`mem-profile-empty`,children:`No insights generated.`})]})]}),Je===`goals`&&(0,K.jsxs)(`div`,{className:`mem-goals-tab`,children:[(0,K.jsx)(`div`,{className:`mem-goals-stats-row`,children:[`queued`,`in_progress`,`completed`,`failed`].map(e=>(0,K.jsxs)(`div`,{className:`mem-goals-stat-pill mem-goal-status-${e.replace(`_`,`-`)}`,children:[(0,K.jsx)(`span`,{className:`mem-goals-stat-n`,children:$e?.goals[e]??0}),(0,K.jsx)(`span`,{className:`mem-goals-stat-label`,children:e.replace(`_`,` `)})]},e))}),Ze.filter(e=>e.status===`pending_approval`).length>0&&(0,K.jsxs)(`div`,{className:`mem-goals-approval-banner`,children:[(0,K.jsxs)(`div`,{className:`mem-goals-approval-title`,children:[(0,K.jsx)(It,{size:14}),` Agent suggested `,Ze.filter(e=>e.status===`pending_approval`).length,` goal(s) — review before execution`]}),Ze.filter(e=>e.status===`pending_approval`).map(e=>(0,K.jsxs)(`div`,{className:`mem-goals-approval-item`,children:[(0,K.jsxs)(`div`,{className:`mem-goals-approval-text`,children:[(0,K.jsx)(`strong`,{children:e.title}),(0,K.jsx)(`span`,{children:e.description})]}),(0,K.jsxs)(`div`,{className:`mem-goals-approval-actions`,children:[(0,K.jsx)(`button`,{className:`btn-danger-sm`,onClick:async()=>{await Zg(e.id),gn()},children:`Reject`}),(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:async()=>{await Xg(e.id),gn()},children:`Accept`})]})]},e.id))]}),(0,K.jsx)(`div`,{className:`mem-goals-toolbar`,children:(0,K.jsxs)(`button`,{className:`btn-primary`,onClick:()=>st(e=>!e),children:[(0,K.jsx)(lt,{size:14}),` New Goal`]})}),at&&(0,K.jsxs)(`div`,{className:`mem-goals-add-form`,children:[(0,K.jsx)(`input`,{className:`mem-input`,placeholder:`Goal title`,value:ct.title,onChange:e=>dt(t=>({...t,title:e.target.value}))}),(0,K.jsx)(`textarea`,{className:`mem-input`,placeholder:`Description — what should the agent work toward?`,rows:2,value:ct.description,onChange:e=>dt(t=>({...t,description:e.target.value}))}),(0,K.jsxs)(`div`,{className:`mem-goals-form-row`,children:[(0,K.jsxs)(`select`,{className:`mem-select`,value:ct.priority,onChange:e=>dt(t=>({...t,priority:e.target.value})),children:[(0,K.jsx)(`option`,{value:`low`,children:`Low priority`}),(0,K.jsx)(`option`,{value:`medium`,children:`Medium priority`}),(0,K.jsx)(`option`,{value:`high`,children:`High priority`})]}),(0,K.jsx)(`button`,{className:`btn-primary`,onClick:async()=>{ct.title.trim()&&(await Yg(ct),dt({title:``,description:``,priority:`medium`}),st(!1),gn())},children:`Create`}),(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:()=>st(!1),children:`Cancel`})]})]}),tt?(0,K.jsxs)(`div`,{className:`mem-loading`,children:[(0,K.jsx)(`div`,{className:`mem-spinner`}),` Loading goals...`]}):Ze.filter(e=>e.status!==`pending_approval`&&e.status!==`rejected`).length===0?(0,K.jsxs)(`div`,{className:`mem-empty`,children:[(0,K.jsx)(`div`,{className:`mem-empty-icon`,children:(0,K.jsx)(Et,{size:32})}),(0,K.jsx)(`p`,{children:`No goals yet. Create one or let the agent suggest goals in autonomous mode.`})]}):(0,K.jsx)(`div`,{className:`mem-goals-list`,children:Ze.filter(e=>e.status!==`pending_approval`&&e.status!==`rejected`).map(e=>(0,K.jsxs)(`div`,{className:`mem-goal-card mem-goal-status-${e.status.replace(`_`,`-`)}`,children:[(0,K.jsxs)(`div`,{className:`mem-goal-header`,onClick:()=>it(t=>t===e.id?null:e.id),children:[(0,K.jsxs)(`div`,{className:`mem-goal-header-left`,children:[(0,K.jsx)(`span`,{className:`mem-goal-status-dot status-${e.status.replace(`_`,`-`)}`}),(0,K.jsx)(`span`,{className:`mem-goal-title`,children:e.title}),(0,K.jsx)(`span`,{className:`mem-goal-priority mem-priority-${e.priority}`,children:e.priority}),e.source!==`user`&&(0,K.jsxs)(`span`,{className:`mem-goal-source-badge`,children:[(0,K.jsx)(It,{size:10}),` `,e.source.replace(`_`,` `)]})]}),(0,K.jsxs)(`div`,{className:`mem-goal-header-right`,children:[(0,K.jsxs)(`span`,{className:`mem-goal-task-count`,children:[(0,K.jsx)(Ue,{size:12}),e.tasks.filter(e=>e.status===`completed`).length,`/`,e.tasks.length]}),e.status===`queued`&&(0,K.jsx)(`button`,{className:`mem-goal-action-btn mem-goal-cancel-btn`,onClick:async t=>{t.stopPropagation(),await Qg(e.id),gn()},children:`Cancel`}),(0,K.jsx)(`button`,{className:`mem-goal-action-btn mem-goal-delete-btn`,onClick:async t=>{t.stopPropagation(),confirm(`Delete goal "${e.title}"?`)&&(await $g(e.id),gn())},children:(0,K.jsx)(Ot,{size:12})}),(0,K.jsx)(I,{size:14,className:rt===e.id?`mem-chevron-open`:``})]})]}),rt===e.id&&(0,K.jsxs)(`div`,{className:`mem-goal-body`,children:[e.description&&(0,K.jsx)(`p`,{className:`mem-goal-desc`,children:e.description}),e.progress_notes&&(0,K.jsx)(`p`,{className:`mem-goal-progress`,children:e.progress_notes}),e.tasks.length>0?(0,K.jsx)(`div`,{className:`mem-task-list`,children:e.tasks.map(e=>(0,K.jsxs)(`div`,{className:`mem-task-row mem-task-status-${e.status}`,children:[(0,K.jsx)(`span`,{className:`mem-task-dot status-${e.status}`}),(0,K.jsx)(`span`,{className:`mem-task-desc`,children:e.description}),(0,K.jsx)(`span`,{className:`mem-task-status-label`,children:e.status}),e.result&&(0,K.jsx)(`span`,{className:`mem-task-result`,children:e.result})]},e.id))}):(0,K.jsx)(`p`,{className:`mem-goal-no-tasks`,children:`No tasks yet — the agent will break this down when it starts.`})]})]},e.id))})]})]}),O.length>0&&(0,K.jsx)(`div`,{className:`mem-toast-container`,"aria-live":`polite`,children:O.map(e=>(0,K.jsxs)(`div`,{className:`mem-toast mem-toast-${e.type}`,role:`status`,children:[e.type===`success`&&(0,K.jsx)(le,{size:14}),e.type===`error`&&(0,K.jsx)(At,{size:14}),e.type===`info`&&(0,K.jsx)(N,{size:14}),(0,K.jsx)(`span`,{children:e.text})]},e.id))})]})}function p_(e,t){if(!(e instanceof Error))return t;let n=e.message,r=n.match(/API \d+: (.+)/);if(r)try{let e=JSON.parse(r[1]);if(e.detail)return e.detail}catch{}return n}var m_=Ht((e,t)=>({schedules:[],loading:!1,error:null,selectedSchedule:null,results:[],resultsLoading:!1,loadSchedules:async()=>{t().schedules.length===0&&!t().error&&e({loading:!0}),e({error:null});try{e({schedules:(await hr()).schedules||[],loading:!1})}catch(t){U.api.error(`Failed to load schedules`,t),e({error:`Failed to load schedules`,loading:!1})}},createSchedule:async(t,n,r)=>{try{let i=await gr(t,n,r);e(e=>({schedules:[...e.schedules,i],error:null}))}catch(t){let n=p_(t,`Failed to create schedule`);throw U.api.error(`Failed to create schedule`,t),e({error:n}),t}},updateScheduleStatus:async(t,n)=>{try{let r=await _r(t,n);e(e=>({schedules:e.schedules.map(e=>e.name===t?r:e),error:null}))}catch(n){U.api.error(`Failed to update schedule "${t}"`,n),e({error:p_(n,`Failed to update schedule`)})}},deleteSchedule:async t=>{try{await vr(t),e(e=>({schedules:e.schedules.filter(e=>e.name!==t),selectedSchedule:e.selectedSchedule===t?null:e.selectedSchedule,error:null}))}catch(n){U.api.error(`Failed to delete schedule "${t}"`,n),e({error:p_(n,`Failed to delete schedule`)})}},selectSchedule:n=>{e({selectedSchedule:n,results:[]}),n&&t().loadResults(n)},loadResults:async t=>{e({resultsLoading:!0});try{e({results:(await yr(t)).results||[],resultsLoading:!1})}catch(n){U.api.error(`Failed to load results for "${t}"`,n),e({results:[],resultsLoading:!1})}}}));function h_(e){return e<60?`${e}s`:e<3600?`${Math.round(e/60)}m`:e<86400?`${Math.round(e/3600)}h`:`${Math.round(e/86400)}d`}function g_(e,t){if(!e)return`never`;let n=new Date(e),r=(t||new Date).getTime()-n.getTime(),i=Math.floor(r/1e3);if(i<0){let e=Math.abs(i);if(e<60)return`in ${e}s`;let t=Math.floor(e/60);if(t<60)return`in ${t}m`;let n=Math.floor(t/60);return n<24?`in ${n}h`:`in ${Math.floor(n/24)}d`}if(i<60)return`just now`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:n.toLocaleDateString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function __(e){if(!e)return!1;let t=new Date(e).getTime()-Date.now();return t>0&&t<6e4}function v_(e){let[t,n]=e.split(`:`).map(Number),r=t>=12?`PM`:`AM`;return`${t===0?12:t>12?t-12:t}:${n.toString().padStart(2,`0`)} ${r}`}function y_(e){let t=e>=12?`PM`:`AM`;return`${e===0?12:e>12?e-12:e} ${t}`}function b_(e){let t=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`];return e.length===5&&!e.includes(5)&&!e.includes(6)?`Weekdays`:e.length===2&&e.includes(5)&&e.includes(6)?`Weekends`:e.length===7?`Every day`:e.map(e=>t[e]).join(`, `)}function x_({schedule:e}){let{selectedSchedule:t,selectSchedule:n,updateScheduleStatus:r,deleteSchedule:i,results:a,resultsLoading:o,loadSchedules:s,loadResults:c}=m_(),{setCurrentSession:l,setShowSchedules:u}=H(),d=t===e.name,[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(()=>new Date),g=(0,w.useRef)(null);(0,w.useEffect)(()=>{let t=e.status===`active`&&__(e.next_run_at);return t&&!g.current?g.current=setInterval(()=>{h(new Date),e.next_run_at&&new Date(e.next_run_at).getTime()<=Date.now()&&s()},1e3):!t&&g.current&&(clearInterval(g.current),g.current=null),()=>{g.current&&=(clearInterval(g.current),null)}},[e.status,e.next_run_at,s]);let _=(0,w.useRef)(e.last_run_at);(0,w.useEffect)(()=>{d&&e.last_run_at!==_.current&&(_.current=e.last_run_at,c(e.name))},[d,e.last_run_at,e.name,c]);let v=e.last_run_at&&Date.now()-new Date(e.last_run_at).getTime()<5e3,y=(0,w.useCallback)(t=>{t.stopPropagation();let n=e.status===`active`?`paused`:`active`;U.ui.info(`Schedule "${e.name}": ${e.status} -> ${n}`),r(e.name,n)},[e.name,e.status,r]),b=(0,w.useCallback)(t=>{if(t.stopPropagation(),!f){p(!0),setTimeout(()=>p(!1),3e3);return}U.ui.info(`Deleting schedule "${e.name}"`),i(e.name)},[e.name,f,i]),x=(0,w.useCallback)(t=>{t.stopPropagation(),e.session_id&&(U.ui.info(`Opening chat session for schedule "${e.name}"`),l(e.session_id),u(!1))},[e.session_id,e.name,l,u]);return(0,K.jsxs)(`div`,{className:`schedule-card ${d?`selected`:``} ${v?`just-ran`:``}`,onClick:()=>n(d?null:e.name),children:[(0,K.jsxs)(`div`,{className:`schedule-card-header`,children:[(0,K.jsx)(`span`,{className:`schedule-card-name`,children:e.name}),(0,K.jsx)(`span`,{className:`schedule-card-status ${e.status}`,children:e.status})]}),(0,K.jsx)(`div`,{className:`schedule-card-prompt`,children:e.prompt}),(0,K.jsxs)(`div`,{className:`schedule-card-meta`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(pe,{size:11}),` `,h_(e.interval_seconds)]}),(0,K.jsxs)(`span`,{children:[`Runs: `,e.run_count]}),e.error_count>0&&(0,K.jsxs)(`span`,{children:[`Errors: `,e.error_count]}),(0,K.jsxs)(`span`,{children:[`Last: `,g_(e.last_run_at)]}),(0,K.jsxs)(`span`,{children:[`Next: `,g_(e.next_run_at,m)]})]}),(0,K.jsxs)(`div`,{className:`schedule-card-actions`,children:[e.session_id&&(0,K.jsxs)(`button`,{className:`btn-sm chat`,onClick:x,title:`Open chat session`,children:[(0,K.jsx)(Ye,{size:11}),` Open Chat`]}),(0,K.jsx)(`button`,{className:`btn-sm`,onClick:y,title:e.status===`active`?`Pause`:`Resume`,children:e.status===`active`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(it,{size:11}),` Pause`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(st,{size:11}),` Resume`]})}),(0,K.jsxs)(`button`,{className:`btn-sm danger`,onClick:b,title:`Delete`,children:[(0,K.jsx)(Ot,{size:11}),` `,f?`Confirm?`:`Delete`]})]}),d&&(0,K.jsxs)(`div`,{className:`schedule-results`,children:[(0,K.jsx)(`h4`,{children:`Execution History`}),o?(0,K.jsx)(`p`,{className:`schedule-results-empty`,children:`Loading...`}):a.length===0?(0,K.jsx)(`p`,{className:`schedule-results-empty`,children:`No executions yet`}):(0,K.jsx)(`div`,{className:`schedule-results-list`,children:a.map(e=>(0,K.jsxs)(`div`,{className:`schedule-result-item`,children:[(0,K.jsx)(`div`,{className:`schedule-result-time`,children:g_(e.executed_at)}),e.error?(0,K.jsx)(`div`,{className:`schedule-result-content schedule-result-error`,children:e.error}):(0,K.jsx)(`div`,{className:`schedule-result-content`,children:e.result||`(no output)`})]},e.id))})]})]})}function S_(){let{setShowSchedules:e}=H(),{schedules:t,loading:n,error:r,loadSchedules:i,createSchedule:a}=m_(),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(``),[u,d]=(0,w.useState)(``),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(null),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(null),S=(0,w.useRef)(null);(0,w.useEffect)(()=>{if(!c.trim()){h(null);return}return S.current&&clearTimeout(S.current),S.current=window.setTimeout(async()=>{_(!0);try{let e=await br(c);h(e)}catch{h(null)}finally{_(!1)}},400),()=>{S.current&&clearTimeout(S.current)}},[c]);let C=(0,w.useRef)(null);(0,w.useEffect)(()=>(U.ui.info(`Schedule Manager opened`),i(),C.current=window.setInterval(()=>i(),5e3),()=>{C.current&&clearInterval(C.current)}),[i]);let T=c.trim()&&u.trim()&&f.trim()&&(m===null||m.valid),E=(0,w.useCallback)(async()=>{if(T){y(!0),x(null);try{await a(u.trim(),c.trim(),f.trim()),l(``),d(``),p(``),h(null),s(!1),U.ui.info(`Schedule "${u}" created`)}catch(e){let t=e instanceof Error?e.message:`Failed to create schedule`;x(t)}finally{y(!1)}}},[T,u,c,f,a]);return(0,K.jsx)(`div`,{className:`modal-overlay`,onClick:()=>e(!1),role:`dialog`,"aria-modal":`true`,"aria-label":`Schedule Manager`,children:(0,K.jsxs)(`div`,{className:`modal-panel schedule-modal`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`modal-header`,children:[(0,K.jsx)(`h3`,{children:`Scheduled Tasks`}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:()=>e(!1),"aria-label":`Close schedule manager`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`modal-body`,children:[(0,K.jsx)(`section`,{className:`schedule-section`,children:o?(0,K.jsxs)(`div`,{className:`schedule-create-form`,children:[(0,K.jsx)(`textarea`,{className:`schedule-nl-input`,placeholder:`Describe your schedule in natural language...
|
|
@@ -65,5 +65,5 @@ Continue?`)){c({kind:`working`,message:`Exporting…`});try{let e=await fetch(`$
|
|
|
65
65
|
|
|
66
66
|
`+r+`
|
|
67
67
|
|
|
68
|
-
Import?`)){c({kind:`working`,message:`Uploading…`});try{let e=new FormData;e.append(`bundle`,t,t.name);let n=await fetch(`${A_}/agents/import`,{method:`POST`,headers:{"X-Gaia-UI":`1`},body:e});if(!n.ok){let e=await n.text().catch(()=>``),t=e;try{t=JSON.parse(e).detail||e}catch{}throw Error(t||`Import failed (HTTP ${n.status})`)}let r=await n.json(),i=r.imported||[],a=r.overwritten||[];await l();let o;if(i.length===0?o=`No agents imported`:(o=`Installed ${i.length} agent(s): ${i.join(`, `)}`,a.length>0&&(o+=` (replaced: ${a.join(`, `)})`)),r.requires_restart&&(o+=` — restart required for replaced agents to take full effect`),r.errors&&r.errors.length>0){let e=r.errors.map(e=>`${e.id}: ${e.error}`).join(`; `);c({kind:`error`,message:`${o}. Errors: ${e}`})}else c({kind:`success`,message:o})}catch(e){console.error(`Agent import failed:`,e);let t=e instanceof Error?e.message:String(e);U.api.error(`Agent import failed`,e),c({kind:`error`,message:`Import failed: ${t}`})}}},[c,l]),h=t.kind===`working`;return(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Custom Agents`}),u.length===0?(0,K.jsx)(`p`,{className:`danger-warning`,style:{marginBottom:12},children:`No custom agents installed yet. Import a bundle below to add one.`}):(0,K.jsx)(`div`,{className:`status-grid`,style:{marginBottom:12},children:u.map(e=>(0,K.jsxs)(`div`,{className:`status-row`,children:[(0,K.jsx)(`span`,{className:`status-label`,children:e.name}),(0,K.jsxs)(`div`,{className:`status-value-wrap`,children:[(0,K.jsx)(`span`,{className:`status-value ${e.registered?`ok`:`warn`}`,children:e.id}),e.registered?e.source&&(0,K.jsx)(`span`,{className:`status-hint`,children:(0,K.jsx)(`code`,{children:e.source})}):(0,K.jsx)(`span`,{className:`status-hint`,children:`Not loaded`})]})]},e.id))}),(0,K.jsxs)(`div`,{className:`setting-actions`,style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,K.jsx)(`button`,{className:`btn-model-save`,onClick:f,disabled:h||!d,title:d?void 0:`No custom agents to export`,children:h&&t.message.startsWith(`Export`)?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Exporting…`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(be,{size:13,style:{verticalAlign:-2,marginRight:6}}),`Export All`]})}),(0,K.jsx)(`button`,{className:`btn-model-save`,onClick:p,disabled:h,children:h&&t.message.startsWith(`Upload`)?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Uploading…`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jt,{size:13,style:{verticalAlign:-2,marginRight:6}}),`Import`]})}),(0,K.jsx)(`input`,{ref:a,type:`file`,accept:`.zip,application/zip`,style:{display:`none`},onChange:m})]}),t.kind!==`idle`&&(0,K.jsxs)(`div`,{ref:s,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`&&(0,K.jsx)(B,{size:14,className:`btn-spinner`}),t.kind===`success`&&(0,K.jsx)(z,{size:14}),t.kind===`error`&&(0,K.jsx)(L,{size:14}),(0,K.jsx)(`span`,{children:t.message})]})]})}async function M_(e){let t=await e.arrayBuffer(),n=new DataView(t),r=new Uint8Array(t),i=Math.min(t.byteLength,65557),a=t.byteLength-i,o=-1;for(let e=t.byteLength-22;e>=a;e--)if(n.getUint32(e,!0)===101010256){o=e;break}if(o<0)return null;let s=n.getUint16(o+10,!0),c=n.getUint32(o+16,!0);for(let e=0;e<s;e++){if(c+46>t.byteLength||n.getUint32(c,!0)!==33639248)return null;let e=n.getUint16(c+10,!0),i=n.getUint32(c+20,!0),a=n.getUint16(c+28,!0),o=n.getUint16(c+30,!0),s=n.getUint16(c+32,!0),l=n.getUint32(c+42,!0);if(new TextDecoder(`utf-8`).decode(r.subarray(c+46,c+46+a))===`bundle.json`){if(l+30>t.byteLength||n.getUint32(l,!0)!==67324752)return null;let a=n.getUint16(l+26,!0),o=n.getUint16(l+28,!0),s=l+30+a+o,c=s+i;if(c>t.byteLength)return null;let u=r.subarray(s,c),d;if(e===0)d=new TextDecoder(`utf-8`).decode(u);else if(e===8){let e=new DecompressionStream(`deflate-raw`),t=new Blob([u]).stream().pipeThrough(e),n=await new Response(t).arrayBuffer();d=new TextDecoder(`utf-8`).decode(n)}else return null;let f=JSON.parse(d)?.agent_ids;return Array.isArray(f)&&f.every(e=>typeof e==`string`)?f:null}c+=46+a+o+s}return null}var N_=U.api;function P_(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`;case`connector.activation.changed`:return`activation_changed`;default:return null}}function F_(e){let t=(0,w.useRef)(e);(0,w.useEffect)(()=>{t.current=e},[e]),(0,w.useEffect)(()=>{let e=`${Kt()}/connectors/events`,n=null,r=1e3,i=null,a=!1,o=()=>{a||(n=new EventSource(e),n.onopen=()=>{r=1e3},n.onmessage=e=>{try{let n=JSON.parse(e.data),r=P_(n.type);if(r===null){N_.debug(`connectors-sse: ignoring event`,n.type);return}let i=n.payload??{},a=i.connector_id??i.provider??null;t.current({connectorId:a,reason:r,payload:i})}catch(e){N_.warn(`connectors-sse: malformed event`,e)}},n.onerror=()=>{n?.close(),n=null,!a&&(i=setTimeout(o,r),r=Math.min(r*2,3e4))})};return o(),()=>{a=!0,i&&clearTimeout(i),n?.close()}},[])}function I_(e){return e.type===`mcp_server`&&e.configured}function L_({connector:e,onChanged:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)(null),u=(0,w.useRef)(null),d=(0,w.useRef)(null);if((0,w.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;u.current&&!u.current.contains(t)&&d.current&&!d.current.contains(t)&&r(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]),(0,w.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n]),(0,w.useEffect)(()=>{if(!n)return;let e=()=>{if(!u.current)return;let e=u.current.getBoundingClientRect();l({top:e.bottom+4,right:window.innerWidth-e.right})};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[n]),!I_(e))return null;let f=e=>{e.stopPropagation(),e.preventDefault()},p=e=>{if(f(e),!n&&u.current){let e=u.current.getBoundingClientRect();l({top:e.bottom+4,right:window.innerWidth-e.right})}r(e=>!e)},m=async e=>{a(!0),s(null);try{await e(),r(!1),t()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}};return(0,K.jsxs)(`div`,{className:`connector-tile-menu`,onClick:f,onKeyDown:f,children:[(0,K.jsx)(`button`,{ref:u,type:`button`,className:`connector-tile-menu-trigger`,"aria-haspopup":`menu`,"aria-expanded":n,"aria-label":`Connector actions`,onClick:p,disabled:i,children:(0,K.jsx)(xe,{size:14})}),n&&c&&(0,K.jsxs)(`div`,{ref:d,role:`menu`,className:`connector-tile-menu-popup`,style:{position:`fixed`,top:c.top,right:c.right},children:[e.enabled?(0,K.jsx)(`button`,{role:`menuitem`,type:`button`,className:`connector-tile-menu-item`,onClick:()=>void m(()=>Cn(e.id)),disabled:i,children:`Disable`}):(0,K.jsx)(`button`,{role:`menuitem`,type:`button`,className:`connector-tile-menu-item`,onClick:()=>void m(()=>Sn(e.id)),disabled:i,children:`Enable`}),(0,K.jsx)(`div`,{className:`connector-tile-menu-divider`}),(0,K.jsx)(`button`,{role:`menuitem`,type:`button`,className:`connector-tile-menu-item connector-tile-menu-item--danger`,onClick:()=>void m(()=>xn(e.id)),disabled:i,children:`Disconnect`}),o&&(0,K.jsx)(`div`,{className:`connector-tile-menu-error`,children:o})]})]})}var R_={"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`,"https://graph.microsoft.com/Mail.ReadWrite":`Read & organize Outlook mail (archive, label, trash)`,"https://graph.microsoft.com/Mail.Send":`Send Outlook mail on your behalf`,"https://graph.microsoft.com/Calendars.ReadWrite":`Create & respond to Outlook calendar events`,"https://graph.microsoft.com/Calendars.Read":`View Outlook calendar events`,"https://graph.microsoft.com/User.Read":`Read your basic Microsoft profile`};function z_(e){return R_[e]??e.split(/[/.:]/).pop()??e}var B_=[`use`];function V_(){let[e,t]=(0,w.useState)([]),[n,r]=(0,w.useState)([]),[i,a]=(0,w.useState)(!0),[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)(null),u=(0,w.useCallback)(async()=>{try{let[{connectors:e},{agent_mcps:n}]=await Promise.all([gn(),wn()]);t(e),r(n),s(null)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}},[]);(0,w.useEffect)(()=>{u()},[u]);let d=e=>l(t=>t===e?null:e),f=(0,w.useCallback)(async e=>{try{let n=await _n(e);t(t=>t.map(t=>t.id===e?n:t))}catch{u()}},[u]);return F_((0,w.useCallback)(e=>{e.connectorId?f(e.connectorId):u()},[f,u])),(0,K.jsxs)(`section`,{className:`settings-section connectors-section`,children:[(0,K.jsx)(`h4`,{children:`Connectors`}),(0,K.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.`}),o&&(0,K.jsxs)(`div`,{className:`error-banner`,children:[(0,K.jsx)(L,{size:14}),(0,K.jsx)(`span`,{children:o})]}),i?(0,K.jsx)(`div`,{className:`connectors-loading`,children:(0,K.jsx)(B,{size:16,className:`spin`})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`connectors-list`,children:e.map(e=>(0,K.jsx)(H_,{connector:e,expanded:c===e.id,onToggle:()=>d(e.id),onChanged:()=>void f(e.id)},e.id))}),n.length>0&&(0,K.jsx)(q_,{servers:n,expanded:c,onToggle:d})]})]})}function H_({connector:e,expanded:t,onToggle:n,onChanged:r}){return(0,K.jsxs)(`div`,{className:`connector-tile${t?` connector-tile--open`:``}`,children:[(0,K.jsxs)(`button`,{className:`connector-tile-header`,onClick:n,"aria-expanded":t,children:[(0,K.jsx)(`span`,{className:`connector-tile-name`,children:e.display_name}),(0,K.jsx)(`span`,{className:`connector-tile-type`,children:e.type===`oauth_pkce`?`OAuth`:`MCP`}),e.configured?e.type===`mcp_server`&&e.enabled===!1?(0,K.jsx)(`span`,{className:`connector-status disabled`,children:`Disabled`}):(0,K.jsxs)(`span`,{className:`connector-status ok`,children:[(0,K.jsx)(z,{size:12}),e.account_id??`Configured`]}):(0,K.jsx)(`span`,{className:`connector-status idle`,children:`Not configured`}),(0,K.jsx)(L_,{connector:e,onChanged:r}),(0,K.jsx)(`span`,{className:`connector-tile-chevron`,children:t?(0,K.jsx)(ce,{size:14}):(0,K.jsx)(I,{size:14})})]}),t&&(0,K.jsxs)(`div`,{className:`connector-detail`,children:[e.type===`oauth_pkce`?(0,K.jsx)(U_,{connector:e,onChanged:r}):(0,K.jsx)(G_,{connector:e,onChanged:r}),e.configured&&(0,K.jsx)(Y_,{connectorId:e.id,connectorType:e.type})]})]})}function U_({connector:e,onChanged:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)({}),[c,l]=(0,w.useState)(null),{agents:u}=H(),d=u.filter(t=>t.namespaced_agent_id&&t.required_connections?.some(t=>t.connector_id===e.id)),f=d.map(e=>e.namespaced_agent_id).join(`,`),[p,m]=(0,w.useState)(()=>new Set);(0,w.useEffect)(()=>{m(new Set(d.map(e=>e.namespaced_agent_id)))},[f]);let h=e=>m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),g=()=>[...p];(0,w.useEffect)(()=>{let e=()=>{t()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[t]);let _=e=>{let t=window;t.gaia?.openExternal?t.gaia.openExternal(e):window.open(e,`_blank`,`noopener`)},v=async()=>{r(!0),a(null);try{let t=await vn(e.id,e.available_scopes?.length?e.available_scopes:e.default_scopes,g());_(t.authorization_url)}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}},y=async()=>{r(!0),a(null),l(null);try{let t=await yn(e.id,e.available_scopes?.length?e.available_scopes:e.default_scopes,g());l(t)}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}};(0,w.useEffect)(()=>{e.configured&&l(null)},[e.configured]),F_((0,w.useCallback)(t=>{t.connectorId===e.id&&(t.reason===`oauth_error`?(a(String(t.payload.error??`Device sign-in failed.`)),l(null)):t.reason===`oauth_completed`&&l(null))},[e.id]));let b=async()=>{r(!0),a(null);try{await xn(e.id),t()}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}},x=async()=>{let n=(e.oauth_setup_fields??[]).filter(e=>e.required!==!1&&!o[e.key]?.trim()).map(e=>e.label);if(n.length){a(`Required: ${n.join(`, `)}`);return}r(!0),a(null);try{let n=e.available_scopes?.length?e.available_scopes:e.default_scopes,r=await bn(e.id,{...o,scopes:n,grant_agents:g()}),i=typeof r.authorization_url==`string`?r.authorization_url:null;i&&_(i),t()}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}},S=e.oauth_setup_fields??[],C=e.configurable===!1&&!e.configured&&S.length>0;return(0,K.jsxs)(`div`,{className:`configure-body`,children:[e.description&&(0,K.jsx)(`p`,{className:`connector-desc`,children:e.description}),C&&(0,K.jsxs)(`div`,{className:`oauth-setup-form`,children:[(0,K.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.`}),S.map(e=>(0,K.jsxs)(`label`,{className:`oauth-setup-field`,children:[(0,K.jsx)(`span`,{className:`oauth-setup-label`,children:e.label}),(0,K.jsx)(`input`,{type:e.kind===`secret`?`password`:`text`,className:`oauth-setup-input`,placeholder:e.placeholder,value:o[e.key]??``,onChange:t=>s(n=>({...n,[e.key]:t.target.value})),autoComplete:`off`,spellCheck:!1}),e.help_md&&(0,K.jsx)(`span`,{className:`oauth-setup-help`,children:e.help_md})]},e.key))]}),!e.configured&&d.length>0&&(0,K.jsxs)(`div`,{className:`oauth-grant-onconnect`,children:[(0,K.jsx)(`p`,{className:`oauth-grant-onconnect-label`,children:`Grant access to these agents when you connect:`}),d.map(e=>(0,K.jsxs)(`label`,{className:`oauth-grant-onconnect-item`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:p.has(e.namespaced_agent_id),onChange:()=>h(e.namespaced_agent_id)}),(0,K.jsx)(`span`,{children:e.name})]},e.namespaced_agent_id)),(0,K.jsx)(`p`,{className:`oauth-grant-onconnect-help`,children:`You can change these any time under Per-agent grants below.`})]}),!C&&(0,K.jsx)(W_,{connector:e,onChanged:t}),i&&(0,K.jsxs)(`div`,{className:`configure-error`,children:[(0,K.jsx)(L,{size:12}),` `,i]}),(0,K.jsxs)(`div`,{className:`configure-actions`,children:[e.configured?(0,K.jsx)(`button`,{className:`btn-secondary`,disabled:n,onClick:()=>void b(),children:n?(0,K.jsx)(B,{size:12,className:`spin`}):`Disconnect`}):C?(0,K.jsx)(`button`,{className:`btn-primary`,disabled:n,onClick:()=>void x(),children:n?(0,K.jsx)(B,{size:12,className:`spin`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Se,{size:12}),` Save & Connect`]})}):e.configurable===!1?(0,K.jsx)(`span`,{className:`connector-setup-required`,title:e.config_error??void 0,children:`Setup required`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{className:`btn-primary`,disabled:n||c!==null,onClick:()=>void v(),children:n?(0,K.jsx)(B,{size:12,className:`spin`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Se,{size:12}),` Connect`]})}),e.supports_device_code&&(0,K.jsx)(`button`,{className:`btn-secondary`,disabled:n||c!==null,onClick:()=>void y(),title:`Enter a short code at a URL — no browser redirect or app registration needed`,children:`Sign in with a code`})]}),(e.docs_url||e.product_url)&&(0,K.jsxs)(`a`,{href:e.docs_url||e.product_url||`#`,target:`_blank`,rel:`noopener noreferrer`,className:`connector-product-link`,children:[`Learn more `,(0,K.jsx)(Se,{size:11})]})]}),c&&!e.configured&&(0,K.jsxs)(`div`,{className:`device-code-block`,children:[(0,K.jsxs)(`p`,{className:`device-code-instructions`,children:[`Go to`,` `,(0,K.jsx)(`a`,{href:c.verification_uri,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>{e.preventDefault(),_(c.verification_uri)},children:c.verification_uri}),` `,`and enter this code:`]}),(0,K.jsxs)(`div`,{className:`device-code-value`,children:[(0,K.jsx)(`code`,{children:c.user_code}),(0,K.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void navigator.clipboard?.writeText(c.user_code),title:`Copy code`,children:`Copy`})]}),(0,K.jsxs)(`p`,{className:`device-code-waiting`,children:[(0,K.jsx)(B,{size:12,className:`spin`}),` Waiting for sign-in…`]}),(0,K.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>l(null),children:`Cancel`})]})]})}function W_({connector:e,onChanged:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)({}),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(!1),[u,d]=(0,w.useState)(null),f=e.oauth_setup_fields??[];if(f.length===0)return null;let p=e.oauth_client,m=p?.source===`keyring`?`Saved client: ${p.client_id}`:p?.source===`env`?`From environment: ${p.client_id}`:`No OAuth client configured`,h=async()=>{if(!i.client_id?.trim()){d(`Client ID is required.`);return}s(!0),d(null),l(!1);try{await bn(e.id,{...Object.fromEntries(Object.entries(i).map(([e,t])=>[e,t.trim()])),save_only:!0}),l(!0),a({}),t(),setTimeout(()=>l(!1),2200)}catch(e){d(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,K.jsxs)(`div`,{className:`oauth-client-editor`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`oauth-client-editor__toggle`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[n?(0,K.jsx)(ce,{size:12}):(0,K.jsx)(I,{size:12}),(0,K.jsx)(`span`,{children:`OAuth client`}),(0,K.jsx)(`span`,{className:`oauth-client-editor__status`,children:m})]}),n&&(0,K.jsxs)(`div`,{className:`oauth-setup-form`,children:[(0,K.jsxs)(`p`,{className:`connector-desc`,children:[`Bring your own OAuth client — saved encrypted in your OS keyring (same store as`,` `,(0,K.jsx)(`code`,{children:`gaia connectors configure`}),`) and reused for future connections. Environment variables are only used when no saved client exists.`]}),f.map(e=>(0,K.jsxs)(`label`,{className:`oauth-setup-field`,children:[(0,K.jsx)(`span`,{className:`oauth-setup-label`,children:e.label}),(0,K.jsx)(`input`,{type:e.kind===`secret`?`password`:`text`,className:`oauth-setup-input`,placeholder:e.kind===`secret`&&p?.source===`keyring`&&p.has_secret?`••••••••`:e.placeholder,value:i[e.key]??``,onChange:t=>a(n=>({...n,[e.key]:t.target.value})),autoComplete:`off`,spellCheck:!1}),e.help_md&&(0,K.jsx)(`span`,{className:`oauth-setup-help`,children:e.help_md})]},e.key)),u&&(0,K.jsxs)(`div`,{className:`configure-error`,children:[(0,K.jsx)(L,{size:12}),` `,u]}),(0,K.jsx)(`div`,{className:`configure-actions`,children:(0,K.jsx)(`button`,{className:`btn-model-save${c?` saved`:``}`,disabled:o||!i.client_id?.trim(),onClick:()=>void h(),children:o?(0,K.jsx)(B,{size:12,className:`spin`}):c?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(z,{size:12}),` Saved`]}):`Save client`})})]})]})}function G_({connector:e,onChanged:t}){let[n,r]=(0,w.useState)(()=>Object.fromEntries(e.mcp_env_keys.map(e=>[e,``]))),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null);(0,w.useEffect)(()=>{r(Object.fromEntries(e.mcp_env_keys.map(e=>[e,``])))},[e.mcp_env_keys.join(`,`)]);let u=async()=>{let r=Object.fromEntries(Object.entries(n).filter(([,e])=>e.trim()!==``));if(Object.keys(r).length!==0){a(!0),l(null),s(!1);try{await bn(e.id,r),s(!0),t(),setTimeout(()=>s(!1),2200)}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(!1)}}},d=async()=>{a(!0),l(null);try{await xn(e.id),r(Object.fromEntries(e.mcp_env_keys.map(e=>[e,``]))),t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(!1)}},f=async()=>{a(!0),l(null);try{e.enabled?await Cn(e.id):await Sn(e.id),t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(!1)}};return(0,K.jsxs)(`div`,{className:`configure-body`,children:[e.description&&(0,K.jsx)(`p`,{className:`connector-desc`,children:e.description}),c&&(0,K.jsxs)(`div`,{className:`configure-error`,children:[(0,K.jsx)(L,{size:12}),` `,c]}),e.configured&&(0,K.jsxs)(`div`,{className:`connector-toggle-row`,children:[(0,K.jsx)(`span`,{className:`connector-toggle-label`,children:`Active`}),(0,K.jsxs)(`span`,{className:`toggle-switch`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:e.enabled!==!1,onChange:()=>void f(),disabled:i,"aria-label":e.enabled?`Disable this MCP server`:`Enable this MCP server`}),(0,K.jsx)(`span`,{className:`toggle-track`})]})]}),e.configured&&e.enabled===!1&&(0,K.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(t=>(0,K.jsxs)(`div`,{className:`mcp-key-row`,children:[(0,K.jsx)(`label`,{className:`mcp-key-label`,children:t}),(0,K.jsx)(`input`,{type:`password`,className:`mcp-key-input`,placeholder:e.configured?`••••••••`:`Enter value`,value:n[t]??``,onChange:e=>r(n=>({...n,[t]:e.target.value})),spellCheck:!1,autoComplete:`off`})]},t)),(0,K.jsxs)(`div`,{className:`configure-actions`,children:[(0,K.jsx)(`button`,{className:`btn-model-save${o?` saved`:``}`,disabled:i||Object.values(n).every(e=>e.trim()===``),onClick:()=>void u(),children:i?(0,K.jsx)(B,{size:12,className:`spin`}):o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(z,{size:12}),` Saved`]}):`Save`}),e.configured&&(0,K.jsx)(`button`,{className:`btn-secondary`,disabled:i,onClick:()=>void d(),children:`Disconnect`}),e.product_url&&(0,K.jsxs)(`a`,{href:e.product_url,target:`_blank`,rel:`noopener noreferrer`,className:`connector-product-link`,children:[`Docs `,(0,K.jsx)(Se,{size:11})]})]})]})}function K_({agent:e,connectorId:t,grantedScopes:n,onChanged:r}){let i=e.required_connections?.find(e=>e.connector_id===t),a=e.namespaced_agent_id;if(!i||!a)return null;let[o,s]=(0,w.useState)(()=>new Set(n)),[c,l]=(0,w.useState)(null),[u,d]=(0,w.useState)(null);(0,w.useEffect)(()=>{s(new Set(n))},[n.join(`,`)]);let f=async e=>{if(c!==null)return;let i=new Set(o);i.has(e)?i.delete(e):i.add(e),s(i),l(e),d(null);try{i.size===0?await Dn(t,a):await En(t,a,[...i]),r()}catch(e){s(new Set(n)),d(e instanceof Error?e.message:String(e))}finally{l(null)}};return(0,K.jsxs)(`div`,{className:`grant-agent-card`,children:[(0,K.jsx)(`div`,{className:`grant-agent-card-name`,children:e.name}),(0,K.jsx)(`div`,{className:`grant-scope-list`,children:i.scopes.map(e=>(0,K.jsxs)(`label`,{className:`grant-scope-item`,children:[(0,K.jsx)(`span`,{className:`grant-scope-label`,children:z_(e)}),(0,K.jsxs)(`span`,{className:`toggle-switch`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:o.has(e),onChange:()=>void f(e),disabled:c!==null}),(0,K.jsx)(`span`,{className:`toggle-track`})]})]},e))}),u&&(0,K.jsxs)(`div`,{className:`grant-scope-warning grant-scope-warning--error`,children:[(0,K.jsx)(L,{size:11}),` `,u]})]})}function q_({servers:e,expanded:t,onToggle:n}){return(0,K.jsxs)(`div`,{className:`agent-mcps-section`,children:[(0,K.jsx)(`div`,{className:`agent-mcps-section-header`,children:`Custom agent servers`}),(0,K.jsx)(`div`,{className:`connectors-list`,children:e.map(e=>{let r=`${e.agent_id}::${e.server_name}`;return(0,K.jsx)(J_,{server:e,expanded:t===r,onToggle:()=>n(r)},r)})})]})}function J_({server:e,expanded:t,onToggle:n}){let r=[e.command,...e.args].join(` `);return(0,K.jsxs)(`div`,{className:`agent-mcp-tile${t?` agent-mcp-tile--open`:``}`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`agent-mcp-tile-header`,onClick:n,"aria-expanded":t,children:[(0,K.jsx)(`span`,{className:`agent-mcp-server-name`,children:e.server_name}),(0,K.jsxs)(`span`,{className:`agent-mcp-agent-label`,children:[`via `,e.agent_name]}),e.disabled?(0,K.jsx)(`span`,{className:`agent-mcp-status disabled`,children:`Disabled`}):(0,K.jsxs)(`span`,{className:`agent-mcp-status enabled`,children:[(0,K.jsx)(z,{size:11}),` Active`]}),(0,K.jsx)(`span`,{className:`agent-mcp-readonly-badge`,children:`read-only`}),(0,K.jsx)(`span`,{className:`agent-mcp-chevron`,children:t?(0,K.jsx)(ce,{size:14}):(0,K.jsx)(I,{size:14})})]}),t&&(0,K.jsxs)(`div`,{className:`agent-mcp-detail`,children:[r&&(0,K.jsx)(`div`,{className:`agent-mcp-command-row`,children:r}),(0,K.jsx)(`div`,{className:`agent-mcp-config-path`,children:e.config_path}),(0,K.jsxs)(`div`,{className:`agent-mcp-config-hint`,children:[`Edit the agent's `,(0,K.jsx)(`code`,{children:`mcp_servers.json`}),` to change this server.`]})]})]})}function Y_({connectorId:e,connectorType:t}){let{agents:n}=H(),[r,i]=(0,w.useState)({}),[a,o]=(0,w.useState)({}),[s,c]=(0,w.useState)(!0),l=(0,w.useCallback)(async()=>{try{let[{grants:t},{activations:n}]=await Promise.all([Tn(e),On(e)]);i(t),o(n)}catch{i({}),o({})}finally{c(!1)}},[e]);if((0,w.useEffect)(()=>{l()},[l]),F_((0,w.useCallback)(t=>{t.connectorId===e&&(t.reason===`grant_changed`||t.reason===`activation_changed`||t.reason===`disconnected`)&&l()},[e,l])),s)return null;let u=n.filter(t=>t.namespaced_agent_id&&t.required_connections?.some(t=>t.connector_id===e)),d=t===`mcp_server`?n.filter(t=>t.namespaced_agent_id&&(t.consumes_mcp_servers||t.required_connections?.some(t=>t.connector_id===e))):[];return(0,K.jsxs)(`div`,{className:`connection-grants`,children:[(0,K.jsx)(`div`,{className:`grants-header`,children:`Per-agent grants`}),u.length===0?(0,K.jsx)(`div`,{className:`grants-empty`,children:`No agents require access to this connector.`}):u.map(t=>(0,K.jsx)(K_,{agent:t,connectorId:e,grantedScopes:r[t.namespaced_agent_id]??[],onChanged:()=>void l()},t.namespaced_agent_id)),d.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`grants-header grants-header--activations`,children:`Active for`}),(0,K.jsx)(`div`,{className:`grants-help`,children:`Activations gate which agents see this connector's tools. Activating without a prior grant auto-creates one.`}),d.map(t=>(0,K.jsx)(X_,{agent:t,connectorId:e,active:!!a[t.namespaced_agent_id],grantedScopes:r[t.namespaced_agent_id]??[],onChanged:()=>void l()},`activation-${t.namespaced_agent_id}`))]})]})}function X_({agent:e,connectorId:t,active:n,grantedScopes:r,onChanged:i}){let a=e.required_connections?.find(e=>e.connector_id===t),o=e.namespaced_agent_id;if(!o)return null;let[s,c]=(0,w.useState)(n),[l,u]=(0,w.useState)(!1),[d,f]=(0,w.useState)(null);(0,w.useEffect)(()=>{c(n)},[n]);let p=async()=>{if(l)return;let e=!s;c(e),u(!0),f(null);try{if(e){let e=r.length===0?a?[...a.scopes]:[...B_]:void 0;await kn(t,o,e)}else await An(t,o);i()}catch(e){c(n),f(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,K.jsxs)(`div`,{className:`grant-agent-card`,children:[(0,K.jsx)(`div`,{className:`grant-agent-card-name`,children:e.name}),(0,K.jsx)(`div`,{className:`grant-scope-list`,children:(0,K.jsxs)(`label`,{className:`grant-scope-item`,children:[(0,K.jsx)(`span`,{className:`grant-scope-label`,children:s?`Tools visible to this agent`:`Tools hidden from this agent`}),(0,K.jsxs)(`span`,{className:`toggle-switch`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:s,onChange:()=>void p(),disabled:l}),(0,K.jsx)(`span`,{className:`toggle-track`})]})]})}),d&&(0,K.jsxs)(`div`,{className:`grant-scope-warning grant-scope-warning--error`,children:[(0,K.jsx)(L,{size:11}),` `,d]})]})}function Z_(){return window.gaiaUpdater}function Q_({onClose:e}){let[t,n]=(0,w.useState)({kind:`loading`}),r=(0,w.useRef)(null);(0,w.useEffect)(()=>{let e=Z_();if(!e){n({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`});return}e.listReleases().then(e=>{n(Array.isArray(e)?{kind:`list`,releases:e}:{kind:`error`,message:e.error})}).catch(()=>{n({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`})})},[]),(0,w.useEffect)(()=>{function t(t){t.key===`Escape`&&e()}return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e]),(0,w.useEffect)(()=>{let e=r.current;e&&e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)?.focus()},[]),(0,w.useEffect)(()=>{let e=r.current;if(!e)return;function t(t){if(t.key!==`Tab`||!e)return;let n=e.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);if(n.length===0)return;let r=n[0],i=n[n.length-1];t.shiftKey?document.activeElement===r&&(t.preventDefault(),i?.focus()):document.activeElement===i&&(t.preventDefault(),r?.focus())}return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[]);function i(e,t){e.isCurrent||n({kind:`confirm`,release:e,releases:t})}async function a(t){n({kind:`installing`});let r=Z_();if(!r){n({kind:`error`,message:`Bridge unavailable — please restart the app.`});return}try{await r.installVersion(t.tag),e()}catch(e){let t=e instanceof Error?e.message:String(e);n({kind:`error`,message:`Failed to start rollback: ${t}`})}}function o(e){if(!e)return``;try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}catch{return e}}return(0,K.jsx)(`div`,{className:`version-picker-overlay`,onClick:t=>{t.target===t.currentTarget&&e()},children:(0,K.jsxs)(`div`,{className:`version-picker-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Roll back to a previous version`,ref:r,children:[(0,K.jsxs)(`div`,{className:`version-picker-header`,children:[(0,K.jsx)(`h3`,{children:`Roll back to a previous version`}),(0,K.jsx)(`button`,{className:`version-picker-close`,onClick:e,"aria-label":`Close`,type:`button`,children:`×`})]}),(0,K.jsxs)(`div`,{className:`version-picker-body`,children:[t.kind===`loading`&&(0,K.jsxs)(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[(0,K.jsx)(`span`,{className:`version-picker-spinner`}),`Loading releases…`]}),t.kind===`error`&&(0,K.jsxs)(`div`,{className:`version-picker-error`,children:[(0,K.jsx)(`p`,{children:t.message}),(0,K.jsx)(`p`,{children:(0,K.jsx)(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:`Browse releases on GitHub`})})]}),t.kind===`list`&&(0,K.jsx)(`ul`,{className:`version-picker-list`,role:`listbox`,"aria-label":`Available releases`,children:t.releases.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:`version-picker-row`,"data-version":e.version,"aria-label":`${e.version}${e.isCurrent?` — installed`:``}${e.isPinned?` — pinned`:``}`,"aria-disabled":e.isCurrent?`true`:`false`,onClick:()=>i(e,t.releases),disabled:e.isCurrent,children:[(0,K.jsx)(`span`,{className:`vp-version`,children:e.version}),(0,K.jsx)(`span`,{className:`vp-date`,children:o(e.date)}),e.isCurrent&&(0,K.jsx)(`span`,{className:`vp-badge vp-badge-current`,children:`Installed`}),e.isPinned&&!e.isCurrent&&(0,K.jsx)(`span`,{className:`vp-badge vp-badge-pinned`,children:`Pinned`}),!e.isCurrent&&(0,K.jsx)(`span`,{className:`vp-arrow`,"aria-hidden":`true`,children:`›`})]})},e.tag))}),t.kind===`list`&&(0,K.jsxs)(`p`,{className:`version-picker-more`,children:[`Showing the `,t.releases.length,` most recent.`,` `,(0,K.jsx)(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:`Browse all releases on GitHub`})]}),t.kind===`confirm`&&(0,K.jsxs)(`div`,{className:`version-picker-confirm`,children:[(0,K.jsxs)(`p`,{children:[`This will `,(0,K.jsxs)(`strong`,{children:[`downgrade to v`,t.release.version]}),` and restart the app.`]}),(0,K.jsxs)(`p`,{className:`vp-confirm-note`,children:[`Auto-update will be paused after rollback so the app stays on v`,t.release.version,`. You can resume updates from Settings → About.`]}),(0,K.jsxs)(`div`,{className:`vp-confirm-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`vp-btn-cancel`,onClick:()=>n({kind:`list`,releases:t.releases}),children:`Back`}),(0,K.jsx)(`button`,{type:`button`,className:`vp-btn-confirm`,onClick:()=>a(t.release),children:`Confirm downgrade & restart`})]})]}),t.kind===`installing`&&(0,K.jsxs)(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[(0,K.jsx)(`span`,{className:`version-picker-spinner`}),`Starting download…`]})]})]})})}function $_(){let{setShowSettings:e,sessions:t,removeSession:n,agents:r}=H(),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!0),[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)(!1),f=k_(),[p,m]=(0,w.useState)(``),[h,g]=(0,w.useState)(``),[_,v]=(0,w.useState)(!1),[y,b]=(0,w.useState)(!1),[x,S]=(0,w.useState)(null),[C,T]=(0,w.useState)(!1),E=(0,w.useRef)(null),[D,O]=(0,w.useState)(!1),[k,ee]=(0,w.useState)(!1),[A,j]=(0,w.useState)(!1),[ne,re]=(0,w.useState)(null);(0,w.useEffect)(()=>{U.system.info(`Checking system status...`);let e=U.system.time();nn().then(t=>{a(t),U.system.timed(`System status received`,e,{lemonade:t.lemonade_running?`running`:`stopped`,model:t.model_loaded||`none`,embedding:t.embedding_model_loaded?`yes`:`no`,disk:`${t.disk_space_gb}GB free`,memory:t.memory_available_gb==null?`unknown`:`${t.memory_available_gb}GB available`}),t.lemonade_running||U.system.warn(`Lemonade Server is NOT running.`)}).catch(e=>{U.system.error(`Failed to get system status`,e),a(null)}).finally(()=>s(!1)),mr().then(e=>l(e.servers)).catch(()=>{}),rn().then(e=>{let t=e.custom_model??``;m(t),g(t),O(e.dynamic_tools),ee(e.dynamic_tools_locked)}).catch(e=>{U.system.error(`Failed to load settings`,e)}).finally(()=>v(!0))},[]),(0,w.useEffect)(()=>()=>{E.current&&clearTimeout(E.current)},[]);let M=(0,w.useCallback)(async()=>{let e=p.trim(),t=e.length>0?e:``;b(!0),S(null),T(!1);try{U.system.info(`Saving custom_model override`,{custom_model:t});let e=(await an({custom_model:t})).custom_model??``;m(e),g(e),T(!0),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>T(!1),2200)}catch(e){let t=e instanceof Error?e.message:String(e);U.system.error(`Failed to save custom_model`,e),S(t)}finally{b(!1)}},[p]),N=(0,w.useCallback)(async()=>{if(k||A)return;let e=D,t=!e;O(t),j(!0),re(null);try{U.system.info(`Saving dynamic_tools setting`,{dynamic_tools:t});let e=await an({dynamic_tools:t});O(e.dynamic_tools),ee(e.dynamic_tools_locked)}catch(t){let n=t instanceof Error?t.message:String(t);U.system.error(`Failed to save dynamic_tools`,t),O(e),re(n)}finally{j(!1)}},[D,k,A]),P=p.trim()!==h.trim(),ie=i?.default_model_name??`Gemma-4-E4B-it-GGUF`,{isLoadingModel:ae,isDownloadingModel:F,loadModel:I,downloadModel:oe}=D_(ie),se=[{label:`4K`,value:4096},{label:`8K`,value:8192},{label:`16K`,value:16384},{label:`32K`,value:32768}],ce=i?.model_context_size??null,[R,le]=(0,w.useState)(``);(0,w.useEffect)(()=>{ce!=null&&le(String(ce))},[ce]);let ue=(()=>{let e=parseInt(R,10);return Number.isFinite(e)&&e>0?e:null})(),de=ue!=null&&ue!==ce,fe=i?.model_loaded??ie,pe=(0,w.useCallback)(async()=>{ue&&(U.system.info(`Reloading ${fe} with ctx_size=${ue}`),await I(fe,ue))},[ue,fe,I]),[me,he]=(0,w.useState)(!1),ge=(0,w.useRef)(null);(0,w.useEffect)(()=>()=>{ge.current&&clearTimeout(ge.current)},[]);let _e=(0,w.useCallback)(async()=>{if(!me){he(!0),ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>he(!1),4e3);return}he(!1),ge.current&&clearTimeout(ge.current),U.system.warn(`Clearing ALL data: ${t.length} session(s)`);let r=U.system.time(),i=0;for(let e of t)try{await Pn(e.id),n(e.id),i++}catch(t){U.system.error(`Failed to delete session ${e.id}`,t)}U.system.timed(`Cleared ${i}/${t.length} session(s)`,r),e(!1)},[me,t,n,e]),ve=!!(i?.lemonade_running&&i.model_loaded&&i.expected_model_loaded===!1),ye=!!(i?.lemonade_running&&i.model_loaded&&i.context_size_sufficient===!1),be=!!(i?.lemonade_running&&!i.model_loaded&&i.model_downloaded===!1),xe=ve||ye;return(0,K.jsxs)(`div`,{className:`settings-page`,children:[(0,K.jsxs)(`div`,{className:`settings-page-header`,children:[(0,K.jsx)(`button`,{className:`btn-icon settings-back-btn`,onClick:()=>e(!1),"aria-label":`Back`,children:(0,K.jsx)(te,{size:18})}),(0,K.jsx)(`h3`,{children:`Settings`})]}),(0,K.jsxs)(`div`,{className:`settings-page-body`,children:[(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`System Status`}),o?(0,K.jsx)(`p`,{className:`loading-text`,children:`Checking system...`}):i?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`status-grid`,children:[(0,K.jsx)(ev,{label:`Lemonade Server`,value:i.lemonade_running?`Running${i.lemonade_version?` v${i.lemonade_version}`:``}`:i.lemonade_error?`Status unavailable`:`Not Running`,ok:i.lemonade_running,hint:i.lemonade_running?void 0:i.lemonade_error?`Could not query Lemonade Server; check it and retry.`:i.initialized?i.start_command?`Run: ${i.start_command}`:i.start_instruction??`Start Lemonade Server`:`Run: gaia init`}),(0,K.jsx)(ev,{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: ${ie}`:void 0:`Run: gaia init`}),i.model_size_gb!=null&&(0,K.jsx)(ev,{label:`Model Size`,value:`${i.model_size_gb} GB`,ok:!0}),i.model_device&&(0,K.jsx)(ev,{label:`Device`,value:i.model_device.toUpperCase(),ok:i.model_device!==`cpu`}),i.model_context_size!=null&&(0,K.jsx)(ev,{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&&(0,K.jsx)(ev,{label:`Capabilities`,value:i.model_labels.join(`, `),ok:!0}),(0,K.jsx)(ev,{label:`Embedding Model`,value:i.embedding_model_loaded?`Available`:`Not loaded`,ok:i.embedding_model_loaded}),i.gpu_name&&(0,K.jsx)(ev,{label:`GPU`,value:`${i.gpu_name}${i.gpu_vram_gb?` (${i.gpu_vram_gb} GB)`:``}`,ok:!0}),(0,K.jsx)(ev,{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}),(0,K.jsx)(ev,{label:`Memory`,value:i.memory_available_gb==null?`unknown`:`${i.memory_available_gb} GB available`,ok:i.memory_available_gb!=null&&i.memory_available_gb>2}),i.processor_name&&(0,K.jsx)(ev,{label:`Processor`,value:i.processor_name,ok:i.device_supported!==!1})]}),be&&(0,K.jsxs)(`div`,{className:`model-action-row model-action-row--download`,children:[(0,K.jsxs)(`div`,{className:`model-action-info`,children:[(0,K.jsx)(`span`,{className:`model-action-label`,children:`Model not downloaded.`}),(0,K.jsxs)(`span`,{className:`model-action-desc`,children:[(0,K.jsx)(`strong`,{children:ie}),` is required for GAIA Chat (~25 GB).`]})]}),(0,K.jsx)(`button`,{className:`btn-model-action btn-model-action--download`,onClick:()=>oe(!1),disabled:F,children:F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Downloading…`]}):`Download`})]}),xe&&(0,K.jsxs)(`div`,{className:`model-action-row model-action-row--load`,children:[(0,K.jsxs)(`div`,{className:`model-action-info`,children:[(0,K.jsx)(`span`,{className:`model-action-label`,children:ve?`Wrong model loaded.`:`Context window too small.`}),(0,K.jsxs)(`span`,{className:`model-action-desc`,children:[`Load `,(0,K.jsx)(`strong`,{children:ie}),` with `,32 .toFixed(0),`K token context.`]})]}),(0,K.jsx)(`button`,{className:`btn-model-action btn-model-action--load`,onClick:()=>I(),disabled:ae,children:ae?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Loading…`]}):`Load Model`})]}),i.lemonade_running&&(0,K.jsxs)(`div`,{className:`force-redownload-row`,children:[(0,K.jsx)(`span`,{className:`force-redownload-label`,children:`If the model file is corrupted:`}),(0,K.jsx)(`button`,{className:`btn-force-redownload`,onClick:()=>oe(!0),disabled:F,children:F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:12,className:`btn-spinner`}),` Downloading…`]}):`Force Re-download`})]})]}):(0,K.jsxs)(`div`,{className:`status-error`,children:[(0,K.jsx)(`p`,{children:`Could not connect to server`}),(0,K.jsx)(`code`,{children:`gaia chat --ui`})]})]}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Active Model`}),(0,K.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.`}),(0,K.jsxs)(`div`,{className:`model-input-row`,children:[(0,K.jsx)(`input`,{type:`text`,className:`model-input${h?` has-override`:``}`,placeholder:`Use agent default`,value:p,onChange:e=>{m(e.target.value),S(null),T(!1)},onKeyDown:e=>{e.key===`Enter`&&!y&&P&&_&&(e.preventDefault(),M())},disabled:!_||y,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-label":`Custom model override`}),(0,K.jsx)(`div`,{className:`model-btn-group`,children:(0,K.jsx)(`button`,{className:`btn-model-save${C?` saved`:``}`,onClick:()=>{M()},disabled:!_||y||!P&&!C,"aria-label":`Save custom model`,children:y?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Saving…`]}):C?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(z,{size:13}),` Saved`]}):`Save`})})]}),(0,K.jsxs)(`p`,{className:`model-status-hint`,children:[`Accepts a Lemonade model ID (e.g. `,(0,K.jsx)(`code`,{children:`Qwen3-4B-Instruct-2507-GGUF`}),`)`,` `,`or a HuggingFace ID (e.g. `,(0,K.jsx)(`code`,{children:`unsloth/Qwen3-4B-GGUF`}),`).`]}),x&&(0,K.jsxs)(`div`,{className:`model-warning`,role:`alert`,children:[(0,K.jsx)(L,{size:14}),(0,K.jsxs)(`div`,{className:`model-warning-content`,children:[(0,K.jsx)(`strong`,{children:`Could not save`}),(0,K.jsx)(`p`,{children:x})]})]})]}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Context Size`}),(0,K.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.`}),(0,K.jsx)(`div`,{className:`ctx-preset-row`,children:se.map(e=>{let t=ue===e.value;return(0,K.jsx)(`button`,{className:`btn-ctx-preset${t?` active`:``}`,onClick:()=>le(String(e.value)),disabled:ae,type:`button`,children:e.label},e.value)})}),(0,K.jsxs)(`div`,{className:`model-input-row`,children:[(0,K.jsx)(`input`,{type:`number`,className:`model-input`,placeholder:ce==null?`4096`:String(ce),value:R,min:512,step:1024,onChange:e=>le(e.target.value),disabled:ae,"aria-label":`Context size in tokens`}),(0,K.jsx)(`div`,{className:`model-btn-group`,children:(0,K.jsx)(`button`,{className:`btn-model-save`,onClick:()=>{pe()},disabled:ae||!de||!i?.lemonade_running,"aria-label":`Reload model with new context size`,children:ae?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Reloading…`]}):`Apply`})})]}),(0,K.jsxs)(`p`,{className:`model-status-hint`,children:[`Current: `,(0,K.jsx)(`code`,{children:ce==null?`unknown`:`${ce.toLocaleString()} tokens`}),i?.model_loaded&&(0,K.jsxs)(K.Fragment,{children:[` on `,(0,K.jsx)(`code`,{children:i.model_loaded})]}),`.`]})]}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsxs)(`h4`,{children:[`Dynamic Tools `,(0,K.jsx)(`span`,{className:`beta-badge`,children:`BETA`})]}),(0,K.jsx)(`p`,{className:`model-override-desc`,children:`Trim each turn’s tool list to a semantically-matched subset to speed up the first response. Currently affects the Doc Agent only.`}),(0,K.jsxs)(`label`,{className:`setting-row`,children:[(0,K.jsx)(`span`,{children:`Enable dynamic tool loading`}),(0,K.jsxs)(`span`,{className:`toggle-switch`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:D,onChange:()=>void N(),disabled:!_||A||k,"aria-label":D?`Disable dynamic tools`:`Enable dynamic tools`}),(0,K.jsx)(`span`,{className:`toggle-track`})]})]}),k&&(0,K.jsxs)(`p`,{className:`model-status-hint`,children:[`Controlled by `,(0,K.jsx)(`code`,{children:`GAIA_DYNAMIC_TOOLS`}),` — unset that environment variable to change this here.`]}),ne&&(0,K.jsxs)(`div`,{className:`model-warning`,role:`alert`,children:[(0,K.jsx)(L,{size:14}),(0,K.jsxs)(`div`,{className:`model-warning-content`,children:[(0,K.jsx)(`strong`,{children:`Could not save`}),(0,K.jsx)(`p`,{children:ne})]})]})]}),i&&i.memory_available_gb!=null&&(()=>{let e=i.memory_available_gb,t=r.filter(t=>t.min_memory_gb!=null&&t.min_memory_gb>e);return t.length===0?null:(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Memory Warnings`}),(0,K.jsx)(`div`,{className:`status-grid`,children:t.map(e=>(0,K.jsxs)(`div`,{className:`status-row status-row--has-hint`,children:[(0,K.jsx)(`span`,{className:`status-label`,children:e.name}),(0,K.jsxs)(`div`,{className:`status-value-wrap`,children:[(0,K.jsxs)(`span`,{className:`status-value warn memory-warning-value`,children:[(0,K.jsx)(L,{size:12}),`Needs ~`,e.min_memory_gb,` GB free`]}),(0,K.jsxs)(`span`,{className:`status-hint`,children:[`Only `,i.memory_available_gb,` GB available — model load may fail or swap heavily.`]})]})]},e.id))})]})})(),c.length>0&&(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`MCP Servers`}),(0,K.jsx)(`div`,{className:`status-grid`,children:c.map(e=>(0,K.jsxs)(`div`,{className:`status-row`,children:[(0,K.jsx)(`span`,{className:`status-label`,children:e.name}),(0,K.jsx)(`div`,{className:`status-value-wrap`,children:e.connected?(0,K.jsxs)(`span`,{className:`status-value ok mcp-status-connected`,children:[(0,K.jsx)(z,{size:12}),e.tool_count,` tool`,e.tool_count===1?``:`s`]}):(0,K.jsxs)(`span`,{className:`status-value warn mcp-status-failed`,title:e.error??void 0,children:[(0,K.jsx)(L,{size:12}),`Failed`]})})]},e.name))})]}),(0,K.jsx)(j_,{}),(0,K.jsx)(V_,{}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`About`}),(0,K.jsxs)(`div`,{className:`about-info`,children:[(0,K.jsxs)(`p`,{children:[`GAIA v`,`0.24.0`,` `,(0,K.jsx)(`span`,{className:`beta-badge`,children:`BETA`})]}),(0,K.jsx)(`p`,{className:`about-sub`,children:`Privacy-first AI chat for AMD Ryzen AI PCs.`}),f.pinnedVersion&&(0,K.jsxs)(`p`,{className:`about-pinned-notice`,children:[`Auto-update paused (pinned to `,f.pinnedVersion,`).`,` `,(0,K.jsx)(`button`,{type:`button`,className:`about-resume-btn`,onClick:()=>{window.gaiaUpdater?.resumeUpdates().catch(e=>{U.system.error(`Resume updates failed`,e)})},children:`Resume updates`})]})]}),(0,K.jsx)(`div`,{className:`setting-actions`,children:(0,K.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>d(!0),children:`Roll back to a previous version`})})]}),u&&(0,K.jsx)(Q_,{onClose:()=>d(!1)}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Privacy & Data`}),(0,K.jsxs)(`div`,{className:`setting-row`,children:[(0,K.jsx)(`span`,{children:`Data location`}),(0,K.jsx)(`code`,{className:`setting-path`,children:`~/.gaia/chat/`})]}),(0,K.jsx)(`div`,{className:`danger-divider`}),(0,K.jsxs)(`div`,{className:`setting-actions`,children:[(0,K.jsx)(`p`,{className:`danger-warning`,children:`This will permanently delete all sessions, messages, and documents.`}),(0,K.jsx)(`button`,{className:`btn-danger`,onClick:_e,children:me?`Click again to confirm`:`Clear All Data`})]})]})]})]})}function ev({label:e,value:t,ok:n,hint:r}){return(0,K.jsxs)(`div`,{className:`status-row${r?` status-row--has-hint`:``}`,children:[(0,K.jsx)(`span`,{className:`status-label`,children:e}),(0,K.jsxs)(`div`,{className:`status-value-wrap`,children:[(0,K.jsx)(`span`,{className:`status-value ${n?`ok`:`warn`}`,children:t}),r&&(0,K.jsx)(`span`,{className:`status-hint`,children:(0,K.jsx)(`code`,{children:r})})]})]})}var tv=`modulepreload`,nv=function(e,t){return new URL(e,t).href},rv={},iv=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=nv(t,n),t=s(t),t in rv)return;rv[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:tv,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},av=null;function ov({isOpen:e,onClose:t,onStop:n,error:r}){let[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),c=(0,w.useRef)(null),u=(0,w.useCallback)(async()=>{try{let e=await pr();return a(e),e}catch(e){return U.system.error(`Failed to fetch tunnel status`,e),null}},[]);(0,w.useEffect)(()=>{if(!e||r)return;u();let t=setInterval(async()=>{let e=await u();e?.active&&e?.url&&clearInterval(t)},2e3);return()=>clearInterval(t)},[e,r,u]),(0,w.useEffect)(()=>{if(!i?.active||!i.url||!i.token||!c.current)return;let e=`${i.url}/?token=${i.token}`;U.system.info(`Generating QR code for: ${e}`),(async()=>{if(!av)try{let e=await iv(()=>import(`./browser-D6fty1nl.js`).then(e=>l(e.default,1)),[],import.meta.url);av=e.default||e}catch{U.system.error(`QR code library not available - install with: npm install qrcode`);return}let t=document.documentElement.getAttribute(`data-theme`)===`dark`;try{await av.toCanvas(c.current,e,{width:200,margin:2,color:{dark:t?`#e6edf3`:`#111827`,light:t?`#0d0d0d`:`#ffffff`}})}catch(e){U.system.error(`QR code generation failed`,e)}})()},[i?.active,i?.url,i?.token]);let d=(0,w.useRef)(null),f=(0,w.useCallback)(()=>{if(!i?.url||!i?.token)return;let e=`${i.url}/?token=${i.token}`;navigator.clipboard.writeText(e).then(()=>{s(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>s(!1),2e3)})},[i]);if((0,w.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]),!e)return null;let p=i?.active&&i?.url&&i?.token?`${i.url}/?token=${i.token}`:``;return(0,K.jsx)(`div`,{className:`modal-overlay`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Mobile Access`,children:(0,K.jsxs)(`div`,{className:`modal-panel mobile-modal`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`modal-header`,children:[(0,K.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,K.jsx)(yt,{size:18}),`Mobile Access`]}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:t,"aria-label":`Close`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`modal-body mobile-modal-body`,children:[(0,K.jsxs)(`div`,{className:`tunnel-status`,children:[(0,K.jsx)(`span`,{className:`status-dot ${i?.active?`active`:r?`error`:`starting`}`}),(0,K.jsx)(`span`,{children:i?.active?`Tunnel active`:r?`Connection failed`:`Starting tunnel...`}),!i?.active&&!r&&(0,K.jsx)(`span`,{className:`tunnel-spinner`})]}),r&&(0,K.jsx)(`div`,{className:`tunnel-error`,children:r}),(0,K.jsx)(`div`,{className:`qr-code-area`,children:i?.active?(0,K.jsx)(`canvas`,{ref:c}):r?(0,K.jsx)(`div`,{className:`qr-placeholder error`,children:`Failed to connect`}):(0,K.jsxs)(`div`,{className:`qr-placeholder`,children:[(0,K.jsx)(`div`,{className:`placeholder-spinner`}),(0,K.jsx)(`span`,{children:`Connecting...`})]})}),i?.active&&p&&(0,K.jsxs)(`div`,{className:`tunnel-url-area`,children:[(0,K.jsx)(`label`,{children:`Mobile URL`}),(0,K.jsxs)(`div`,{className:`tunnel-url-row`,children:[(0,K.jsx)(`input`,{type:`text`,readOnly:!0,value:p}),(0,K.jsxs)(`button`,{className:`copy-url-btn ${o?`copied`:``}`,onClick:f,title:`Copy URL`,children:[o?(0,K.jsx)(F,{size:13}):(0,K.jsx)(ge,{size:13}),o?`Copied`:`Copy`]})]})]}),i?.active&&i?.publicIp&&i?.url&&!i.url.includes(`ngrok-free.app`)&&(0,K.jsxs)(`div`,{className:`tunnel-password-hint`,children:[(0,K.jsx)(`label`,{children:`Tunnel Password`}),(0,K.jsx)(`div`,{className:`tunnel-password-value`,children:i.publicIp}),(0,K.jsx)(`span`,{className:`tunnel-password-note`,children:`Enter this when the tunnel page asks for a password`})]}),(0,K.jsx)(`div`,{className:`mobile-instructions`,children:(0,K.jsxs)(`ol`,{children:[(0,K.jsx)(`li`,{children:`Scan the QR code with your phone's camera`}),i?.url&&!i.url.includes(`ngrok-free.app`)&&(0,K.jsx)(`li`,{children:`Enter the tunnel password shown above when prompted`}),(0,K.jsx)(`li`,{children:`Chat with GAIA from your mobile device`}),(0,K.jsx)(`li`,{children:`Your data stays secure via encrypted tunnel`})]})}),(0,K.jsxs)(`div`,{className:`mobile-access-actions`,children:[i?.active&&n&&(0,K.jsx)(`button`,{className:`btn-danger`,onClick:n,title:`Close the tunnel and revoke the mobile URL`,children:`Stop Tunnel`}),(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:t,children:`Close`})]})]})]})})}function sv({onRetry:e}){let{backendConnected:t,systemStatus:n,currentSessionId:r,messages:i}=H(),[a,o]=(0,w.useState)(!1),s=!!r&&i.length>0,c=n?.default_model_name??`Gemma-4-E4B-it-GGUF`,{isLoadingModel:l,isDownloadingModel:u,loadModel:d,downloadModel:f}=D_(c),p=(0,w.useRef)(n?.lemonade_running),m=(0,w.useRef)(n?.model_downloaded),h=(0,w.useRef)(n?.context_size_sufficient),g=(0,w.useRef)(n?.expected_model_loaded);(0,w.useEffect)(()=>{if(s)return;let e=n?.lemonade_running,t=n?.model_downloaded,r=n?.context_size_sufficient,i=n?.expected_model_loaded,a=!1;p.current!==e&&(p.current=e,e===!1&&(a=!0)),m.current!==t&&(m.current=t,t===!1&&(a=!0)),h.current!==r&&(h.current=r,r===!1&&(a=!0)),g.current!==i&&(g.current=i,i===!1&&(a=!0)),a&&o(!1)},[n,s]);let _=n?.download_progress??null;if(u||_?.state===`downloading`||_?.state===`starting`||_?.state===`error`){let e=n?.default_model_size_gb?`~${n.default_model_size_gb.toFixed(1)} GB`:`large download`,t=_?.state===`error`;return(0,K.jsxs)(`div`,{className:`connection-banner ${t?`connection-banner--error`:`connection-banner--warning`}`,role:t?`alert`:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:t?(0,K.jsx)(At,{size:16}):(0,K.jsx)(be,{size:16})}),(0,K.jsx)(`div`,{className:`connection-banner__text`,children:t?(0,K.jsxs)(K.Fragment,{children:[`Download of `,(0,K.jsx)(`strong`,{children:c}),` failed.`,` `,_?.message&&(0,K.jsx)(`span`,{className:`connection-banner__hint`,children:_.message})]}):(0,K.jsxs)(K.Fragment,{children:[`Downloading `,(0,K.jsx)(`strong`,{children:c}),` (`,e,`).`,_?.state===`downloading`&&_.file&&(0,K.jsxs)(K.Fragment,{children:[` `,(0,K.jsxs)(`span`,{className:`connection-banner__hint`,children:[`File `,_.file_index,` / `,_.total_files,`: `,(0,K.jsx)(`code`,{children:_.file})]})]})]})}),t?(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:()=>f(!1),children:`Retry`}):(0,K.jsx)(`span`,{className:`connection-banner__loading connection-banner__progress`,children:_&&_.state===`downloading`&&_.total_bytes>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`connection-banner__progress-bar`,role:`progressbar`,"aria-valuenow":_.percent,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Download progress`,children:(0,K.jsx)(`span`,{className:`connection-banner__progress-fill`,style:{width:`${_.percent}%`}})}),(0,K.jsxs)(`span`,{className:`connection-banner__progress-label`,children:[_.percent,`% ·`,` `,(_.downloaded_bytes/1e9).toFixed(2),` /`,` `,(_.total_bytes/1e9).toFixed(2),` GB`]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`connection-banner__spinner`}),_?.state===`starting`?`Starting download…`:`Downloading…`]})}),t&&(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}if(n?.init_state===`initializing`){let e=n.init_tasks?.find(e=>e.status===`running`)?.name||`Preparing AI system`;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--init`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(B,{size:16,className:`connection-banner__spinner`})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[e,(0,K.jsxs)(`span`,{className:`thinking-dots`,children:[(0,K.jsx)(`span`,{children:`.`}),(0,K.jsx)(`span`,{children:`.`}),(0,K.jsx)(`span`,{children:`.`})]})]})]})}if(a||s)return null;if(!t)return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(Nt,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[`Cannot connect to GAIA server.`,` `,(0,K.jsxs)(`span`,{className:`connection-banner__hint`,children:[`Start it with: `,(0,K.jsx)(`code`,{children:`gaia chat --ui`})]})]}),e&&(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:e,children:`Retry`})]});if(n&&!n.lemonade_running){let t=!!n.lemonade_error;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(At,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[t?`Could not query the LLM server status.`:`LLM server is not responding — it may be busy or not running.`,` `,(0,K.jsx)(`span`,{className:`connection-banner__hint`,children:n.start_command?(0,K.jsxs)(K.Fragment,{children:[`If not started, run: `,(0,K.jsx)(`code`,{children:n.start_command})]}):n.start_instruction??`Start Lemonade Server, then retry.`})]}),e&&(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:e,children:`Check again`}),(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}if(n&&n.lemonade_running&&!n.model_loaded&&n.model_downloaded===!1){let t=n.default_model_size_gb?`~${n.default_model_size_gb.toFixed(1)} GB`:`large download`;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(be,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[`Required model `,(0,K.jsx)(`strong`,{children:c}),` is not downloaded (`,t,`).`]}),(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:()=>f(!1),children:`Download`}),e&&(0,K.jsx)(`button`,{className:`connection-banner__retry connection-banner__retry--secondary`,onClick:e,children:`Recheck`}),(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}if(n&&n.lemonade_running&&n.model_loaded&&n.expected_model_loaded===!1&&!n.embedding_model_loaded){let t=n.model_loaded,r=n.context_size_sufficient===!1;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(_e,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[`Wrong model loaded: `,(0,K.jsx)(`strong`,{children:t}),`.`,` `,`GAIA Chat requires `,(0,K.jsx)(`strong`,{children:c}),`.`,r&&(0,K.jsxs)(K.Fragment,{children:[` `,`Context window is also too small.`]})]}),l?(0,K.jsxs)(`span`,{className:`connection-banner__loading`,children:[(0,K.jsx)(B,{size:13,className:`connection-banner__spinner`}),`Loading…`]}):(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:()=>d(),children:`Load Now`}),e&&!l&&(0,K.jsx)(`button`,{className:`connection-banner__retry connection-banner__retry--secondary`,onClick:e,children:`Recheck`}),(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}if(n&&n.lemonade_running&&n.model_loaded&&n.context_size_sufficient===!1){let t=n.model_context_size??0,r=n.lemonade_url??`http://localhost:13305`;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(Be,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[`LLM context window is too small (`,t.toLocaleString(),` tokens;`,` `,C_.toLocaleString(),` required).`,` `,(0,K.jsxs)(`span`,{className:`connection-banner__hint`,children:[`In`,` `,(0,K.jsx)(`a`,{className:`connection-banner__link`,href:r,target:`_blank`,rel:`noreferrer`,children:`Lemonade`}),`, set ctx‑size to `,C_.toLocaleString(),`, or restart with:`,` `,(0,K.jsx)(`code`,{children:n?.start_command?n.start_command:`LEMONADE_CTX_SIZE=${C_} (see Settings)`})]})]}),e&&(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:e,children:`Check again`}),(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}return null}function cv(){let e=k_(),[t,n]=(0,w.useState)(!1),r=(0,w.useCallback)(()=>{window.gaiaUpdater?.check().catch(()=>{})},[]);if(t||e.status===`idle`||e.status===`checking`||e.status===`disabled`)return null;if(e.status===`downloading`){let t=Math.max(0,Math.min(100,e.progress));return(0,K.jsxs)(`div`,{className:`update-chip update-chip--downloading`,role:`status`,"aria-live":`polite`,title:`Downloading update${e.version?` ${e.version}`:``}…`,children:[(0,K.jsx)(be,{size:13,className:`update-chip__icon`}),(0,K.jsxs)(`span`,{className:`update-chip__label`,children:[`Downloading update… `,t,`%`]})]})}return e.status===`available`?(0,K.jsxs)(`div`,{className:`update-chip update-chip--available`,role:`status`,title:e.releaseNotes||`A new version is available.`,children:[(0,K.jsx)(be,{size:13,className:`update-chip__icon`}),(0,K.jsxs)(`span`,{className:`update-chip__label`,children:[`Update available`,e.version?`: ${e.version}`:``]}),(0,K.jsx)(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>n(!0),"aria-label":`Dismiss update notification`,children:(0,K.jsx)(Ft,{size:11})})]}):e.status===`downloaded`?(0,K.jsxs)(`div`,{className:`update-chip update-chip--ready`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(ut,{size:13,className:`update-chip__icon`}),(0,K.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`?(0,K.jsxs)(`div`,{className:`update-chip update-chip--error`,role:`status`,title:e.error||`Update check failed.`,children:[(0,K.jsx)(At,{size:13,className:`update-chip__icon`}),(0,K.jsx)(`span`,{className:`update-chip__label`,children:`Update check failed`}),(0,K.jsx)(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>n(!0),"aria-label":`Dismiss update error`,children:(0,K.jsx)(Ft,{size:11})})]}):null}function lv(){let e=Zm(eh),t=Zm(e=>e.respondToPermission);return e?(0,K.jsx)(`div`,{className:`permission-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Permission Request`,children:(0,K.jsx)(uv,{notification:e,onRespond:t},e.id)}):null}function uv({notification:e,onRespond:t}){let n=e.timeoutSeconds!=null&&e.timeoutSeconds>0,[r,i]=(0,w.useState)(n?e.timeoutSeconds:null),a=(0,w.useRef)(null),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(!1),u=(0,w.useRef)(!1),d=(0,w.useRef)(t);d.current=t,(0,w.useEffect)(()=>{if(n)return a.current=setInterval(()=>{i(e=>e===null||e<=1?(a.current&&clearInterval(a.current),0):e-1)},1e3),()=>{a.current&&clearInterval(a.current)}},[n]),(0,w.useEffect)(()=>{if(r===0){if(u.current)return;u.current=!0,s(!0),d.current(e.id,`deny`,!1)}},[r,e.id]);let f=(0,w.useCallback)(async()=>{if(!u.current){u.current=!0,s(!0),a.current&&clearInterval(a.current);try{await t(e.id,`allow`,c)}finally{u.current=!1,s(!1)}}},[e.id,t,c]),p=(0,w.useCallback)(async()=>{if(!u.current){u.current=!0,s(!0),a.current&&clearInterval(a.current);try{await t(e.id,`deny`,!1)}finally{u.current=!1,s(!1)}}},[e.id,t]);(0,w.useEffect)(()=>{let e=e=>{e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),p())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,p]);let m=e.toolArgs,h=m&&Object.keys(m).length>0;return(0,K.jsxs)(`div`,{className:`permission-prompt`,children:[(0,K.jsxs)(`div`,{className:`permission-header`,children:[(0,K.jsx)(`div`,{className:`permission-header-icon`,children:(0,K.jsx)(gt,{size:24})}),(0,K.jsxs)(`div`,{className:`permission-header-text`,children:[(0,K.jsx)(`h2`,{className:`permission-title`,children:`Permission Request`}),(0,K.jsx)(`span`,{className:`permission-agent`,children:e.agentName})]}),r!==null&&r>0&&(0,K.jsxs)(`div`,{className:`permission-countdown`,title:`Auto-deny on timeout`,children:[(0,K.jsx)(pe,{size:14}),(0,K.jsxs)(`span`,{children:[r,`s`]})]})]}),(0,K.jsxs)(`div`,{className:`permission-body`,children:[(0,K.jsx)(`p`,{className:`permission-message`,children:e.message}),e.tool&&(0,K.jsxs)(`div`,{className:`permission-tool-info`,children:[(0,K.jsxs)(`div`,{className:`permission-tool-header`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsx)(`span`,{children:`Tool Invocation`})]}),(0,K.jsx)(`div`,{className:`permission-tool-name`,children:(0,K.jsx)(`code`,{children:e.tool})}),h&&(0,K.jsx)(`div`,{className:`permission-tool-args`,children:(0,K.jsx)(`pre`,{children:JSON.stringify(m,null,2)})})]}),e.priority===`critical`&&(0,K.jsxs)(`div`,{className:`permission-critical-banner`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsx)(`span`,{children:`This is a critical-tier operation`})]}),(0,K.jsxs)(`label`,{className:`permission-remember`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),disabled:o}),(0,K.jsx)(`span`,{children:`Always allow this tool`})]})]}),(0,K.jsxs)(`div`,{className:`permission-actions`,children:[(0,K.jsxs)(`button`,{className:`permission-btn permission-btn-deny`,onClick:p,disabled:o,title:`Deny (Esc)`,children:[(0,K.jsx)(Ft,{size:16}),`Deny`]}),(0,K.jsxs)(`button`,{className:`permission-btn permission-btn-allow`,onClick:f,disabled:o,title:`Allow (Enter)`,children:[(0,K.jsx)(F,{size:16}),`Allow`]})]}),(0,K.jsxs)(`div`,{className:`permission-hints`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{children:`Enter`}),` Allow`]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{children:`Esc`}),` Deny`]})]})]})}var dv={permission_request:{icon:(0,K.jsx)(gt,{size:16}),colorClass:`notif-type-permission`,label:`Permission`},policy_alert:{icon:(0,K.jsx)(gt,{size:16}),colorClass:`notif-type-policy`,label:`Policy`},security_alert:{icon:(0,K.jsx)(At,{size:16}),colorClass:`notif-type-security`,label:`Security`},status_change:{icon:(0,K.jsx)(le,{size:16}),colorClass:`notif-type-status`,label:`Status`},info:{icon:(0,K.jsx)(Re,{size:16}),colorClass:`notif-type-info`,label:`Info`},error:{icon:(0,K.jsx)(L,{size:16}),colorClass:`notif-type-error`,label:`Error`}};function fv(e){let t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<7?`${a}d ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function pv({onClose:e}){let t=Zm($m),n=Zm(Qm),r=Zm(e=>e.markRead),i=Zm(e=>e.markAllRead),a=Zm(e=>e.clearAll),o=Zm(e=>e.dismiss),s=Zm(e=>e.addNotification),c=Zm(e=>e.respondToPermission),l=Zm(e=>e.typeFilter),u=Zm(e=>e.setTypeFilter),d=(0,w.useRef)(!1);(0,w.useEffect)(()=>{let e=window.gaiaAPI;!e?.notification?.onNotification||d.current||(d.current=!0,e.notification.onNotification(e=>{s(e)}))},[s]);let f=(0,w.useCallback)(e=>{r(e)},[r]),p=(0,w.useCallback)(e=>{c(e.id,`allow`,!1)},[c]),m=(0,w.useCallback)(e=>{c(e.id,`deny`,!1)},[c]);return(0,w.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!t.defaultPrevented&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,K.jsxs)(`div`,{className:`notification-center`,role:`dialog`,"aria-label":`Notification Center`,children:[(0,K.jsxs)(`div`,{className:`notification-center-header`,children:[(0,K.jsxs)(`div`,{className:`notification-center-title-row`,children:[(0,K.jsx)(`h2`,{className:`notification-center-title`,children:`Notifications`}),n>0&&(0,K.jsx)(`span`,{className:`notification-center-badge`,children:n})]}),(0,K.jsx)(`button`,{className:`btn-icon notification-center-close`,onClick:e,"aria-label":`Close notification center`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsx)(`div`,{className:`notification-filter-bar`,role:`tablist`,"aria-label":`Filter notifications`,children:[{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`}].map(e=>(0,K.jsx)(`button`,{role:`tab`,"aria-selected":l===e.key,className:`notification-filter-tab ${l===e.key?`active`:``}`,onClick:()=>u(e.key),children:e.label},e.key??`all`))}),(0,K.jsx)(`div`,{className:`notification-list`,children:t.length===0?(0,K.jsxs)(`div`,{className:`notification-empty`,children:[(0,K.jsx)(ne,{size:40,strokeWidth:1.2}),(0,K.jsx)(`span`,{children:`No notifications`})]}):t.map(e=>{let t=dv[e.type];return(0,K.jsxs)(`div`,{className:`notification-item ${e.read?``:`unread`} ${t.colorClass}`,id:e.type===`policy_alert`&&e.receiptId?`policy-receipt-${encodeURIComponent(e.receiptId)}`:void 0,onClick:()=>f(e.id),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&f(e.id)},children:[!e.read&&(0,K.jsx)(`span`,{className:`notification-unread-dot`}),(0,K.jsx)(`span`,{className:`notification-icon`,children:t.icon}),(0,K.jsxs)(`div`,{className:`notification-content`,children:[(0,K.jsxs)(`div`,{className:`notification-content-header`,children:[(0,K.jsx)(`span`,{className:`notification-agent`,children:e.agentName}),(0,K.jsx)(`span`,{className:`notification-time`,children:fv(e.timestamp)})]}),e.title&&(0,K.jsx)(`span`,{className:`notification-title`,children:e.title}),(0,K.jsx)(`span`,{className:`notification-message`,children:e.message}),e.type===`permission_request`&&e.tool&&(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Tool: `,(0,K.jsx)(`code`,{children:e.tool})]}),e.type===`policy_alert`&&(0,K.jsxs)(`div`,{className:`notification-policy-details`,children:[e.tool&&(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Tool: `,(0,K.jsx)(`code`,{children:e.tool})]}),e.reason&&(0,K.jsxs)(`span`,{className:`notification-policy-reason`,children:[`Reason: `,e.reason]}),e.ruleIds&&e.ruleIds.length>0&&(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Rules: `,(0,K.jsx)(`code`,{children:e.ruleIds.join(`, `)})]}),e.policyVersion&&(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Policy: `,(0,K.jsx)(`code`,{children:e.policyVersion})]}),(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Receipt:`,` `,e.receiptId?(0,K.jsx)(`code`,{children:e.receiptId}):(0,K.jsx)(`em`,{children:`Receipt unavailable`})]})]}),e.type===`permission_request`&&!e.response&&(0,K.jsxs)(`div`,{className:`notification-actions`,children:[(0,K.jsxs)(`button`,{className:`notification-action-btn notification-action-allow`,onClick:t=>{t.stopPropagation(),p(e)},children:[(0,K.jsx)(F,{size:14}),`Approve`]}),(0,K.jsxs)(`button`,{className:`notification-action-btn notification-action-deny`,onClick:t=>{t.stopPropagation(),m(e)},children:[(0,K.jsx)(Ft,{size:14}),`Deny`]})]}),e.type===`permission_request`&&e.response&&(0,K.jsx)(`span`,{className:`notification-response-badge ${e.response===`allow`?`response-allow`:`response-deny`}`,children:e.response===`allow`?`Approved`:`Denied`})]}),(0,K.jsx)(`button`,{className:`notification-dismiss`,onClick:t=>{t.stopPropagation(),o(e.id)},"aria-label":`Dismiss notification`,children:(0,K.jsx)(Ft,{size:14})})]},e.id)})}),t.length>0&&(0,K.jsxs)(`div`,{className:`notification-center-footer`,children:[(0,K.jsxs)(`button`,{className:`notification-footer-btn`,onClick:i,disabled:n===0,children:[(0,K.jsx)(F,{size:14}),`Mark All Read`]}),(0,K.jsxs)(`button`,{className:`notification-footer-btn notification-footer-clear`,onClick:a,children:[(0,K.jsx)(Ot,{size:14}),`Clear`]})]})]})}var mv=[`welcome`,`preflight`,`download`,`connector`,`done`];function hv(e=`welcome`){let[t,n]=(0,w.useState)(()=>Math.max(0,mv.indexOf(e))),[r,i]=(0,w.useState)({}),a=mv[t],o=!!r[a],s=(0,w.useCallback)(e=>{i(t=>t[a]===e?t:{...t,[a]:e})},[a]),c=(0,w.useCallback)(()=>{if(r[a])return!1;let e=!1;return n(t=>t<mv.length-1?(e=!0,t+1):t),e},[r,a]),l=(0,w.useCallback)(()=>{n(e=>Math.min(e+1,mv.length-1))},[]),u=(0,w.useCallback)(()=>{let e=!1;return n(t=>t>0?(e=!0,t-1):t),e},[]),d=(0,w.useCallback)(e=>{let t=mv.indexOf(e);t>=0&&n(t)},[]);return(0,w.useMemo)(()=>({step:a,index:t,total:mv.length,isFirst:t===0,isLast:t===mv.length-1,guarded:o,setGuard:s,next:c,back:u,goTo:d,skip:l}),[a,t,o,s,c,u,d,l])}function gv(){return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-welcome`,children:[(0,K.jsx)(`h1`,{children:`Welcome to GAIA`}),(0,K.jsx)(`p`,{className:`lede`,children:`Your private AI assistant that runs 100% locally on AMD hardware — no data ever leaves your device. Let's get you set up.`}),(0,K.jsxs)(`ul`,{className:`onboarding-steps-list`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`num`,children:(0,K.jsx)(_e,{size:15})}),`Check your hardware`]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`num`,children:(0,K.jsx)(be,{size:15})}),`Download an AI model`]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`num`,children:(0,K.jsx)(Ye,{size:15})}),`Connect an app (optional) and start chatting`]})]}),(0,K.jsxs)(`p`,{className:`lede`,style:{marginTop:16,display:`flex`,alignItems:`center`,gap:8},children:[(0,K.jsx)(V,{size:16}),` Everything stays on this machine.`]})]})}function _v(e){return e===null?`—`:`${e} GB`}function vv({onGuardChange:e,onReport:t}){let[n,r]=(0,w.useState)({kind:`loading`}),i=(0,w.useCallback)(async()=>{r({kind:`loading`}),e(!0);try{let n=await sn();r({kind:`ready`,report:n}),t?.(n),e(!n.compatible)}catch(t){let n=t instanceof Error?t.message:`Hardware scan failed.`;U.system.error(`Preflight scan failed`,t),r({kind:`error`,message:n}),e(!0)}},[e,t]);if((0,w.useEffect)(()=>{i()},[i]),n.kind===`loading`)return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-preflight-loading`,children:[(0,K.jsx)(`h2`,{children:`Checking your hardware…`}),(0,K.jsxs)(`p`,{className:`lede`,style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,K.jsx)(B,{size:16,className:`onboarding-spin`}),` Scanning RAM, disk, and accelerators.`]})]});if(n.kind===`error`)return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-preflight-error`,children:[(0,K.jsx)(`h2`,{children:`Couldn't scan your hardware`}),(0,K.jsxs)(`div`,{className:`onboarding-banner error`,role:`alert`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsxs)(`div`,{children:[n.message,(0,K.jsx)(`div`,{style:{marginTop:6},children:`Make sure the GAIA backend is running, then retry.`})]})]}),(0,K.jsxs)(`button`,{className:`onboarding-btn secondary`,onClick:i,children:[(0,K.jsx)(ut,{size:15}),` Retry scan`]})]});let{report:a}=n,o=a.ram_gb===null||a.ram_gb>=a.required_memory_gb,s=a.disk_free_gb===null||a.disk_free_gb>=a.required_disk_gb;return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-preflight`,children:[(0,K.jsx)(`h2`,{children:`Hardware check`}),(0,K.jsxs)(`span`,{className:`onboarding-tier`,children:[`Tier: `,a.tier]}),(0,K.jsxs)(`div`,{className:`preflight-rows`,children:[(0,K.jsx)(yv,{ok:o,label:`Memory (RAM)`,value:_v(a.ram_gb)}),(0,K.jsx)(yv,{ok:s,hardFail:!s,label:`Free disk space`,value:_v(a.disk_free_gb)}),(0,K.jsx)(yv,{ok:a.npu_detected===!0,unknown:a.npu_detected===null,label:`Ryzen AI NPU`,value:a.npu_detected===!0?`Detected`:a.npu_detected===!1?`Not found`:a.lemonade_error?`Unknown (query failed)`:`Unknown`}),a.gpu_name&&(0,K.jsx)(yv,{ok:!0,label:`GPU`,value:a.gpu_name})]}),!a.compatible&&a.blockers.length>0&&(0,K.jsxs)(`div`,{className:`onboarding-banner error`,role:`alert`,"data-testid":`preflight-blockers`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:`This machine can't run the setup yet:`}),(0,K.jsx)(`ul`,{children:a.blockers.map((e,t)=>(0,K.jsx)(`li`,{children:e},t))})]})]}),a.warnings.length>0&&(0,K.jsxs)(`div`,{className:`onboarding-banner warn`,"data-testid":`preflight-warnings`,children:[(0,K.jsx)(At,{size:18}),(0,K.jsx)(`div`,{children:(0,K.jsx)(`ul`,{children:a.warnings.map((e,t)=>(0,K.jsx)(`li`,{children:e},t))})})]}),(0,K.jsxs)(`button`,{className:`onboarding-btn secondary`,onClick:i,children:[(0,K.jsx)(ut,{size:15}),` Re-scan`]})]})}function yv({ok:e,hardFail:t,unknown:n,label:r,value:i}){return(0,K.jsxs)(`div`,{className:`preflight-row`,children:[(0,K.jsx)(`span`,{className:`pf-icon ${n?`warn`:e?`ok`:t?`bad`:`warn`}`,children:n?(0,K.jsx)(At,{size:17}):e?(0,K.jsx)(z,{size:17}):t?(0,K.jsx)(de,{size:17}):(0,K.jsx)(At,{size:17})}),(0,K.jsx)(`span`,{className:`pf-label`,children:r}),(0,K.jsx)(`span`,{className:`pf-value`,children:i})]})}var bv=2e3;function xv(e){return`${(e/1024**3).toFixed(1)} GB`}function Sv({modelName:e,onGuardChange:t}){let[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),u=(0,w.useRef)(null),d=(0,w.useCallback)(()=>{u.current&&=(clearInterval(u.current),null)},[]),f=(0,w.useCallback)(async()=>{try{let n=await nn();if(r(n.download_progress),n.download_progress?.state===`complete`||n.model_downloaded===!0||n.model_loaded&&n.model_loaded.toLowerCase()===e.toLowerCase())return a(!0),t(!1),d(),!1;let i=n.download_progress?.state;return i===`downloading`||i===`starting`}catch(e){return U.system.warn(`Model download poll failed`,e),!1}},[e,t,d]),p=(0,w.useCallback)(()=>{u.current||=setInterval(f,bv)},[f]);(0,w.useEffect)(()=>(t(!0),f().then(e=>{e&&p()}),d),[t,f,p,d]);let m=(0,w.useCallback)(async n=>{s(!0),l(null),t(!0);try{await G(e,n),U.system.info(`Onboarding download started: ${e} (force=${n})`),p()}catch(e){let t=e instanceof Error?e.message:`Failed to start download.`;U.system.error(`Onboarding download failed to start`,e),l(t)}finally{s(!1)}},[e,t,p]);if(i)return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-download-done`,children:[(0,K.jsx)(`h2`,{children:`Model ready`}),(0,K.jsxs)(`div`,{className:`onboarding-banner warn`,style:{background:`transparent`,border:`none`},children:[(0,K.jsx)(z,{size:18,className:`pf-icon ok`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`download-model-name`,children:e}),` is downloaded and ready to use.`]})]})]});let h=n?.state===`error`||!!c,g=c||n?.message||`Download failed.`,_=n?.state===`downloading`||n?.state===`starting`;return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-download`,children:[(0,K.jsx)(`h2`,{children:`Download your AI model`}),(0,K.jsxs)(`p`,{className:`lede`,children:[`GAIA needs a local model to run. This is a one-time download of`,` `,(0,K.jsx)(`span`,{className:`download-model-name`,children:e}),`.`]}),h&&(0,K.jsxs)(`div`,{className:`onboarding-banner error`,role:`alert`,"data-testid":`download-error`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsxs)(`div`,{children:[g,(0,K.jsx)(`div`,{style:{marginTop:6},children:`Check your connection and disk space, then retry.`})]})]}),_&&n&&(0,K.jsxs)(`div`,{"data-testid":`download-progress`,children:[(0,K.jsx)(`div`,{className:`download-model-name`,children:n.file||e}),(0,K.jsx)(`div`,{className:`download-bar`,children:(0,K.jsx)(`div`,{className:`fill`,style:{width:`${n.percent}%`}})}),(0,K.jsxs)(`div`,{className:`download-meta`,children:[(0,K.jsxs)(`span`,{children:[n.percent,`%`]}),(0,K.jsx)(`span`,{children:n.total_bytes>0?`${xv(n.downloaded_bytes)} / ${xv(n.total_bytes)}`:`Starting…`})]})]}),!_&&!h&&(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:()=>m(!1),disabled:o,"data-testid":`download-start`,children:[o?(0,K.jsx)(B,{size:15,className:`onboarding-spin`}):(0,K.jsx)(be,{size:15}),o?`Starting…`:`Download model`]}),h&&(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:()=>m(!0),disabled:o,"data-testid":`download-retry`,children:[(0,K.jsx)(ut,{size:15}),` Retry download`]})]})}var Cv=2e3;function wv({connectorId:e=`google`}){let[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)(!0),[a,o]=(0,w.useState)(!1),[s,c]=(0,w.useState)(null),l=(0,w.useRef)(null),u=(0,w.useCallback)(()=>{l.current&&=(clearInterval(l.current),null)},[]);(0,w.useEffect)(()=>{let t=!1;return gn().then(({connectors:r})=>{t||n(r.find(t=>t.id===e)??null)}).catch(e=>{U.system.warn(`Onboarding: failed to list connectors`,e),t||c(`Could not load connectors.`)}).finally(()=>{t||i(!1)}),()=>{t=!0,u()}},[e,u]);let d=e=>{let t=window;t.gaia?.openExternal?t.gaia.openExternal(e):window.open(e,`_blank`,`noopener`)},f=(0,w.useCallback)(()=>{u(),l.current=setInterval(async()=>{try{let t=await _n(e);n(t),t.configured&&(o(!1),u())}catch(e){U.system.warn(`Onboarding: connector poll failed`,e)}},Cv)},[e,u]),p=(0,w.useCallback)(async()=>{if(t){o(!0),c(null);try{let{authorization_url:n}=await vn(e,(t.default_scopes?.length?t.default_scopes:t.available_scopes)??[]);d(n),f()}catch(e){let t=e instanceof Error?e.message:`Failed to start the connection.`;U.system.error(`Onboarding: connect failed`,e),c(t),o(!1)}}},[t,e,f]);return r?(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-connector-loading`,children:[(0,K.jsx)(`h2`,{children:`Connect an app`}),(0,K.jsxs)(`p`,{className:`lede`,style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,K.jsx)(B,{size:16,className:`onboarding-spin`}),` Loading…`]})]}):t?(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-connector`,children:[(0,K.jsxs)(`h2`,{children:[`Connect an app `,(0,K.jsx)(`span`,{style:{color:`var(--text-muted)`,fontWeight:400,fontSize:`0.9rem`},children:`(optional)`})]}),(0,K.jsx)(`p`,{className:`lede`,children:`Some agents (like Email triage) work with your accounts. Connect now, or skip and do it later from Settings.`}),(0,K.jsxs)(`div`,{className:`connector-choice`,children:[(0,K.jsx)(`span`,{className:`cc-icon`,children:(0,K.jsx)(He,{size:20})}),(0,K.jsxs)(`div`,{className:`cc-body`,children:[(0,K.jsx)(`div`,{className:`cc-title`,children:t.display_name}),(0,K.jsx)(`div`,{className:`cc-desc`,children:t.description})]}),t.configured?(0,K.jsxs)(`span`,{className:`cc-connected`,"data-testid":`connector-connected`,children:[(0,K.jsx)(z,{size:15}),` Connected`]}):(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:p,disabled:a||!t.configurable,"data-testid":`connector-connect`,children:[a?(0,K.jsx)(B,{size:15,className:`onboarding-spin`}):(0,K.jsx)(He,{size:15}),a?`Waiting…`:`Connect`]})]}),!t.configurable&&t.config_error&&(0,K.jsxs)(`div`,{className:`onboarding-banner warn`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsx)(`div`,{children:t.config_error})]}),s&&(0,K.jsxs)(`div`,{className:`onboarding-banner error`,role:`alert`,"data-testid":`connector-error`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsx)(`div`,{children:s})]})]}):(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-connector-none`,children:[(0,K.jsx)(`h2`,{children:`Connect an app`}),(0,K.jsx)(`p`,{className:`lede`,children:`No apps to connect right now. You can add connectors any time from Settings → Connectors.`})]})}function Tv(){return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-done`,children:[(0,K.jsxs)(`h1`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,K.jsx)(rt,{size:24}),` You're all set`]}),(0,K.jsx)(`p`,{className:`lede`,children:`GAIA is ready. Ask a question, drop in a document, or explore the agents in the sidebar. Everything runs locally on your machine.`})]})}function Ev({onComplete:e}){let t=hv(),[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(null),c=n?.recommended_model||`Gemma-4-E4B-it-GGUF`,l=(0,w.useCallback)(async t=>{a(!0),s(null);try{await ln(t),U.system.info(`Onboarding complete (skipped=${t})`),e()}catch(e){let t=e instanceof Error?e.message:`Failed to finish setup.`;U.system.error(`Onboarding: failed to write completion marker`,e),s(t),a(!1)}},[e]);return(0,K.jsx)(`div`,{className:`onboarding-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`GAIA first-run setup`,children:(0,K.jsxs)(`div`,{className:`onboarding-card`,children:[(0,K.jsx)(`div`,{className:`onboarding-progress`,"aria-hidden":`true`,children:mv.map((e,n)=>(0,K.jsx)(`span`,{className:`dot ${n===t.index?`active`:``} ${n<t.index?`done`:``}`},e))}),(()=>{switch(t.step){case`welcome`:return(0,K.jsx)(gv,{});case`preflight`:return(0,K.jsx)(vv,{onGuardChange:t.setGuard,onReport:r});case`download`:return(0,K.jsx)(Sv,{modelName:c,onGuardChange:t.setGuard});case`connector`:return(0,K.jsx)(wv,{});case`done`:return(0,K.jsx)(Tv,{})}})(),o&&(0,K.jsx)(`div`,{className:`onboarding-banner error`,role:`alert`,style:{margin:`0 28px`},children:o}),(0,K.jsx)(`div`,{className:`onboarding-footer`,children:(()=>{if(t.step===`welcome`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{className:`onboarding-btn link`,onClick:()=>l(!0),disabled:i,children:`Skip — I know what I'm doing`}),(0,K.jsx)(`div`,{className:`spacer`}),(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:t.next,children:[`Get started `,(0,K.jsx)(A,{size:15})]})]});if(t.step===`done`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`spacer`}),(0,K.jsx)(`button`,{className:`onboarding-btn primary`,onClick:()=>l(!1),disabled:i,children:i?`Finishing…`:`Start using GAIA`})]});let e=t.step===`download`||t.step===`connector`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{className:`onboarding-btn secondary`,onClick:t.back,disabled:t.isFirst,children:[(0,K.jsx)(te,{size:15}),` Back`]}),e&&(0,K.jsx)(`button`,{className:`onboarding-btn link`,onClick:t.skip,"data-testid":`onboarding-skip-later`,children:`Set up later`}),(0,K.jsx)(`div`,{className:`spacer`}),(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:t.next,disabled:t.guarded,"data-testid":`onboarding-next`,children:[`Continue `,(0,K.jsx)(A,{size:15})]})]})})()})]})})}function Dv(e,t,n){return!e||t&&(e===t||e===xr(t))?null:n.some(t=>t.id===e)?e:Sr(n,e)}function Ov({show:e,children:t,duration:n=250}){let[r,i]=(0,w.useState)(!1),[a,o]=(0,w.useState)(`idle`);return(0,w.useEffect)(()=>{if(e)i(!0),requestAnimationFrame(()=>o(`entering`));else if(r){o(`exiting`);let e=setTimeout(()=>{i(!1),o(`idle`)},n);return()=>clearTimeout(e)}},[e,r,n]),r?(0,K.jsx)(`div`,{className:`animated-presence ${a}`,"data-duration":n,children:t}):null}function kv(){let{agents:e,activeAgentId:t,setActiveAgentId:n,currentSessionId:r,setSessions:i,setCurrentSession:a,addSession:o,removeSession:s,updateSessionInList:c,setMessages:l,resetStreaming:u,showDocLibrary:d,showFileBrowser:f,showSettings:p,setShowSettings:m,showMemoryDashboard:h,setShowMemoryDashboard:g,showSchedules:_,setShowSchedules:v,showHub:y,setShowHub:b,sidebarOpen:x,toggleSidebar:S,setSidebarOpen:C,systemStatus:T,setSystemStatus:E,setBackendConnected:D,setAgents:O,setAgentsError:k,setRunningSessions:ee}=H(),te=Zm(e=>e.showPanel),A=Zm(e=>e.setShowPanel),j=(0,w.useRef)(``),ne=(0,w.useCallback)(async()=>{try{let e=(await un()).agents||[],t=e.map(e=>e.id).sort().join(`,`);t!==j.current&&(j.current=t,O(e)),k(null)}catch(e){let t=e instanceof Error?e.message:`agent discovery failed`;U.api.warn(`[App] agent list load failed`,e),k(t)}},[O,k]);(0,w.useEffect)(()=>{ne();let e=setInterval(ne,3e4);return()=>clearInterval(e)},[ne]);let[re,M]=(0,w.useState)(!1);(0,w.useEffect)(()=>{let e=!1;return cn().then(t=>{e||M(!t.initialized)}).catch(e=>{U.system.warn(`Onboarding status check failed`,e)}),()=>{e=!0}},[]);let[N,P]=(0,w.useState)(!1),[ie,ae]=(0,w.useState)(!1),[F,I]=(0,w.useState)(!1),[oe,se]=(0,w.useState)(null),ce=(0,w.useRef)(null),L=(0,w.useRef)(0),R=(0,w.useCallback)(async()=>{try{let e=await nn();if(D(!0),e.detected_devices&&e.detected_devices.length>0&&H.getState().setDetectedDevices(e.detected_devices),e.lemonade_running)L.current=0,E(e);else if(L.current+=1,U.system.warn(`Lemonade health check failed (${L.current}/3)`),L.current>=3)E(e);else{let t=H.getState().systemStatus;t&&t.lemonade_running?E({...t,disk_space_gb:e.disk_space_gb,memory_available_gb:e.memory_available_gb}):E(e)}U.system.info(`System status:`,{lemonade:e.lemonade_running,model:e.model_loaded,failCount:L.current})}catch(e){U.system.warn(`System status check failed`,e),D(!1),E(null)}},[E,D]),le=(0,w.useRef)(3e3);(0,w.useEffect)(()=>(R(),le.current=3e3,ce.current=setInterval(R,3e3),()=>{ce.current&&clearInterval(ce.current)}),[R]),(0,w.useEffect)(()=>{let e=T?.init_state;if(!e||e===`initializing`)return;let t=15e3;t!==le.current&&(le.current=t,ce.current&&clearInterval(ce.current),ce.current=setInterval(R,t))},[T?.init_state,R]);let z=(0,w.useRef)(null),ue=(0,w.useRef)(``);(0,w.useEffect)(()=>{Qt(`0.24.0`),U.system.info(`App mounting, loading sessions...`);let e=U.system.time(),t=e=>e.map(e=>`${e.id}|${e.updated_at}|${e.title}`).join(`
|
|
68
|
+
Import?`)){c({kind:`working`,message:`Uploading…`});try{let e=new FormData;e.append(`bundle`,t,t.name);let n=await fetch(`${A_}/agents/import`,{method:`POST`,headers:{"X-Gaia-UI":`1`},body:e});if(!n.ok){let e=await n.text().catch(()=>``),t=e;try{t=JSON.parse(e).detail||e}catch{}throw Error(t||`Import failed (HTTP ${n.status})`)}let r=await n.json(),i=r.imported||[],a=r.overwritten||[];await l();let o;if(i.length===0?o=`No agents imported`:(o=`Installed ${i.length} agent(s): ${i.join(`, `)}`,a.length>0&&(o+=` (replaced: ${a.join(`, `)})`)),r.requires_restart&&(o+=` — restart required for replaced agents to take full effect`),r.errors&&r.errors.length>0){let e=r.errors.map(e=>`${e.id}: ${e.error}`).join(`; `);c({kind:`error`,message:`${o}. Errors: ${e}`})}else c({kind:`success`,message:o})}catch(e){console.error(`Agent import failed:`,e);let t=e instanceof Error?e.message:String(e);U.api.error(`Agent import failed`,e),c({kind:`error`,message:`Import failed: ${t}`})}}},[c,l]),h=t.kind===`working`;return(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Custom Agents`}),u.length===0?(0,K.jsx)(`p`,{className:`danger-warning`,style:{marginBottom:12},children:`No custom agents installed yet. Import a bundle below to add one.`}):(0,K.jsx)(`div`,{className:`status-grid`,style:{marginBottom:12},children:u.map(e=>(0,K.jsxs)(`div`,{className:`status-row`,children:[(0,K.jsx)(`span`,{className:`status-label`,children:e.name}),(0,K.jsxs)(`div`,{className:`status-value-wrap`,children:[(0,K.jsx)(`span`,{className:`status-value ${e.registered?`ok`:`warn`}`,children:e.id}),e.registered?e.source&&(0,K.jsx)(`span`,{className:`status-hint`,children:(0,K.jsx)(`code`,{children:e.source})}):(0,K.jsx)(`span`,{className:`status-hint`,children:`Not loaded`})]})]},e.id))}),(0,K.jsxs)(`div`,{className:`setting-actions`,style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,K.jsx)(`button`,{className:`btn-model-save`,onClick:f,disabled:h||!d,title:d?void 0:`No custom agents to export`,children:h&&t.message.startsWith(`Export`)?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Exporting…`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(be,{size:13,style:{verticalAlign:-2,marginRight:6}}),`Export All`]})}),(0,K.jsx)(`button`,{className:`btn-model-save`,onClick:p,disabled:h,children:h&&t.message.startsWith(`Upload`)?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Uploading…`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jt,{size:13,style:{verticalAlign:-2,marginRight:6}}),`Import`]})}),(0,K.jsx)(`input`,{ref:a,type:`file`,accept:`.zip,application/zip`,style:{display:`none`},onChange:m})]}),t.kind!==`idle`&&(0,K.jsxs)(`div`,{ref:s,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`&&(0,K.jsx)(B,{size:14,className:`btn-spinner`}),t.kind===`success`&&(0,K.jsx)(z,{size:14}),t.kind===`error`&&(0,K.jsx)(L,{size:14}),(0,K.jsx)(`span`,{children:t.message})]})]})}async function M_(e){let t=await e.arrayBuffer(),n=new DataView(t),r=new Uint8Array(t),i=Math.min(t.byteLength,65557),a=t.byteLength-i,o=-1;for(let e=t.byteLength-22;e>=a;e--)if(n.getUint32(e,!0)===101010256){o=e;break}if(o<0)return null;let s=n.getUint16(o+10,!0),c=n.getUint32(o+16,!0);for(let e=0;e<s;e++){if(c+46>t.byteLength||n.getUint32(c,!0)!==33639248)return null;let e=n.getUint16(c+10,!0),i=n.getUint32(c+20,!0),a=n.getUint16(c+28,!0),o=n.getUint16(c+30,!0),s=n.getUint16(c+32,!0),l=n.getUint32(c+42,!0);if(new TextDecoder(`utf-8`).decode(r.subarray(c+46,c+46+a))===`bundle.json`){if(l+30>t.byteLength||n.getUint32(l,!0)!==67324752)return null;let a=n.getUint16(l+26,!0),o=n.getUint16(l+28,!0),s=l+30+a+o,c=s+i;if(c>t.byteLength)return null;let u=r.subarray(s,c),d;if(e===0)d=new TextDecoder(`utf-8`).decode(u);else if(e===8){let e=new DecompressionStream(`deflate-raw`),t=new Blob([u]).stream().pipeThrough(e),n=await new Response(t).arrayBuffer();d=new TextDecoder(`utf-8`).decode(n)}else return null;let f=JSON.parse(d)?.agent_ids;return Array.isArray(f)&&f.every(e=>typeof e==`string`)?f:null}c+=46+a+o+s}return null}var N_=U.api;function P_(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`;case`connector.activation.changed`:return`activation_changed`;default:return null}}function F_(e){let t=(0,w.useRef)(e);(0,w.useEffect)(()=>{t.current=e},[e]),(0,w.useEffect)(()=>{let e=`${Kt()}/connectors/events`,n=null,r=1e3,i=null,a=!1,o=()=>{a||(n=new EventSource(e),n.onopen=()=>{r=1e3},n.onmessage=e=>{try{let n=JSON.parse(e.data),r=P_(n.type);if(r===null){N_.debug(`connectors-sse: ignoring event`,n.type);return}let i=n.payload??{},a=i.connector_id??i.provider??null;t.current({connectorId:a,reason:r,payload:i})}catch(e){N_.warn(`connectors-sse: malformed event`,e)}},n.onerror=()=>{n?.close(),n=null,!a&&(i=setTimeout(o,r),r=Math.min(r*2,3e4))})};return o(),()=>{a=!0,i&&clearTimeout(i),n?.close()}},[])}function I_(e){return e.type===`mcp_server`&&e.configured}function L_({connector:e,onChanged:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)(null),u=(0,w.useRef)(null),d=(0,w.useRef)(null);if((0,w.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;u.current&&!u.current.contains(t)&&d.current&&!d.current.contains(t)&&r(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]),(0,w.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n]),(0,w.useEffect)(()=>{if(!n)return;let e=()=>{if(!u.current)return;let e=u.current.getBoundingClientRect();l({top:e.bottom+4,right:window.innerWidth-e.right})};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[n]),!I_(e))return null;let f=e=>{e.stopPropagation(),e.preventDefault()},p=e=>{if(f(e),!n&&u.current){let e=u.current.getBoundingClientRect();l({top:e.bottom+4,right:window.innerWidth-e.right})}r(e=>!e)},m=async e=>{a(!0),s(null);try{await e(),r(!1),t()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}};return(0,K.jsxs)(`div`,{className:`connector-tile-menu`,onClick:f,onKeyDown:f,children:[(0,K.jsx)(`button`,{ref:u,type:`button`,className:`connector-tile-menu-trigger`,"aria-haspopup":`menu`,"aria-expanded":n,"aria-label":`Connector actions`,onClick:p,disabled:i,children:(0,K.jsx)(xe,{size:14})}),n&&c&&(0,K.jsxs)(`div`,{ref:d,role:`menu`,className:`connector-tile-menu-popup`,style:{position:`fixed`,top:c.top,right:c.right},children:[e.enabled?(0,K.jsx)(`button`,{role:`menuitem`,type:`button`,className:`connector-tile-menu-item`,onClick:()=>void m(()=>Cn(e.id)),disabled:i,children:`Disable`}):(0,K.jsx)(`button`,{role:`menuitem`,type:`button`,className:`connector-tile-menu-item`,onClick:()=>void m(()=>Sn(e.id)),disabled:i,children:`Enable`}),(0,K.jsx)(`div`,{className:`connector-tile-menu-divider`}),(0,K.jsx)(`button`,{role:`menuitem`,type:`button`,className:`connector-tile-menu-item connector-tile-menu-item--danger`,onClick:()=>void m(()=>xn(e.id)),disabled:i,children:`Disconnect`}),o&&(0,K.jsx)(`div`,{className:`connector-tile-menu-error`,children:o})]})]})}var R_={"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`,"https://graph.microsoft.com/Mail.ReadWrite":`Read & organize Outlook mail (archive, label, trash)`,"https://graph.microsoft.com/Mail.Send":`Send Outlook mail on your behalf`,"https://graph.microsoft.com/Calendars.ReadWrite":`Create & respond to Outlook calendar events`,"https://graph.microsoft.com/Calendars.Read":`View Outlook calendar events`,"https://graph.microsoft.com/User.Read":`Read your basic Microsoft profile`};function z_(e){return R_[e]??e.split(/[/.:]/).pop()??e}var B_=[`use`];function V_(){let[e,t]=(0,w.useState)([]),[n,r]=(0,w.useState)([]),[i,a]=(0,w.useState)(!0),[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)(null),u=(0,w.useCallback)(async()=>{try{let[{connectors:e},{agent_mcps:n}]=await Promise.all([gn(),wn()]);t(e),r(n),s(null)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}},[]);(0,w.useEffect)(()=>{u()},[u]);let d=e=>l(t=>t===e?null:e),f=(0,w.useCallback)(async e=>{try{let n=await _n(e);t(t=>t.map(t=>t.id===e?n:t))}catch{u()}},[u]);return F_((0,w.useCallback)(e=>{e.connectorId?f(e.connectorId):u()},[f,u])),(0,K.jsxs)(`section`,{className:`settings-section connectors-section`,children:[(0,K.jsx)(`h4`,{children:`Connectors`}),(0,K.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.`}),o&&(0,K.jsxs)(`div`,{className:`error-banner`,children:[(0,K.jsx)(L,{size:14}),(0,K.jsx)(`span`,{children:o})]}),i?(0,K.jsx)(`div`,{className:`connectors-loading`,children:(0,K.jsx)(B,{size:16,className:`spin`})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`connectors-list`,children:e.map(e=>(0,K.jsx)(H_,{connector:e,expanded:c===e.id,onToggle:()=>d(e.id),onChanged:()=>void f(e.id)},e.id))}),n.length>0&&(0,K.jsx)(q_,{servers:n,expanded:c,onToggle:d})]})]})}function H_({connector:e,expanded:t,onToggle:n,onChanged:r}){return(0,K.jsxs)(`div`,{className:`connector-tile${t?` connector-tile--open`:``}`,children:[(0,K.jsxs)(`button`,{className:`connector-tile-header`,onClick:n,"aria-expanded":t,children:[(0,K.jsx)(`span`,{className:`connector-tile-name`,children:e.display_name}),(0,K.jsx)(`span`,{className:`connector-tile-type`,children:e.type===`oauth_pkce`?`OAuth`:`MCP`}),e.configured?e.type===`mcp_server`&&e.enabled===!1?(0,K.jsx)(`span`,{className:`connector-status disabled`,children:`Disabled`}):(0,K.jsxs)(`span`,{className:`connector-status ok`,children:[(0,K.jsx)(z,{size:12}),e.account_id??`Configured`]}):(0,K.jsx)(`span`,{className:`connector-status idle`,children:`Not configured`}),(0,K.jsx)(L_,{connector:e,onChanged:r}),(0,K.jsx)(`span`,{className:`connector-tile-chevron`,children:t?(0,K.jsx)(ce,{size:14}):(0,K.jsx)(I,{size:14})})]}),t&&(0,K.jsxs)(`div`,{className:`connector-detail`,children:[e.type===`oauth_pkce`?(0,K.jsx)(U_,{connector:e,onChanged:r}):(0,K.jsx)(G_,{connector:e,onChanged:r}),e.configured&&(0,K.jsx)(Y_,{connectorId:e.id,connectorType:e.type})]})]})}function U_({connector:e,onChanged:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)({}),[c,l]=(0,w.useState)(null),{agents:u}=H(),d=u.filter(t=>t.namespaced_agent_id&&t.required_connections?.some(t=>t.connector_id===e.id)),f=d.map(e=>e.namespaced_agent_id).join(`,`),[p,m]=(0,w.useState)(()=>new Set);(0,w.useEffect)(()=>{m(new Set(d.map(e=>e.namespaced_agent_id)))},[f]);let h=e=>m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),g=()=>[...p];(0,w.useEffect)(()=>{let e=()=>{t()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[t]);let _=e=>{let t=window;t.gaia?.openExternal?t.gaia.openExternal(e):window.open(e,`_blank`,`noopener`)},v=async()=>{r(!0),a(null);try{let t=await vn(e.id,e.available_scopes?.length?e.available_scopes:e.default_scopes,g());_(t.authorization_url)}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}},y=async()=>{r(!0),a(null),l(null);try{let t=await yn(e.id,e.available_scopes?.length?e.available_scopes:e.default_scopes,g());l(t)}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}};(0,w.useEffect)(()=>{e.configured&&l(null)},[e.configured]),F_((0,w.useCallback)(t=>{t.connectorId===e.id&&(t.reason===`oauth_error`?(a(String(t.payload.error??`Device sign-in failed.`)),l(null)):t.reason===`oauth_completed`&&l(null))},[e.id]));let b=async()=>{r(!0),a(null);try{await xn(e.id),t()}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}},x=async()=>{let n=(e.oauth_setup_fields??[]).filter(e=>e.required!==!1&&!o[e.key]?.trim()).map(e=>e.label);if(n.length){a(`Required: ${n.join(`, `)}`);return}r(!0),a(null);try{let n=e.available_scopes?.length?e.available_scopes:e.default_scopes,r=await bn(e.id,{...o,scopes:n,grant_agents:g()}),i=typeof r.authorization_url==`string`?r.authorization_url:null;i&&_(i),t()}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}},S=e.oauth_setup_fields??[],C=e.configurable===!1&&!e.configured&&S.length>0;return(0,K.jsxs)(`div`,{className:`configure-body`,children:[e.description&&(0,K.jsx)(`p`,{className:`connector-desc`,children:e.description}),C&&(0,K.jsxs)(`div`,{className:`oauth-setup-form`,children:[(0,K.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.`}),S.map(e=>(0,K.jsxs)(`label`,{className:`oauth-setup-field`,children:[(0,K.jsx)(`span`,{className:`oauth-setup-label`,children:e.label}),(0,K.jsx)(`input`,{type:e.kind===`secret`?`password`:`text`,className:`oauth-setup-input`,placeholder:e.placeholder,value:o[e.key]??``,onChange:t=>s(n=>({...n,[e.key]:t.target.value})),autoComplete:`off`,spellCheck:!1}),e.help_md&&(0,K.jsx)(`span`,{className:`oauth-setup-help`,children:e.help_md})]},e.key))]}),!e.configured&&d.length>0&&(0,K.jsxs)(`div`,{className:`oauth-grant-onconnect`,children:[(0,K.jsx)(`p`,{className:`oauth-grant-onconnect-label`,children:`Grant access to these agents when you connect:`}),d.map(e=>(0,K.jsxs)(`label`,{className:`oauth-grant-onconnect-item`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:p.has(e.namespaced_agent_id),onChange:()=>h(e.namespaced_agent_id)}),(0,K.jsx)(`span`,{children:e.name})]},e.namespaced_agent_id)),(0,K.jsx)(`p`,{className:`oauth-grant-onconnect-help`,children:`You can change these any time under Per-agent grants below.`})]}),!C&&(0,K.jsx)(W_,{connector:e,onChanged:t}),i&&(0,K.jsxs)(`div`,{className:`configure-error`,children:[(0,K.jsx)(L,{size:12}),` `,i]}),(0,K.jsxs)(`div`,{className:`configure-actions`,children:[e.configured?(0,K.jsx)(`button`,{className:`btn-secondary`,disabled:n,onClick:()=>void b(),children:n?(0,K.jsx)(B,{size:12,className:`spin`}):`Disconnect`}):C?(0,K.jsx)(`button`,{className:`btn-primary`,disabled:n,onClick:()=>void x(),children:n?(0,K.jsx)(B,{size:12,className:`spin`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Se,{size:12}),` Save & Connect`]})}):e.configurable===!1?(0,K.jsx)(`span`,{className:`connector-setup-required`,title:e.config_error??void 0,children:`Setup required`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{className:`btn-primary`,disabled:n||c!==null,onClick:()=>void v(),children:n?(0,K.jsx)(B,{size:12,className:`spin`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Se,{size:12}),` Connect`]})}),e.supports_device_code&&(0,K.jsx)(`button`,{className:`btn-secondary`,disabled:n||c!==null,onClick:()=>void y(),title:`Enter a short code at a URL — no browser redirect or app registration needed`,children:`Sign in with a code`})]}),(e.docs_url||e.product_url)&&(0,K.jsxs)(`a`,{href:e.docs_url||e.product_url||`#`,target:`_blank`,rel:`noopener noreferrer`,className:`connector-product-link`,children:[`Learn more `,(0,K.jsx)(Se,{size:11})]})]}),c&&!e.configured&&(0,K.jsxs)(`div`,{className:`device-code-block`,children:[(0,K.jsxs)(`p`,{className:`device-code-instructions`,children:[`Go to`,` `,(0,K.jsx)(`a`,{href:c.verification_uri,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>{e.preventDefault(),_(c.verification_uri)},children:c.verification_uri}),` `,`and enter this code:`]}),(0,K.jsxs)(`div`,{className:`device-code-value`,children:[(0,K.jsx)(`code`,{children:c.user_code}),(0,K.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void navigator.clipboard?.writeText(c.user_code),title:`Copy code`,children:`Copy`})]}),(0,K.jsxs)(`p`,{className:`device-code-waiting`,children:[(0,K.jsx)(B,{size:12,className:`spin`}),` Waiting for sign-in…`]}),(0,K.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>l(null),children:`Cancel`})]})]})}function W_({connector:e,onChanged:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)({}),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(!1),[u,d]=(0,w.useState)(null),f=e.oauth_setup_fields??[];if(f.length===0)return null;let p=e.oauth_client,m=p?.source===`keyring`?`Saved client: ${p.client_id}`:p?.source===`env`?`From environment: ${p.client_id}`:`No OAuth client configured`,h=async()=>{if(!i.client_id?.trim()){d(`Client ID is required.`);return}s(!0),d(null),l(!1);try{await bn(e.id,{...Object.fromEntries(Object.entries(i).map(([e,t])=>[e,t.trim()])),save_only:!0}),l(!0),a({}),t(),setTimeout(()=>l(!1),2200)}catch(e){d(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,K.jsxs)(`div`,{className:`oauth-client-editor`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`oauth-client-editor__toggle`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[n?(0,K.jsx)(ce,{size:12}):(0,K.jsx)(I,{size:12}),(0,K.jsx)(`span`,{children:`OAuth client`}),(0,K.jsx)(`span`,{className:`oauth-client-editor__status`,children:m})]}),n&&(0,K.jsxs)(`div`,{className:`oauth-setup-form`,children:[(0,K.jsxs)(`p`,{className:`connector-desc`,children:[`Bring your own OAuth client — saved encrypted in your OS keyring (same store as`,` `,(0,K.jsx)(`code`,{children:`gaia connectors configure`}),`) and reused for future connections. Environment variables are only used when no saved client exists.`]}),f.map(e=>(0,K.jsxs)(`label`,{className:`oauth-setup-field`,children:[(0,K.jsx)(`span`,{className:`oauth-setup-label`,children:e.label}),(0,K.jsx)(`input`,{type:e.kind===`secret`?`password`:`text`,className:`oauth-setup-input`,placeholder:e.kind===`secret`&&p?.source===`keyring`&&p.has_secret?`••••••••`:e.placeholder,value:i[e.key]??``,onChange:t=>a(n=>({...n,[e.key]:t.target.value})),autoComplete:`off`,spellCheck:!1}),e.help_md&&(0,K.jsx)(`span`,{className:`oauth-setup-help`,children:e.help_md})]},e.key)),u&&(0,K.jsxs)(`div`,{className:`configure-error`,children:[(0,K.jsx)(L,{size:12}),` `,u]}),(0,K.jsx)(`div`,{className:`configure-actions`,children:(0,K.jsx)(`button`,{className:`btn-model-save${c?` saved`:``}`,disabled:o||!i.client_id?.trim(),onClick:()=>void h(),children:o?(0,K.jsx)(B,{size:12,className:`spin`}):c?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(z,{size:12}),` Saved`]}):`Save client`})})]})]})}function G_({connector:e,onChanged:t}){let[n,r]=(0,w.useState)(()=>Object.fromEntries(e.mcp_env_keys.map(e=>[e,``]))),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null);(0,w.useEffect)(()=>{r(Object.fromEntries(e.mcp_env_keys.map(e=>[e,``])))},[e.mcp_env_keys.join(`,`)]);let u=async()=>{let r=Object.fromEntries(Object.entries(n).filter(([,e])=>e.trim()!==``));if(Object.keys(r).length!==0){a(!0),l(null),s(!1);try{await bn(e.id,r),s(!0),t(),setTimeout(()=>s(!1),2200)}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(!1)}}},d=async()=>{a(!0),l(null);try{await xn(e.id),r(Object.fromEntries(e.mcp_env_keys.map(e=>[e,``]))),t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(!1)}},f=async()=>{a(!0),l(null);try{e.enabled?await Cn(e.id):await Sn(e.id),t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(!1)}};return(0,K.jsxs)(`div`,{className:`configure-body`,children:[e.description&&(0,K.jsx)(`p`,{className:`connector-desc`,children:e.description}),c&&(0,K.jsxs)(`div`,{className:`configure-error`,children:[(0,K.jsx)(L,{size:12}),` `,c]}),e.configured&&(0,K.jsxs)(`div`,{className:`connector-toggle-row`,children:[(0,K.jsx)(`span`,{className:`connector-toggle-label`,children:`Active`}),(0,K.jsxs)(`span`,{className:`toggle-switch`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:e.enabled!==!1,onChange:()=>void f(),disabled:i,"aria-label":e.enabled?`Disable this MCP server`:`Enable this MCP server`}),(0,K.jsx)(`span`,{className:`toggle-track`})]})]}),e.configured&&e.enabled===!1&&(0,K.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(t=>(0,K.jsxs)(`div`,{className:`mcp-key-row`,children:[(0,K.jsx)(`label`,{className:`mcp-key-label`,children:t}),(0,K.jsx)(`input`,{type:`password`,className:`mcp-key-input`,placeholder:e.configured?`••••••••`:`Enter value`,value:n[t]??``,onChange:e=>r(n=>({...n,[t]:e.target.value})),spellCheck:!1,autoComplete:`off`})]},t)),(0,K.jsxs)(`div`,{className:`configure-actions`,children:[(0,K.jsx)(`button`,{className:`btn-model-save${o?` saved`:``}`,disabled:i||Object.values(n).every(e=>e.trim()===``),onClick:()=>void u(),children:i?(0,K.jsx)(B,{size:12,className:`spin`}):o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(z,{size:12}),` Saved`]}):`Save`}),e.configured&&(0,K.jsx)(`button`,{className:`btn-secondary`,disabled:i,onClick:()=>void d(),children:`Disconnect`}),e.product_url&&(0,K.jsxs)(`a`,{href:e.product_url,target:`_blank`,rel:`noopener noreferrer`,className:`connector-product-link`,children:[`Docs `,(0,K.jsx)(Se,{size:11})]})]})]})}function K_({agent:e,connectorId:t,grantedScopes:n,onChanged:r}){let i=e.required_connections?.find(e=>e.connector_id===t),a=e.namespaced_agent_id;if(!i||!a)return null;let[o,s]=(0,w.useState)(()=>new Set(n)),[c,l]=(0,w.useState)(null),[u,d]=(0,w.useState)(null);(0,w.useEffect)(()=>{s(new Set(n))},[n.join(`,`)]);let f=async e=>{if(c!==null)return;let i=new Set(o);i.has(e)?i.delete(e):i.add(e),s(i),l(e),d(null);try{i.size===0?await Dn(t,a):await En(t,a,[...i]),r()}catch(e){s(new Set(n)),d(e instanceof Error?e.message:String(e))}finally{l(null)}};return(0,K.jsxs)(`div`,{className:`grant-agent-card`,children:[(0,K.jsx)(`div`,{className:`grant-agent-card-name`,children:e.name}),(0,K.jsx)(`div`,{className:`grant-scope-list`,children:i.scopes.map(e=>(0,K.jsxs)(`label`,{className:`grant-scope-item`,children:[(0,K.jsx)(`span`,{className:`grant-scope-label`,children:z_(e)}),(0,K.jsxs)(`span`,{className:`toggle-switch`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:o.has(e),onChange:()=>void f(e),disabled:c!==null}),(0,K.jsx)(`span`,{className:`toggle-track`})]})]},e))}),u&&(0,K.jsxs)(`div`,{className:`grant-scope-warning grant-scope-warning--error`,children:[(0,K.jsx)(L,{size:11}),` `,u]})]})}function q_({servers:e,expanded:t,onToggle:n}){return(0,K.jsxs)(`div`,{className:`agent-mcps-section`,children:[(0,K.jsx)(`div`,{className:`agent-mcps-section-header`,children:`Custom agent servers`}),(0,K.jsx)(`div`,{className:`connectors-list`,children:e.map(e=>{let r=`${e.agent_id}::${e.server_name}`;return(0,K.jsx)(J_,{server:e,expanded:t===r,onToggle:()=>n(r)},r)})})]})}function J_({server:e,expanded:t,onToggle:n}){let r=[e.command,...e.args].join(` `);return(0,K.jsxs)(`div`,{className:`agent-mcp-tile${t?` agent-mcp-tile--open`:``}`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`agent-mcp-tile-header`,onClick:n,"aria-expanded":t,children:[(0,K.jsx)(`span`,{className:`agent-mcp-server-name`,children:e.server_name}),(0,K.jsxs)(`span`,{className:`agent-mcp-agent-label`,children:[`via `,e.agent_name]}),e.disabled?(0,K.jsx)(`span`,{className:`agent-mcp-status disabled`,children:`Disabled`}):(0,K.jsxs)(`span`,{className:`agent-mcp-status enabled`,children:[(0,K.jsx)(z,{size:11}),` Active`]}),(0,K.jsx)(`span`,{className:`agent-mcp-readonly-badge`,children:`read-only`}),(0,K.jsx)(`span`,{className:`agent-mcp-chevron`,children:t?(0,K.jsx)(ce,{size:14}):(0,K.jsx)(I,{size:14})})]}),t&&(0,K.jsxs)(`div`,{className:`agent-mcp-detail`,children:[r&&(0,K.jsx)(`div`,{className:`agent-mcp-command-row`,children:r}),(0,K.jsx)(`div`,{className:`agent-mcp-config-path`,children:e.config_path}),(0,K.jsxs)(`div`,{className:`agent-mcp-config-hint`,children:[`Edit the agent's `,(0,K.jsx)(`code`,{children:`mcp_servers.json`}),` to change this server.`]})]})]})}function Y_({connectorId:e,connectorType:t}){let{agents:n}=H(),[r,i]=(0,w.useState)({}),[a,o]=(0,w.useState)({}),[s,c]=(0,w.useState)(!0),l=(0,w.useCallback)(async()=>{try{let[{grants:t},{activations:n}]=await Promise.all([Tn(e),On(e)]);i(t),o(n)}catch{i({}),o({})}finally{c(!1)}},[e]);if((0,w.useEffect)(()=>{l()},[l]),F_((0,w.useCallback)(t=>{t.connectorId===e&&(t.reason===`grant_changed`||t.reason===`activation_changed`||t.reason===`disconnected`)&&l()},[e,l])),s)return null;let u=n.filter(t=>t.namespaced_agent_id&&t.required_connections?.some(t=>t.connector_id===e)),d=t===`mcp_server`?n.filter(t=>t.namespaced_agent_id&&(t.consumes_mcp_servers||t.required_connections?.some(t=>t.connector_id===e))):[];return(0,K.jsxs)(`div`,{className:`connection-grants`,children:[(0,K.jsx)(`div`,{className:`grants-header`,children:`Per-agent grants`}),u.length===0?(0,K.jsx)(`div`,{className:`grants-empty`,children:`No agents require access to this connector.`}):u.map(t=>(0,K.jsx)(K_,{agent:t,connectorId:e,grantedScopes:r[t.namespaced_agent_id]??[],onChanged:()=>void l()},t.namespaced_agent_id)),d.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`grants-header grants-header--activations`,children:`Active for`}),(0,K.jsx)(`div`,{className:`grants-help`,children:`Activations gate which agents see this connector's tools. Activating without a prior grant auto-creates one.`}),d.map(t=>(0,K.jsx)(X_,{agent:t,connectorId:e,active:!!a[t.namespaced_agent_id],grantedScopes:r[t.namespaced_agent_id]??[],onChanged:()=>void l()},`activation-${t.namespaced_agent_id}`))]})]})}function X_({agent:e,connectorId:t,active:n,grantedScopes:r,onChanged:i}){let a=e.required_connections?.find(e=>e.connector_id===t),o=e.namespaced_agent_id;if(!o)return null;let[s,c]=(0,w.useState)(n),[l,u]=(0,w.useState)(!1),[d,f]=(0,w.useState)(null);(0,w.useEffect)(()=>{c(n)},[n]);let p=async()=>{if(l)return;let e=!s;c(e),u(!0),f(null);try{if(e){let e=r.length===0?a?[...a.scopes]:[...B_]:void 0;await kn(t,o,e)}else await An(t,o);i()}catch(e){c(n),f(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,K.jsxs)(`div`,{className:`grant-agent-card`,children:[(0,K.jsx)(`div`,{className:`grant-agent-card-name`,children:e.name}),(0,K.jsx)(`div`,{className:`grant-scope-list`,children:(0,K.jsxs)(`label`,{className:`grant-scope-item`,children:[(0,K.jsx)(`span`,{className:`grant-scope-label`,children:s?`Tools visible to this agent`:`Tools hidden from this agent`}),(0,K.jsxs)(`span`,{className:`toggle-switch`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:s,onChange:()=>void p(),disabled:l}),(0,K.jsx)(`span`,{className:`toggle-track`})]})]})}),d&&(0,K.jsxs)(`div`,{className:`grant-scope-warning grant-scope-warning--error`,children:[(0,K.jsx)(L,{size:11}),` `,d]})]})}function Z_(){return window.gaiaUpdater}function Q_({onClose:e}){let[t,n]=(0,w.useState)({kind:`loading`}),r=(0,w.useRef)(null);(0,w.useEffect)(()=>{let e=Z_();if(!e){n({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`});return}e.listReleases().then(e=>{n(Array.isArray(e)?{kind:`list`,releases:e}:{kind:`error`,message:e.error})}).catch(()=>{n({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`})})},[]),(0,w.useEffect)(()=>{function t(t){t.key===`Escape`&&e()}return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e]),(0,w.useEffect)(()=>{let e=r.current;e&&e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)?.focus()},[]),(0,w.useEffect)(()=>{let e=r.current;if(!e)return;function t(t){if(t.key!==`Tab`||!e)return;let n=e.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);if(n.length===0)return;let r=n[0],i=n[n.length-1];t.shiftKey?document.activeElement===r&&(t.preventDefault(),i?.focus()):document.activeElement===i&&(t.preventDefault(),r?.focus())}return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[]);function i(e,t){e.isCurrent||n({kind:`confirm`,release:e,releases:t})}async function a(t){n({kind:`installing`});let r=Z_();if(!r){n({kind:`error`,message:`Bridge unavailable — please restart the app.`});return}try{await r.installVersion(t.tag),e()}catch(e){let t=e instanceof Error?e.message:String(e);n({kind:`error`,message:`Failed to start rollback: ${t}`})}}function o(e){if(!e)return``;try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}catch{return e}}return(0,K.jsx)(`div`,{className:`version-picker-overlay`,onClick:t=>{t.target===t.currentTarget&&e()},children:(0,K.jsxs)(`div`,{className:`version-picker-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Roll back to a previous version`,ref:r,children:[(0,K.jsxs)(`div`,{className:`version-picker-header`,children:[(0,K.jsx)(`h3`,{children:`Roll back to a previous version`}),(0,K.jsx)(`button`,{className:`version-picker-close`,onClick:e,"aria-label":`Close`,type:`button`,children:`×`})]}),(0,K.jsxs)(`div`,{className:`version-picker-body`,children:[t.kind===`loading`&&(0,K.jsxs)(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[(0,K.jsx)(`span`,{className:`version-picker-spinner`}),`Loading releases…`]}),t.kind===`error`&&(0,K.jsxs)(`div`,{className:`version-picker-error`,children:[(0,K.jsx)(`p`,{children:t.message}),(0,K.jsx)(`p`,{children:(0,K.jsx)(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:`Browse releases on GitHub`})})]}),t.kind===`list`&&(0,K.jsx)(`ul`,{className:`version-picker-list`,role:`listbox`,"aria-label":`Available releases`,children:t.releases.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:`version-picker-row`,"data-version":e.version,"aria-label":`${e.version}${e.isCurrent?` — installed`:``}${e.isPinned?` — pinned`:``}`,"aria-disabled":e.isCurrent?`true`:`false`,onClick:()=>i(e,t.releases),disabled:e.isCurrent,children:[(0,K.jsx)(`span`,{className:`vp-version`,children:e.version}),(0,K.jsx)(`span`,{className:`vp-date`,children:o(e.date)}),e.isCurrent&&(0,K.jsx)(`span`,{className:`vp-badge vp-badge-current`,children:`Installed`}),e.isPinned&&!e.isCurrent&&(0,K.jsx)(`span`,{className:`vp-badge vp-badge-pinned`,children:`Pinned`}),!e.isCurrent&&(0,K.jsx)(`span`,{className:`vp-arrow`,"aria-hidden":`true`,children:`›`})]})},e.tag))}),t.kind===`list`&&(0,K.jsxs)(`p`,{className:`version-picker-more`,children:[`Showing the `,t.releases.length,` most recent.`,` `,(0,K.jsx)(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:`Browse all releases on GitHub`})]}),t.kind===`confirm`&&(0,K.jsxs)(`div`,{className:`version-picker-confirm`,children:[(0,K.jsxs)(`p`,{children:[`This will `,(0,K.jsxs)(`strong`,{children:[`downgrade to v`,t.release.version]}),` and restart the app.`]}),(0,K.jsxs)(`p`,{className:`vp-confirm-note`,children:[`Auto-update will be paused after rollback so the app stays on v`,t.release.version,`. You can resume updates from Settings → About.`]}),(0,K.jsxs)(`div`,{className:`vp-confirm-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`vp-btn-cancel`,onClick:()=>n({kind:`list`,releases:t.releases}),children:`Back`}),(0,K.jsx)(`button`,{type:`button`,className:`vp-btn-confirm`,onClick:()=>a(t.release),children:`Confirm downgrade & restart`})]})]}),t.kind===`installing`&&(0,K.jsxs)(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[(0,K.jsx)(`span`,{className:`version-picker-spinner`}),`Starting download…`]})]})]})})}function $_(){let{setShowSettings:e,sessions:t,removeSession:n,agents:r}=H(),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!0),[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)(!1),f=k_(),[p,m]=(0,w.useState)(``),[h,g]=(0,w.useState)(``),[_,v]=(0,w.useState)(!1),[y,b]=(0,w.useState)(!1),[x,S]=(0,w.useState)(null),[C,T]=(0,w.useState)(!1),E=(0,w.useRef)(null),[D,O]=(0,w.useState)(!1),[k,ee]=(0,w.useState)(!1),[A,j]=(0,w.useState)(!1),[ne,re]=(0,w.useState)(null);(0,w.useEffect)(()=>{U.system.info(`Checking system status...`);let e=U.system.time();nn().then(t=>{a(t),U.system.timed(`System status received`,e,{lemonade:t.lemonade_running?`running`:`stopped`,model:t.model_loaded||`none`,embedding:t.embedding_model_loaded?`yes`:`no`,disk:`${t.disk_space_gb}GB free`,memory:t.memory_available_gb==null?`unknown`:`${t.memory_available_gb}GB available`}),t.lemonade_running||U.system.warn(`Lemonade Server is NOT running.`)}).catch(e=>{U.system.error(`Failed to get system status`,e),a(null)}).finally(()=>s(!1)),mr().then(e=>l(e.servers)).catch(()=>{}),rn().then(e=>{let t=e.custom_model??``;m(t),g(t),O(e.dynamic_tools),ee(e.dynamic_tools_locked)}).catch(e=>{U.system.error(`Failed to load settings`,e)}).finally(()=>v(!0))},[]),(0,w.useEffect)(()=>()=>{E.current&&clearTimeout(E.current)},[]);let M=(0,w.useCallback)(async()=>{let e=p.trim(),t=e.length>0?e:``;b(!0),S(null),T(!1);try{U.system.info(`Saving custom_model override`,{custom_model:t});let e=(await an({custom_model:t})).custom_model??``;m(e),g(e),T(!0),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>T(!1),2200)}catch(e){let t=e instanceof Error?e.message:String(e);U.system.error(`Failed to save custom_model`,e),S(t)}finally{b(!1)}},[p]),N=(0,w.useCallback)(async()=>{if(k||A)return;let e=D,t=!e;O(t),j(!0),re(null);try{U.system.info(`Saving dynamic_tools setting`,{dynamic_tools:t});let e=await an({dynamic_tools:t});O(e.dynamic_tools),ee(e.dynamic_tools_locked)}catch(t){let n=t instanceof Error?t.message:String(t);U.system.error(`Failed to save dynamic_tools`,t),O(e),re(n)}finally{j(!1)}},[D,k,A]),P=p.trim()!==h.trim(),ie=i?.default_model_name??`Gemma-4-E4B-it-GGUF`,{isLoadingModel:ae,isDownloadingModel:F,loadModel:I,downloadModel:oe}=D_(ie),se=[{label:`4K`,value:4096},{label:`8K`,value:8192},{label:`16K`,value:16384},{label:`32K`,value:32768}],ce=i?.model_context_size??null,[R,le]=(0,w.useState)(``);(0,w.useEffect)(()=>{ce!=null&&le(String(ce))},[ce]);let ue=(()=>{let e=parseInt(R,10);return Number.isFinite(e)&&e>0?e:null})(),de=ue!=null&&ue!==ce,fe=i?.model_loaded??ie,pe=(0,w.useCallback)(async()=>{ue&&(U.system.info(`Reloading ${fe} with ctx_size=${ue}`),await I(fe,ue))},[ue,fe,I]),[me,he]=(0,w.useState)(!1),ge=(0,w.useRef)(null);(0,w.useEffect)(()=>()=>{ge.current&&clearTimeout(ge.current)},[]);let _e=(0,w.useCallback)(async()=>{if(!me){he(!0),ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>he(!1),4e3);return}he(!1),ge.current&&clearTimeout(ge.current),U.system.warn(`Clearing ALL data: ${t.length} session(s)`);let r=U.system.time(),i=0;for(let e of t)try{await Pn(e.id),n(e.id),i++}catch(t){U.system.error(`Failed to delete session ${e.id}`,t)}U.system.timed(`Cleared ${i}/${t.length} session(s)`,r),e(!1)},[me,t,n,e]),ve=!!(i?.lemonade_running&&i.model_loaded&&i.expected_model_loaded===!1),ye=!!(i?.lemonade_running&&i.model_loaded&&i.context_size_sufficient===!1),be=!!(i?.lemonade_running&&!i.model_loaded&&i.model_downloaded===!1),xe=ve||ye;return(0,K.jsxs)(`div`,{className:`settings-page`,children:[(0,K.jsxs)(`div`,{className:`settings-page-header`,children:[(0,K.jsx)(`button`,{className:`btn-icon settings-back-btn`,onClick:()=>e(!1),"aria-label":`Back`,children:(0,K.jsx)(te,{size:18})}),(0,K.jsx)(`h3`,{children:`Settings`})]}),(0,K.jsxs)(`div`,{className:`settings-page-body`,children:[(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`System Status`}),o?(0,K.jsx)(`p`,{className:`loading-text`,children:`Checking system...`}):i?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`status-grid`,children:[(0,K.jsx)(ev,{label:`Lemonade Server`,value:i.lemonade_running?`Running${i.lemonade_version?` v${i.lemonade_version}`:``}`:i.lemonade_error?`Status unavailable`:`Not Running`,ok:i.lemonade_running,hint:i.lemonade_running?void 0:i.lemonade_error?`Could not query Lemonade Server; check it and retry.`:i.initialized?i.start_command?`Run: ${i.start_command}`:i.start_instruction??`Start Lemonade Server`:`Run: gaia init`}),(0,K.jsx)(ev,{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: ${ie}`:void 0:`Run: gaia init`}),i.model_size_gb!=null&&(0,K.jsx)(ev,{label:`Model Size`,value:`${i.model_size_gb} GB`,ok:!0}),i.model_device&&(0,K.jsx)(ev,{label:`Device`,value:i.model_device.toUpperCase(),ok:i.model_device!==`cpu`}),i.model_context_size!=null&&(0,K.jsx)(ev,{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&&(0,K.jsx)(ev,{label:`Capabilities`,value:i.model_labels.join(`, `),ok:!0}),(0,K.jsx)(ev,{label:`Embedding Model`,value:i.embedding_model_loaded?`Available`:`Not loaded`,ok:i.embedding_model_loaded}),i.gpu_name&&(0,K.jsx)(ev,{label:`GPU`,value:`${i.gpu_name}${i.gpu_vram_gb?` (${i.gpu_vram_gb} GB)`:``}`,ok:!0}),(0,K.jsx)(ev,{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}),(0,K.jsx)(ev,{label:`Memory`,value:i.memory_available_gb==null?`unknown`:`${i.memory_available_gb} GB available`,ok:i.memory_available_gb!=null&&i.memory_available_gb>2}),i.processor_name&&(0,K.jsx)(ev,{label:`Processor`,value:i.processor_name,ok:i.device_supported!==!1})]}),be&&(0,K.jsxs)(`div`,{className:`model-action-row model-action-row--download`,children:[(0,K.jsxs)(`div`,{className:`model-action-info`,children:[(0,K.jsx)(`span`,{className:`model-action-label`,children:`Model not downloaded.`}),(0,K.jsxs)(`span`,{className:`model-action-desc`,children:[(0,K.jsx)(`strong`,{children:ie}),` is required for GAIA Chat (~25 GB).`]})]}),(0,K.jsx)(`button`,{className:`btn-model-action btn-model-action--download`,onClick:()=>oe(!1),disabled:F,children:F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Downloading…`]}):`Download`})]}),xe&&(0,K.jsxs)(`div`,{className:`model-action-row model-action-row--load`,children:[(0,K.jsxs)(`div`,{className:`model-action-info`,children:[(0,K.jsx)(`span`,{className:`model-action-label`,children:ve?`Wrong model loaded.`:`Context window too small.`}),(0,K.jsxs)(`span`,{className:`model-action-desc`,children:[`Load `,(0,K.jsx)(`strong`,{children:ie}),` with `,32 .toFixed(0),`K token context.`]})]}),(0,K.jsx)(`button`,{className:`btn-model-action btn-model-action--load`,onClick:()=>I(),disabled:ae,children:ae?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Loading…`]}):`Load Model`})]}),i.lemonade_running&&(0,K.jsxs)(`div`,{className:`force-redownload-row`,children:[(0,K.jsx)(`span`,{className:`force-redownload-label`,children:`If the model file is corrupted:`}),(0,K.jsx)(`button`,{className:`btn-force-redownload`,onClick:()=>oe(!0),disabled:F,children:F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:12,className:`btn-spinner`}),` Downloading…`]}):`Force Re-download`})]})]}):(0,K.jsxs)(`div`,{className:`status-error`,children:[(0,K.jsx)(`p`,{children:`Could not connect to server`}),(0,K.jsx)(`code`,{children:`gaia chat --ui`})]})]}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Active Model`}),(0,K.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.`}),(0,K.jsxs)(`div`,{className:`model-input-row`,children:[(0,K.jsx)(`input`,{type:`text`,className:`model-input${h?` has-override`:``}`,placeholder:`Use agent default`,value:p,onChange:e=>{m(e.target.value),S(null),T(!1)},onKeyDown:e=>{e.key===`Enter`&&!y&&P&&_&&(e.preventDefault(),M())},disabled:!_||y,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-label":`Custom model override`}),(0,K.jsx)(`div`,{className:`model-btn-group`,children:(0,K.jsx)(`button`,{className:`btn-model-save${C?` saved`:``}`,onClick:()=>{M()},disabled:!_||y||!P&&!C,"aria-label":`Save custom model`,children:y?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Saving…`]}):C?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(z,{size:13}),` Saved`]}):`Save`})})]}),(0,K.jsxs)(`p`,{className:`model-status-hint`,children:[`Accepts a Lemonade model ID (e.g. `,(0,K.jsx)(`code`,{children:`Qwen3-4B-Instruct-2507-GGUF`}),`)`,` `,`or a HuggingFace ID (e.g. `,(0,K.jsx)(`code`,{children:`unsloth/Qwen3-4B-GGUF`}),`).`]}),x&&(0,K.jsxs)(`div`,{className:`model-warning`,role:`alert`,children:[(0,K.jsx)(L,{size:14}),(0,K.jsxs)(`div`,{className:`model-warning-content`,children:[(0,K.jsx)(`strong`,{children:`Could not save`}),(0,K.jsx)(`p`,{children:x})]})]})]}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Context Size`}),(0,K.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.`}),(0,K.jsx)(`div`,{className:`ctx-preset-row`,children:se.map(e=>{let t=ue===e.value;return(0,K.jsx)(`button`,{className:`btn-ctx-preset${t?` active`:``}`,onClick:()=>le(String(e.value)),disabled:ae,type:`button`,children:e.label},e.value)})}),(0,K.jsxs)(`div`,{className:`model-input-row`,children:[(0,K.jsx)(`input`,{type:`number`,className:`model-input`,placeholder:ce==null?`4096`:String(ce),value:R,min:512,step:1024,onChange:e=>le(e.target.value),disabled:ae,"aria-label":`Context size in tokens`}),(0,K.jsx)(`div`,{className:`model-btn-group`,children:(0,K.jsx)(`button`,{className:`btn-model-save`,onClick:()=>{pe()},disabled:ae||!de||!i?.lemonade_running,"aria-label":`Reload model with new context size`,children:ae?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`btn-spinner`}),` Reloading…`]}):`Apply`})})]}),(0,K.jsxs)(`p`,{className:`model-status-hint`,children:[`Current: `,(0,K.jsx)(`code`,{children:ce==null?`unknown`:`${ce.toLocaleString()} tokens`}),i?.model_loaded&&(0,K.jsxs)(K.Fragment,{children:[` on `,(0,K.jsx)(`code`,{children:i.model_loaded})]}),`.`]})]}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsxs)(`h4`,{children:[`Dynamic Tools `,(0,K.jsx)(`span`,{className:`beta-badge`,children:`BETA`})]}),(0,K.jsx)(`p`,{className:`model-override-desc`,children:`Trim each turn’s tool list to a semantically-matched subset to speed up the first response. Currently affects the Doc Agent only.`}),(0,K.jsxs)(`label`,{className:`setting-row`,children:[(0,K.jsx)(`span`,{children:`Enable dynamic tool loading`}),(0,K.jsxs)(`span`,{className:`toggle-switch`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:D,onChange:()=>void N(),disabled:!_||A||k,"aria-label":D?`Disable dynamic tools`:`Enable dynamic tools`}),(0,K.jsx)(`span`,{className:`toggle-track`})]})]}),k&&(0,K.jsxs)(`p`,{className:`model-status-hint`,children:[`Controlled by `,(0,K.jsx)(`code`,{children:`GAIA_DYNAMIC_TOOLS`}),` — unset that environment variable to change this here.`]}),ne&&(0,K.jsxs)(`div`,{className:`model-warning`,role:`alert`,children:[(0,K.jsx)(L,{size:14}),(0,K.jsxs)(`div`,{className:`model-warning-content`,children:[(0,K.jsx)(`strong`,{children:`Could not save`}),(0,K.jsx)(`p`,{children:ne})]})]})]}),i&&i.memory_available_gb!=null&&(()=>{let e=i.memory_available_gb,t=r.filter(t=>t.min_memory_gb!=null&&t.min_memory_gb>e);return t.length===0?null:(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Memory Warnings`}),(0,K.jsx)(`div`,{className:`status-grid`,children:t.map(e=>(0,K.jsxs)(`div`,{className:`status-row status-row--has-hint`,children:[(0,K.jsx)(`span`,{className:`status-label`,children:e.name}),(0,K.jsxs)(`div`,{className:`status-value-wrap`,children:[(0,K.jsxs)(`span`,{className:`status-value warn memory-warning-value`,children:[(0,K.jsx)(L,{size:12}),`Needs ~`,e.min_memory_gb,` GB free`]}),(0,K.jsxs)(`span`,{className:`status-hint`,children:[`Only `,i.memory_available_gb,` GB available — model load may fail or swap heavily.`]})]})]},e.id))})]})})(),c.length>0&&(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`MCP Servers`}),(0,K.jsx)(`div`,{className:`status-grid`,children:c.map(e=>(0,K.jsxs)(`div`,{className:`status-row`,children:[(0,K.jsx)(`span`,{className:`status-label`,children:e.name}),(0,K.jsx)(`div`,{className:`status-value-wrap`,children:e.connected?(0,K.jsxs)(`span`,{className:`status-value ok mcp-status-connected`,children:[(0,K.jsx)(z,{size:12}),e.tool_count,` tool`,e.tool_count===1?``:`s`]}):(0,K.jsxs)(`span`,{className:`status-value warn mcp-status-failed`,title:e.error??void 0,children:[(0,K.jsx)(L,{size:12}),`Failed`]})})]},e.name))})]}),(0,K.jsx)(j_,{}),(0,K.jsx)(V_,{}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`About`}),(0,K.jsxs)(`div`,{className:`about-info`,children:[(0,K.jsxs)(`p`,{children:[`GAIA v`,`0.24.1`,` `,(0,K.jsx)(`span`,{className:`beta-badge`,children:`BETA`})]}),(0,K.jsx)(`p`,{className:`about-sub`,children:`Privacy-first AI chat for AMD Ryzen AI PCs.`}),f.pinnedVersion&&(0,K.jsxs)(`p`,{className:`about-pinned-notice`,children:[`Auto-update paused (pinned to `,f.pinnedVersion,`).`,` `,(0,K.jsx)(`button`,{type:`button`,className:`about-resume-btn`,onClick:()=>{window.gaiaUpdater?.resumeUpdates().catch(e=>{U.system.error(`Resume updates failed`,e)})},children:`Resume updates`})]})]}),(0,K.jsx)(`div`,{className:`setting-actions`,children:(0,K.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>d(!0),children:`Roll back to a previous version`})})]}),u&&(0,K.jsx)(Q_,{onClose:()=>d(!1)}),(0,K.jsxs)(`section`,{className:`settings-section`,children:[(0,K.jsx)(`h4`,{children:`Privacy & Data`}),(0,K.jsxs)(`div`,{className:`setting-row`,children:[(0,K.jsx)(`span`,{children:`Data location`}),(0,K.jsx)(`code`,{className:`setting-path`,children:`~/.gaia/chat/`})]}),(0,K.jsx)(`div`,{className:`danger-divider`}),(0,K.jsxs)(`div`,{className:`setting-actions`,children:[(0,K.jsx)(`p`,{className:`danger-warning`,children:`This will permanently delete all sessions, messages, and documents.`}),(0,K.jsx)(`button`,{className:`btn-danger`,onClick:_e,children:me?`Click again to confirm`:`Clear All Data`})]})]})]})]})}function ev({label:e,value:t,ok:n,hint:r}){return(0,K.jsxs)(`div`,{className:`status-row${r?` status-row--has-hint`:``}`,children:[(0,K.jsx)(`span`,{className:`status-label`,children:e}),(0,K.jsxs)(`div`,{className:`status-value-wrap`,children:[(0,K.jsx)(`span`,{className:`status-value ${n?`ok`:`warn`}`,children:t}),r&&(0,K.jsx)(`span`,{className:`status-hint`,children:(0,K.jsx)(`code`,{children:r})})]})]})}var tv=`modulepreload`,nv=function(e,t){return new URL(e,t).href},rv={},iv=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=nv(t,n),t=s(t),t in rv)return;rv[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:tv,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},av=null;function ov({isOpen:e,onClose:t,onStop:n,error:r}){let[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),c=(0,w.useRef)(null),u=(0,w.useCallback)(async()=>{try{let e=await pr();return a(e),e}catch(e){return U.system.error(`Failed to fetch tunnel status`,e),null}},[]);(0,w.useEffect)(()=>{if(!e||r)return;u();let t=setInterval(async()=>{let e=await u();e?.active&&e?.url&&clearInterval(t)},2e3);return()=>clearInterval(t)},[e,r,u]),(0,w.useEffect)(()=>{if(!i?.active||!i.url||!i.token||!c.current)return;let e=`${i.url}/?token=${i.token}`;U.system.info(`Generating QR code for: ${e}`),(async()=>{if(!av)try{let e=await iv(()=>import(`./browser-BKCjVmVD.js`).then(e=>l(e.default,1)),[],import.meta.url);av=e.default||e}catch{U.system.error(`QR code library not available - install with: npm install qrcode`);return}let t=document.documentElement.getAttribute(`data-theme`)===`dark`;try{await av.toCanvas(c.current,e,{width:200,margin:2,color:{dark:t?`#e6edf3`:`#111827`,light:t?`#0d0d0d`:`#ffffff`}})}catch(e){U.system.error(`QR code generation failed`,e)}})()},[i?.active,i?.url,i?.token]);let d=(0,w.useRef)(null),f=(0,w.useCallback)(()=>{if(!i?.url||!i?.token)return;let e=`${i.url}/?token=${i.token}`;navigator.clipboard.writeText(e).then(()=>{s(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>s(!1),2e3)})},[i]);if((0,w.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]),!e)return null;let p=i?.active&&i?.url&&i?.token?`${i.url}/?token=${i.token}`:``;return(0,K.jsx)(`div`,{className:`modal-overlay`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Mobile Access`,children:(0,K.jsxs)(`div`,{className:`modal-panel mobile-modal`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`modal-header`,children:[(0,K.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,K.jsx)(yt,{size:18}),`Mobile Access`]}),(0,K.jsx)(`button`,{className:`btn-icon`,onClick:t,"aria-label":`Close`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsxs)(`div`,{className:`modal-body mobile-modal-body`,children:[(0,K.jsxs)(`div`,{className:`tunnel-status`,children:[(0,K.jsx)(`span`,{className:`status-dot ${i?.active?`active`:r?`error`:`starting`}`}),(0,K.jsx)(`span`,{children:i?.active?`Tunnel active`:r?`Connection failed`:`Starting tunnel...`}),!i?.active&&!r&&(0,K.jsx)(`span`,{className:`tunnel-spinner`})]}),r&&(0,K.jsx)(`div`,{className:`tunnel-error`,children:r}),(0,K.jsx)(`div`,{className:`qr-code-area`,children:i?.active?(0,K.jsx)(`canvas`,{ref:c}):r?(0,K.jsx)(`div`,{className:`qr-placeholder error`,children:`Failed to connect`}):(0,K.jsxs)(`div`,{className:`qr-placeholder`,children:[(0,K.jsx)(`div`,{className:`placeholder-spinner`}),(0,K.jsx)(`span`,{children:`Connecting...`})]})}),i?.active&&p&&(0,K.jsxs)(`div`,{className:`tunnel-url-area`,children:[(0,K.jsx)(`label`,{children:`Mobile URL`}),(0,K.jsxs)(`div`,{className:`tunnel-url-row`,children:[(0,K.jsx)(`input`,{type:`text`,readOnly:!0,value:p}),(0,K.jsxs)(`button`,{className:`copy-url-btn ${o?`copied`:``}`,onClick:f,title:`Copy URL`,children:[o?(0,K.jsx)(F,{size:13}):(0,K.jsx)(ge,{size:13}),o?`Copied`:`Copy`]})]})]}),i?.active&&i?.publicIp&&i?.url&&!i.url.includes(`ngrok-free.app`)&&(0,K.jsxs)(`div`,{className:`tunnel-password-hint`,children:[(0,K.jsx)(`label`,{children:`Tunnel Password`}),(0,K.jsx)(`div`,{className:`tunnel-password-value`,children:i.publicIp}),(0,K.jsx)(`span`,{className:`tunnel-password-note`,children:`Enter this when the tunnel page asks for a password`})]}),(0,K.jsx)(`div`,{className:`mobile-instructions`,children:(0,K.jsxs)(`ol`,{children:[(0,K.jsx)(`li`,{children:`Scan the QR code with your phone's camera`}),i?.url&&!i.url.includes(`ngrok-free.app`)&&(0,K.jsx)(`li`,{children:`Enter the tunnel password shown above when prompted`}),(0,K.jsx)(`li`,{children:`Chat with GAIA from your mobile device`}),(0,K.jsx)(`li`,{children:`Your data stays secure via encrypted tunnel`})]})}),(0,K.jsxs)(`div`,{className:`mobile-access-actions`,children:[i?.active&&n&&(0,K.jsx)(`button`,{className:`btn-danger`,onClick:n,title:`Close the tunnel and revoke the mobile URL`,children:`Stop Tunnel`}),(0,K.jsx)(`button`,{className:`btn-secondary`,onClick:t,children:`Close`})]})]})]})})}function sv({onRetry:e}){let{backendConnected:t,systemStatus:n,currentSessionId:r,messages:i}=H(),[a,o]=(0,w.useState)(!1),s=!!r&&i.length>0,c=n?.default_model_name??`Gemma-4-E4B-it-GGUF`,{isLoadingModel:l,isDownloadingModel:u,loadModel:d,downloadModel:f}=D_(c),p=(0,w.useRef)(n?.lemonade_running),m=(0,w.useRef)(n?.model_downloaded),h=(0,w.useRef)(n?.context_size_sufficient),g=(0,w.useRef)(n?.expected_model_loaded);(0,w.useEffect)(()=>{if(s)return;let e=n?.lemonade_running,t=n?.model_downloaded,r=n?.context_size_sufficient,i=n?.expected_model_loaded,a=!1;p.current!==e&&(p.current=e,e===!1&&(a=!0)),m.current!==t&&(m.current=t,t===!1&&(a=!0)),h.current!==r&&(h.current=r,r===!1&&(a=!0)),g.current!==i&&(g.current=i,i===!1&&(a=!0)),a&&o(!1)},[n,s]);let _=n?.download_progress??null;if(u||_?.state===`downloading`||_?.state===`starting`||_?.state===`error`){let e=n?.default_model_size_gb?`~${n.default_model_size_gb.toFixed(1)} GB`:`large download`,t=_?.state===`error`;return(0,K.jsxs)(`div`,{className:`connection-banner ${t?`connection-banner--error`:`connection-banner--warning`}`,role:t?`alert`:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:t?(0,K.jsx)(At,{size:16}):(0,K.jsx)(be,{size:16})}),(0,K.jsx)(`div`,{className:`connection-banner__text`,children:t?(0,K.jsxs)(K.Fragment,{children:[`Download of `,(0,K.jsx)(`strong`,{children:c}),` failed.`,` `,_?.message&&(0,K.jsx)(`span`,{className:`connection-banner__hint`,children:_.message})]}):(0,K.jsxs)(K.Fragment,{children:[`Downloading `,(0,K.jsx)(`strong`,{children:c}),` (`,e,`).`,_?.state===`downloading`&&_.file&&(0,K.jsxs)(K.Fragment,{children:[` `,(0,K.jsxs)(`span`,{className:`connection-banner__hint`,children:[`File `,_.file_index,` / `,_.total_files,`: `,(0,K.jsx)(`code`,{children:_.file})]})]})]})}),t?(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:()=>f(!1),children:`Retry`}):(0,K.jsx)(`span`,{className:`connection-banner__loading connection-banner__progress`,children:_&&_.state===`downloading`&&_.total_bytes>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`connection-banner__progress-bar`,role:`progressbar`,"aria-valuenow":_.percent,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Download progress`,children:(0,K.jsx)(`span`,{className:`connection-banner__progress-fill`,style:{width:`${_.percent}%`}})}),(0,K.jsxs)(`span`,{className:`connection-banner__progress-label`,children:[_.percent,`% ·`,` `,(_.downloaded_bytes/1e9).toFixed(2),` /`,` `,(_.total_bytes/1e9).toFixed(2),` GB`]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{size:13,className:`connection-banner__spinner`}),_?.state===`starting`?`Starting download…`:`Downloading…`]})}),t&&(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}if(n?.init_state===`initializing`){let e=n.init_tasks?.find(e=>e.status===`running`)?.name||`Preparing AI system`;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--init`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(B,{size:16,className:`connection-banner__spinner`})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[e,(0,K.jsxs)(`span`,{className:`thinking-dots`,children:[(0,K.jsx)(`span`,{children:`.`}),(0,K.jsx)(`span`,{children:`.`}),(0,K.jsx)(`span`,{children:`.`})]})]})]})}if(a||s)return null;if(!t)return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(Nt,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[`Cannot connect to GAIA server.`,` `,(0,K.jsxs)(`span`,{className:`connection-banner__hint`,children:[`Start it with: `,(0,K.jsx)(`code`,{children:`gaia chat --ui`})]})]}),e&&(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:e,children:`Retry`})]});if(n&&!n.lemonade_running){let t=!!n.lemonade_error;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(At,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[t?`Could not query the LLM server status.`:`LLM server is not responding — it may be busy or not running.`,` `,(0,K.jsx)(`span`,{className:`connection-banner__hint`,children:n.start_command?(0,K.jsxs)(K.Fragment,{children:[`If not started, run: `,(0,K.jsx)(`code`,{children:n.start_command})]}):n.start_instruction??`Start Lemonade Server, then retry.`})]}),e&&(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:e,children:`Check again`}),(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}if(n&&n.lemonade_running&&!n.model_loaded&&n.model_downloaded===!1){let t=n.default_model_size_gb?`~${n.default_model_size_gb.toFixed(1)} GB`:`large download`;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(be,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[`Required model `,(0,K.jsx)(`strong`,{children:c}),` is not downloaded (`,t,`).`]}),(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:()=>f(!1),children:`Download`}),e&&(0,K.jsx)(`button`,{className:`connection-banner__retry connection-banner__retry--secondary`,onClick:e,children:`Recheck`}),(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}if(n&&n.lemonade_running&&n.model_loaded&&n.expected_model_loaded===!1&&!n.embedding_model_loaded){let t=n.model_loaded,r=n.context_size_sufficient===!1;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(_e,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[`Wrong model loaded: `,(0,K.jsx)(`strong`,{children:t}),`.`,` `,`GAIA Chat requires `,(0,K.jsx)(`strong`,{children:c}),`.`,r&&(0,K.jsxs)(K.Fragment,{children:[` `,`Context window is also too small.`]})]}),l?(0,K.jsxs)(`span`,{className:`connection-banner__loading`,children:[(0,K.jsx)(B,{size:13,className:`connection-banner__spinner`}),`Loading…`]}):(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:()=>d(),children:`Load Now`}),e&&!l&&(0,K.jsx)(`button`,{className:`connection-banner__retry connection-banner__retry--secondary`,onClick:e,children:`Recheck`}),(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}if(n&&n.lemonade_running&&n.model_loaded&&n.context_size_sufficient===!1){let t=n.model_context_size??0,r=n.lemonade_url??`http://localhost:13305`;return(0,K.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,K.jsx)(`div`,{className:`connection-banner__icon`,children:(0,K.jsx)(Be,{size:16})}),(0,K.jsxs)(`div`,{className:`connection-banner__text`,children:[`LLM context window is too small (`,t.toLocaleString(),` tokens;`,` `,C_.toLocaleString(),` required).`,` `,(0,K.jsxs)(`span`,{className:`connection-banner__hint`,children:[`In`,` `,(0,K.jsx)(`a`,{className:`connection-banner__link`,href:r,target:`_blank`,rel:`noreferrer`,children:`Lemonade`}),`, set ctx‑size to `,C_.toLocaleString(),`, or restart with:`,` `,(0,K.jsx)(`code`,{children:n?.start_command?n.start_command:`LEMONADE_CTX_SIZE=${C_} (see Settings)`})]})]}),e&&(0,K.jsx)(`button`,{className:`connection-banner__retry`,onClick:e,children:`Check again`}),(0,K.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>o(!0),"aria-label":`Dismiss`,children:(0,K.jsx)(Ft,{size:14})})]})}return null}function cv(){let e=k_(),[t,n]=(0,w.useState)(!1),r=(0,w.useCallback)(()=>{window.gaiaUpdater?.check().catch(()=>{})},[]);if(t||e.status===`idle`||e.status===`checking`||e.status===`disabled`)return null;if(e.status===`downloading`){let t=Math.max(0,Math.min(100,e.progress));return(0,K.jsxs)(`div`,{className:`update-chip update-chip--downloading`,role:`status`,"aria-live":`polite`,title:`Downloading update${e.version?` ${e.version}`:``}…`,children:[(0,K.jsx)(be,{size:13,className:`update-chip__icon`}),(0,K.jsxs)(`span`,{className:`update-chip__label`,children:[`Downloading update… `,t,`%`]})]})}return e.status===`available`?(0,K.jsxs)(`div`,{className:`update-chip update-chip--available`,role:`status`,title:e.releaseNotes||`A new version is available.`,children:[(0,K.jsx)(be,{size:13,className:`update-chip__icon`}),(0,K.jsxs)(`span`,{className:`update-chip__label`,children:[`Update available`,e.version?`: ${e.version}`:``]}),(0,K.jsx)(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>n(!0),"aria-label":`Dismiss update notification`,children:(0,K.jsx)(Ft,{size:11})})]}):e.status===`downloaded`?(0,K.jsxs)(`div`,{className:`update-chip update-chip--ready`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(ut,{size:13,className:`update-chip__icon`}),(0,K.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`?(0,K.jsxs)(`div`,{className:`update-chip update-chip--error`,role:`status`,title:e.error||`Update check failed.`,children:[(0,K.jsx)(At,{size:13,className:`update-chip__icon`}),(0,K.jsx)(`span`,{className:`update-chip__label`,children:`Update check failed`}),(0,K.jsx)(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>n(!0),"aria-label":`Dismiss update error`,children:(0,K.jsx)(Ft,{size:11})})]}):null}function lv(){let e=Zm(eh),t=Zm(e=>e.respondToPermission);return e?(0,K.jsx)(`div`,{className:`permission-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`Permission Request`,children:(0,K.jsx)(uv,{notification:e,onRespond:t},e.id)}):null}function uv({notification:e,onRespond:t}){let n=e.timeoutSeconds!=null&&e.timeoutSeconds>0,[r,i]=(0,w.useState)(n?e.timeoutSeconds:null),a=(0,w.useRef)(null),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(!1),u=(0,w.useRef)(!1),d=(0,w.useRef)(t);d.current=t,(0,w.useEffect)(()=>{if(n)return a.current=setInterval(()=>{i(e=>e===null||e<=1?(a.current&&clearInterval(a.current),0):e-1)},1e3),()=>{a.current&&clearInterval(a.current)}},[n]),(0,w.useEffect)(()=>{if(r===0){if(u.current)return;u.current=!0,s(!0),d.current(e.id,`deny`,!1)}},[r,e.id]);let f=(0,w.useCallback)(async()=>{if(!u.current){u.current=!0,s(!0),a.current&&clearInterval(a.current);try{await t(e.id,`allow`,c)}finally{u.current=!1,s(!1)}}},[e.id,t,c]),p=(0,w.useCallback)(async()=>{if(!u.current){u.current=!0,s(!0),a.current&&clearInterval(a.current);try{await t(e.id,`deny`,!1)}finally{u.current=!1,s(!1)}}},[e.id,t]);(0,w.useEffect)(()=>{let e=e=>{e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),p())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,p]);let m=e.toolArgs,h=m&&Object.keys(m).length>0;return(0,K.jsxs)(`div`,{className:`permission-prompt`,children:[(0,K.jsxs)(`div`,{className:`permission-header`,children:[(0,K.jsx)(`div`,{className:`permission-header-icon`,children:(0,K.jsx)(gt,{size:24})}),(0,K.jsxs)(`div`,{className:`permission-header-text`,children:[(0,K.jsx)(`h2`,{className:`permission-title`,children:`Permission Request`}),(0,K.jsx)(`span`,{className:`permission-agent`,children:e.agentName})]}),r!==null&&r>0&&(0,K.jsxs)(`div`,{className:`permission-countdown`,title:`Auto-deny on timeout`,children:[(0,K.jsx)(pe,{size:14}),(0,K.jsxs)(`span`,{children:[r,`s`]})]})]}),(0,K.jsxs)(`div`,{className:`permission-body`,children:[(0,K.jsx)(`p`,{className:`permission-message`,children:e.message}),e.tool&&(0,K.jsxs)(`div`,{className:`permission-tool-info`,children:[(0,K.jsxs)(`div`,{className:`permission-tool-header`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsx)(`span`,{children:`Tool Invocation`})]}),(0,K.jsx)(`div`,{className:`permission-tool-name`,children:(0,K.jsx)(`code`,{children:e.tool})}),h&&(0,K.jsx)(`div`,{className:`permission-tool-args`,children:(0,K.jsx)(`pre`,{children:JSON.stringify(m,null,2)})})]}),e.priority===`critical`&&(0,K.jsxs)(`div`,{className:`permission-critical-banner`,children:[(0,K.jsx)(At,{size:14}),(0,K.jsx)(`span`,{children:`This is a critical-tier operation`})]}),(0,K.jsxs)(`label`,{className:`permission-remember`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),disabled:o}),(0,K.jsx)(`span`,{children:`Always allow this tool`})]})]}),(0,K.jsxs)(`div`,{className:`permission-actions`,children:[(0,K.jsxs)(`button`,{className:`permission-btn permission-btn-deny`,onClick:p,disabled:o,title:`Deny (Esc)`,children:[(0,K.jsx)(Ft,{size:16}),`Deny`]}),(0,K.jsxs)(`button`,{className:`permission-btn permission-btn-allow`,onClick:f,disabled:o,title:`Allow (Enter)`,children:[(0,K.jsx)(F,{size:16}),`Allow`]})]}),(0,K.jsxs)(`div`,{className:`permission-hints`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{children:`Enter`}),` Allow`]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{children:`Esc`}),` Deny`]})]})]})}var dv={permission_request:{icon:(0,K.jsx)(gt,{size:16}),colorClass:`notif-type-permission`,label:`Permission`},policy_alert:{icon:(0,K.jsx)(gt,{size:16}),colorClass:`notif-type-policy`,label:`Policy`},security_alert:{icon:(0,K.jsx)(At,{size:16}),colorClass:`notif-type-security`,label:`Security`},status_change:{icon:(0,K.jsx)(le,{size:16}),colorClass:`notif-type-status`,label:`Status`},info:{icon:(0,K.jsx)(Re,{size:16}),colorClass:`notif-type-info`,label:`Info`},error:{icon:(0,K.jsx)(L,{size:16}),colorClass:`notif-type-error`,label:`Error`}};function fv(e){let t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<7?`${a}d ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function pv({onClose:e}){let t=Zm($m),n=Zm(Qm),r=Zm(e=>e.markRead),i=Zm(e=>e.markAllRead),a=Zm(e=>e.clearAll),o=Zm(e=>e.dismiss),s=Zm(e=>e.addNotification),c=Zm(e=>e.respondToPermission),l=Zm(e=>e.typeFilter),u=Zm(e=>e.setTypeFilter),d=(0,w.useRef)(!1);(0,w.useEffect)(()=>{let e=window.gaiaAPI;!e?.notification?.onNotification||d.current||(d.current=!0,e.notification.onNotification(e=>{s(e)}))},[s]);let f=(0,w.useCallback)(e=>{r(e)},[r]),p=(0,w.useCallback)(e=>{c(e.id,`allow`,!1)},[c]),m=(0,w.useCallback)(e=>{c(e.id,`deny`,!1)},[c]);return(0,w.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!t.defaultPrevented&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,K.jsxs)(`div`,{className:`notification-center`,role:`dialog`,"aria-label":`Notification Center`,children:[(0,K.jsxs)(`div`,{className:`notification-center-header`,children:[(0,K.jsxs)(`div`,{className:`notification-center-title-row`,children:[(0,K.jsx)(`h2`,{className:`notification-center-title`,children:`Notifications`}),n>0&&(0,K.jsx)(`span`,{className:`notification-center-badge`,children:n})]}),(0,K.jsx)(`button`,{className:`btn-icon notification-center-close`,onClick:e,"aria-label":`Close notification center`,children:(0,K.jsx)(Ft,{size:18})})]}),(0,K.jsx)(`div`,{className:`notification-filter-bar`,role:`tablist`,"aria-label":`Filter notifications`,children:[{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`}].map(e=>(0,K.jsx)(`button`,{role:`tab`,"aria-selected":l===e.key,className:`notification-filter-tab ${l===e.key?`active`:``}`,onClick:()=>u(e.key),children:e.label},e.key??`all`))}),(0,K.jsx)(`div`,{className:`notification-list`,children:t.length===0?(0,K.jsxs)(`div`,{className:`notification-empty`,children:[(0,K.jsx)(ne,{size:40,strokeWidth:1.2}),(0,K.jsx)(`span`,{children:`No notifications`})]}):t.map(e=>{let t=dv[e.type];return(0,K.jsxs)(`div`,{className:`notification-item ${e.read?``:`unread`} ${t.colorClass}`,id:e.type===`policy_alert`&&e.receiptId?`policy-receipt-${encodeURIComponent(e.receiptId)}`:void 0,onClick:()=>f(e.id),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&f(e.id)},children:[!e.read&&(0,K.jsx)(`span`,{className:`notification-unread-dot`}),(0,K.jsx)(`span`,{className:`notification-icon`,children:t.icon}),(0,K.jsxs)(`div`,{className:`notification-content`,children:[(0,K.jsxs)(`div`,{className:`notification-content-header`,children:[(0,K.jsx)(`span`,{className:`notification-agent`,children:e.agentName}),(0,K.jsx)(`span`,{className:`notification-time`,children:fv(e.timestamp)})]}),e.title&&(0,K.jsx)(`span`,{className:`notification-title`,children:e.title}),(0,K.jsx)(`span`,{className:`notification-message`,children:e.message}),e.type===`permission_request`&&e.tool&&(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Tool: `,(0,K.jsx)(`code`,{children:e.tool})]}),e.type===`policy_alert`&&(0,K.jsxs)(`div`,{className:`notification-policy-details`,children:[e.tool&&(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Tool: `,(0,K.jsx)(`code`,{children:e.tool})]}),e.reason&&(0,K.jsxs)(`span`,{className:`notification-policy-reason`,children:[`Reason: `,e.reason]}),e.ruleIds&&e.ruleIds.length>0&&(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Rules: `,(0,K.jsx)(`code`,{children:e.ruleIds.join(`, `)})]}),e.policyVersion&&(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Policy: `,(0,K.jsx)(`code`,{children:e.policyVersion})]}),(0,K.jsxs)(`span`,{className:`notification-tool`,children:[`Receipt:`,` `,e.receiptId?(0,K.jsx)(`code`,{children:e.receiptId}):(0,K.jsx)(`em`,{children:`Receipt unavailable`})]})]}),e.type===`permission_request`&&!e.response&&(0,K.jsxs)(`div`,{className:`notification-actions`,children:[(0,K.jsxs)(`button`,{className:`notification-action-btn notification-action-allow`,onClick:t=>{t.stopPropagation(),p(e)},children:[(0,K.jsx)(F,{size:14}),`Approve`]}),(0,K.jsxs)(`button`,{className:`notification-action-btn notification-action-deny`,onClick:t=>{t.stopPropagation(),m(e)},children:[(0,K.jsx)(Ft,{size:14}),`Deny`]})]}),e.type===`permission_request`&&e.response&&(0,K.jsx)(`span`,{className:`notification-response-badge ${e.response===`allow`?`response-allow`:`response-deny`}`,children:e.response===`allow`?`Approved`:`Denied`})]}),(0,K.jsx)(`button`,{className:`notification-dismiss`,onClick:t=>{t.stopPropagation(),o(e.id)},"aria-label":`Dismiss notification`,children:(0,K.jsx)(Ft,{size:14})})]},e.id)})}),t.length>0&&(0,K.jsxs)(`div`,{className:`notification-center-footer`,children:[(0,K.jsxs)(`button`,{className:`notification-footer-btn`,onClick:i,disabled:n===0,children:[(0,K.jsx)(F,{size:14}),`Mark All Read`]}),(0,K.jsxs)(`button`,{className:`notification-footer-btn notification-footer-clear`,onClick:a,children:[(0,K.jsx)(Ot,{size:14}),`Clear`]})]})]})}var mv=[`welcome`,`preflight`,`download`,`connector`,`done`];function hv(e=`welcome`){let[t,n]=(0,w.useState)(()=>Math.max(0,mv.indexOf(e))),[r,i]=(0,w.useState)({}),a=mv[t],o=!!r[a],s=(0,w.useCallback)(e=>{i(t=>t[a]===e?t:{...t,[a]:e})},[a]),c=(0,w.useCallback)(()=>{if(r[a])return!1;let e=!1;return n(t=>t<mv.length-1?(e=!0,t+1):t),e},[r,a]),l=(0,w.useCallback)(()=>{n(e=>Math.min(e+1,mv.length-1))},[]),u=(0,w.useCallback)(()=>{let e=!1;return n(t=>t>0?(e=!0,t-1):t),e},[]),d=(0,w.useCallback)(e=>{let t=mv.indexOf(e);t>=0&&n(t)},[]);return(0,w.useMemo)(()=>({step:a,index:t,total:mv.length,isFirst:t===0,isLast:t===mv.length-1,guarded:o,setGuard:s,next:c,back:u,goTo:d,skip:l}),[a,t,o,s,c,u,d,l])}function gv(){return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-welcome`,children:[(0,K.jsx)(`h1`,{children:`Welcome to GAIA`}),(0,K.jsx)(`p`,{className:`lede`,children:`Your private AI assistant that runs 100% locally on AMD hardware — no data ever leaves your device. Let's get you set up.`}),(0,K.jsxs)(`ul`,{className:`onboarding-steps-list`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`num`,children:(0,K.jsx)(_e,{size:15})}),`Check your hardware`]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`num`,children:(0,K.jsx)(be,{size:15})}),`Download an AI model`]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`num`,children:(0,K.jsx)(Ye,{size:15})}),`Connect an app (optional) and start chatting`]})]}),(0,K.jsxs)(`p`,{className:`lede`,style:{marginTop:16,display:`flex`,alignItems:`center`,gap:8},children:[(0,K.jsx)(V,{size:16}),` Everything stays on this machine.`]})]})}function _v(e){return e===null?`—`:`${e} GB`}function vv({onGuardChange:e,onReport:t}){let[n,r]=(0,w.useState)({kind:`loading`}),i=(0,w.useCallback)(async()=>{r({kind:`loading`}),e(!0);try{let n=await sn();r({kind:`ready`,report:n}),t?.(n),e(!n.compatible)}catch(t){let n=t instanceof Error?t.message:`Hardware scan failed.`;U.system.error(`Preflight scan failed`,t),r({kind:`error`,message:n}),e(!0)}},[e,t]);if((0,w.useEffect)(()=>{i()},[i]),n.kind===`loading`)return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-preflight-loading`,children:[(0,K.jsx)(`h2`,{children:`Checking your hardware…`}),(0,K.jsxs)(`p`,{className:`lede`,style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,K.jsx)(B,{size:16,className:`onboarding-spin`}),` Scanning RAM, disk, and accelerators.`]})]});if(n.kind===`error`)return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-preflight-error`,children:[(0,K.jsx)(`h2`,{children:`Couldn't scan your hardware`}),(0,K.jsxs)(`div`,{className:`onboarding-banner error`,role:`alert`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsxs)(`div`,{children:[n.message,(0,K.jsx)(`div`,{style:{marginTop:6},children:`Make sure the GAIA backend is running, then retry.`})]})]}),(0,K.jsxs)(`button`,{className:`onboarding-btn secondary`,onClick:i,children:[(0,K.jsx)(ut,{size:15}),` Retry scan`]})]});let{report:a}=n,o=a.ram_gb===null||a.ram_gb>=a.required_memory_gb,s=a.disk_free_gb===null||a.disk_free_gb>=a.required_disk_gb;return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-preflight`,children:[(0,K.jsx)(`h2`,{children:`Hardware check`}),(0,K.jsxs)(`span`,{className:`onboarding-tier`,children:[`Tier: `,a.tier]}),(0,K.jsxs)(`div`,{className:`preflight-rows`,children:[(0,K.jsx)(yv,{ok:o,label:`Memory (RAM)`,value:_v(a.ram_gb)}),(0,K.jsx)(yv,{ok:s,hardFail:!s,label:`Free disk space`,value:_v(a.disk_free_gb)}),(0,K.jsx)(yv,{ok:a.npu_detected===!0,unknown:a.npu_detected===null,label:`Ryzen AI NPU`,value:a.npu_detected===!0?`Detected`:a.npu_detected===!1?`Not found`:a.lemonade_error?`Unknown (query failed)`:`Unknown`}),a.gpu_name&&(0,K.jsx)(yv,{ok:!0,label:`GPU`,value:a.gpu_name})]}),!a.compatible&&a.blockers.length>0&&(0,K.jsxs)(`div`,{className:`onboarding-banner error`,role:`alert`,"data-testid":`preflight-blockers`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:`This machine can't run the setup yet:`}),(0,K.jsx)(`ul`,{children:a.blockers.map((e,t)=>(0,K.jsx)(`li`,{children:e},t))})]})]}),a.warnings.length>0&&(0,K.jsxs)(`div`,{className:`onboarding-banner warn`,"data-testid":`preflight-warnings`,children:[(0,K.jsx)(At,{size:18}),(0,K.jsx)(`div`,{children:(0,K.jsx)(`ul`,{children:a.warnings.map((e,t)=>(0,K.jsx)(`li`,{children:e},t))})})]}),(0,K.jsxs)(`button`,{className:`onboarding-btn secondary`,onClick:i,children:[(0,K.jsx)(ut,{size:15}),` Re-scan`]})]})}function yv({ok:e,hardFail:t,unknown:n,label:r,value:i}){return(0,K.jsxs)(`div`,{className:`preflight-row`,children:[(0,K.jsx)(`span`,{className:`pf-icon ${n?`warn`:e?`ok`:t?`bad`:`warn`}`,children:n?(0,K.jsx)(At,{size:17}):e?(0,K.jsx)(z,{size:17}):t?(0,K.jsx)(de,{size:17}):(0,K.jsx)(At,{size:17})}),(0,K.jsx)(`span`,{className:`pf-label`,children:r}),(0,K.jsx)(`span`,{className:`pf-value`,children:i})]})}var bv=2e3;function xv(e){return`${(e/1024**3).toFixed(1)} GB`}function Sv({modelName:e,onGuardChange:t}){let[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),u=(0,w.useRef)(null),d=(0,w.useCallback)(()=>{u.current&&=(clearInterval(u.current),null)},[]),f=(0,w.useCallback)(async()=>{try{let n=await nn();if(r(n.download_progress),n.download_progress?.state===`complete`||n.model_downloaded===!0||n.model_loaded&&n.model_loaded.toLowerCase()===e.toLowerCase())return a(!0),t(!1),d(),!1;let i=n.download_progress?.state;return i===`downloading`||i===`starting`}catch(e){return U.system.warn(`Model download poll failed`,e),!1}},[e,t,d]),p=(0,w.useCallback)(()=>{u.current||=setInterval(f,bv)},[f]);(0,w.useEffect)(()=>(t(!0),f().then(e=>{e&&p()}),d),[t,f,p,d]);let m=(0,w.useCallback)(async n=>{s(!0),l(null),t(!0);try{await G(e,n),U.system.info(`Onboarding download started: ${e} (force=${n})`),p()}catch(e){let t=e instanceof Error?e.message:`Failed to start download.`;U.system.error(`Onboarding download failed to start`,e),l(t)}finally{s(!1)}},[e,t,p]);if(i)return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-download-done`,children:[(0,K.jsx)(`h2`,{children:`Model ready`}),(0,K.jsxs)(`div`,{className:`onboarding-banner warn`,style:{background:`transparent`,border:`none`},children:[(0,K.jsx)(z,{size:18,className:`pf-icon ok`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`download-model-name`,children:e}),` is downloaded and ready to use.`]})]})]});let h=n?.state===`error`||!!c,g=c||n?.message||`Download failed.`,_=n?.state===`downloading`||n?.state===`starting`;return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-download`,children:[(0,K.jsx)(`h2`,{children:`Download your AI model`}),(0,K.jsxs)(`p`,{className:`lede`,children:[`GAIA needs a local model to run. This is a one-time download of`,` `,(0,K.jsx)(`span`,{className:`download-model-name`,children:e}),`.`]}),h&&(0,K.jsxs)(`div`,{className:`onboarding-banner error`,role:`alert`,"data-testid":`download-error`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsxs)(`div`,{children:[g,(0,K.jsx)(`div`,{style:{marginTop:6},children:`Check your connection and disk space, then retry.`})]})]}),_&&n&&(0,K.jsxs)(`div`,{"data-testid":`download-progress`,children:[(0,K.jsx)(`div`,{className:`download-model-name`,children:n.file||e}),(0,K.jsx)(`div`,{className:`download-bar`,children:(0,K.jsx)(`div`,{className:`fill`,style:{width:`${n.percent}%`}})}),(0,K.jsxs)(`div`,{className:`download-meta`,children:[(0,K.jsxs)(`span`,{children:[n.percent,`%`]}),(0,K.jsx)(`span`,{children:n.total_bytes>0?`${xv(n.downloaded_bytes)} / ${xv(n.total_bytes)}`:`Starting…`})]})]}),!_&&!h&&(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:()=>m(!1),disabled:o,"data-testid":`download-start`,children:[o?(0,K.jsx)(B,{size:15,className:`onboarding-spin`}):(0,K.jsx)(be,{size:15}),o?`Starting…`:`Download model`]}),h&&(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:()=>m(!0),disabled:o,"data-testid":`download-retry`,children:[(0,K.jsx)(ut,{size:15}),` Retry download`]})]})}var Cv=2e3;function wv({connectorId:e=`google`}){let[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)(!0),[a,o]=(0,w.useState)(!1),[s,c]=(0,w.useState)(null),l=(0,w.useRef)(null),u=(0,w.useCallback)(()=>{l.current&&=(clearInterval(l.current),null)},[]);(0,w.useEffect)(()=>{let t=!1;return gn().then(({connectors:r})=>{t||n(r.find(t=>t.id===e)??null)}).catch(e=>{U.system.warn(`Onboarding: failed to list connectors`,e),t||c(`Could not load connectors.`)}).finally(()=>{t||i(!1)}),()=>{t=!0,u()}},[e,u]);let d=e=>{let t=window;t.gaia?.openExternal?t.gaia.openExternal(e):window.open(e,`_blank`,`noopener`)},f=(0,w.useCallback)(()=>{u(),l.current=setInterval(async()=>{try{let t=await _n(e);n(t),t.configured&&(o(!1),u())}catch(e){U.system.warn(`Onboarding: connector poll failed`,e)}},Cv)},[e,u]),p=(0,w.useCallback)(async()=>{if(t){o(!0),c(null);try{let{authorization_url:n}=await vn(e,(t.default_scopes?.length?t.default_scopes:t.available_scopes)??[]);d(n),f()}catch(e){let t=e instanceof Error?e.message:`Failed to start the connection.`;U.system.error(`Onboarding: connect failed`,e),c(t),o(!1)}}},[t,e,f]);return r?(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-connector-loading`,children:[(0,K.jsx)(`h2`,{children:`Connect an app`}),(0,K.jsxs)(`p`,{className:`lede`,style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,K.jsx)(B,{size:16,className:`onboarding-spin`}),` Loading…`]})]}):t?(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-connector`,children:[(0,K.jsxs)(`h2`,{children:[`Connect an app `,(0,K.jsx)(`span`,{style:{color:`var(--text-muted)`,fontWeight:400,fontSize:`0.9rem`},children:`(optional)`})]}),(0,K.jsx)(`p`,{className:`lede`,children:`Some agents (like Email triage) work with your accounts. Connect now, or skip and do it later from Settings.`}),(0,K.jsxs)(`div`,{className:`connector-choice`,children:[(0,K.jsx)(`span`,{className:`cc-icon`,children:(0,K.jsx)(He,{size:20})}),(0,K.jsxs)(`div`,{className:`cc-body`,children:[(0,K.jsx)(`div`,{className:`cc-title`,children:t.display_name}),(0,K.jsx)(`div`,{className:`cc-desc`,children:t.description})]}),t.configured?(0,K.jsxs)(`span`,{className:`cc-connected`,"data-testid":`connector-connected`,children:[(0,K.jsx)(z,{size:15}),` Connected`]}):(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:p,disabled:a||!t.configurable,"data-testid":`connector-connect`,children:[a?(0,K.jsx)(B,{size:15,className:`onboarding-spin`}):(0,K.jsx)(He,{size:15}),a?`Waiting…`:`Connect`]})]}),!t.configurable&&t.config_error&&(0,K.jsxs)(`div`,{className:`onboarding-banner warn`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsx)(`div`,{children:t.config_error})]}),s&&(0,K.jsxs)(`div`,{className:`onboarding-banner error`,role:`alert`,"data-testid":`connector-error`,children:[(0,K.jsx)(de,{size:18}),(0,K.jsx)(`div`,{children:s})]})]}):(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-connector-none`,children:[(0,K.jsx)(`h2`,{children:`Connect an app`}),(0,K.jsx)(`p`,{className:`lede`,children:`No apps to connect right now. You can add connectors any time from Settings → Connectors.`})]})}function Tv(){return(0,K.jsxs)(`div`,{className:`onboarding-body`,"data-testid":`onboarding-done`,children:[(0,K.jsxs)(`h1`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,K.jsx)(rt,{size:24}),` You're all set`]}),(0,K.jsx)(`p`,{className:`lede`,children:`GAIA is ready. Ask a question, drop in a document, or explore the agents in the sidebar. Everything runs locally on your machine.`})]})}function Ev({onComplete:e}){let t=hv(),[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(null),c=n?.recommended_model||`Gemma-4-E4B-it-GGUF`,l=(0,w.useCallback)(async t=>{a(!0),s(null);try{await ln(t),U.system.info(`Onboarding complete (skipped=${t})`),e()}catch(e){let t=e instanceof Error?e.message:`Failed to finish setup.`;U.system.error(`Onboarding: failed to write completion marker`,e),s(t),a(!1)}},[e]);return(0,K.jsx)(`div`,{className:`onboarding-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`GAIA first-run setup`,children:(0,K.jsxs)(`div`,{className:`onboarding-card`,children:[(0,K.jsx)(`div`,{className:`onboarding-progress`,"aria-hidden":`true`,children:mv.map((e,n)=>(0,K.jsx)(`span`,{className:`dot ${n===t.index?`active`:``} ${n<t.index?`done`:``}`},e))}),(()=>{switch(t.step){case`welcome`:return(0,K.jsx)(gv,{});case`preflight`:return(0,K.jsx)(vv,{onGuardChange:t.setGuard,onReport:r});case`download`:return(0,K.jsx)(Sv,{modelName:c,onGuardChange:t.setGuard});case`connector`:return(0,K.jsx)(wv,{});case`done`:return(0,K.jsx)(Tv,{})}})(),o&&(0,K.jsx)(`div`,{className:`onboarding-banner error`,role:`alert`,style:{margin:`0 28px`},children:o}),(0,K.jsx)(`div`,{className:`onboarding-footer`,children:(()=>{if(t.step===`welcome`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{className:`onboarding-btn link`,onClick:()=>l(!0),disabled:i,children:`Skip — I know what I'm doing`}),(0,K.jsx)(`div`,{className:`spacer`}),(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:t.next,children:[`Get started `,(0,K.jsx)(A,{size:15})]})]});if(t.step===`done`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`spacer`}),(0,K.jsx)(`button`,{className:`onboarding-btn primary`,onClick:()=>l(!1),disabled:i,children:i?`Finishing…`:`Start using GAIA`})]});let e=t.step===`download`||t.step===`connector`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{className:`onboarding-btn secondary`,onClick:t.back,disabled:t.isFirst,children:[(0,K.jsx)(te,{size:15}),` Back`]}),e&&(0,K.jsx)(`button`,{className:`onboarding-btn link`,onClick:t.skip,"data-testid":`onboarding-skip-later`,children:`Set up later`}),(0,K.jsx)(`div`,{className:`spacer`}),(0,K.jsxs)(`button`,{className:`onboarding-btn primary`,onClick:t.next,disabled:t.guarded,"data-testid":`onboarding-next`,children:[`Continue `,(0,K.jsx)(A,{size:15})]})]})})()})]})})}function Dv(e,t,n){return!e||t&&(e===t||e===xr(t))?null:n.some(t=>t.id===e)?e:Sr(n,e)}function Ov({show:e,children:t,duration:n=250}){let[r,i]=(0,w.useState)(!1),[a,o]=(0,w.useState)(`idle`);return(0,w.useEffect)(()=>{if(e)i(!0),requestAnimationFrame(()=>o(`entering`));else if(r){o(`exiting`);let e=setTimeout(()=>{i(!1),o(`idle`)},n);return()=>clearTimeout(e)}},[e,r,n]),r?(0,K.jsx)(`div`,{className:`animated-presence ${a}`,"data-duration":n,children:t}):null}function kv(){let{agents:e,activeAgentId:t,setActiveAgentId:n,currentSessionId:r,setSessions:i,setCurrentSession:a,addSession:o,removeSession:s,updateSessionInList:c,setMessages:l,resetStreaming:u,showDocLibrary:d,showFileBrowser:f,showSettings:p,setShowSettings:m,showMemoryDashboard:h,setShowMemoryDashboard:g,showSchedules:_,setShowSchedules:v,showHub:y,setShowHub:b,sidebarOpen:x,toggleSidebar:S,setSidebarOpen:C,systemStatus:T,setSystemStatus:E,setBackendConnected:D,setAgents:O,setAgentsError:k,setRunningSessions:ee}=H(),te=Zm(e=>e.showPanel),A=Zm(e=>e.setShowPanel),j=(0,w.useRef)(``),ne=(0,w.useCallback)(async()=>{try{let e=(await un()).agents||[],t=e.map(e=>e.id).sort().join(`,`);t!==j.current&&(j.current=t,O(e)),k(null)}catch(e){let t=e instanceof Error?e.message:`agent discovery failed`;U.api.warn(`[App] agent list load failed`,e),k(t)}},[O,k]);(0,w.useEffect)(()=>{ne();let e=setInterval(ne,3e4);return()=>clearInterval(e)},[ne]);let[re,M]=(0,w.useState)(!1);(0,w.useEffect)(()=>{let e=!1;return cn().then(t=>{e||M(!t.initialized)}).catch(e=>{U.system.warn(`Onboarding status check failed`,e)}),()=>{e=!0}},[]);let[N,P]=(0,w.useState)(!1),[ie,ae]=(0,w.useState)(!1),[F,I]=(0,w.useState)(!1),[oe,se]=(0,w.useState)(null),ce=(0,w.useRef)(null),L=(0,w.useRef)(0),R=(0,w.useCallback)(async()=>{try{let e=await nn();if(D(!0),e.detected_devices&&e.detected_devices.length>0&&H.getState().setDetectedDevices(e.detected_devices),e.lemonade_running)L.current=0,E(e);else if(L.current+=1,U.system.warn(`Lemonade health check failed (${L.current}/3)`),L.current>=3)E(e);else{let t=H.getState().systemStatus;t&&t.lemonade_running?E({...t,disk_space_gb:e.disk_space_gb,memory_available_gb:e.memory_available_gb}):E(e)}U.system.info(`System status:`,{lemonade:e.lemonade_running,model:e.model_loaded,failCount:L.current})}catch(e){U.system.warn(`System status check failed`,e),D(!1),E(null)}},[E,D]),le=(0,w.useRef)(3e3);(0,w.useEffect)(()=>(R(),le.current=3e3,ce.current=setInterval(R,3e3),()=>{ce.current&&clearInterval(ce.current)}),[R]),(0,w.useEffect)(()=>{let e=T?.init_state;if(!e||e===`initializing`)return;let t=15e3;t!==le.current&&(le.current=t,ce.current&&clearInterval(ce.current),ce.current=setInterval(R,t))},[T?.init_state,R]);let z=(0,w.useRef)(null),ue=(0,w.useRef)(``);(0,w.useEffect)(()=>{Qt(`0.24.1`),U.system.info(`App mounting, loading sessions...`);let e=U.system.time(),t=e=>e.map(e=>`${e.id}|${e.updated_at}|${e.title}`).join(`
|
|
69
69
|
`),n=(n=!1)=>{jn().then(r=>{let a=r.sessions||[];if(n){i(a),D(!0),ue.current=t(a),U.system.timed(`Loaded ${a.length} session(s)`,e);return}let o=H.getState().sessions;if(a.length===0&&o.length>0){U.system.warn(`Session poll returned 0 sessions but sidebar has ${o.length} — skipping update to prevent data loss`);return}let s=t(a);s!==ue.current&&(U.system.info(`Session list changed (${o.length} → ${a.length} sessions)`),i(a),ue.current=s)}).catch(e=>{n&&(U.system.error(`Failed to load sessions from backend`,e),U.system.warn(`Is the Python backend running? Start it with: gaia chat --ui`))})};return n(!0),z.current=setInterval(()=>n(!1),5e3),()=>{z.current&&clearInterval(z.current)}},[i,o,s,c,D]);let de=(0,w.useRef)(null);(0,w.useEffect)(()=>{let e=()=>{Gn().then(e=>ee(e.session_ids||[])).catch(()=>{})};return e(),de.current=setInterval(e,2600),()=>{de.current&&clearInterval(de.current)}},[ee]),(0,w.useEffect)(()=>{let e=()=>{let e=new URLSearchParams(window.location.search).get(`session`),t=window.location.hash.replace(/^#/,``),n=e||t,{currentSessionId:r,sessions:i}=H.getState(),o=Dv(n,r,i);o&&(U.nav.info(`URL session navigation: ${n}`),a(o),l([]))},t=setTimeout(e,500);return window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),()=>{clearTimeout(t),window.removeEventListener(`hashchange`,e),window.removeEventListener(`popstate`,e)}},[a,l]),(0,w.useEffect)(()=>{let e=`${Kt()}/sessions/events`,t=null,n=2e3,r=!1,i=null,o=()=>{r||(t=new EventSource(e),t.onopen=()=>{n=2e3},t.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.type===`set_active_session`&&t.session_id){let e=H.getState().currentSessionId;t.session_id!==e&&(U.nav.info(`MCP activate session: ${t.session_id}`),a(t.session_id),l([]))}}catch{}},t.onerror=()=>{t?.close(),t=null,!r&&(i=setTimeout(o,n),n=Math.min(n*2,3e4))})};return o(),()=>{r=!0,i&&clearTimeout(i),t?.close()}},[a,l]),(0,w.useEffect)(()=>{if(r){let e=xr(r);window.location.hash!==`#${e}`&&window.history.replaceState(null,``,`#${e}`)}else window.location.hash&&window.history.replaceState(null,``,window.location.pathname+window.location.search)},[r]),(0,w.useEffect)(()=>{pr().then(e=>{ae(e.active===!0)}).catch(()=>{})},[]),(0,w.useEffect)(()=>{let e=()=>{window.innerWidth>768&&C(!0)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[C]);let[fe,pe]=(0,w.useState)(null),me=(0,w.useCallback)(async()=>{U.chat.info(`Creating new task session...`),pe(null);try{let e=H.getState(),{activeAgentId:t,activeDevice:n,activeModelTier:r,agents:i}=e,s=e.currentSessionId,c=e.sessions.find(e=>e.id===s);if(s!=null&&Or(s,{sessions:e.sessions,currentSessionId:e.currentSessionId,messages:e.messages,isStreaming:e.isStreaming,runningSessionIds:e.runningSessionIds})&&c?.agent_type===t){U.chat.info(`Reusing existing empty draft ${s} for agent ${t}`),window.innerWidth<=768&&C(!1);return}let u=(i.find(e=>e.id===t)?.model_tiers?.find(e=>e.name===r))?.models?.[0],d=await Mn({title:`New Task`,agent_type:t,device:n,...u?{model:u}:{}});U.chat.info(`Session created: id=${d.id}, title="${d.title}"`),o(d),kr(s),a(d.id),l([]),window.innerWidth<=768&&C(!1)}catch(e){U.chat.error(`Failed to create session`,e),R(),pe(`Failed to create task. Is the server running?`),setTimeout(()=>pe(null),6e3)}},[o,a,l,C,R]),he=(0,w.useCallback)(async e=>{H.getState().setActiveAgentId(e),await me()},[me]),{setPendingPrompt:ge}=H(),_e=(0,w.useCallback)(async e=>{U.chat.info(`New task with prompt: "${e.slice(0,60)}..."`),ge(e),await me()},[me,ge]),ve=(0,w.useCallback)(async(e,t)=>{H.getState().setActiveAgentId(e),b(!1),t?await _e(t):await me()},[me,_e,b]),ye=(0,w.useCallback)(async()=>{U.chat.info(`Creating builder agent session...`),pe(null);let e=H.getState().currentSessionId;try{ge(`Hi, I'd like to create a new custom agent.`);let{activeDevice:t}=H.getState(),n=await Mn({title:`New Agent`,agent_type:`builder`,device:t});U.chat.info(`Builder session created: id=${n.id}`),o(n),kr(e),a(n.id),l([]),window.innerWidth<=768&&C(!1)}catch(e){ge(null),U.chat.error(`Failed to create builder session`,e),R(),pe(`Failed to create task. Is the server running?`),setTimeout(()=>pe(null),6e3)}},[o,a,l,C,R,ge]),be=(0,w.useCallback)(async()=>{if(ie){U.system.info(`Reopening mobile access modal (tunnel already running)`),se(null),P(!0);return}U.system.info(`Starting mobile access tunnel...`),P(!0),I(!0),se(null);try{let e=await dr();e.error?(U.system.error(`Tunnel failed to start:`,e.error),ae(!1),se(e.error)):(ae(!0),U.system.info(`Tunnel started successfully`))}catch(e){U.system.error(`Tunnel start error:`,e),ae(!1),se(e instanceof Error?e.message:`Failed to connect`)}finally{I(!1)}},[ie]),xe=(0,w.useCallback)(async()=>{U.system.info(`Stopping mobile access tunnel...`);try{await fr()}catch(e){U.system.warn(`stopTunnel call failed (continuing)`,e)}ae(!1),se(null),P(!1)},[]);(0,w.useEffect)(()=>{let{sessions:e,setActiveAgentId:t}=H.getState(),n=e.find(e=>e.id===r);n?.agent_type&&t(n.agent_type)},[r]),(0,w.useEffect)(()=>{r?U.nav.info(`Viewing session: ${r}`):U.nav.info(`Viewing welcome screen (no session selected)`)},[r]),(0,w.useEffect)(()=>{d&&U.ui.info(`Document Library opened`)},[d]),(0,w.useEffect)(()=>{p&&U.ui.info(`Settings page opened`)},[p]);let[Se,Ce]=(0,w.useState)(typeof window<`u`&&window.innerWidth<=768);(0,w.useEffect)(()=>{let e=()=>Ce(window.innerWidth<=768);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let[we,Te]=(0,w.useState)(!1),[Ee,De]=(0,w.useState)(null);return(0,w.useEffect)(()=>{if(r!==Ee){Te(!0);let e=setTimeout(()=>{u(),De(r),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Te(!1)})})},220);return()=>clearTimeout(e)}},[r,Ee,u]),(0,K.jsxs)(`div`,{className:`app`,children:[(0,K.jsx)(`button`,{className:`sidebar-toggle`,onClick:S,"aria-label":x?`Close sidebar`:`Open sidebar`,children:(0,K.jsx)(qe,{size:18})}),(0,K.jsx)(`div`,{className:`sidebar-overlay ${x?`visible`:``}`,onClick:()=>C(!1),"aria-hidden":`true`}),(0,K.jsx)(Ir,{onNewTask:me,onHome:()=>{kr(r),a(null),m(!1),g(!1),v(!1),b(!0),window.history.replaceState(null,``,window.location.pathname)},tunnelActive:ie,tunnelLoading:F,onMobileToggle:be}),(0,K.jsx)(`div`,{className:`main-content`,children:p?(0,K.jsx)($_,{}):h?(0,K.jsx)(f_,{}):_?(0,K.jsx)(S_,{}):y?(0,K.jsx)(Jh,{agents:e,activeAgentId:t,onSelect:n,onStartChat:ve,onCreateAgent:ye}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(sv,{onRetry:R}),(0,K.jsx)(`div`,{className:`view-container ${we?`view-transitioning`:``}`,children:Ee?(0,K.jsx)(xh,{sessionId:Ee,onCreateAgent:ye,onAgentChange:he},Ee):(0,K.jsx)(ig,{onNewTask:me,onSendPrompt:_e,onCreateAgent:ye})})]})}),(0,K.jsx)(Ov,{show:d,children:(0,K.jsx)(lg,{})}),(0,K.jsx)(Ov,{show:f,children:(0,K.jsx)(_g,{})}),(0,K.jsx)(Ov,{show:te,children:(0,K.jsx)(`div`,{className:`notification-center-popover`,children:(0,K.jsx)(pv,{onClose:()=>A(!1)})})}),!Se&&(0,K.jsx)(Ov,{show:N,children:(0,K.jsx)(ov,{isOpen:N,onClose:()=>P(!1),onStop:xe,error:oe})}),(0,K.jsx)(lv,{}),(0,K.jsx)(cv,{}),fe&&(0,K.jsx)(`div`,{className:`toast`,role:`alert`,children:fe}),re&&(0,K.jsx)(Ev,{onComplete:()=>{M(!1),R()}})]})}localStorage.getItem(`gaia-chat-theme`)!==`light`&&document.documentElement.setAttribute(`data-theme`,`dark`),Ut.createRoot(document.getElementById(`root`)).render((0,K.jsx)(w.StrictMode,{children:(0,K.jsx)(kv,{})}));export{o as t};
|