@amd-gaia/agent-ui 0.25.4-rc.8 → 0.26.0-rc.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.
Files changed (34) hide show
  1. package/dist/assets/AdvancedSettings-D8P_x4lg.js +1 -0
  2. package/dist/assets/ConnectorsPane-Byq5_CvM.js +1 -0
  3. package/dist/assets/DocumentLibrary-B8SHRZpL.js +4 -0
  4. package/dist/assets/FileBrowser-OU9tD0Ek.js +4 -0
  5. package/dist/assets/MemoryDashboard-D2A5sTz6.js +1 -0
  6. package/dist/assets/MobileAccessModal-BgeK3LK3.js +2 -0
  7. package/dist/assets/ScheduleManager-Bye5OV6N.js +1 -0
  8. package/dist/assets/api-9RdlUJAP.js +4 -0
  9. package/dist/assets/index-Cw3Kx9eq.js +83 -0
  10. package/dist/assets/index-LLooEbjq.css +1 -0
  11. package/dist/assets/useT-C0ow1Kps.js +3 -0
  12. package/dist/assets/{zap-CORjwTA2.js → zap-D2mvP3-6.js} +1 -1
  13. package/dist/index.html +4 -4
  14. package/dist/sw.js +1 -1
  15. package/main.cjs +135 -24
  16. package/package.json +2 -1
  17. package/preload.cjs +8 -0
  18. package/services/auto-updater.cjs +26 -3
  19. package/services/backend-supervisor.cjs +150 -0
  20. package/services/port-manager.cjs +3 -0
  21. package/services/quit-guard.cjs +34 -6
  22. package/services/tray-host.cjs +84 -0
  23. package/services/tray-manager.cjs +64 -11
  24. package/dist/assets/AdvancedSettings-DNdcv0E1.js +0 -1
  25. package/dist/assets/ConnectorsPane-DMzaqCee.js +0 -1
  26. package/dist/assets/DocumentLibrary-BP-jP670.js +0 -4
  27. package/dist/assets/FileBrowser-CV8AsCp-.js +0 -4
  28. package/dist/assets/MemoryDashboard-BLpYob9X.js +0 -1
  29. package/dist/assets/MobileAccessModal-t727pxc6.js +0 -2
  30. package/dist/assets/ScheduleManager-Dv9WjtNl.js +0 -1
  31. package/dist/assets/api-BsMIEtSA.js +0 -4
  32. package/dist/assets/index-CNhwlnjv.css +0 -1
  33. package/dist/assets/index-DBKyXg4y.js +0 -78
  34. package/dist/assets/useT-DmcuCJlO.js +0 -3
@@ -0,0 +1,83 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ConnectorsPane-Byq5_CvM.js","./rolldown-runtime-XKyaHtl9.js","./useT-C0ow1Kps.js","./api-9RdlUJAP.js","./ConnectorsPane-CzLYXGMl.css","./AdvancedSettings-D8P_x4lg.js","./MemoryDashboard-D2A5sTz6.js","./zap-D2mvP3-6.js","./MemoryDashboard-DwrWAXi6.css","./ScheduleManager-Bye5OV6N.js","./ScheduleManager-CjHJ4NbD.css","./DocumentLibrary-B8SHRZpL.js","./DocumentLibrary-CM6o8j2T.css","./FileBrowser-OU9tD0Ek.js","./FileBrowser-Cna3BsT7.css","./MobileAccessModal-BgeK3LK3.js","./MobileAccessModal-BkVDm3YG.css"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{A as r,B as i,C as a,D as o,E as s,F as c,G as l,H as u,I as d,J as f,K as p,L as m,M as h,N as g,O as _,R as v,S as y,T as b,U as x,V as S,W as C,_ as w,a as T,b as E,c as D,d as O,f as k,g as A,h as j,j as M,k as N,l as P,m as F,n as I,o as L,p as ee,q as R,r as z,s as B,t as te,u as V,v as ne,w as re,x as ie,y as ae,z as oe}from"./useT-C0ow1Kps.js";import{$ as H,$n as U,$t as se,A as W,An as G,B as ce,Bn as le,Bt as ue,C as de,D as fe,Dt as pe,E as me,En as he,Et as ge,F as _e,Fn as ve,Ft as ye,G as be,Gn as xe,Gt as Se,Hn as Ce,Ht as we,In as Te,It as Ee,J as De,Jn as Oe,Jt as ke,K as Ae,Kn as je,L as Me,Ln as Ne,Lt as Pe,M as Fe,Mn as Ie,Mt as Le,N as Re,Nn as ze,Nt as Be,O as Ve,On as He,Ot as Ue,P as We,Pn as Ge,Pt as Ke,Qn as qe,Qt as Je,R as Ye,Rn as Xe,Rt as Ze,S as Qe,St as $e,T as et,Tt as tt,U as nt,Un as rt,Ut as it,V as at,Vn as ot,Vt as st,W as ct,Wn as lt,Wt as ut,X as dt,Xn as ft,Xt as pt,Y as mt,Yn as ht,Z as gt,Zn as _t,Zt as vt,_ as yt,_t as bt,a as xt,an as St,b as Ct,bt as wt,c as Tt,cn as Et,ct as Dt,d as Ot,dn as kt,dt as At,en as jt,er as Mt,et as Nt,fn as Pt,ft as Ft,g as It,gt as Lt,h as Rt,ht as zt,i as Bt,in as Vt,it as Ht,j as Ut,jn as Wt,jt as Gt,k as Kt,kn as qt,kt as Jt,l as Yt,ln as Xt,lt as Zt,m as Qt,mn as $t,mt as en,nn as tn,nt as nn,o as rn,on as an,ot as on,p as sn,pt as cn,q as ln,qn as un,qt as dn,r as fn,rn as pn,rt as mn,s as hn,sn as gn,st as _n,t as vn,tn as yn,tr as bn,tt as xn,u as Sn,un as Cn,ut as wn,v as Tn,vt as En,w as Dn,x as On,xn as kn,yt as An,z as jn,zn as Mn,zt as Nn}from"./api-9RdlUJAP.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Pn=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Fn=n(((e,t)=>{t.exports=Pn()})),In=n((e=>{var t=f();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),Ln=n(((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=In()})),Rn=n((e=>{var t=Fn(),n=f(),r=Ln();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,E=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),P=Symbol.for(`react.forward_ref`),F=Symbol.for(`react.suspense`),I=Symbol.for(`react.suspense_list`),L=Symbol.for(`react.memo`),ee=Symbol.for(`react.lazy`),R=Symbol.for(`react.activity`),z=Symbol.for(`react.legacy_hidden`),B=Symbol.for(`react.memo_cache_sentinel`),te=Symbol.for(`react.view_transition`),V=Symbol.for(`react.recoverable`),ne=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var ie=Symbol.for(`react.client.reference`);function ae(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case F:return`Suspense`;case I:return`SuspenseList`;case R:return`Activity`;case te:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case P:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case L:return t=e.displayName||null,t===null?ae(e.type)||`Memo`:t;case ee:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}var oe=Array.isArray,H=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},W=[],G=-1;function ce(e){return{current:e}}function le(e){0>G||(e.current=W[G],W[G]=null,G--)}function ue(e,t){G++,W[G]=e.current,e.current=t}var de=ce(null),fe=ce(null),pe=ce(null),me=ce(null);function he(e,t){switch(ue(pe,t),ue(fe,e),ue(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dp(t),e=fp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}le(de),ue(de,e)}function ge(){le(de),le(fe),le(pe)}function _e(e){var t=e.memoizedState;t!==null&&(ch._currentValue=t.memoizedState,ue(me,e)),t=de.current;var n=fp(t,e.type);t!==n&&(ue(fe,e),ue(de,n))}function ve(e){fe.current===e&&(le(de),le(fe)),me.current===e&&(le(me),ch._currentValue=se)}var ye,be;function xe(e){if(ye===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ye=t&&t[1]||``,be=-1<e.stack.indexOf(`
3
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
+ `+ye+e+be}var Se=!1;function Ce(e,t){if(!e||Se)return``;Se=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
+ `),l=s.split(`
6
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
7
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Se=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?xe(n):``}function we(e,t){switch(e.tag){case 26:case 27:case 5:return xe(e.type);case 16:return xe(`Lazy`);case 13:return e.child!==t&&t!==null?xe(`Suspense Fallback`):xe(`Suspense`);case 19:return xe(`SuspenseList`);case 0:case 15:return Ce(e.type,!1);case 11:return Ce(e.type.render,!1);case 1:return Ce(e.type,!0);case 31:return xe(`Activity`);case 30:return xe(`ViewTransition`);default:return``}}function Te(e){try{var t=``,n=null;do t+=we(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
+ Error generating stack: `+e.message+`
9
+ `+e.stack}}var Ee=Object.prototype.hasOwnProperty,De=t.unstable_scheduleCallback,Oe=t.unstable_cancelCallback,ke=t.unstable_shouldYield,Ae=t.unstable_requestPaint,je=t.unstable_now,Me=t.unstable_getCurrentPriorityLevel,Ne=t.unstable_ImmediatePriority,Pe=t.unstable_UserBlockingPriority,Fe=t.unstable_NormalPriority,Ie=t.unstable_LowPriority,Le=t.unstable_IdlePriority,Re=t.log,ze=t.unstable_setDisableYieldValue,Be=null,Ve=null;function He(e){if(typeof Re==`function`&&ze(e),Ve&&typeof Ve.setStrictMode==`function`)try{Ve.setStrictMode(Be,e)}catch{}}var Ue=Math.clz32?Math.clz32:Ke,We=Math.log,Ge=Math.LN2;function Ke(e){return e>>>=0,e===0?32:31-(We(e)/Ge|0)|0}var qe=256,Je=262144,Ye=4194304;function Xe(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&-e;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 Ze(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=Xe(n))):i=Xe(o):i=Xe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Xe(n))):i=Xe(o)):i=Xe(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 Qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $e(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Ue(n),i=1<<r;t|=e[r],n&=~i}return t}function et(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 tt(){var e=Ye;return Ye<<=1,!(Ye&62914560)&&(Ye=4194304),e}function nt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function rt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function it(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-Ue(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&&at(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function at(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ue(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ot(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ue(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function st(e,t){var n=t&-t;return n=n&42?1:ct(n),(n&(e.suspendedLanes|t))===0?n:0}function ct(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 lt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ut(){var e=U.p;return e===0?(e=window.event,e===void 0?32:wh(e.type)):e}function dt(e,t){var n=U.p;try{return U.p=e,t()}finally{U.p=n}}var ft=Math.random().toString(36).slice(2),pt=`__reactFiber$`+ft,mt=`__reactProps$`+ft,ht=`__reactContainer$`+ft,gt=`__reactEvents$`+ft,_t=`__reactListeners$`+ft,vt=`__reactHandles$`+ft,yt=`__reactResources$`+ft,bt=`__reactMarker$`+ft,xt=`__reactLoad$`+ft;function St(e){delete e[pt],delete e[mt],delete e[_t],delete e[vt]}function Ct(e){var t;if(t=e[pt])return t;for(var n=e.parentNode;n;){if(t=n[ht]||n[pt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=pm(e);e!==null;){if(n=e[pt])return n;e=pm(e)}return t}e=n,n=e.parentNode}return null}function wt(e){if(e=e[pt]||e[ht]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Tt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Et(e){var t=e[yt];return t||=e[yt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Dt(e){e[bt]=!0}function Ot(e){e[xt]=void 0}var kt=new Set,At={};function jt(e,t){Mt(e,t),Mt(e+`Capture`,t)}function Mt(e,t){for(At[e]=t,e=0;e<t.length;e++)kt.add(t[e])}var Nt=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]*$`),Pt={},Ft={};function It(e){return Ee.call(Ft,e)?!0:Ee.call(Pt,e)?!1:Nt.test(e)?Ft[e]=!0:(Pt[e]=!0,!1)}var Lt=!1;function Rt(){var e=Lt;return Lt=!1,e}function zt(e,t,n){if(It(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 Bt(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 Vt(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 Ht(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ut(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Wt(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 Gt(e){if(!e._valueTracker){var t=Ut(e)?`checked`:`value`;e._valueTracker=Wt(e,t,``+e[t])}}function Kt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ut(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var qt=/[\n"\\]/g;function Jt(e){return e.replace(qt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Yt(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=``+Ht(t)):e.value!==``+Ht(t)&&(e.value=``+Ht(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Zt(e,Ht(n)):o===`number`&&e.value==t?Zt(e,Ht(e.value)):Zt(e,Ht(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=``+Ht(s):e.removeAttribute(`name`)}function Xt(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)){Gt(e);return}n=n==null?``:``+Ht(n),t=t==null?n:``+Ht(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),Gt(e)}function Zt(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function Qt(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=``+Ht(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 $t(e,t,n){t!=null&&(t=``+Ht(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Ht(n)}function en(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(oe(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Ht(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Gt(e)}function tn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var nn=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 rn(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||nn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function an(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]=``,Lt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(rn(e,a,r),Lt=!0)}else for(var o in t)t.hasOwnProperty(o)&&rn(e,o,t[o])}function on(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 sn=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`],[`maskType`,`mask-type`],[`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`]]),cn=/^[\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 ln(e){return cn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function un(){}var dn=null;function fn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pn=null,mn=null;function hn(e){var t=wt(e);if(t&&(e=t.stateNode)){var n=e[mt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Yt(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="`+Jt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[mt]||null;if(!a)throw Error(i(90));Yt(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&&Kt(r)}break a;case`textarea`:$t(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Qt(e,!!n.multiple,t,!1)}}}var gn=!1;function _n(e,t,n){if(gn)return e(t,n);gn=!0;try{return e(t)}finally{if(gn=!1,(pn!==null||mn!==null)&&(Ld(),pn&&(t=pn,e=mn,mn=pn=null,hn(t),e)))for(t=0;t<e.length;t++)hn(e[t])}}function vn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[mt]||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 yn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,bn=!1;if(yn)try{var xn={};Object.defineProperty(xn,"passive",{get:function(){bn=!0}}),window.addEventListener(`test`,xn,xn),window.removeEventListener(`test`,xn,xn)}catch{bn=!1}var Sn=null,Cn=null,wn=null;function Tn(){if(wn)return wn;var e,t=Cn,n=t.length,r,i=`value`in Sn?Sn.value:Sn.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 wn=i.slice(e,1<r?1-r:void 0)}function En(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 Dn(){return!0}function On(){return!1}function kn(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)?Dn:On,this.isPropagationStopped=On,this}return T(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=Dn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Dn)},persist:function(){},isPersistent:Dn}),t}var An={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},jn=kn(An),Mn=T({},An,{view:0,detail:0}),Nn=kn(Mn),Pn,In,Rn,zn=T({},Mn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xn,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!==Rn&&(Rn&&e.type===`mousemove`?(Pn=e.screenX-Rn.screenX,In=e.screenY-Rn.screenY):In=Pn=0,Rn=e),Pn)},movementY:function(e){return`movementY`in e?e.movementY:In}}),Bn=kn(zn),Vn=kn(T({},zn,{dataTransfer:0})),Hn=kn(T({},Mn,{relatedTarget:0})),Un=kn(T({},An,{animationName:0,elapsedTime:0,pseudoElement:0})),Wn=kn(T({},An,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Gn=kn(T({},An,{data:0})),Kn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},qn={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`},Jn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Yn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Jn[e])?!!t[e]:!1}function Xn(){return Yn}var Zn=kn(T({},Mn,{key:function(e){if(e.key){var t=Kn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=En(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?qn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xn,charCode:function(e){return e.type===`keypress`?En(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?En(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Qn=kn(T({},zn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),$n=kn(T({},An,{submitter:0})),er=kn(T({},Mn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xn})),tr=kn(T({},An,{propertyName:0,elapsedTime:0,pseudoElement:0})),nr=kn(T({},zn,{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})),rr=kn(T({},An,{newState:0,oldState:0,source:0})),ir=[9,13,27,32],ar=yn&&`CompositionEvent`in window,or=null;yn&&`documentMode`in document&&(or=document.documentMode);var sr=yn&&`TextEvent`in window&&!or,cr=yn&&(!ar||or&&8<or&&11>=or),lr=` `,ur=!1;function dr(e,t){switch(e){case`keyup`:return ir.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function fr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var pr=!1;function mr(e,t){switch(e){case`compositionend`:return fr(t);case`keypress`:return t.which===32?(ur=!0,lr):null;case`textInput`:return e=t.data,e===lr&&ur?null:e;default:return null}}function hr(e,t){if(pr)return e===`compositionend`||!ar&&dr(e,t)?(e=Tn(),wn=Cn=Sn=null,pr=!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 cr&&t.locale!==`ko`?null:t.data;default:return null}}var gr={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 _r(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!gr[e.type]:t===`textarea`}function vr(e,t,n,r){pn?mn?mn.push(r):mn=[r]:pn=r,t=Jf(t,`onChange`),0<t.length&&(n=new jn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var yr=null,br=null;function xr(e){Bf(e,0)}function Sr(e){if(Kt(Tt(e)))return e}function Cr(e,t){if(e===`change`)return t}var wr=!1;if(yn){var Tr;if(yn){var Er=`oninput`in document;if(!Er){var Dr=document.createElement(`div`);Dr.setAttribute(`oninput`,`return;`),Er=typeof Dr.oninput==`function`}Tr=Er}else Tr=!1;wr=Tr&&(!document.documentMode||9<document.documentMode)}function Or(){yr&&(yr.detachEvent(`onpropertychange`,kr),br=yr=null)}function kr(e){if(e.propertyName===`value`&&Sr(br)){var t=[];vr(t,br,e,fn(e)),_n(xr,t)}}function Ar(e,t,n){e===`focusin`?(Or(),yr=t,br=n,yr.attachEvent(`onpropertychange`,kr)):e===`focusout`&&Or()}function jr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Sr(br)}function Mr(e,t){if(e===`click`)return Sr(t)}function Nr(e,t){if(e===`input`||e===`change`)return Sr(t)}function Pr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Fr=typeof Object.is==`function`?Object.is:Pr;function Ir(e,t){if(Fr(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(!Ee.call(t,i)||!Fr(e[i],t[i]))return!1}return!0}function Lr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Rr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function zr(e,t){var n=Rr(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=Rr(n)}}function Br(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Br(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Vr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Lr(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=Lr(e.document)}return t}function Hr(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 Ur=yn&&`documentMode`in document&&11>=document.documentMode,Wr=null,Gr=null,Kr=null,qr=!1;function Jr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;qr||Wr==null||Wr!==Lr(r)||(r=Wr,`selectionStart`in r&&Hr(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}),Kr&&Ir(Kr,r)||(Kr=r,r=Jf(Gr,`onSelect`),0<r.length&&(t=new jn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Wr)))}function Yr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Xr={animationend:Yr(`Animation`,`AnimationEnd`),animationiteration:Yr(`Animation`,`AnimationIteration`),animationstart:Yr(`Animation`,`AnimationStart`),transitionrun:Yr(`Transition`,`TransitionRun`),transitionstart:Yr(`Transition`,`TransitionStart`),transitioncancel:Yr(`Transition`,`TransitionCancel`),transitionend:Yr(`Transition`,`TransitionEnd`)},Zr={},Qr={};yn&&(Qr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Xr.animationend.animation,delete Xr.animationiteration.animation,delete Xr.animationstart.animation),`TransitionEvent`in window||delete Xr.transitionend.transition);function $r(e){if(Zr[e])return Zr[e];if(!Xr[e])return e;var t=Xr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Qr)return Zr[e]=t[n];return e}var ei=$r(`animationend`),ti=$r(`animationiteration`),ni=$r(`animationstart`),ri=$r(`transitionrun`),ii=$r(`transitionstart`),ai=$r(`transitioncancel`),oi=$r(`transitionend`),si=new Map,ci=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(` `);ci.push(`scrollEnd`);function li(e,t){si.set(e,t),jt(t,[e])}var ui=0;function di(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=vd.identifierPrefix;var n=ui++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function fi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Ed;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function pi(e,t){return e=fi(e),t=fi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var mi=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)},hi=[],gi=0,_i=0;function vi(){for(var e=gi,t=_i=gi=0;t<e;){var n=hi[t];hi[t++]=null;var r=hi[t];hi[t++]=null;var i=hi[t];hi[t++]=null;var a=hi[t];if(hi[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&&Si(n,i,a)}}function yi(e,t,n,r){hi[gi++]=e,hi[gi++]=t,hi[gi++]=n,hi[gi++]=r,_i|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function bi(e,t,n,r){return yi(e,t,n,r),Ci(e)}function xi(e,t){return yi(e,null,null,t),Ci(e)}function Si(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-Ue(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Ci(e){if(50<Dd)throw Dd=0,Od=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var wi={};function Ti(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 Ei(e,t,n,r){return new Ti(e,t,n,r)}function Di(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Oi(e,t){var n=e.alternate;return n===null?(n=Ei(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&1206910976,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 ki(e,t){e.flags&=1206910978;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 Ai(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Di(r)&&(s=1);else if(typeof r==`string`)s=Jm(e,n,de.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case R:return e=Ei(31,n,t,a),e.elementType=R,e.lanes=o,e;case k:return ji(n.children,a,o,t);case A:s=8,a|=24;break;case j:return e=Ei(12,n,t,a|2),e.elementType=j,e.lanes=o,e;case F:return e=Ei(13,n,t,a),e.elementType=F,e.lanes=o,e;case I:return e=Ei(19,n,t,a),e.elementType=I,e.lanes=o,e;case z:case te:return e=a|32,e=Ei(30,n,t,e),e.elementType=te,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case N:s=10;break a;case M:s=9;break a;case P:s=11;break a;case L:s=14;break a;case ee:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Ei(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ji(e,t,n,r){return e=Ei(7,e,r,t),e.lanes=n,e}function Mi(e,t,n){return e=Ei(6,e,null,t),e.lanes=n,e}function Ni(e){var t=Ei(18,null,null,0);return t.stateNode=e,t}function Pi(e,t,n){return t=Ei(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Fi=new WeakMap;function Ii(e,t){if(typeof e==`object`&&e){var n=Fi.get(e);return n===void 0?(t={value:e,source:t,stack:Te(t)},Fi.set(e,t),t):n}return{value:e,source:t,stack:Te(t)}}var Li=[],Ri=0,zi=null,Bi=0,Vi=[],Hi=0,Ui=null,Wi=1,Gi=``;function Ki(e,t){Li[Ri++]=Bi,Li[Ri++]=zi,zi=e,Bi=t}function qi(e,t,n){Vi[Hi++]=Wi,Vi[Hi++]=Gi,Vi[Hi++]=Ui,Ui=e;var r=Wi;e=Gi;var i=32-Ue(r)-1;r&=~(1<<i),n+=1;var a=32-Ue(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Wi=1<<32-Ue(t)+i|n<<i|r,Gi=a+e}else Wi=1<<a|n<<i|r,Gi=e}function Ji(e){e.return!==null&&(Ki(e,1),qi(e,1,0))}function Yi(e){for(;e===zi;)zi=Li[--Ri],Li[Ri]=null,Bi=Li[--Ri],Li[Ri]=null;for(;e===Ui;)Ui=Vi[--Hi],Vi[Hi]=null,Gi=Vi[--Hi],Vi[Hi]=null,Wi=Vi[--Hi],Vi[Hi]=null}function Xi(e,t){Vi[Hi++]=Wi,Vi[Hi++]=Gi,Vi[Hi++]=Ui,Wi=t.id,Gi=t.overflow,Ui=e}var Zi=null,Qi=null,$i=!1,ea=null,ta=!1,na=Error(i(519));function K(e){throw ca(Ii(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),na}function ra(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[pt]=e,t[mt]=r,n){case`dialog`:Vf(`cancel`,t),Vf(`close`,t);break;case`iframe`:case`object`:case`embed`:Vf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Rf.length;n++)Vf(Rf[n],t);break;case`source`:Vf(`error`,t);break;case`img`:case`image`:case`link`:Vf(`error`,t),Vf(`load`,t);break;case`details`:Vf(`toggle`,t);break;case`input`:Vf(`invalid`,t),Xt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Vf(`invalid`,t);break;case`textarea`:Vf(`invalid`,t),en(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||ep(t.textContent,n)?(r.popover!=null&&(Vf(`beforetoggle`,t),Vf(`toggle`,t)),r.onScroll!=null&&Vf(`scroll`,t),r.onScrollEnd!=null&&Vf(`scrollend`,t),r.onClick!=null&&(t.onclick=un),t=!0):t=!1,t||K(e,!0)}function ia(e){for(Zi=e.return;Zi;)switch(Zi.tag){case 5:case 31:case 13:ta=!1;return;case 27:case 3:ta=!0;return;default:Zi=Zi.return}}function aa(e){if(e!==Zi)return!1;if(!$i)return ia(e),$i=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||mp(e.type,e.memoizedProps)),n=!n),n&&Qi&&K(e),ia(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Qi=fm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Qi=fm(e)}else t===27?(t=Qi,Cp(e.type)?(e=dm,dm=null,Qi=e):Qi=t):Qi=Zi?um(e.stateNode.nextSibling):null;return!0}function oa(){Qi=Zi=null,$i=!1}function sa(){var e=ea;return e!==null&&(ud===null?ud=e:ud.push.apply(ud,e),ea=null),e}function ca(e){ea===null?ea=[e]:ea.push(e)}var la=ce(null),ua=null,da=null;function fa(e,t,n){ue(la,t._currentValue),t._currentValue=n}function pa(e){e._currentValue=la.current,le(la)}function ma(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 ha(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),ma(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),ma(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),ma(a.return,n,e),s=a.child,s=s===null?null:s.sibling):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 ga(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;Fr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===me.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ch]:e.push(ch))}a=a.return}return e!==null&&ha(t,e,n,r),t.flags|=262144,e!==null}function _a(e){for(e=e.firstContext;e!==null;){if(!Fr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function va(e){ua=e,da=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ya(e){return xa(ua,e)}function ba(e,t){return ua===null&&va(e),xa(e,t)}function xa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},da===null){if(e===null)throw Error(i(308));da=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else da=da.next=t;return n}var Sa=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()})}},Ca=t.unstable_scheduleCallback,wa=t.unstable_NormalPriority,Ta={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ea(){return{controller:new Sa,data:new Map,refCount:0}}function Da(e){e.refCount--,e.refCount===0&&Ca(wa,function(){e.controller.abort()})}function Oa(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var ka=null;function Aa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var ja=null,Ma=0,Na=0,Pa=null;function Fa(e,t){if(ja===null){var n=ja=[];Ma=0,Na=Nf(),Pa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ma++,t.then(Ia,Ia),t}function Ia(){if(--Ma===0&&(ka=null,ja!==null)){Pa!==null&&(Pa.status=`fulfilled`);var e=ja;ja=null,Na=0,Pa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function La(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 Ra=H.S;H.S=function(e,t){if(pd=je(),typeof t==`object`&&t&&typeof t.then==`function`&&Fa(e,t),ka!==null)for(var n=yf;n!==null;)Oa(n,ka),n=n.next;if(n=e.types,n!==null){for(var r=yf;r!==null;)Oa(r,n),r=r.next;if(Na!==0){r=ka,r===null&&(r=ka=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ra!==null&&Ra(e,t)};var za=ce(null);function Ba(){var e=za.current;return e===null?Xu.pooledCache:e}function Va(e,t){t===null?ue(za,za.current):ue(za,t.pool)}function Ha(){var e=Ba();return e===null?null:{parent:Ta._currentValue,pool:e}}var Ua=Error(i(460)),Wa=Error(i(474)),Ga=Error(i(542)),Ka={then:function(){}};function qa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ja(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(un,un),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Qa(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(un,un);else{if(e=Xu,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,Qa(e),e}throw Xa=t,Ua}}function Ya(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Xa=e,Ua):e}}var Xa=null;function Za(){if(Xa===null)throw Error(i(459));var e=Xa;return Xa=null,e}function Qa(e){if(e===Ua||e===Ga)throw Error(i(483))}var $a=null,eo=0;function to(e){var t=eo;return eo+=1,$a===null&&($a=[]),Ja($a,e,t)}function no(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ro(e,t){throw t.$$typeof===E?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function io(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=Oi(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|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Mi(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===k?(e=d(e,t,n.props.children,r,n.key),no(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===ee&&Ya(i)===t.type)?(t=a(t,n.props),no(t,n),t.return=e,t):(t=Ai(n.type,n.key,n.props,null,e.mode,r),no(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=Pi(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=ji(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=Mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case D:return n=Ai(t.type,t.key,t.props,null,e.mode,n),no(n,t),n.return=e,n;case O:return t=Pi(t,e.mode,n),t.return=e,t;case ee:return t=Ya(t),f(e,t,n)}if(oe(t)||re(t))return t=ji(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,to(t),n);if(t.$$typeof===N)return f(e,ba(e,t),n);ro(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 D:return n.key===i?l(e,t,n,r):null;case O:return n.key===i?u(e,t,n,r):null;case ee:return n=Ya(n),p(e,t,n,r)}if(oe(n)||re(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,to(n),r);if(n.$$typeof===N)return p(e,t,ba(e,n),r);ro(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 D:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case O:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ee:return r=Ya(r),m(e,t,n,r,i)}if(oe(r)||re(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,to(r),i);if(r.$$typeof===N)return m(e,t,n,ba(t,r),i);ro(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),$i&&Ki(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 $i&&Ki(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(_.key===null?h:_.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)}),$i&&Ki(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),$i&&Ki(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 $i&&Ki(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(_.key===null?g:_.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)}),$i&&Ki(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===k&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case D:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===k){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),no(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ee&&Ya(l)===r.type){n(e,r.sibling),c=a(r,o.props),no(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===k?(c=ji(o.props.children,e.mode,c,o.key),no(c,o),c.return=e,e=c):(c=Ai(o.type,o.key,o.props,null,e.mode,c),no(c,o),c.return=e,e=c)}return s(e);case O: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=Pi(o,e.mode,c),c.return=e,e=c}return s(e);case ee:return o=Ya(o),_(e,r,o,c)}if(oe(o))return h(e,r,o,c);if(re(o)){if(l=re(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,to(o),c);if(o.$$typeof===N)return _(e,r,ba(e,o),c);ro(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=Mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{eo=0;var i=_(e,t,n,r);return $a=null,i}catch(t){if(t===Ua||t===Ga)throw t;var a=Ei(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ao=io(!0),oo=io(!1),so=!1;function co(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lo(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 q(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function uo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Yu&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Ci(e),Si(e,null,n),t}return yi(e,r,t,n),Ci(e)}function fo(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,ot(e,n)}}function po(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}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var mo=!1;function ho(){if(mo){var e=Pa;if(e!==null)throw e}}function go(e,t,n,r){mo=!1;var i=e.updateQueue;so=!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?(Z&f)===f:(r&f)===f){f!==0&&f===Na&&(mo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:so=!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),Q|=o,e.lanes=o,e.memoizedState=d}}function _o(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function vo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)_o(n[e],t)}var yo=ce(null),bo=ce(0);function xo(e,t){e=rd,ue(bo,e),ue(yo,t),rd=e|t.baseLanes}function So(){ue(bo,rd),ue(yo,yo.current)}function J(){rd=bo.current,le(yo),le(bo)}var Co=ce(null),wo=null;function To(e){var t=e.alternate;ue(Ao,Ao.current&1),ue(Co,e),wo===null&&(t===null||yo.current!==null||t.memoizedState!==null)&&(wo=e)}function Eo(e){ue(Ao,Ao.current),ue(Co,e),wo===null&&(wo=e)}function Do(e){e.tag===22?(ue(Ao,Ao.current),ue(Co,e),wo===null&&(wo=e)):Oo()}function Oo(){ue(Ao,Ao.current),ue(Co,Co.current)}function ko(e){le(Co),wo===e&&(wo=null),le(Ao)}var Ao=ce(0);function jo(e,t){ue(Co,Co.current),ue(Ao,t)}function Mo(e){le(Ao),le(Co),wo===e&&(wo=null)}function No(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||sm(n)||cm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){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 Po=0,Fo=null,Io=null,Lo=null,Ro=!1,zo=!1,Bo=!1,Vo=0,Ho=0,Uo=null,Wo=0;function Go(){throw Error(i(321))}function Ko(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Fr(e[n],t[n]))return!1;return!0}function qo(e,t,n,r,i,a){return Po=a,Fo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,H.H=e===null||e.memoizedState===null?uc:dc,Bo=!1,a=n(r,i),Bo=!1,zo&&(a=Yo(t,n,r,i)),Jo(e),a}function Jo(e){H.H=lc;var t=Io!==null&&Io.next!==null;if(Po=0,Lo=Io=Fo=null,Ro=!1,Ho=0,Uo=null,t)throw Error(i(300));e===null||Oc||(e=e.dependencies,e!==null&&_a(e)&&(Oc=!0))}function Yo(e,t,n,r){Fo=e;var a=0;do{if(zo&&(Uo=null),Ho=0,zo=!1,25<=a)throw Error(i(301));if(a+=1,Lo=Io=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}H.H=fc,o=t(n,r)}while(zo);return o}function Xo(){var e=H.H,t=e.useState()[0];return t=typeof t.then==`function`?rs(t):t,e=e.useState()[0],(Io===null?null:Io.memoizedState)!==e&&(Fo.flags|=1024),t}function Zo(){var e=Vo!==0;return Vo=0,e}function Qo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function $o(e){if(Ro){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ro=!1}Po=0,Lo=Io=Fo=null,zo=!1,Ho=Vo=0,Uo=null}function es(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lo===null?Fo.memoizedState=Lo=e:Lo=Lo.next=e,Lo}function ts(){if(Io===null){var e=Fo.alternate;e=e===null?null:e.memoizedState}else e=Io.next;var t=Lo===null?Fo.memoizedState:Lo.next;if(t!==null)Lo=t,Io=e;else{if(e===null)throw Fo.alternate===null?Error(i(467)):Error(i(310));Io=e,e={memoizedState:Io.memoizedState,baseState:Io.baseState,baseQueue:Io.baseQueue,queue:Io.queue,next:null},Lo===null?Fo.memoizedState=Lo=e:Lo=Lo.next=e}return Lo}function ns(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rs(e){var t=Ho;return Ho+=1,Uo===null&&(Uo=[]),e=Ja(Uo,e,t),t=Fo,(Lo===null?t.memoizedState:Lo.next)===null&&(t=t.alternate,H.H=t===null||t.memoizedState===null?uc:dc),e}function is(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return rs(e);if(e.$$typeof===V)return;if(e.$$typeof===N)return ya(e)}throw Error(i(438,String(e)))}function as(e){var t=null,n=Fo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Fo.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=ns(),Fo.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]=B;return t.index++,n}function os(e,t){return typeof t==`function`?t(e):t}function ss(e){return cs(ts(),Io,e)}function cs(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?(Po&f)===f:(Z&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===Na&&(d=!0);else if((Po&p)===p){u=u.next,p===Na&&(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,Fo.lanes|=p,Q|=p;f=u.action,Bo&&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,Fo.lanes|=f,Q|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Fr(o,e.memoizedState)&&(Oc=!0,d&&(n=Pa,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 ls(e){var t=ts(),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);Fr(o,t.memoizedState)||(Oc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function us(e,t,n){var r=Fo,a=ts(),o=$i;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Fr((Io||a).memoizedState,n);if(s&&(a.memoizedState=n,Oc=!0),a=a.queue,Fs(ps.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Lo!==null&&!!(Lo.memoizedState.tag&1),As(e?9:8,{destroy:void 0},fs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,Xu===null)throw Error(i(349));o||Po&127||ds(r,t,n)}return n}function ds(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Fo.updateQueue,t===null?(t=ns(),Fo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function fs(e,t,n,r){t.value=n,t.getSnapshot=r,ms(t)&&hs(e)}function ps(e,t,n){return n(function(){ms(t)&&hs(e)})}function ms(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Fr(e,n)}catch{return!0}}function hs(e){var t=xi(e,2);t!==null&&Md(t,e,2)}function gs(e){var t=es();if(typeof e==`function`){var n=e;if(e=n(),Bo){He(!0);try{n()}finally{He(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:e},t}function _s(e,t,n,r){return e.baseState=n,cs(e,Io,typeof r==`function`?r:os)}function vs(e,t,n,r,a){if(oc(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)}};H.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,ys(t,o)):(o.next=n.next,t.pending=n.next=o)}}function ys(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=H.T,o={};o.types=a===null?null:a.types,H.T=o;try{var s=n(i,r),c=H.S;c!==null&&c(o,s),bs(e,t,s)}catch(n){Ss(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),H.T=a}}else try{a=n(i,r),bs(e,t,a)}catch(n){Ss(e,t,n)}}function bs(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){xs(e,t,n)},function(n){return Ss(e,t,n)}):xs(e,t,n)}function xs(e,t,n){t.status=`fulfilled`,t.value=n,Cs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ys(e,n)))}function Ss(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Cs(t),t=t.next;while(t!==r)}e.action=null}function Cs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ws(e,t){return t}function Ts(e,t){if($i){var n=Xu.formState;if(n!==null){a:{var r=Fo;if($i){if(Qi){b:{for(var i=Qi,a=ta;i.nodeType!==8;)if(!a||(i=um(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Qi=um(i.nextSibling),r=i.data===`F!`;break a}}K(r)}r=!1}r&&(t=n[0])}}return n=es(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ws,lastRenderedState:t},n.queue=r,n=rc.bind(null,Fo,r),r.dispatch=n,r=gs(!1),a=ac.bind(null,Fo,!1,r.queue),r=es(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=vs.bind(null,Fo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Es(e){return Ds(ts(),Io,e)}function Ds(e,t,n){if(t=cs(e,t,ws)[0],e=ss(os)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=rs(t)}catch(e){throw e===Ua?Ga:e}else r=t;t=ts();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Fo.flags|=2048,As(9,{destroy:void 0},Os.bind(null,i,n),null)),[r,a,e]}function Os(e,t){e.action=t}function ks(e){var t=ts(),n=Io;if(n!==null)return Ds(t,n,e);ts(),t=t.memoizedState,n=ts();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function As(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Fo.updateQueue,t===null&&(t=ns(),Fo.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 js(){return ts().memoizedState}function Ms(e,t,n,r){var i=es();Fo.flags|=e,i.memoizedState=As(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ns(e,t,n,r){var i=ts();r=r===void 0?null:r;var a=i.memoizedState.inst;Io!==null&&r!==null&&Ko(r,Io.memoizedState.deps)?i.memoizedState=As(t,a,n,r):(Fo.flags|=e,i.memoizedState=As(1|t,a,n,r))}function Ps(e,t){Ms(8390656,8,e,t)}function Fs(e,t){Ns(2048,8,e,t)}function Is(e){Fo.flags|=4;var t=Fo.updateQueue;if(t===null)t=ns(),Fo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ls(e){var t=ts().memoizedState;return Is({ref:t,nextImpl:e}),function(){if(Yu&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Rs(e,t){return Ns(4,2,e,t)}function zs(e,t){return Ns(4,4,e,t)}function Bs(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 Vs(e,t,n){n=n==null?null:n.concat([e]),Ns(4,4,Bs.bind(null,t,e),n)}function Hs(){}function Us(e,t){var n=ts();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Ko(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ws(e,t){var n=ts();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Ko(t,r[1]))return r[0];if(r=e(),Bo){He(!0);try{e()}finally{He(!1)}}return n.memoizedState=[r,t],r}function Gs(e,t,n){return n===void 0||Po&1073741824&&!(Z&261930)?e.memoizedState=t:(e.memoizedState=n,e=Ad(),Fo.lanes|=e,Q|=e,n)}function Ks(e,t,n,r){return Fr(n,t)?n:yo.current===null?!(Po&106)||Po&1073741824&&!(Z&261930)?(Oc=!0,e.memoizedState=n):(e=Ad(),Fo.lanes|=e,Q|=e,t):(e=Gs(e,n,r),Fr(e,t)||(Oc=!0),e)}function qs(e,t,n,r,i){var a=U.p;U.p=a!==0&&8>a?a:8;var o=H.T,s={};s.types=o===null?null:o.types,H.T=s,ac(e,!1,t,n);try{var c=i(),l=H.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ic(e,t,La(c,r),kd(e)):ic(e,t,r,kd(e))}catch(n){ic(e,t,{then:function(){},status:`rejected`,reason:n},kd())}finally{U.p=a,o!==null&&s.types!==null&&(o.types=s.types),H.T=o}}function Js(){}function Ys(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Xs(e).queue;qs(e,a,t,se,n===null?Js:function(){return Zs(e),n(r)})}function Xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:se},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Zs(e){var t=Xs(e);t.next===null&&(t=e.alternate.memoizedState),ic(e,t.next.queue,{},kd())}function Qs(){return ya(ch)}function $s(){return ts().memoizedState}function ec(){return ts().memoizedState}function tc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kd();e=q(n);var r=uo(t,e,n);r!==null&&(Md(r,t,n),fo(r,t,n)),t={cache:Ea()},e.payload=t;return}t=t.return}}function nc(e,t,n){var r=kd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},oc(e)?sc(t,n):(n=bi(e,t,n,r),n!==null&&(Md(n,e,r),cc(n,t,r)))}function rc(e,t,n){ic(e,t,n,kd())}function ic(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(oc(e))sc(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,Fr(s,o))return yi(e,t,i,0),Xu===null&&vi(),!1}catch{}if(n=bi(e,t,i,r),n!==null)return Md(n,e,r),cc(n,t,r),!0}return!1}function ac(e,t,n,r){if(r={lane:2,revertLane:Nf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},oc(e)){if(t)throw Error(i(479))}else t=bi(e,n,r,2),t!==null&&Md(t,e,2)}function oc(e){var t=e.alternate;return e===Fo||t!==null&&t===Fo}function sc(e,t){zo=Ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ot(e,n)}}var lc={readContext:ya,use:is,useCallback:Go,useContext:Go,useEffect:Go,useImperativeHandle:Go,useLayoutEffect:Go,useInsertionEffect:Go,useMemo:Go,useReducer:Go,useRef:Go,useState:Go,useDebugValue:Go,useDeferredValue:Go,useTransition:Go,useSyncExternalStore:Go,useId:Go,useHostTransitionStatus:Go,useFormState:Go,useActionState:Go,useOptimistic:Go,useMemoCache:Go,useCacheRefresh:Go,useEffectEvent:Go},uc={readContext:ya,use:is,useCallback:function(e,t){return es().memoizedState=[e,t===void 0?null:t],e},useContext:ya,useEffect:Ps,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Ms(4194308,4,Bs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ms(4194308,4,e,t)},useInsertionEffect:function(e,t){Ms(4,2,e,t)},useMemo:function(e,t){var n=es();t=t===void 0?null:t;var r=e();if(Bo){He(!0);try{e()}finally{He(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=es();if(n!==void 0){var i=n(t);if(Bo){He(!0);try{n(t)}finally{He(!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=nc.bind(null,Fo,e),[r.memoizedState,e]},useRef:function(e){var t=es();return e={current:e},t.memoizedState=e},useState:function(e){e=gs(e);var t=e.queue,n=rc.bind(null,Fo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Hs,useDeferredValue:function(e,t){return Gs(es(),e,t)},useTransition:function(){var e=gs(!1);return e=qs.bind(null,Fo,e.queue,!0,!1),es().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Fo,a=es();if($i){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Xu===null)throw Error(i(349));Z&127||ds(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Ps(ps.bind(null,r,o,e),[e]),r.flags|=2048,As(9,{destroy:void 0},fs.bind(null,r,o,n,t),null),n},useId:function(){var e=es(),t=Xu.identifierPrefix;if($i){var n=Gi,r=Wi;n=(r&~(1<<32-Ue(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Vo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Wo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Qs,useFormState:Ts,useActionState:Ts,useOptimistic:function(e){var t=es();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ac.bind(null,Fo,!0,n),n.dispatch=t,[e,t]},useMemoCache:as,useCacheRefresh:function(){return es().memoizedState=tc.bind(null,Fo)},useEffectEvent:function(e){var t=es(),n={impl:e};return t.memoizedState=n,function(){if(Yu&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},dc={readContext:ya,use:is,useCallback:Us,useContext:ya,useEffect:Fs,useImperativeHandle:Vs,useInsertionEffect:Rs,useLayoutEffect:zs,useMemo:Ws,useReducer:ss,useRef:js,useState:function(){return ss(os)},useDebugValue:Hs,useDeferredValue:function(e,t){return Ks(ts(),Io.memoizedState,e,t)},useTransition:function(){var e=ss(os)[0],t=ts().memoizedState;return[typeof e==`boolean`?e:rs(e),t]},useSyncExternalStore:us,useId:$s,useHostTransitionStatus:Qs,useFormState:Es,useActionState:Es,useOptimistic:function(e,t){return _s(ts(),Io,e,t)},useMemoCache:as,useCacheRefresh:ec,useEffectEvent:Ls},fc={readContext:ya,use:is,useCallback:Us,useContext:ya,useEffect:Fs,useImperativeHandle:Vs,useInsertionEffect:Rs,useLayoutEffect:zs,useMemo:Ws,useReducer:ls,useRef:js,useState:function(){return ls(os)},useDebugValue:Hs,useDeferredValue:function(e,t){var n=ts();return Io===null?Gs(n,e,t):Ks(n,Io.memoizedState,e,t)},useTransition:function(){var e=ls(os)[0],t=ts().memoizedState;return[typeof e==`boolean`?e:rs(e),t]},useSyncExternalStore:us,useId:$s,useHostTransitionStatus:Qs,useFormState:ks,useActionState:ks,useOptimistic:function(e,t){var n=ts();return Io===null?(n.baseState=e,[e,n.queue.dispatch]):_s(n,Io,e,t)},useMemoCache:as,useCacheRefresh:ec,useEffectEvent:Ls};function pc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:T({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var mc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=kd(),i=q(r);i.payload=t,n!=null&&(i.callback=n),t=uo(e,i,r),t!==null&&(Md(t,e,r),fo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=kd(),i=q(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=uo(e,i,r),t!==null&&(Md(t,e,r),fo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kd(),r=q(n);r.tag=2,t!=null&&(r.callback=t),t=uo(e,r,n),t!==null&&(Md(t,e,n),fo(t,e,n))}};function hc(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?!Ir(n,r)||!Ir(i,a):!0}function gc(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&&mc.enqueueReplaceState(t,t.state,null)}function _c(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=T({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function vc(e){mi(e)}function yc(e){console.error(e)}function bc(e){mi(e)}function xc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Sc(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 Cc(e,t,n){return n=q(n),n.tag=3,n.payload={element:null},n.callback=function(){xc(e,t)},n}function wc(e){return e=q(e),e.tag=3,e}function Tc(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(){Sc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Sc(t,n,r),typeof i!=`function`&&(gd===null?gd=new Set([this]):gd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ec(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ga(t,n,a,!0),n=Co.current,n!==null){switch(n.tag){case 31:case 13:case 19:return wo===null?Wd():n.alternate===null&&id===0&&(id=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ka?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),pf(e,r,a)),!1;case 22:return n.flags|=65536,r===Ka?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)),pf(e,r,a)),!1}throw Error(i(435,n.tag))}return pf(e,r,a),Wd(),!1}if($i)return t=Co.current,t===null?(r!==na&&(t=Error(i(423),{cause:r}),ca(Ii(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Ii(r,n),a=Cc(e.stateNode,r,a),po(e,a),id!==4&&(id=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==na&&(e=Error(i(422),{cause:r}),ca(Ii(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Ii(o,n),ld===null?ld=[o]:ld.push(o),id!==4&&(id=2),t===null)return!0;r=Ii(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Cc(n.stateNode,r,e),po(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`&&(gd===null||!gd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=wc(a),Tc(a,e,n,r),po(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Dc=Error(i(461)),Oc=!1;function kc(e,t,n,r){t.child=e===null?oo(t,null,n,r):ao(t,e.child,n,r)}function Ac(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 va(t),r=qo(e,t,n,o,a,i),s=Zo(),e!==null&&!Oc?(Qo(e,t,i),il(e,t,i)):($i&&s&&Ji(t),t.flags|=1,kc(e,t,r,i),t.child)}function jc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Di(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Mc(e,t,a,r,i)):(e=Ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!al(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Ir:n,n(o,r)&&e.ref===t.ref)return il(e,t,i)}return t.flags|=1,e=Oi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Mc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Ir(a,r)&&e.ref===t.ref){if(Oc=!1,t.pendingProps=r=a,al(e,i))e.flags&131072&&(Oc=!0);else return t.lanes=e.lanes,il(e,t,i)}}return Bc(e,t,n,r,i)}function Nc(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 Fc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Va(t,a===null?null:a.cachePool),a===null?So():xo(t,a),Do(t);else return r=t.lanes=536870912,Fc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Va(t,null),So(),Oo()):(Va(t,a.cachePool),xo(t,a),Oo(),t.memoizedState=null);return kc(e,t,i,n),t.child}function Pc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Fc(e,t,n,r,i){var a=Ba();return a=a===null?null:{parent:Ta._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Va(t,null),So(),Do(t),e!==null&&ga(e,t,r,!0),t.childLanes=i,null}function Ic(e,t){return t=Yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Lc(e,t,n){return ao(t,e.child,null,n),e=Ic(t,t.pendingProps),e.flags|=2,ko(t),t.memoizedState=null,e}function Rc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if($i){if(r.mode===`hidden`)return e=Ic(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Pc(null,e);if(Eo(t),(e=Qi)?(e=om(e,ta),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ui===null?null:{id:Wi,overflow:Gi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Zi=t,Qi=null)):e=null,e===null)throw K(t);return t.lanes=536870912,null}return Ic(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Eo(t),a){if(t.flags&256)t.flags&=-257,t=Lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Oc||ga(e,t,n,!1),a=(n&e.childLanes)!==0,Oc||a){if(yo.current===null){if(r=Xu,r!==null&&(s=st(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,xi(e,s),Md(r,e,s),Dc;Wd()}t=Lc(e,t,n)}else e=o.treeContext,Qi=um(s.nextSibling),Zi=t,$i=!0,ea=null,ta=!1,e!==null&&Xi(t,e),t=Ic(t,r),t.flags|=134221824;return t}return e=Oi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function zc(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 Bc(e,t,n,r,i){return va(t),n=qo(e,t,n,r,void 0,i),r=Zo(),e!==null&&!Oc?(Qo(e,t,i),il(e,t,i)):($i&&r&&Ji(t),t.flags|=1,kc(e,t,n,i),t.child)}function Vc(e,t,n,r,i,a){return va(t),t.updateQueue=null,n=Yo(t,r,n,i),Jo(e),r=Zo(),e!==null&&!Oc?(Qo(e,t,a),il(e,t,a)):($i&&r&&Ji(t),t.flags|=1,kc(e,t,n,a),t.child)}function Hc(e,t,n,r,i){if(va(t),t.stateNode===null){var a=wi,o=n.contextType;typeof o==`object`&&o&&(a=ya(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=mc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},co(t),o=n.contextType,a.context=typeof o==`object`&&o?ya(o):wi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(pc(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&&mc.enqueueReplaceState(a,a.state,null),go(t,r,a,i),ho(),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=_c(n,s);a.props=c;var l=a.context,u=n.contextType;o=wi,typeof u==`object`&&u&&(o=ya(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)&&gc(t,a,r,o),so=!1;var f=t.memoizedState;a.state=f,go(t,r,a,i),ho(),l=t.memoizedState,s||f!==l||so?(typeof d==`function`&&(pc(t,n,d,r),l=t.memoizedState),(c=so||hc(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,lo(e,t),o=t.memoizedProps,u=_c(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=wi,typeof l==`object`&&l&&(c=ya(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)&&gc(t,a,r,c),so=!1,f=t.memoizedState,a.state=f,go(t,r,a,i),ho();var p=t.memoizedState;o!==d||f!==p||so||e!==null&&e.dependencies!==null&&_a(e.dependencies)?(typeof s==`function`&&(pc(t,n,s,r),p=t.memoizedState),(u=so||hc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&_a(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,zc(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=ao(t,e.child,null,i),t.child=ao(t,null,n,i)):kc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=il(e,t,i),e}function Uc(e,t,n,r){return oa(),t.flags|=256,kc(e,t,n,r),t.child}var Wc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gc(e){return{baseLanes:e,cachePool:Ha()}}function Kc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=sd),e}function qc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Ao.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if($i){if(i?To(t):Oo(),(e=Qi)?(e=om(e,ta),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ui===null?null:{id:Wi,overflow:Gi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Zi=t,Qi=null)):e=null,e===null)throw K(t);return t.lanes=cm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Oo(),i=t.mode,a=Yc({mode:`hidden`,children:a},i),r=ji(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Gc(n),r.childLanes=Kc(e,o,n),t.memoizedState=Wc,Pc(null,r)):(To(t),Jc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return Zc(e,t,a,o,r,c,s,n)}return i?(Oo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Oi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=ji(i,a,n,null),i.flags|=2):i=Oi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Pc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Gc(n):(a=i.cachePool,a===null?a=Ha():(s=Ta._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Kc(e,o,n),t.memoizedState=Wc,Pc(e.child,r)):(To(t),n=e.child,e=n.sibling,n=Oi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Jc(e,t){return t=Yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Yc(e,t){return e=Ei(22,e,null,t),e.lanes=0,e}function Xc(e,t,n){return ao(t,e.child,null,n),e=Jc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zc(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(To(t),t.flags&=-257,Xc(e,t,c)):t.memoizedState===null?(Oo(),o=a.fallback,s=t.mode,a=Yc({mode:`visible`,children:a.children},s),o=ji(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,ao(t,e.child,null,c),a=t.child,a.memoizedState=Gc(c),a.childLanes=Kc(e,r,c),t.memoizedState=Wc,Pc(null,a)):(Oo(),t.child=e.child,t.flags|=128,null);if(To(t),cm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,ca({value:a,source:null,stack:null})),Xc(e,t,c)}if(Oc||ga(e,t,c,!1),r=(c&e.childLanes)!==0,Oc||r){if(yo.current!==null)return Xc(e,t,c);if(r=Xu,r!==null&&(a=st(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,xi(e,a),Md(r,e,a),Dc;return sm(o)||Wd(),Xc(e,t,c)}return sm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,Qi=um(o.nextSibling),Zi=t,$i=!0,ea=null,ta=!1,e!==null&&Xi(t,e),t=Jc(t,a.children),t.flags|=134221824,t)}function Qc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ma(e.return,t,n)}function $c(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&No(n)===null&&(t=e),e=e.sibling}return t}function el(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 tl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function nl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Ao.current;if(t.flags&128)return jo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,jo(t,o),i===`backwards`&&e!==null?(tl(e),kc(e,t,r,n),tl(e)):kc(e,t,r,n),r=$i?Bi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Qc(e,n,t);else if(e.tag===19)Qc(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`backwards`:n=$c(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,tl(t)),el(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&No(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}el(t,!0,n,null,a,r);break;case`together`:el(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=$c(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),el(t,!1,i,n,a,r)}return t.child}function rl(e,t,n){var r=t.pendingProps;return fa(t,t.type,r.value),kc(e,t,r.children,n),t.child}function il(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Q|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ga(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=Oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function al(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&_a(e)))}function ol(e,t,n){switch(t.tag){case 3:he(t,t.stateNode.containerInfo),fa(t,Ta,e.memoizedState.cache),oa();break;case 27:case 5:_e(t);break;case 4:he(t,t.stateNode.containerInfo);break;case 10:fa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Eo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return To(t),t.flags|=128,null;r=ga(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?qc(e,t,n):(To(t),e=il(e,t,n),e===null?null:e.sibling)}To(t);break;case 19:if(t.flags&128)return nl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(ga(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return nl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),jo(t,Ao.current),r)break;return null;case 22:return t.lanes=0,Nc(e,t,n,t.pendingProps);case 24:fa(t,Ta,e.memoizedState.cache)}return il(e,t,n)}function sl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Oc=!0;else{if(!al(e,n)&&!(t.flags&128))return Oc=!1,ol(e,t,n);Oc=!!(e.flags&131072)}}else Oc=!1,$i&&t.flags&1048576&&qi(t,Bi,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`)Di(e)?(r=_c(e,r),t.tag=1,t=Hc(null,t,e,r,n)):(t.tag=0,t=Bc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===P){t.tag=11,t=Ac(null,t,e,r,n);break a}if(a===L){t.tag=14,t=jc(null,t,e,r,n);break a}if(a===N){t.tag=10,t.type=e,t=rl(null,t,n);break a}}throw t=ae(e)||e,Error(i(306,t,``))}}return t;case 0:return Bc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=_c(r,t.pendingProps),Hc(e,t,r,a,n);case 3:a:{if(he(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,lo(e,t),go(t,r,null,n);var s=t.memoizedState;if(r=s.cache,fa(t,Ta,r),r!==o.cache&&ha(t,[Ta],n,!0),ho(),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=Uc(e,t,r,n);break a}if(r!==a){a=Ii(Error(i(424)),t),ca(a),t=Uc(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(Qi=um(e.firstChild),Zi=t,$i=!0,ea=null,ta=!0,n=oo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(oa(),r===a){t=il(e,t,n);break a}kc(e,t,r,n)}t=t.child}return t;case 26:return zc(e,t),e===null?(n=Pm(t.type,null,t.pendingProps,null))?t.memoizedState=n:$i||(t.stateNode=pp(t.type,t.pendingProps,pe.current,t)):t.memoizedState=Pm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return _e(t),e===null&&$i&&(r=t.stateNode=gm(t.type,t.pendingProps,pe.current),Zi=t,ta=!0,a=Qi,Cp(t.type)?(dm=a,Qi=um(r.firstChild)):Qi=a),kc(e,t,t.pendingProps.children,n),zc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&$i&&((a=r=Qi)&&(r=im(r,t.type,t.pendingProps,ta),r===null?a=!1:(t.stateNode=r,Zi=t,Qi=um(r.firstChild),ta=!1,a=!0)),a||K(t)),_e(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,mp(a,o)?r=null:s!==null&&mp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=qo(e,t,Xo,null,null,n),ch._currentValue=a),zc(e,t),kc(e,t,r,n),t.child;case 6:return e===null&&$i&&((e=n=Qi)&&(n=am(n,t.pendingProps,ta),n===null?e=!1:(t.stateNode=n,Zi=t,Qi=null,e=!0)),e||K(t)),null;case 13:return qc(e,t,n);case 4:return he(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ao(t,null,r,n):kc(e,t,r,n),t.child;case 11:return Ac(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,zc(e,t),kc(e,t,r,n),t.child;case 8:return kc(e,t,t.pendingProps.children,n),t.child;case 12:return kc(e,t,t.pendingProps.children,n),t.child;case 10:return rl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,va(t),a=ya(a),r=r(a),t.flags|=1,kc(e,t,r,n),t.child;case 14:return jc(e,t,t.type,t.pendingProps,n);case 15:return Mc(e,t,t.type,t.pendingProps,n);case 19:return nl(e,t,n);case 31:return Rc(e,t,n);case 22:return Nc(e,t,n,t.pendingProps);case 24:return va(t),r=ya(Ta),e===null?(a=Ba(),a===null&&(a=Xu,o=Ea(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},co(t),fa(t,Ta,a)):((e.lanes&n)!==0&&(lo(e,t),go(t,null,null,n),ho()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,fa(t,Ta,r),r!==a.cache&&ha(t,[Ta],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),fa(t,Ta,r))),kc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:$i&&Ji(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:zc(e,t),kc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function cl(e){e.flags|=4}function ll(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Ym(t,r):Ym(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Vd())e.flags|=8192;else throw Xa=Ka,Wa}}else e.flags&=-16777217}function ul(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Xm(t)){if(Vd())e.flags|=8192;else throw Xa=Ka,Wa}}function dl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:tt(),e.lanes|=t,cd|=t)}function fl(e,t){if(!$i)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,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;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function pl(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&1206910976,r|=i.flags&1206910976,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 ml(e,t,n){var r=t.pendingProps;switch(Yi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pl(t),null;case 1:return pl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),pa(Ta),ge(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(aa(t)?cl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,sa())),pl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(cl(t),o===null?(pl(t),ll(t,a,null,r,n)):(pl(t),ul(t,o))):o?o===e.memoizedState?(pl(t),t.flags&=-16777217):(cl(t),pl(t),ul(t,o)):(e=e.memoizedProps,e!==r&&cl(t),pl(t),ll(t,a,e,r,n)),null;case 27:if(ve(t),n=pe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return pl(t),t.subtreeFlags&=-33554433,null}e=de.current,aa(t)?ra(t,e):(e=gm(a,r,n),t.stateNode=e,cl(t))}return pl(t),t.subtreeFlags&=-33554433,null;case 5:if(ve(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return pl(t),t.subtreeFlags&=-33554433,null}if(o=de.current,aa(t))ra(t,o);else{var s=up(pe.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[pt]=t,o[mt]=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(rp(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&&cl(t)}}return pl(t),t.subtreeFlags&=-33554433,ll(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=pe.current,aa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Zi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[pt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||K(t,!0)}else e=up(e).createTextNode(r),e[pt]=t,t.stateNode=e}return pl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=aa(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[pt]=t}else oa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pl(t),e=!1}else n=sa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ko(t),t):(ko(t),null);if(t.flags&128)throw Error(i(558))}return pl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=aa(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[pt]=t}else oa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pl(t),a=!1}else a=sa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ko(t),t):(ko(t),null)}return ko(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),dl(t,t.updateQueue),pl(t),null);case 4:return ge(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,pl(t),null;case 10:return pa(t.type),pl(t),null;case 19:if(Mo(t),r=t.memoizedState,r===null)return pl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)fl(r,!1);else{if(id!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=No(e),o!==null){for(t.flags|=128,fl(r,!1),e=o.updateQueue,t.updateQueue=e,dl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ki(n,e),n=n.sibling;return jo(t,Ao.current&1|2),$i&&Ki(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&je()>md&&(t.flags|=128,a=!0,fl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=No(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,dl(t,e),fl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!$i)return pl(t),null}else 2*je()-r.renderingStartTime>md&&n!==536870912&&(t.flags|=128,a=!0,fl(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)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=je(),e.sibling=null,o=Ao.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||$i?jo(t,o):(n=o,ue(Co,t),ue(Ao,n),wo===null&&(wo=t)),$i&&Ki(t,r.treeForkCount),e}return pl(t),null;case 22:case 23:return ko(t),J(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(pl(t),t.subtreeFlags&6&&(t.flags|=8192)):pl(t),n=t.updateQueue,n!==null&&dl(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&&le(za),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),pa(Ta),pl(t),null;case 25:return null;case 30:return t.flags|=33554432,pl(t),null}throw Error(i(156,t.tag))}function hl(e,t){switch(Yi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pa(Ta),ge(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ve(t),null;case 31:if(t.memoizedState!==null){if(ko(t),t.alternate===null)throw Error(i(340));oa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ko(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));oa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Mo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return ge(),null;case 10:return pa(t.type),null;case 22:case 23:return ko(t),J(),e!==null&&le(za),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return pa(Ta),null;case 25:return null;default:return null}}function gl(e,t){switch(Yi(t),t.tag){case 3:pa(Ta),ge();break;case 26:case 27:case 5:ve(t);break;case 4:ge();break;case 31:t.memoizedState!==null&&ko(t);break;case 13:ko(t);break;case 19:Mo(t);break;case 10:pa(t.type);break;case 22:case 23:ko(t),J(),e!==null&&le(za);break;case 24:pa(Ta)}}function _l(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){ff(t,t.return,e)}}function vl(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){ff(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ff(t,t.return,e)}}function yl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{vo(t,n)}catch(t){ff(e,e.return,t)}}}function bl(e,t,n){n.props=_c(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ff(e,t,n)}}function Y(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:var i=e.stateNode,a=di(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Fp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Ip(e);p(e.child,!1,$p,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ff(e,t,n)}}function xl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){ff(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){ff(e,t,n)}else n.current=null}}function Sl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)tm(e.stateNode,t[n])}function X(e){for(var t=e.return;t!==null&&(Tl(t)&&tm(e.stateNode,t.stateNode),!wl(t));)t=t.return}function Cl(e){for(var t=e.return;t!==null&&(Tl(t)&&nm(e.stateNode,t.stateNode),!wl(t));)t=t.return}function wl(e){return e.tag===5||e.tag===3||e.tag===27}function Tl(e){return e&&e.tag===7&&e.stateNode!==null}function El(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){ff(e,e.return,t)}}function Dl(e,t,n){try{var r=e.stateNode;ap(r,e.type,n,t),r[mt]=t}catch(t){ff(e,e.return,t)}}function Ol(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Cp(e.type)||e.tag===4}function kl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ol(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&&Cp(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 Al(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=un)),Sl(e,r),Lt=!0;else if(i!==4&&(i===27&&(Sl(e,r),r=null,Cp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Al(e,t,n,r),e=e.sibling;e!==null;)Al(e,t,n,r),e=e.sibling}function jl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Sl(e,r),Lt=!0;else if(i!==4&&(i===27&&(Sl(e,r),r=null,Cp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(jl(e,t,n,r),e=e.sibling;e!==null;)jl(e,t,n,r),e=e.sibling}function Ml(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);rp(t,r,n),t[pt]=e,t[mt]=n}catch(t){ff(e,e.return,t)}}var Nl=!1,Pl=null;function Fl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Nl=!0)}var Il=null;function Ll(){var e=Il;return Il=null,e}var Rl=0;function zl(e,t,n,r,i){return Rl=0,Bl(e.child,t,n,r,i)}function Bl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=kp(o);r.push(s),s.view&&(a=!0)}else a||kp(o).view&&(a=!0);Nl=!0,Ep(o,Rl===0?t:t+`_`+Rl,n),Rl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Bl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Vl(e,t){for(;e!==null;)e.tag===5?Dp(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Vl(e.child,t)),e=e.sibling}function Hl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Hl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=pi(t.default,t.share),t!==`none`&&(zl(e,n,t,null,!1)||Vl(e.child,!1))}e=e.sibling}}function Ul(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=di(r,n),a=pi(r.default,n.paired?r.share:r.enter);a===`none`?Hl(e):zl(e,i,a,null,!1)?(Hl(e),n.paired||t||jd(e,r.onEnter)):Vl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ul(e,t),e=e.sibling;else Hl(e)}function Wl(e){if(Pl!==null&&Pl.size!==0){var t=Pl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=pi(n.default,n.share);if(a!==`none`&&(zl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,jd(e,n.onShare)):Vl(e.child,!1)),t.delete(r),t.size===0)break}}}Wl(e)}e=e.sibling}}}function Gl(e){if(e.tag===30){var t=e.memoizedProps,n=di(t,e.stateNode),r=Pl===null?void 0:Pl.get(n),i=pi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(zl(e,n,i,null,!1)?r===void 0?jd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Pl.delete(n),jd(e,t.onShare)):Vl(e.child,!1)),Pl!==null&&Wl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Gl(e),e=e.sibling;else Pl!==null&&Wl(e)}function Kl(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=di(t,e.stateNode);t=pi(t.default,t.update),e.flags&=-5,t!==`none`&&zl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Kl(e);e=e.sibling}}function ql(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Vl(e.child,!1))}ql(e)}e=e.sibling}}function Jl(e){if(e.tag===30)e.stateNode.paired=null,Vl(e.child,!1),ql(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Jl(e),e=e.sibling;else ql(e)}function Yl(e){for(e=e.child;e!==null;)e.tag===30?Vl(e.child,!1):e.subtreeFlags&33554432&&Yl(e),e=e.sibling}function Xl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Rl<a.length){var l=a[Rl],u=kp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Ep(c,Rl===0?n:n+`_`+Rl,i),s&&e.flags&4||(Il===null&&(Il=[]),Il.push(c,Rl===0?r:r+`_`+Rl,t.memoizedProps)),Rl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Xl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Zl(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=di(n,r),a=pi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Ap)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Rl=0,i=Xl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||jd(e,n.onUpdate))}else e.subtreeFlags&33554432&&Zl(e,t);e=e.sibling}}var Ql=!1,$l=!1,eu=!1,tu=!1,nu=typeof WeakSet==`function`?WeakSet:Set,ru=null,iu=!1,au=!1,ou=!1,su=!1;function cu(e,t,n){if(e=e.containerInfo,cp=_h,e=Vr(e),Hr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(lp={focusedElem:e,selectionRange:r},_h=!1,n=(n&335544064)===n,ru=t,t=n?9270:1024;ru!==null;){if(e=ru,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Gl(r[a]);if(e.alternate===null&&e.flags&2)n&&Fl(e),lu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Gl(r),lu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Fl(e),lu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,ru=r):(n&&Kl(e),lu(n))}}Pl=null}function lu(e){for(;ru!==null;){var t=ru,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=_c(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){ff(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)rm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:rm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=di(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=pi(a.default,a.update),a!==`none`&&zl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,ru=r;break}ru=t.return}}function uu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Au(e,n),r&4&&_l(5,n);break;case 1:if(Au(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ff(n,n.return,e)}else{var i=_c(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ff(n,n.return,e)}}}r&64&&yl(n),r&512&&Y(n,n.return);break;case 3:if(Au(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{vo(e,t)}catch(e){ff(n,n.return,e)}}break;case 27:t===null&&r&4&&Ml(n);case 26:case 5:Au(e,n),t===null&&r&4&&El(n),r&512&&Y(n,n.return);break;case 12:Au(e,n);break;case 31:Au(e,n),r&4&&yu(e,n);break;case 13:Au(e,n),r&4&&bu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=gf.bind(null,n),lm(e,n))));break;case 22:if(r=n.memoizedState!==null||Ql,!r){var a=t!==null&&t.memoizedState!==null||$l;t=Ql,i=$l,Ql=r,($l=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Mu(e,n,r)):Au(e,n),Ql=t,$l=i}break;case 30:Au(e,n),r&512&&Y(n,n.return);break;case 7:r&512&&Y(n,n.return);default:Au(e,n)}}function du(e,t){for(e=e.child;e!==null;)fu(e,t),e=e.sibling}function fu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){ff(e,e.return,t)}pu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Lt=!0}catch(t){ff(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Tp(s,!0):Tp(e.stateNode,!1)}catch(t){ff(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&du(e,t);break;default:du(e,t)}}function pu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:fu(n,r);break a;case 22:n.memoizedState===null&&pu(n,r);break a;default:pu(n,r)}}e=e.sibling}}function mu(e){var t=e.alternate;t!==null&&(e.alternate=null,mu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&St(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 hu=null,gu=!1;function _u(e,t,n){for(n=n.child;n!==null;)vu(e,t,n),n=n.sibling}function vu(e,t,n){if(Ve&&typeof Ve.onCommitFiberUnmount==`function`)try{Ve.onCommitFiberUnmount(Be,n)}catch{}switch(n.tag){case 26:$l||xl(n,t),_u(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!$l&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:$l||xl(n,t),Cl(n);var r=hu,i=gu;Cp(n.type)&&(hu=n.stateNode,gu=!1),_u(e,t,n),_m(n.stateNode,n.type,n.memoizedProps),hu=r,gu=i;break;case 5:$l||xl(n,t),Cl(n);case 6:if(n.tag===6&&Cl(n),r=hu,i=gu,hu=null,_u(e,t,n),hu=r,gu=i,hu!==null){if(gu)try{(hu.nodeType===9?hu.body:hu.nodeName===`HTML`?hu.ownerDocument.body:hu).removeChild(n.stateNode),Lt=!0}catch(e){ff(n,t,e)}else try{hu.removeChild(n.stateNode),Lt=!0}catch(e){ff(n,t,e)}}break;case 18:hu!==null&&(gu?(e=hu,wp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Uh(e)):wp(hu,n.stateNode));break;case 4:r=hu,i=gu,hu=n.stateNode.containerInfo,gu=!0,_u(e,t,n),hu=r,gu=i;break;case 0:case 11:case 14:case 15:vl(2,n,t),$l||vl(4,n,t),_u(e,t,n);break;case 1:$l||(xl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&bl(n,t,r)),_u(e,t,n);break;case 21:_u(e,t,n);break;case 22:$l=(r=$l)||n.memoizedState!==null,_u(e,t,n),$l=r;break;case 30:xl(n,t),_u(e,t,n);break;case 7:$l||xl(n,t),_u(e,t,n);break;default:_u(e,t,n)}}function yu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Uh(e)}catch(e){ff(t,t.return,e)}}}function bu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Uh(e)}catch(e){ff(t,t.return,e)}}function xu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new nu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new nu),t;default:throw Error(i(435,e.tag))}}function Su(e,t){var n=xu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=_f.bind(null,e,t);t.then(r,r)}})}function Cu(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Cp(l.type)){hu=l.stateNode,gu=!1;break a}break;case 5:hu=l.stateNode,gu=!1;break a;case 3:case 4:hu=l.stateNode.containerInfo,gu=!0;break a}l=l.return}if(hu===null)throw Error(i(160));vu(s,c,o),hu=null,gu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Tu(t,e,n),t=t.sibling}var wu=null;function Tu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Cu(t,e,n),Eu(e),a&4&&(vl(3,e,e.return),_l(3,e),vl(5,e,e.return));break;case 1:Cu(t,e,n),Eu(e),a&512&&($l||r===null||xl(r,r.return)),a&64&&Ql&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=wu,Cu(t,e,n),Eu(e),a&512&&($l||r===null||xl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(Ql)e.stateNode=pp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[bt]||r[pt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),rp(r,t,n),r[pt]=e,Dt(r),t=r;break a;case`link`:if(o=Km(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),rp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Km(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),rp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[pt]=e,Dt(r),t=r}e.stateNode=t}}else Ql||qm(o,e.type,e.stateNode)}else e.stateNode=Vm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Dl(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||$l||t.parentNode.removeChild(t)):a.count--,n===null?Ql||qm(o,e.type,e.stateNode):Vm(o,n,e.memoizedProps))}break;case 27:Cu(t,e,n),Eu(e),a&512&&($l||r===null||xl(r,r.return)),r!==null&&a&4&&Dl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=eu,eu=!1,Cu(t,e,n),eu=o,Eu(e),a&512&&($l||r===null||xl(r,r.return)),e.flags&32){t=e.stateNode;try{tn(t,``),Lt=!0}catch(t){ff(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Dl(e,t,r===null?t:r.memoizedProps)),a&1024&&(tu=!0);break;case 6:if(Cu(t,e,n),Eu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Lt=!0}catch(t){ff(e,e.return,t)}}break;case 3:if(Lt=!1,Gm=null,o=wu,wu=xm(t.containerInfo),Cu(t,e,n),wu=o,Eu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Uh(t.containerInfo)}catch(t){ff(e,e.return,t)}tu&&(tu=!1,Du(e)),Lt=!1;break;case 4:a=eu,eu=Ql,r=Rt(),o=wu,wu=xm(e.stateNode.containerInfo),Cu(t,e,n),Eu(e),wu=o,Lt&&au&&(ou=!0),Lt=r,eu=a;break;case 12:Cu(t,e,n),Eu(e);break;case 31:Cu(t,e,n),Eu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Su(e,t)));break;case 13:Cu(t,e,n),Eu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(fd=je()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Su(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=Ql,l=$l,u=eu;Ql=c||o,eu=u||o,$l=l||s,Cu(t,e,n),$l=l,eu=u,Ql=c,Eu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||Ql||$l||(t=s||$l,n=Ql,r=$l,Ql=o||Ql,$l=t,ju(e,2),Ql=n,$l=r),!o&&eu||du(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Su(e,n))));break;case 19:Cu(t,e,n),Eu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Su(e,t)));break;case 30:a&512&&($l||r===null||xl(r,r.return)),a=Rt(),o=au,s=(n&335544064)===n,c=e.memoizedProps,au=s&&pi(c.default,c.update)!==`none`,Cu(t,e,n),Eu(e),s&&r!==null&&Lt&&(e.flags|=4),au=o,Lt=a;break;case 21:break;case 7:a&512&&($l||r===null||xl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Cu(t,e,n),Eu(e)}}function Eu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Ol(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Tl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(wl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;jl(e,kl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(tn(l,``),n.flags&=-33),jl(e,kl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Al(e,kl(e),u,s);break;default:throw Error(i(161))}}catch(t){ff(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Du(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Du(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,_h=!0,t.reset(),_h=!1),e=e.sibling}}function Ou(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)ku(t,e),t=t.sibling;else Zl(t,!1)}function ku(e,t){var n=e.alternate;if(n===null)Ul(e,!1);else switch(e.tag){case 3:if(su=iu=!1,Ll(),Ou(t,e),!iu&&!ou){if(e=Il,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Dp(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),su=!0}Il=null;break;case 5:Ou(t,e);break;case 4:r=iu,iu=!1,Ou(t,e),iu&&(ou=!0),iu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Ou(t,e):Ul(e,!1));break;case 30:r=iu,i=Ll(),iu=!1,Ou(t,e),iu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=di(a,o),o=di(n.memoizedProps,o);var s=pi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Rl=0,t=Xl(e,n,t,o,s,a,!0),Rl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(jd(e,e.memoizedProps.onUpdate),Il=i):i!==null&&(i.push.apply(i,Il),Il=i),iu=e.flags&32?!0:r;break;default:Ou(t,e)}}function Au(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)uu(e,t.alternate,t),t=t.sibling}function ju(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:vl(4,n,n.return),ju(n,r);break;case 1:xl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&bl(n,n.return,i),ju(n,r);break;case 27:r&2&&_m(n.stateNode,n.type,n.memoizedProps);case 5:xl(n,n.return),n.tag!==5&&n.tag!==27||Cl(n),ju(n,r);break;case 6:Cl(n);break;case 26:xl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||$l||i.parentNode.removeChild(i),ju(n,r);break;case 22:n.memoizedState===null&&ju(n,r);break;case 30:xl(n,n.return),ju(n,r);break;case 7:xl(n,n.return);default:ju(n,r)}e=e.sibling}}function Mu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Mu(i,a,n),_l(4,a);break;case 1:if(Mu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ff(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)_o(l[i],c)}catch(e){ff(r,r.return,e)}}s&&o&64&&yl(a),Y(a,a.return);break;case 27:n&2&&Ml(a);case 5:a.tag!==5&&a.tag!==27||X(a),Mu(i,a,n),s&&r===null&&o&4&&El(a),Y(a,a.return);break;case 6:X(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||Ql||qm(xm(c.ownerDocument),a.type,c),Mu(i,a,n),s&&r===null&&o&4&&El(a),Y(a,a.return);break;case 12:Mu(i,a,n);break;case 31:Mu(i,a,n),s&&o&4&&yu(i,a);break;case 13:Mu(i,a,n),s&&o&4&&bu(i,a);break;case 22:a.memoizedState===null&&Mu(i,a,n),Y(a,a.return);break;case 30:Mu(i,a,n),Y(a,a.return);break;case 7:Y(a,a.return);default:Mu(i,a,n)}t=t.sibling}}function Nu(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&&Da(n))}function Pu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Da(e))}function Fu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Iu(e,t,n,r),t=t.sibling;else i&&Yl(t)}function Iu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Jl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Fu(e,t,n,r),a&2048&&_l(9,t);break;case 1:Fu(e,t,n,r);break;case 3:Fu(e,t,n,r),i&&su&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Da(a)));break;case 12:if(a&2048){Fu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){ff(t,t.return,e)}}else Fu(e,t,n,r);break;case 31:Fu(e,t,n,r);break;case 13:Fu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Jl(t),o._visibility&2?Fu(e,t,n,r):(o._visibility|=2,Lu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Jl(s),o._visibility&2?Fu(e,t,n,r):Ru(e,t)),a&2048&&Nu(s,t);break;case 24:Fu(e,t,n,r),a&2048&&Pu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Vl(a.child,!0),Vl(t.child,!0))),Fu(e,t,n,r);break;default:Fu(e,t,n,r)}}function Lu(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:Lu(a,o,s,c,i),_l(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Lu(a,o,s,c,i)):u._visibility&2?Lu(a,o,s,c,i):Ru(a,o),i&&l&2048&&Nu(o.alternate,o);break;case 24:Lu(a,o,s,c,i),i&&l&2048&&Pu(o.alternate,o);break;default:Lu(a,o,s,c,i)}t=t.sibling}}function Ru(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:Ru(n,r),i&2048&&Nu(r.alternate,r);break;case 24:Ru(n,r),i&2048&&Pu(r.alternate,r);break;default:Ru(n,r)}t=t.sibling}}var zu=8192;function Bu(e,t,n){if(e.subtreeFlags&zu)for(e=e.child;e!==null;)Vu(e,t,n),e=e.sibling}function Vu(e,t,n){switch(e.tag){case 26:Bu(e,t,n),e.flags&zu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Qm(n,e)):$m(n,wu,e.memoizedState,e.memoizedProps));break;case 5:Bu(e,t,n),e.flags&zu&&(e=e.stateNode,(t&335544128)===t&&Qm(n,e));break;case 3:case 4:var r=wu;wu=xm(e.stateNode.containerInfo),Bu(e,t,n),wu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=zu,zu=16777216,Bu(e,t,n),zu=r):Bu(e,t,n));break;case 30:if((e.flags&zu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Pl===null&&(Pl=new Map),Pl.set(r,i)}Bu(e,t,n);break;default:Bu(e,t,n)}}function Hu(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 Uu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ru=r,Ku(r,e)}Hu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Wu(e),e=e.sibling}function Wu(e){switch(e.tag){case 0:case 11:case 15:Uu(e),e.flags&2048&&vl(9,e,e.return);break;case 3:Uu(e);break;case 12:Uu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Gu(e)):Uu(e);break;default:Uu(e)}}function Gu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ru=r,Ku(r,e)}Hu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:vl(8,t,t.return),Gu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Gu(t));break;default:Gu(t)}e=e.sibling}}function Ku(e,t){for(;ru!==null;){var n=ru;switch(n.tag){case 0:case 11:case 15:vl(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:Da(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ru=r;else a:for(n=e;ru!==null;){r=ru;var i=r.sibling,a=r.return;if(mu(r),r===n){ru=null;break a}if(i!==null){i.return=a,ru=i;break a}ru=a}}}var qu={getCacheForType:function(e){var t=ya(Ta),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ya(Ta).controller.signal}},Ju=typeof WeakMap==`function`?WeakMap:Map,Yu=0,Xu=null,Zu=null,Z=0,Qu=0,$u=null,ed=!1,td=!1,nd=!1,rd=0,id=0,Q=0,ad=0,od=0,sd=0,cd=0,ld=null,ud=null,dd=!1,fd=0,pd=0,md=1/0,hd=null,gd=null,_d=0,vd=null,yd=null,bd=0,xd=0,Sd=null,Cd=null,wd=null,Td=null,Ed=null,Dd=0,Od=null;function kd(){return Yu&2&&Z!==0?Z&-Z:H.T===null?ut():Nf()}function Ad(){if(sd===0){if(!(Z&536870912)||$i){var e=Je;Je<<=1,!(Je&3932160)&&(Je=262144),sd=e}else sd=536870912}return e=Co.current,e!==null&&(e.flags|=32),sd}function jd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Fp(di(e.memoizedProps,n))),Td===null&&(Td=[]),Td.push(t.bind(null,r))}}function Md(e,t,n){(e===Xu&&(Qu===2||Qu===9)||e.cancelPendingCommit!==null)&&(zd(e,0),Id(e,Z,sd,!1)),rt(e,n),(!(Yu&2)||e!==Xu)&&(e===Xu&&(!(Yu&2)&&(ad|=n),id===4&&Id(e,Z,sd,!1)),Tf(e))}function Nd(e,t,n){if(Yu&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Qe(e,t),a=r?qd(e,t):Gd(e,t,!0),o=r;do{if(a===0){td&&!r&&Id(e,t,0,!1);break}if(n=e.current.alternate,o&&!Fd(n))a=Gd(e,t,!1),o=!1;else{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=ld;var l=c.current.memoizedState.isDehydrated;if(l&&(zd(c,s).flags|=256),s=Gd(c,s,!1),s!==2&&s!==6){if(nd&&!l){c.errorRecoveryDisabledLanes|=o,ad|=o,a=4;break a}o=ud,ud=a,o!==null&&(ud===null?ud=o:ud.push.apply(ud,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){zd(e,0),Id(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&&(t&62914560)!==t)break;case 6:Id(r,t,sd,!ed);break a;case 2:ud=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=fd+300-je(),10<a)){if(Id(r,t,sd,!ed),Ze(r,0,!0)!==0)break a;bd=t,r.timeoutHandle=_p(Pd.bind(null,r,n,ud,hd,dd,t,sd,ad,cd,ed,o,`Throttled`,-0,0),a);break a}Pd(r,n,ud,hd,dd,t,sd,ad,cd,ed,o,null,-0,0)}break}}while(1);Tf(e)}function Pd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:un},Pl=null,Vu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=rh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?fd-je():(a&4194048)===a?pd-je():0,m=th(d,m),m!==null)?(bd=a,e.cancelPendingCommit=m(ef.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Id(e,a,o,!l)):ef(e,t,a,n,r,i,o,s,c,l,u,d)}function Fd(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(!Fr(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 Id(e,t,n,r){t=$e(e,t),t&=~od,t&=~ad,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ue(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&at(e,n,t)}function Ld(){return Yu&6?!0:(Ef(0,!1),!1)}function Rd(){if(Zu!==null){if(Qu===0)var e=Zu.return;else e=Zu,da=ua=null,$o(e),$a=null,eo=0,e=Zu;for(;e!==null;)gl(e.alternate,e),e=e.return;Zu=null}}function zd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,vp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),bd=0,Rd(),Xu=e,Zu=n=Oi(e.current,null),Z=t,Qu=0,$u=null,ed=!1,td=Qe(e,t),nd=!1,cd=sd=od=ad=Q=id=0,ud=ld=null,dd=!1,rd=$e(e,t),vi(),n}function Bd(e,t){Fo=null,H.H=lc,t===Ua||t===Ga?(t=Za(),Qu=3):t===Wa?(t=Za(),Qu=4):Qu=t===Dc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,$u=t,Zu===null&&(id=1,xc(e,Ii(t,e.current)))}function Vd(){var e=Co.current;return e===null?!0:(Z&4194048)===Z?wo===null:(Z&62914560)===Z||Z&536870912?e===wo:!1}function Hd(){var e=H.H;return H.H=lc,e===null?lc:e}function Ud(){var e=H.A;return H.A=qu,e}function Wd(){id=4,ed||(Z&4194048)!==Z&&Co.current!==null||(td=!0),!(Q&134217727)&&!(ad&134217727)||Xu===null||Id(Xu,Z,sd,!1)}function Gd(e,t,n){var r=Yu;Yu|=2;var i=Hd(),a=Ud();(Xu!==e||Z!==t)&&(hd=null,zd(e,t)),t=!1;var o=id;a:do try{if(Qu!==0&&Zu!==null){var s=Zu,c=$u;switch(Qu){case 8:Rd(),o=6;break a;case 3:case 2:case 9:case 6:Co.current===null&&(t=!0);var l=Qu;if(Qu=0,$u=null,Zd(e,s,c,l),n&&td){o=0;break a}break;default:l=Qu,Qu=0,$u=null,Zd(e,s,c,l)}}Kd(),o=id;break}catch(t){Bd(e,t)}while(1);return t&&e.shellSuspendCounter++,da=ua=null,Yu=r,H.H=i,H.A=a,Zu===null&&(Xu=null,Z=0,vi()),o}function Kd(){for(;Zu!==null;)Yd(Zu)}function qd(e,t){var n=Yu;Yu|=2;var r=Hd(),a=Ud();Xu!==e||Z!==t?(hd=null,md=je()+500,zd(e,t)):td=Qe(e,t);a:do try{if(Qu!==0&&Zu!==null){t=Zu;var o=$u;b:switch(Qu){case 1:Qu=0,$u=null,Zd(e,t,o,1);break;case 2:case 9:if(qa(o)){Qu=0,$u=null,Xd(t);break}t=function(){Qu!==2&&Qu!==9||Xu!==e||(Qu=7),Tf(e)},o.then(t,t);break a;case 3:Qu=7;break a;case 4:Qu=5;break a;case 7:qa(o)?(Qu=0,$u=null,Xd(t)):(Qu=0,$u=null,Zd(e,t,o,7));break;case 5:var s=null;switch(Zu.tag){case 26:s=Zu.memoizedState;case 5:case 27:var c=Zu;if(s?Xm(s):c.stateNode.complete){Qu=0,$u=null;var l=c.sibling;if(l!==null)Zu=l;else{var u=c.return;u===null?Zu=null:(Zu=u,Qd(u))}break b}}Qu=0,$u=null,Zd(e,t,o,5);break;case 6:Qu=0,$u=null,Zd(e,t,o,6);break;case 8:Rd(),id=6;break a;default:throw Error(i(462))}}Jd();break}catch(t){Bd(e,t)}while(1);return da=ua=null,H.H=r,H.A=a,Yu=n,Zu===null?(Xu=null,Z=0,vi(),id):0}function Jd(){for(;Zu!==null&&!ke();)Yd(Zu)}function Yd(e){var t=sl(e.alternate,e,rd);e.memoizedProps=e.pendingProps,t===null?Qd(e):Zu=t}function Xd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Vc(n,t,t.pendingProps,t.type,void 0,Z);break;case 11:t=Vc(n,t,t.pendingProps,t.type.render,t.ref,Z);break;case 5:$o(t);var r=t;r===Zi&&($i?(ia(r),r.tag===5&&r.stateNode!=null&&(Qi=r.stateNode)):(ia(r),$i=!0));default:gl(n,t),t=Zu=ki(t,rd),t=sl(n,t,rd)}e.memoizedProps=e.pendingProps,t===null?Qd(e):Zu=t}function Zd(e,t,n,r){da=ua=null,$o(t),$a=null,eo=0;var i=t.return;try{if(Ec(e,i,t,n,Z)){id=1,xc(e,Ii(n,e.current)),Zu=null;return}}catch(t){if(i!==null)throw Zu=i,t;id=1,xc(e,Ii(n,e.current)),Zu=null;return}t.flags&32768?($i||r===1?e=!0:td||Z&536870912?e=!1:(ed=e=!0,(r===2||r===9||r===3||r===6)&&(r=Co.current,r!==null&&r.tag===13&&(r.flags|=16384))),$d(t,e)):Qd(t)}function Qd(e){var t=e;do{if(t.flags&32768){$d(t,ed);return}e=t.return;var n=ml(t.alternate,t,rd);if(n!==null){Zu=n;return}if(t=t.sibling,t!==null){Zu=t;return}Zu=t=e}while(t!==null);id===0&&(id=5)}function $d(e,t){do{var n=hl(e.alternate,e);if(n!==null){n.flags&=32767,Zu=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Zu=e;return}Zu=e=n}while(e!==null);id=6,Zu=null}function ef(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do lf();while(_d!==0);if(Yu&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===Xu&&(Zu=Xu=null,Z=0),yd=t,vd=e,bd=n,Sd=a,Cd=r,tf(e,t,n,s,c,l,f)}}function tf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(xd=s,s|=_i,it(e,n,s,r,i,a),Td=null,(n&335544064)===n?(Ed=Aa(e),r=10262):(Ed=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,vf(Fe,function(){return uf(),null})):(e.callbackNode=null,e.callbackPriority=0),Nl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=H.T,H.T=null,i=U.p,U.p=2,a=Yu,Yu|=4;try{cu(e,t,n)}finally{Yu=a,U.p=i,H.T=r}}_d=1,Nl?wd=Np(o,e.containerInfo,Ed,af,of,rf,sf,uf,nf,null,null):(af(),of(),sf())}function nf(e){if(_d!==0){var t=vd.onRecoverableError;t(e,{componentStack:null})}}function rf(){_d===3&&(_d=0,ku(yd,vd),_d=4)}function af(){if(_d===1){_d=0;var e=vd,t=yd,n=bd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=H.T,H.T=null;var i=U.p;U.p=2;var a=Yu;Yu|=4;try{au=ou=!1,Tu(t,e,n),n=lp;var o=Vr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Br(s.ownerDocument.documentElement,s)){if(c!==null&&Hr(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 _=zr(s,h),v=zr(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}}_h=!!cp,lp=cp=null}finally{Yu=a,U.p=i,H.T=r}}e.current=t,_d=2}}function of(){if(_d===2){_d=0;var e=vd,t=yd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=H.T,H.T=null;var r=U.p;U.p=2;var i=Yu;Yu|=4;try{uu(e,t.alternate,t)}finally{Yu=i,U.p=r,H.T=n}}_d=3}}function sf(){if(_d===4||_d===3){_d=0;var e=wd;wd=null,Ae();var t=vd,n=yd,r=bd,i=Cd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?_d=5:(_d=0,yd=vd=null,cf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(gd=null),lt(r),n=n.stateNode,Ve&&typeof Ve.onCommitFiberRoot==`function`)try{Ve.onCommitFiberRoot(Be,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=H.T,a=U.p,U.p=2,H.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{H.T=n,U.p=a}}if(i=Td,o=Ed,Ed=null,i!==null&&(Td=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);bd&3&&lf(),Tf(t),a=t.pendingLanes,r&261930&&a&42?t===Od?Dd++:(Dd=0,Od=t):(Dd=0,Od=null),Ef(0,!1)}}function cf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Da(t)))}function lf(){return wd!==null&&(wd.skipTransition(),wd=null),af(),of(),sf(),uf()}function uf(){if(_d!==5)return!1;var e=vd,t=xd;xd=0;var n=lt(bd),r=H.T,a=U.p;try{U.p=32>n?32:n,H.T=null,n=Sd,Sd=null;var o=vd,s=bd;if(_d=0,yd=vd=null,bd=0,Yu&6)throw Error(i(331));var c=Yu;if(Yu|=4,Wu(o.current),Iu(o,o.current,s,n),Yu=c,Ef(0,!1),Ve&&typeof Ve.onPostCommitFiberRoot==`function`)try{Ve.onPostCommitFiberRoot(Be,o)}catch{}return!0}finally{U.p=a,H.T=r,cf(e,t)}}function df(e,t,n){t=Ii(n,t),t=Cc(e.stateNode,t,2),e=uo(e,t,2),e!==null&&(rt(e,2),Tf(e))}function ff(e,t,n){if(e.tag===3)df(e,e,n);else for(;t!==null;){if(t.tag===3){df(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(gd===null||!gd.has(r))){e=Ii(n,e),n=wc(2),r=uo(t,n,2),r!==null&&(Tc(n,r,t,e),rt(r,2),Tf(r));break}}t=t.return}}function pf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ju;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)||(nd=!0,i.add(n),e=mf.bind(null,e,t,n),t.then(e,e))}function mf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Xu===e&&(Z&n)===n&&(id===4||id===3&&(Z&62914560)===Z&&300>je()-fd?Yu&2?od|=n:zd(e,0):od|=n,cd===Z&&(cd=0)),Tf(e)}function hf(e,t){t===0&&(t=tt()),e=xi(e,t),e!==null&&(rt(e,t),Tf(e))}function gf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hf(e,n)}function _f(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),hf(e,n)}function vf(e,t){return De(e,t)}var yf=null,bf=null,xf=!1,Sf=!1,Cf=!1,wf=0;function Tf(e){e!==bf&&e.next===null&&(bf===null?yf=bf=e:bf=bf.next=e),Sf=!0,xf||(xf=!0,Mf())}function Ef(e,t){if(!Cf&&Sf){Cf=!0;do for(var n=!1,r=yf;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-Ue(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,jf(r,a))}else a=Z,a=Ze(r,r===Xu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Qe(r,a)||(n=!0,jf(r,a))}r=r.next}while(n);Cf=!1}}function Df(){Of()}function Of(){Sf=xf=!1;var e=0;wf!==0&&gp()&&(e=wf);for(var t=je(),n=null,r=yf;r!==null;){var i=r.next,a=kf(r,t);a===0?(r.next=null,n===null?yf=i:n.next=i,i===null&&(bf=n)):(n=r,(e!==0||a&3)&&(Sf=!0)),r=i}_d!==0&&_d!==5||Ef(e,!1),wf!==0&&(wf=0)}function kf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ue(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=et(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Xu,n=Z,n=Ze(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Qu===2||Qu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Oe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Qe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Oe(r),lt(n)){case 2:case 8:n=Pe;break;case 32:n=Fe;break;case 268435456:n=Le;break;default:n=Fe}return r=Af.bind(null,e),n=De(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Oe(r),e.callbackPriority=2,e.callbackNode=null,2}function Af(e,t){if(_d!==0&&_d!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(lf()&&e.callbackNode!==n)return null;var r=Z;return r=Ze(e,e===Xu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Nd(e,r,t),kf(e,je()),e.callbackNode!=null&&e.callbackNode===n?Af.bind(null,e):null)}function jf(e,t){if(lf())return null;Nd(e,t,!0)}function Mf(){xp(function(){Yu&6?De(Ne,Df):Of()})}function Nf(){if(wf===0){var e=Na;e===0&&(e=qe,qe<<=1,!(qe&261888)&&(qe=256)),wf=e}return wf}function Pf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:ln(e)}function Ff(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Pf((i[mt]||null).action),o=r.submitter;o&&(t=(t=o[mt]||null)?Pf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new jn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(wf!==0){var e=new FormData(i,o);Ys(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var If=0;If<ci.length;If++){var Lf=ci[If];li(Lf.toLowerCase(),`on`+(Lf[0].toUpperCase()+Lf.slice(1)))}li(ei,`onAnimationEnd`),li(ti,`onAnimationIteration`),li(ni,`onAnimationStart`),li(`dblclick`,`onDoubleClick`),li(`focusin`,`onFocus`),li(`focusout`,`onBlur`),li(ri,`onTransitionRun`),li(ii,`onTransitionStart`),li(ai,`onTransitionCancel`),li(oi,`onTransitionEnd`),Mt(`onMouseEnter`,[`mouseout`,`mouseover`]),Mt(`onMouseLeave`,[`mouseout`,`mouseover`]),Mt(`onPointerEnter`,[`pointerout`,`pointerover`]),Mt(`onPointerLeave`,[`pointerout`,`pointerover`]),jt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),jt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),jt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),jt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),jt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),jt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Rf=`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(` `),zf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Rf));function Bf(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){mi(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){mi(e)}i.currentTarget=null,a=c}}}}function Vf(e,t){var n=t[gt];n===void 0&&(n=t[gt]=new Set);var r=e+`__bubble`;n.has(r)||(Gf(t,e,2,!1),n.add(r))}function Hf(e,t,n){var r=0;t&&(r|=4),Gf(n,e,r,t)}var Uf=`_reactListening`+Math.random().toString(36).slice(2);function Wf(e){if(!e[Uf]){e[Uf]=!0,kt.forEach(function(t){t!==`selectionchange`&&(zf.has(t)||Hf(t,!1,e),Hf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uf]||(t[Uf]=!0,Hf(`selectionchange`,!1,t))}}function Gf(e,t,n,r){switch(wh(t)){case 2:var i=vh;break;case 8:i=yh;break;default:i=bh}n=i.bind(null,t,n,e),i=void 0,!bn||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 Kf(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=Ct(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}_n(function(){var r=a,i=fn(n),s=[];a:{var c=si.get(e);if(c!==void 0){var l=jn,u=e;switch(e){case`keypress`:if(En(n)===0)break a;case`keydown`:case`keyup`:l=Zn;break;case`focusin`:u=`focus`,l=Hn;break;case`focusout`:u=`blur`,l=Hn;break;case`beforeblur`:case`afterblur`:l=Hn;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=Bn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Vn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=er;break;case ei:case ti:case ni:l=Un;break;case oi:l=tr;break;case`scroll`:case`scrollend`:l=Nn;break;case`wheel`:l=nr;break;case`copy`:case`cut`:case`paste`:l=Wn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Qn;break;case`submit`:l=$n;break;case`toggle`:case`beforetoggle`:l=rr}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=vn(m,p),g!=null&&d.push(qf(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(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==dn&&(u=n.relatedTarget||n.fromElement)&&(Ct(u)||u[ht]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ct(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Bn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Qn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Tt(c),h=l==null?u:Tt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Ct(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?w(c,l,Yf):null,c!==null&&Xf(s,u,c,d,!1),l!==null&&f!==null&&Xf(s,f,l,d,!0)))}a:{if(c=r?Tt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Cr;else if(_r(c)){if(wr)_=Nr;else{_=jr;var v=Ar}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&on(r.elementType)&&(_=Cr):_=Mr;if(_&&=_(e,r)){vr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Tt(r):window,e){case`focusin`:(_r(v)||v.contentEditable===`true`)&&(Wr=v,Gr=r,Kr=null);break;case`focusout`:Kr=Gr=Wr=null;break;case`mousedown`:qr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:qr=!1,Jr(s,n,i);break;case`selectionchange`:if(Ur)break;case`keydown`:case`keyup`:Jr(s,n,i)}var y;if(ar)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else pr?dr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(cr&&n.locale!==`ko`&&(pr||b!==`onCompositionStart`?b===`onCompositionEnd`&&pr&&(y=Tn()):(Sn=i,Cn=`value`in Sn?Sn.value:Sn.textContent,pr=!0)),v=Jf(r,b),0<v.length&&(b=new Gn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=fr(n),y!==null&&(b.data=y)))),(y=sr?mr(e,n):hr(e,n))&&(b=Jf(r,`onBeforeInput`),0<b.length&&(v=new Gn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Ff(s,e,r,n,i)}Bf(s,t)})}function qf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jf(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=vn(e,n),i!=null&&r.unshift(qf(e,i,a)),i=vn(e,t),i!=null&&r.push(qf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Yf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xf(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=vn(n,a),l!=null&&o.unshift(qf(n,l,c))):i||(l=vn(n,a),l!=null&&o.push(qf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Zf=/\r\n?/g,Qf=/\u0000|\uFFFD/g;function $f(e){return(typeof e==`string`?e:``+e).replace(Zf,`
10
+ `).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function tp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||tn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&tn(e,``+r);else return;break;case`className`:Bt(e,`class`,r);break;case`tabIndex`:Bt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Bt(e,n,r);break;case`style`:an(e,r,o);return;case`data`:if(t!==`object`){Bt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=ln(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`&&tp(e,t,`name`,a.name,a,null),tp(e,t,`formEncType`,a.formEncType,a,null),tp(e,t,`formMethod`,a.formMethod,a,null),tp(e,t,`formTarget`,a.formTarget,a,null)):(tp(e,t,`encType`,a.encType,a,null),tp(e,t,`method`,a.method,a,null),tp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=ln(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=un);return;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;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));o?.__html!==n&&(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=ln(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`credentialless`: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`:Vf(`beforetoggle`,e),Vf(`toggle`,e),zt(e,`popover`,r);break;case`xlinkActuate`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:zt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=sn.get(n)||n,zt(e,n,r);else return}Lt=!0}function np(e,t,n,r,a,o){switch(n){case`style`:an(e,r,o);return;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));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)tn(e,r);else if(typeof r==`number`||typeof r==`bigint`)tn(e,``+r);else return;break;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=un);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!At.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[mt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Lt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):zt(e,n,r)}return}Lt=!0}function rp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Vf(`error`,e),Vf(`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:tp(e,t,o,s,n,null)}}a&&tp(e,t,`srcSet`,n.srcSet,n,null),r&&tp(e,t,`src`,n.src,n,null);return;case`input`:Vf(`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:tp(e,t,r,d,n,null)}}Xt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Vf(`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:tp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Qt(e,!!r,n,!0):Qt(e,!!r,t,!1);return;case`textarea`:for(s in Vf(`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:tp(e,t,s,c,n,null)}en(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:tp(e,t,l,r,n,null)}return;case`dialog`:Vf(`beforetoggle`,e),Vf(`toggle`,e),Vf(`cancel`,e),Vf(`close`,e);break;case`iframe`:case`object`:Vf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Rf.length;r++)Vf(Rf[r],e);break;case`image`:Vf(`error`,e),Vf(`load`,e);break;case`details`:Vf(`toggle`,e);break;case`embed`:case`source`:case`link`:Vf(`error`,e),Vf(`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:tp(e,t,u,r,n,null)}return;default:if(on(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&np(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&tp(e,t,c,r,n,null))}var ip={};function ap(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)||tp(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`:m!==f&&(Lt=!0),o=m;break;case`name`:m!==f&&(Lt=!0),a=m;break;case`checked`:m!==f&&(Lt=!0),u=m;break;case`defaultChecked`:m!==f&&(Lt=!0),d=m;break;case`value`:m!==f&&(Lt=!0),s=m;break;case`defaultValue`:m!==f&&(Lt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&tp(e,t,p,m,r,f)}}Yt(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)||tp(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`:o!==l&&(Lt=!0),p=o;break;case`defaultValue`:o!==l&&(Lt=!0),c=o;break;case`multiple`:o!==l&&(Lt=!0),s=o;default:o!==l&&tp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Qt(e,!!n,n?[]:``,!1):Qt(e,!!n,t,!0)):Qt(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:tp(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`:a!==o&&(Lt=!0),p=a;break;case`defaultValue`:a!==o&&(Lt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&tp(e,t,s,a,r,o)}$t(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:tp(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`:p!==m&&(Lt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:tp(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)&&tp(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:tp(e,t,u,p,r,m)}return;default:if(on(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&np(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||np(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&tp(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||tp(e,t,f,p,r,m)}function op(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function sp(){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&&op(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&&op(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 cp=null,lp=null;function up(e){return e.nodeType===9?e:e.ownerDocument}function dp(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 fp(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 pp(e,t,n,r){return n=up(n).createElement(e),n[pt]=r,n[mt]=t,rp(n,e,t),Dt(n),n}function mp(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 hp=null;function gp(){var e=window.event;return e&&e.type===`popstate`?e!==hp&&(hp=e,!0):(hp=null,!1)}var _p=typeof setTimeout==`function`?setTimeout:void 0,vp=typeof clearTimeout==`function`?clearTimeout:void 0,yp=typeof Promise==`function`?Promise:void 0,bp=typeof requestAnimationFrame==`function`?requestAnimationFrame:_p,xp=typeof queueMicrotask==`function`?queueMicrotask:yp===void 0?_p:function(e){return yp.resolve(null).then(e).catch(Sp)};function Sp(e){setTimeout(function(){throw e})}function Cp(e){return e===`head`}function wp(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),Uh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)vm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,vm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[bt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&vm(e.ownerDocument.body)}n=i}while(n);Uh(t)}function Tp(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 Ep(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Dp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Op(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function kp(e){return Op(e.getBoundingClientRect(),getComputedStyle(e),e)}function Ap(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Op(t,n,e)}function jp(e){return e.documentElement.clientHeight}function Mp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Np(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(jp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Zm(f),u>eh){s.length=o;break}f=new Promise(Mp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Pp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Pp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Pp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Pp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Fp(e){return{name:e,group:new Pp(`group`,e),imagePair:new Pp(`image-pair`,e),old:new Pp(`old`,e),new:new Pp(`new`,e)}}function Ip(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Ip.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Vp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=zp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),p(this._fragmentFiber.child,!1,Lp,e,s,r)}this._eventListeners=a}};function Lp(e,t,n,r){return v(e).addEventListener(t,n,r),!1}Ip.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Vp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=zp(i.optionsOrUseCapture),p(this._fragmentFiber.child,!1,Rp,e,n,i),r.splice(t,1),a!==null&&a()}};function Rp(e,t,n,r){return v(e).removeEventListener(t,n,r),!1}function zp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Bp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Vp(e,t,n,r){if(e.length===0)return-1;r=Bp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Bp(a.optionsOrUseCapture)===r)return i}return-1}Ip.prototype.dispatchEvent=function(e){var t=m(this._fragmentFiber);if(t===null)return!0;t=v(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Ip.prototype.focus=function(e){p(this._fragmentFiber.child,!0,Hp,e,void 0,void 0)};function Hp(e,t){return e.tag!==6&&(e=v(e),mm(e,t))}Ip.prototype.focusLast=function(e){var t=[];p(this._fragmentFiber.child,!0,Up,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Hp(t[n],e);n--);};function Up(e,t){return t.push(e),!1}Ip.prototype.blur=function(){var e=m(this._fragmentFiber);e!==null&&(e=v(e),e=up(e).activeElement,e!==null&&p(this._fragmentFiber.child,!1,Wp,e,void 0,void 0))};function Wp(e,t){return e.tag!==6&&(e=v(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Ip.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),p(this._fragmentFiber.child,!1,Gp,e,void 0,void 0)};function Gp(e,t){return e.tag===6||(e=v(e),t.observe(e)),!1}Ip.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),p(this._fragmentFiber.child,!1,Kp,e,void 0,void 0);for(var n=t=0;n<qp.length;n++){var r=qp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):qp[t++]=r}qp.length=t}};function Kp(e,t){return e.tag===6||(e=v(e),t.unobserve(e)),!1}var qp=[],Jp=!1;function Yp(e,t,n){qp.push({fragmentInstance:e,observer:t,instance:n}),Jp||(Jp=!0,hm(function(){Jp=!1;var e=qp;qp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Ip.prototype.getClientRects=function(){var e=[];return p(this._fragmentFiber.child,!1,Xp,e,void 0,void 0),e};function Xp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=v(e),t.push.apply(t,e.getClientRects());return!1}Ip.prototype.getRootNode=function(e){var t=m(this._fragmentFiber);return t===null?this:v(t).getRootNode(e)},Ip.prototype.compareDocumentPosition=function(e){var t=m(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];p(this._fragmentFiber.child,!1,Up,n,void 0,void 0);var r=v(t);if(n.length===0){if(n=r,h(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=g(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=v(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=v(n[0]),i=v(n[n.length-1]);var a=h(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Zp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Zp(e,t,n,r,i){var a=Ct(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=m(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=w(n,a,C),t===null?t=!1:(p(t,!0,x,a,n),a=y,y=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=w(r,a,C),t===null?t=!1:(p(t,!0,S,a,r),a=y,b=y=null,t=a!==null)),t):!1}function Qp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Ip.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];p(this._fragmentFiber.child,!1,Up,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=g(this._fragmentFiber);if(r=n?r[1]||r[0]||m(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=v(r),Qp(e,n);return}if(r=v(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=v(a),Qp(a,n)):v(a).scrollIntoView(e),r+=n?-1:1}};function $p(e,t){return e=v(e),em(e,t),!1}function em(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<qp.length;i++){var a=qp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(qp[r++]=a)}qp.length=r,n.observe(e)}),em(e,t))}function nm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Yp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function rm(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`:rm(n),St(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function im(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[bt])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=um(e.nextSibling),e===null)break}return null}function am(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=um(e.nextSibling),e===null))return null;return e}function om(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=um(e.nextSibling),e===null))return null;return e}function sm(e){return e.data===`$?`||e.data===`$~`}function cm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function lm(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 um(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 dm=null;function fm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return um(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function pm(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 mm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function hm(e){bp(function(){bp(function(t){return e(t)})})}function gm(e,t,n){switch(t=up(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 _m(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&tp(e,t,r,null,ip,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===un&&(e.onclick=null),St(e)}function vm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);St(e)}var ym=new Map,bm=new Set;function xm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Sm=U.d;U.d={f:Cm,r:wm,D:Dm,C:Om,L:km,m:Am,X:Mm,S:jm,M:Nm};function Cm(){var e=Sm.f(),t=Ld();return e||t}function wm(e){var t=wt(e);t!==null&&t.tag===5&&t.type===`form`?Zs(t):Sm.r(e)}var Tm=typeof document>`u`?null:document;function Em(e,t,n){var r=Tm;if(r&&typeof t==`string`&&t){var i=Jt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),bm.has(i)||(bm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),rp(t,`link`,e),Dt(t),r.head.appendChild(t)))}}function Dm(e){Sm.D(e),Em(`dns-prefetch`,e,null)}function Om(e,t){Sm.C(e,t),Em(`preconnect`,e,t)}function km(e,t,n){Sm.L(e,t,n);var r=Tm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Jt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Jt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Jt(n.imageSizes)+`"]`)):i+=`[href="`+Jt(e)+`"]`;var a=i;switch(t){case`style`:a=Fm(e);break;case`script`:a=zm(e)}if(!(ym.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),ym.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Im(a))||t===`script`&&r.querySelector(Bm(a))))){var o=r.createElement(`link`);rp(o,`link`,e),t===`style`&&(o[xt]=!0,o.onload=o.onerror=function(){Ot(o)}),Dt(o),r.head.appendChild(o)}}}function Am(e,t){Sm.m(e,t);var n=Tm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Jt(r)+`"][href="`+Jt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=zm(e)}if(!ym.has(a)&&(e=T({rel:`modulepreload`,href:e},t),ym.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Bm(a)))return}r=n.createElement(`link`),rp(r,`link`,e),Dt(r),n.head.appendChild(r)}}}function jm(e,t,n){Sm.S(e,t,n);var r=Tm;if(r&&e){var i=Et(r).hoistableStyles,a=Fm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Im(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=ym.get(a))&&Um(e,n);var c=o=r.createElement(`link`);Dt(c),rp(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,Hm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Mm(e,t){Sm.X(e,t);var n=Tm;if(n&&e){var r=Et(n).hoistableScripts,i=zm(e),a=r.get(i);a||(a=n.querySelector(Bm(i)),a||(e=T({src:e,async:!0},t),(t=ym.get(i))&&Wm(e,t),a=n.createElement(`script`),Dt(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t){Sm.M(e,t);var n=Tm;if(n&&e){var r=Et(n).hoistableScripts,i=zm(e),a=r.get(i);a||(a=n.querySelector(Bm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=ym.get(i))&&Wm(e,t),a=n.createElement(`script`),Dt(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pm(e,t,n,r){var a=(a=pe.current)?xm(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`?(n=Fm(n.href),t=Et(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,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=Fm(n.href);var o=Et(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(Im(e)))?o._p||(s.instance=o,s.state.loading=5):(o=ym.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ym.set(e,o)),Rm(a,e,o,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`?(n=zm(n),t=Et(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Fm(e){return`href="`+Jt(e)+`"`}function Im(e){return`link[rel="stylesheet"][`+e+`]`}function Lm(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Rm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[xt]){r.loading=1;return}}else t=e.createElement(`link`),t[xt]=!0,t.onload=t.onerror=Ot.bind(null,t),rp(t,`link`,n),Dt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function zm(e){return`[src="`+Jt(e)+`"]`}function Bm(e){return`script[async]`+e}function Vm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Jt(n.href)+`"]`);if(r)return t.instance=r,Dt(r),r;var a=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Dt(r),rp(r,`style`,a),Hm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Fm(n.href);var o=e.querySelector(Im(a));if(o)return t.state.loading|=4,t.instance=o,Dt(o),o;r=Lm(n),(a=ym.get(a))&&Um(r,a),o=(e.ownerDocument||e).createElement(`link`),Dt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),rp(o,`link`,r),t.state.loading|=4,Hm(o,n.precedence,e),t.instance=o;case`script`:return o=zm(n.src),(a=e.querySelector(Bm(o)))?(t.instance=a,Dt(a),a):(r=n,(a=ym.get(o))&&(r=T({},n),Wm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Dt(a),rp(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,Hm(r,n.precedence,e));return t.instance}function Hm(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 Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Wm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Gm=null;function Km(e,t,n){if(Gm===null){var r=new Map,i=Gm=new Map;i.set(n,r)}else i=Gm,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[bt]||a[pt]||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 qm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Jm(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 Ym(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Xm(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Qm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Zm(t),e.suspenseyImages.push(t)),e=ih.bind(e),t.decode().then(e,e))}function $m(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=Fm(r.href),a=t.querySelector(Im(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Dt(a);return}a=t.ownerDocument||t,r=Lm(r),(i=ym.get(i))&&Um(r,i),a=a.createElement(`link`),Dt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),rp(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=rh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var eh=0;function th(e,t){return e.stylesheets&&e.count===0&&oh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&oh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&eh===0&&(eh=62500*sp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&oh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>eh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function nh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)oh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function rh(){this.count--,nh(this)}function ih(){this.imgCount--,nh(this)}var ah=null;function oh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ah=new Map,t.forEach(sh,e),ah=null,rh.call(e))}function sh(e,t){if(!(t.state.loading&4)){var n=ah.get(e);if(n)var r=n.get(null);else{n=new Map,ah.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=rh.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 ch={$$typeof:N,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function lh(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=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function uh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new lh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Ei(3,null,null,t),e.current=a,a.stateNode=e,t=Ea(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},co(a),e}function dh(e){return e?(e=wi,e):wi}function fh(e,t,n,r,i,a){i=dh(i),r.context===null?r.context=i:r.pendingContext=i,r=q(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=uo(e,r,t),n!==null&&(Md(n,e,t),fo(n,e,t))}function ph(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function mh(e,t){ph(e,t),(e=e.alternate)&&ph(e,t)}function hh(e){if(e.tag===13||e.tag===31){var t=xi(e,67108864);t!==null&&Md(t,e,67108864),mh(e,67108864)}}function gh(e){if(e.tag===13||e.tag===31){var t=kd();t=ct(t);var n=xi(e,t);n!==null&&Md(n,e,t),mh(e,t)}}var _h=!0;function vh(e,t,n,r){var i=H.T;H.T=null;var a=U.p;try{U.p=2,bh(e,t,n,r)}finally{U.p=a,H.T=i}}function yh(e,t,n,r){var i=H.T;H.T=null;var a=U.p;try{U.p=8,bh(e,t,n,r)}finally{U.p=a,H.T=i}}function bh(e,t,n,r){if(_h){var i=xh(r);if(i===null)Kf(e,t,r,Sh,n),Nh(e,r);else if(Fh(i,e,t,n,r))r.stopPropagation();else if(Nh(e,r),t&4&&-1<Mh.indexOf(e)){for(;i!==null;){var a=wt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Xe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ue(o);s.entanglements[1]|=c,o&=~c}Tf(a),!(Yu&6)&&(md=je()+500,Ef(0,!1))}}break;case 31:case 13:s=xi(a,2),s!==null&&Md(s,a,2),Ld(),mh(a,2)}if(a=xh(r),a===null&&Kf(e,t,r,Sh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function xh(e){return e=fn(e),Ch(e)}var Sh=null;function Ch(e){if(Sh=null,e=Ct(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 Sh=e,null}function wh(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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Me()){case Ne:return 2;case Pe:return 8;case Fe:case Ie:return 32;case Le:return 268435456;default:return 32}default:return 32}}var Th=!1,Eh=null,Dh=null,Oh=null,kh=new Map,Ah=new Map,jh=[],Mh=`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 Nh(e,t){switch(e){case`focusin`:case`focusout`:Eh=null;break;case`dragenter`:case`dragleave`:Dh=null;break;case`mouseover`:case`mouseout`:Oh=null;break;case`pointerover`:case`pointerout`:kh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ah.delete(t.pointerId)}}function Ph(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=wt(t),t!==null&&hh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Fh(e,t,n,r,i){switch(t){case`focusin`:return Eh=Ph(Eh,e,t,n,r,i),!0;case`dragenter`:return Dh=Ph(Dh,e,t,n,r,i),!0;case`mouseover`:return Oh=Ph(Oh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return kh.set(a,Ph(kh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ah.set(a,Ph(Ah.get(a)||null,e,t,n,r,i)),!0}return!1}function Ih(e){var t=Ct(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,dt(e.priority,function(){gh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,dt(e.priority,function(){gh(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 Lh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);dn=r,n.target.dispatchEvent(r),dn=null}else return t=wt(n),t!==null&&hh(t),e.blockedOn=n,!1;t.shift()}return!0}function Rh(e,t,n){Lh(e)&&n.delete(t)}function zh(){Th=!1,Eh!==null&&Lh(Eh)&&(Eh=null),Dh!==null&&Lh(Dh)&&(Dh=null),Oh!==null&&Lh(Oh)&&(Oh=null),kh.forEach(Rh),Ah.forEach(Rh)}function Bh(e,n){e.blockedOn===n&&(e.blockedOn=null,Th||(Th=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,zh)))}var Vh=null;function Hh(e){Vh!==e&&(Vh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Vh===e&&(Vh=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(Ch(r||n)===null)continue;break}var a=wt(n);a!==null&&(e.splice(t,3),t-=3,Ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Uh(e){function t(t){return Bh(t,e)}Eh!==null&&Bh(Eh,e),Dh!==null&&Bh(Dh,e),Oh!==null&&Bh(Oh,e),kh.forEach(t),Ah.forEach(t);for(var n=0;n<jh.length;n++){var r=jh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<jh.length&&(n=jh[0],n.blockedOn===null);)Ih(n),n.blockedOn===null&&jh.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[mt]||null;if(typeof a==`function`)o||Hh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[mt]||null)s=o.formAction;else if(Ch(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Hh(n)}}}function Wh(){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 Gh(e){this._internalRoot=e}Kh.prototype.render=Gh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;fh(n,kd(),e,t,null,null)},Kh.prototype.unmount=Gh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fh(e.current,2,null,e,null,null),Ld(),t[ht]=null}};function Kh(e){this._internalRoot=e}Kh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ut();e={blockedOn:null,target:e,priority:t};for(var n=0;n<jh.length&&t!==0&&t<jh[n].priority;n++);jh.splice(n,0,e),n===0&&Ih(e)}};var qh=n.version;if(qh!==`19.3.1`)throw Error(i(527,qh,`19.3.1`));U.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:d(e),e=e===null?null:e.stateNode,e};var Jh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:H,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Yh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yh.isDisabled&&Yh.supportsFiber)try{Be=Yh.inject(Jh),Ve=Yh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=vc,s=yc,c=bc;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=uh(e,1,!1,null,null,n,r,null,o,s,c,Wh),e[ht]=t.current,Wf(e),new Gh(t)}})),zn=n(((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=Rn()})),Bn={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};Bn.node;var Vn=R(Bn),Hn={name:`archive`,size:24,node:[[`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`}]]};Hn.node;var Un=R(Hn),Wn={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Wn.node;var Gn=R(Wn),Kn={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};Kn.node;var qn=R(Kn),Jn={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Jn.node;var Yn=R(Jn),Xn={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};Xn.node;var Zn=R(Xn),Qn={name:`bell`,size:24,node:[[`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`}]]};Qn.node;var $n=R(Qn),er={name:`book-open`,size:24,node:[[`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`}]]};er.node;var tr=R(er),nr={name:`brain`,size:24,node:[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4`,key:`5nuw1p`}],[`path`,{d:`M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294`,key:`18ldcf`}],[`path`,{d:`M17.996 5.125a4 4 0 012.526 5.77`,key:`1sdu8q`}],[`path`,{d:`M18 18a4 4 0 002-7.465`,key:`7xqqvr`}],[`path`,{d:`M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517`,key:`t46ysz`}],[`path`,{d:`M6 18a4 4 0 01-2-7.465`,key:`1y2m15`}],[`path`,{d:`M6.004 5.125a4 4 0 00-2.526 5.77`,key:`3cw1ss`}]]};nr.node;var rr=R(nr),ir={name:`bug`,size:24,node:[[`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`}]]};ir.node;var ar=R(ir),or={name:`calendar-clock`,size:24,node:[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338`,key:`7hb8p4`}],[`path`,{d:`M3 9h5.859`,key:`numkqi`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]};or.node;var sr=R(or),cr={name:`captions`,size:24,node:[[`rect`,{width:`18`,height:`14`,x:`3`,y:`5`,rx:`2`,ry:`2`,key:`12ruh7`}],[`path`,{d:`M7 15h4M15 15h2M7 11h2M13 11h4`,key:`1ueiar`}]],aliases:[`subtitles`]};cr.node;var lr=R(cr),ur={name:`chart-column`,size:24,node:[[`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`}]],aliases:[`bar-chart-3`]};ur.node;var dr=R(ur),fr={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};fr.node;var pr=R(fr),mr={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};mr.node;var hr=R(mr),gr={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};gr.node;var _r=R(gr),vr={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};vr.node;var yr=R(vr),br={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};br.node;var xr=R(br),Sr={name:`circle-alert`,size:24,node:[[`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`}]],aliases:[`alert-circle`]};Sr.node;var Cr=R(Sr),wr={name:`circle-check-big`,size:24,node:[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]],aliases:[`check-circle`]};wr.node;var Tr=R(wr),Er={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};Er.node;var Dr=R(Er),Or={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};Or.node;var kr=R(Or),Ar={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Ar.node;var jr=R(Ar),Mr={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};Mr.node;var Nr=R(Mr),Pr={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};Pr.node;var Fr=R(Pr),Ir={name:`code-xml`,size:24,node:[[`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`}]],aliases:[`code-2`]};Ir.node;var Lr=R(Ir),Rr={name:`copy`,size:24,node:[[`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`}]]};Rr.node;var zr=R(Rr),Br={name:`corner-down-right`,size:24,node:[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]};Br.node;var Vr=R(Br),Hr={name:`cpu`,size:24,node:[[`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`}]]};Hr.node;var Ur=R(Hr),Wr={name:`database`,size:24,node:[[`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`}]]};Wr.node;var Gr=R(Wr),Kr={name:`download`,size:24,node:[[`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`}]]};Kr.node;var qr=R(Kr),Jr={name:`ellipsis`,size:24,node:[[`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`}]],aliases:[`more-horizontal`]};Jr.node;var Yr=R(Jr),Xr={name:`external-link`,size:24,node:[[`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`}]]};Xr.node;var Zr=R(Xr),Qr={name:`eye-off`,size:24,node:[[`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`}]]};Qr.node;var $r=R(Qr),ei={name:`eye`,size:24,node:[[`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`}]]};ei.node;var ti=R(ei),ni={name:`file-diff`,size:24,node:[[`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:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]};ni.node;var ri=R(ni),ii={name:`file-down`,size:24,node:[[`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:`M12 18v-6`,key:`17g6i2`}],[`path`,{d:`m9 15 3 3 3-3`,key:`1npd3o`}]]};ii.node;var ai=R(ii),oi={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};oi.node;var si=R(oi),ci={name:`file-output`,size:24,node:[[`path`,{d:`M4.226 20.925A2 2 0 0 0 6 22h12a2 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 2v3.127`,key:`wfxp4w`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 11-3 3`,key:`1dgrs4`}],[`path`,{d:`m5 17-3-3h10`,key:`1mvvaf`}]]};ci.node;var li=R(ci),ui={name:`file-pen`,size:24,node:[[`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`}]],aliases:[`file-edit`]};ui.node;var di=R(ui),fi={name:`file-play`,size:24,node:[[`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:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]],aliases:[`file-video`]};fi.node;var pi=R(fi),mi={name:`file-text`,size:24,node:[[`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`}]]};mi.node;var hi=R(mi),gi={name:`file`,size:24,node:[[`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`}]]};gi.node;var _i=R(gi),vi={name:`folder-open`,size:24,node:[[`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`}]]};vi.node;var yi=R(vi),bi={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`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`}]]};bi.node;var xi=R(bi),Si={name:`folder-search`,size:24,node:[[`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`}]]};Si.node;var Ci=R(Si),wi={name:`folder`,size:24,node:[[`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`}]]};wi.node;var Ti=R(wi),Ei={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};Ei.node;var Di=R(Ei),Oi={name:`git-commit-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]],aliases:[`git-commit`]};Oi.node;var ki=R(Oi),Ai={name:`git-pull-request`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]};Ai.node;var ji=R(Ai),Mi={name:`globe`,size:24,node:[[`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`}]]};Mi.node;var Ni=R(Mi),Pi={name:`hard-drive`,size:24,node:[[`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`}]]};Pi.node;var Fi=R(Pi),Ii={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Ii.node;var Li=R(Ii),Ri={name:`inbox`,size:24,node:[[`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`}]]};Ri.node;var zi=R(Ri),Bi={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};Bi.node;var Vi=R(Bi),Hi={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};Hi.node;var Ui=R(Hi),Wi={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Wi.node;var Gi=R(Wi),Ki={name:`layers`,size:24,node:[[`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`}]],aliases:[`layers-3`]};Ki.node;var qi=R(Ki),Ji={name:`library`,size:24,node:[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]};Ji.node;var Yi=R(Ji),Xi={name:`link-2`,size:24,node:[[`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`}]]};Xi.node;var Zi=R(Xi),Qi={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};Qi.node;var $i=R(Qi),ea={name:`list-checks`,size:24,node:[[`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`}]]};ea.node;var ta=R(ea),na={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};na.node;var K=R(na),ra={name:`mail`,size:24,node:[[`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`}]]};ra.node;var ia=R(ra),aa={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};aa.node;var oa=R(aa),sa={name:`message-circle-question-mark`,size:24,node:[[`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`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};sa.node;var ca=R(sa),la={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};la.node;var ua=R(la),da={name:`monitor`,size:24,node:[[`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`}]]};da.node;var fa=R(da),pa={name:`panel-left-close`,size:24,node:[[`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`}]],aliases:[`sidebar-close`]};pa.node;var ma=R(pa),ha={name:`panel-left-open`,size:24,node:[[`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`}]],aliases:[`sidebar-open`]};ha.node;var ga=R(ha),_a={name:`panel-right-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]};_a.node;var va=R(_a),ya={name:`panel-right-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]};ya.node;var ba=R(ya),xa={name:`pause`,size:24,node:[[`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`}]]};xa.node;var Sa=R(xa),Ca={name:`pen-line`,size:24,node:[[`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`}]],aliases:[`edit-3`]};Ca.node;var wa=R(Ca),Ta={name:`pencil`,size:24,node:[[`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`}]]};Ta.node;var Ea=R(Ta),Da={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};Da.node;var Oa=R(Da),ka={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};ka.node;var Aa=R(ka),ja={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};ja.node;var Ma=R(ja),Na={name:`refresh-cw`,size:24,node:[[`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`}]]};Na.node;var Pa=R(Na),Fa={name:`rotate-ccw`,size:24,node:[[`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`}]]};Fa.node;var Ia=R(Fa),La={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};La.node;var Ra=R(La),za={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};za.node;var Ba=R(za),Va={name:`settings`,size:24,node:[[`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`}]]};Va.node;var Ha=R(Va),Ua={name:`shield-alert`,size:24,node:[[`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`}]]};Ua.node;var Wa=R(Ua),Ga={name:`shield-check`,size:24,node:[[`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`}]]};Ga.node;var Ka=R(Ga),qa={name:`shield-question-mark`,size:24,node:[[`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.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`shield-question`]};qa.node;var Ja=R(qa),Ya={name:`shuffle`,size:24,node:[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]};Ya.node;var Xa=R(Ya),Za={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};Za.node;var Qa=R(Za),$a={name:`sparkles`,size:24,node:[[`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`}]],aliases:[`stars`]};$a.node;var eo=R($a),to={name:`square-pen`,size:24,node:[[`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`}]],aliases:[`pen-box`,`edit`,`pen-square`]};to.node;var no=R(to),ro={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};ro.node;var io=R(ro),ao={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};ao.node;var oo=R(ao),so={name:`trash`,size:24,node:[[`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`}]],aliases:[`trash-2`]};so.node;var co=R(so),lo={name:`triangle-alert`,size:24,node:[[`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`}]],aliases:[`alert-triangle`]};lo.node;var q=R(lo),uo={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};uo.node;var fo=R(uo),po={name:`upload`,size:24,node:[[`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`}]]};po.node;var mo=R(po),ho={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};ho.node;var go=R(ho),_o={name:`wifi-off`,size:24,node:[[`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`}]]};_o.node;var vo=R(_o),yo={name:`wrench`,size:24,node:[[`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`}]]};yo.node;var bo=R(yo),xo={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};xo.node;var So=R(xo),J=t(f(),1),Co=t(zn(),1),wo=e=>Symbol.iterator in e,To=e=>`entries`in e,Eo=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},Do=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done};function Oo(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:wo(e)&&wo(t)?To(e)&&To(t)?Eo(e,t):Do(e,t):Eo({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function ko(e){let t=J.useRef(void 0);return n=>{let r=e(n);return Oo(t.current,r)?t.current:t.current=r}}var Ao={"data-claims-escape":``},jo=[];function Mo(e){if(e.key!==`Escape`||e.defaultPrevented)return;let t=jo[jo.length-1];t&&(e.preventDefault(),t.close?.())}function No(e){return jo.length===0&&document.addEventListener(`keydown`,Mo),jo.push(e),()=>{jo.splice(jo.indexOf(e),1),jo.length===0&&document.removeEventListener(`keydown`,Mo)}}function Po(e){if(e.defaultPrevented||jo.length>0)return!0;let t=e.target;return t instanceof Element&&t.closest(`[data-claims-escape]`)!==null}function Fo(e){(0,J.useEffect)(()=>e?No({}):void 0,[e])}function Io(e,t,n=!0){let r=(0,J.useRef)(t),i=(0,J.useRef)(n);(0,J.useEffect)(()=>{r.current=t,i.current=n}),(0,J.useEffect)(()=>{if(e)return No({close:()=>{i.current&&r.current()}})},[e])}var Lo=14;function Ro({open:e,onClose:t,anchor:n,label:r,placement:i=`above`,align:a=`start`,children:o}){let s=(0,J.useRef)(null),[c,l]=(0,J.useState)(i),[u,d]=(0,J.useState)(null);return(0,J.useLayoutEffect)(()=>{if(!e)return;let t=()=>{let e=n.current?.getBoundingClientRect(),t=s.current;if(!e||!t)return;let r=e.top-Lo,a=window.innerHeight-e.bottom-Lo,o=i===`above`?r:a,c=i===`above`?a:r,u=t.scrollHeight>o&&c>o;l(u?i===`above`?`below`:`above`:i),d(Math.max(0,Math.floor(u?c:o)))};t();let r=new MutationObserver(t);return s.current&&r.observe(s.current,{childList:!0,subtree:!0}),window.addEventListener(`resize`,t),()=>{r.disconnect(),window.removeEventListener(`resize`,t)}},[e,i,n]),Fo(e),(0,J.useEffect)(()=>{if(!e)return;(s.current?.querySelector(`button:not(:disabled), input, [tabindex="0"]`))?.focus();let r=e=>{let r=e.target;s.current?.contains(r)||n.current?.contains(r)||t()},i=e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),t(),n.current?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i,!0),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i,!0)}},[e,t,n]),e?P(`div`,{ref:s,className:`popover popover-${c} popover-${a}`,style:u===null?void 0:{"--popover-room":`${u}px`},role:`dialog`,"aria-label":r,children:o}):null}var zo=8e3,Bo=[],Vo=new Set,Ho=e=>Vo.has(e),Uo=()=>Vo.clear(),Wo=p((e,t)=>({need:null,ensure:async n=>{if(Vo.has(n))return!0;let r=t().need;if(r)return r.job===n&&new Promise(e=>{Bo.push(e)});let i,a;try{i=await Promise.race([Mn(n),new Promise((e,t)=>{a=setTimeout(()=>t(Error(`the check timed out`)),zo)})])}catch(e){return console.warn(`[modelNeeded] could not check the model for ${n}`,e),!0}finally{clearTimeout(a)}if(!i?.needed&&!i?.off)return Vo.add(n),!0;let o=t().need;return o&&o.job!==n?!1:new Promise(t=>{Bo.push(t),o||e({need:i})})},settle:t=>{let n=Bo;Bo=[],e({need:null});for(let e of n)e(t)}})),Go=e=>Wo.getState().ensure(e),Ko=1e3,qo=5e3,Jo=24,Yo=1e3,Xo=3e4,Zo=0,Qo=null,$o=!1,es=null,ts=Yo,ns=0;function rs(){Qo&&clearTimeout(Qo),Qo=null}function is(){es&&clearTimeout(es),es=null}function as(e,t){return!e.model||us(e.model,t)}function os(e,t){let n=++ns;t({pickLoad:{model:e,seconds:0,error:null}});let r=async()=>{let a=await Ht();if(n!==ns)return;let o=Math.floor(a.elapsed_seconds??0);a.state===`warming`?(t({pickLoad:{model:e,seconds:as(a,e)?o:0,error:null}}),setTimeout(()=>{r().catch(i)},Ko)):a.state===`failed`&&as(a,e)?t({pickLoad:{model:e,seconds:o,error:a.error?{reason:a.error}:{key:`banner.pickLoad.noReason`,reason:``}}}):t({pickLoad:null})},i=r=>{n===ns&&(d.system.warn(`Lost track of loading ${e}`,r),t({pickLoad:{model:e,seconds:0,error:{key:`banner.pickLoad.lostTrack`,reason:r instanceof Error?r.message:String(r)}}}))};r().catch(i)}async function ss(e){try{let t=await Zt(`local`);t?.models&&e(t.models)}catch(e){$o=!1,d.system.warn(`Model names unavailable; raw model ids show until the model list loads`,e)}}var cs=p((e,t)=>({active:null,error:null,restoreNotice:null,queued:null,queueError:null,names:{},pickLoad:null,refresh:async()=>{$o||($o=!0,ss(t().rememberNames));try{let n=await W();is(),ts=Yo;let r=n.restore;(r?.status===`pending`||r?.status===`failed`&&r.retry)&&!Qo&&Zo<Jo&&(Zo+=1,Qo=setTimeout(()=>{Qo=null,t().refresh()},qo));let i=(r?.status===`restored`||r?.status===`none`)&&!r.message&&t().restoreNotice?.ok===!1;e({active:n,error:null,...r&&r.status!==`none`&&r.message?{restoreNotice:{ok:r.status===`restored`,message:r.message}}:i?{restoreNotice:null}:{}})}catch(n){e({error:n instanceof Error?n.message:String(n)}),es||(es=setTimeout(()=>{es=null,t().refresh()},ts),ts=Math.min(ts*2,Xo))}},retryNow:()=>{es&&(is(),t().refresh())},select:async t=>{Uo(),rs();let n=await Le(t),r=null;try{r=(await Ft()).sessions}catch(e){d.system.error(`Could not refresh chats after a model switch; the next poll will`,e)}e({active:n,error:null,restoreNotice:null}),n.remote?(ns+=1,e({pickLoad:null})):os(t,e),r?.length&&k.getState().setSessions(r)},queue:t=>e({queued:t,queueError:null}),applyQueued:async()=>{let n=t().queued;if(n)try{await t().select(n),e({queued:null})}catch(t){e({queued:null,queueError:`Couldn't switch to ${ds(n)}: ${t instanceof Error?t.message:String(t)}`})}},rememberNames:n=>{let r={...t().names};for(let e of n)e.display_name&&(r[e.id]=e.display_name);e({names:r})},dismissRestoreNotice:()=>e({restoreNotice:null}),retryPickLoad:async()=>{let n=t().pickLoad?.model;if(n){try{await pe(!0)}catch(t){e({pickLoad:{model:n,seconds:0,error:{key:`banner.pickLoad.startFailed`,reason:t instanceof Error?t.message:String(t)}}});return}os(n,e)}},dismissPickLoad:()=>{ns+=1,e({pickLoad:null})}}));k.subscribe((e,t)=>{t.isStreaming&&!e.isStreaming&&cs.getState().queued&&cs.getState().applyQueued()});function ls(){return cs(e=>e.names)}function us(e,t){if(!e||!t)return!1;let n=e=>e.toLowerCase().replace(/^user\./,``);return n(e)===n(t)}function ds(e){let t=cs.getState();return t.names[e]?t.names[e]:t.active?.model===e&&t.active.display_name?t.active.display_name:vs(e)}function fs(e,t){return e.find(e=>e.id===t)??e[0]}function ps(e,t){let n=!!t?.effective_model&&!!e?.model&&t.effective_model!==e.model;return e?.remote&&!(n&&t?.inference_remote!==void 0)?{remote:!0,label:e.provider===`fireworks`?`Fireworks AI`:`AMD LLM Gateway`,description:null}:t?.inference_remote===!0?{remote:!0,label:t.inference_provider_name||`a cloud provider`,description:t.inference_description??null}:t?.inference_remote===!1?{remote:!1,label:`Local`,description:t.inference_description??null}:t===void 0&&e?.inference_remote===!1?{remote:!1,label:`Local`,description:e.inference_description??null}:null}var ms=`GAIA can't tell whether this chat is answered on this PC or by a cloud provider, so it isn't claiming either.`;function hs(){return ps(cs(e=>e.active),k(e=>fs(e.sessions,e.currentSessionId)))}function gs(e,t,n){return t.find(e=>e.id===n)?.effective_model||e?.model||null}function _s(e){return/^(fireworks|amd)\./.test(e)?e.slice(e.indexOf(`.`)+1):e}function vs(e){let t=_s(e);return t.slice(t.lastIndexOf(`/`)+1)}function ys(e){let t={};for(let n of e)t[n.id]=n.display_name||ds(n.id);let n=new Map;for(let r of e)n.set(t[r.id],[...n.get(t[r.id])??[],r.id]);for(let e of n.values()){if(e.length<2)continue;let n=e.map(e=>_s(e).split(`/`)),r=e;for(let e=1;e<=Math.max(...n.map(e=>e.length));e++){let t=n.map(t=>t.slice(-e).join(`/`));if(new Set(t).size===t.length){r=t;break}}e.forEach((e,n)=>{t[e]=r[n]})}return t}function bs(e){return e===`fireworks`?`Fireworks AI`:e===`amd`?`AMD LLM Gateway`:e}var xs={loaded:`Loaded`,downloaded:`Downloaded, ready to load`,not_downloaded:`Not downloaded`};function Ss(e){return e?.label?e.source===`expected`?`${e.label} (expected)`:e.label:null}function Cs(e){return e?`${Math.round(e/1024)}K`:`unknown`}function ws(e){return e.state??(e.downloaded?`downloaded`:`not_downloaded`)}function Ts(e){let t=e.download_progress?.state;return t===`starting`||t===`downloading`}var Es=3e3,Ds={loaded:`modelStatus.state.loaded`,warming:`modelStatus.state.warming`,idle:`modelStatus.state.idle`,stopped:`modelStatus.state.stopped`},Os={loaded:`modelStatus.pillAria.loaded`,warming:`modelStatus.pillAria.warming`,idle:`modelStatus.pillAria.idle`,stopped:`modelStatus.pillAria.stopped`};function ks(e,t){let n=e.memory;return n?!n.model_gb&&n.free_gb==null?t(`modelStatus.memoryTotal`,{size:`${n.total_gb} GB`,source:n.source}):t.compose(e=>[n.model_gb?e(`modelStatus.memoryUsed`,{size:`~${n.model_gb} GB`}):null,n.free_gb==null?null:e(`modelStatus.memoryFree`,{size:`${n.free_gb} GB`})].filter(Boolean).join(` · `)):e.memory_error}function As(e,t){return e.label?e.source===`expected`?t(`modelStatus.expected`,{label:e.label}):e.label:null}function js(){let e=T(),t=cs(e=>e.active);cs(e=>e.names);let n=hs(),r=k(e=>e.systemStatus),i=k(e=>e.openSettings),a=(0,J.useRef)(null),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(!1),_=(0,J.useCallback)(async()=>{try{l(await at()),d(null)}catch(e){d(e instanceof Error?e.message:String(e))}},[]);(0,J.useEffect)(()=>{if(!o)return;_();let e=setInterval(()=>{_()},Es);return()=>clearInterval(e)},[o,_]);let v=(0,J.useCallback)(async e=>{h(!1),p(!0),d(null);try{await Ue(e),await _()}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}},[_]),y=r?r.lemonade_running?us(r.model_loaded,t?.model)?`loaded`:`idle`:`stopped`:`idle`,b=n?.remote?Fr:n?Ur:kr,x=t?.model?ds(t.model):null,S=[n?.label,x].filter(Boolean).join(` · `)||e(`modelStatus.fallbackName`),C=n?n.description??(n.remote?e(`modelStatus.sentTo`,{name:n.label}):e(`modelStatus.runsHere`)):ms,w=c,E=f||!!w?.restarting,O=!!w&&w.owner!==`gaia`,A=!!w&&!(O&&w.state===`stopped`);return V(`div`,{className:`sb-location-wrap`,children:[V(`button`,{ref:a,type:`button`,className:`sb-location`,onClick:()=>s(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":o,"aria-label":n?.remote?S:e(Os[y],{text:S}),title:x?`${S}. ${C}`:C,children:[P(b,{size:13,"aria-hidden":`true`}),V(`span`,{className:`sb-location-text`,children:[n?.label&&x&&P(`span`,{className:`sb-location-place`,children:n.label}),P(`span`,{className:`sb-location-name`,dir:`auto`,children:x??n?.label??e(`modelStatus.fallbackName`)})]}),!n?.remote&&P(`span`,{className:`sb-location-dot is-${y}`,"aria-hidden":`true`})]}),P(Ro,{open:o,onClose:()=>s(!1),anchor:a,label:e(`modelStatus.label`),placement:`above`,children:V(`div`,{className:`model-status`,children:[!w&&!u&&V(`span`,{children:[P(K,{size:13,className:`spin`}),` `,e(`modelStatus.checking`)]}),w&&V(D.Fragment,{children:[V(`div`,{className:`model-status-head`,children:[P(`span`,{className:`model-status-dot is-${w.state}`,"aria-hidden":`true`}),P(`span`,{role:`status`,children:w.state===`loaded`&&w.busy_reason===`request`?e(`modelStatus.state.loadedAnswering`):e(Ds[w.state])})]}),w.active_remote&&P(`span`,{className:`settings-hint`,children:e(`modelStatus.cloudLine`,{name:w.active_display_name??w.active_model??`—`})}),V(`dl`,{className:`model-status-grid`,children:[P(`dt`,{children:e(`modelStatus.model`)}),P(`dd`,{title:w.model??w.active_model??void 0,children:P(`bdi`,{children:w.display_name??(w.active_remote?`—`:w.active_display_name)??`—`})}),w.placement&&V(D.Fragment,{children:[P(`dt`,{children:e(`modelStatus.runsOn`)}),P(`dd`,{children:P(`bdi`,{children:As(w.placement,e)})})]}),w.state!==`stopped`&&V(D.Fragment,{children:[P(`dt`,{children:e(`modelStatus.memory`)}),P(`dd`,{children:ks(w,e)??e(`modelStatus.unknown`)})]}),w.ctx_size!=null&&V(D.Fragment,{children:[P(`dt`,{children:e(`modelStatus.context`)}),P(`dd`,{children:e(`settings.ctx.tokens`,{size:Cs(w.ctx_size)})})]})]}),w.placement?.warning&&P(`span`,{className:`model-status-warning`,role:`alert`,children:w.placement.warning}),w.error&&P(`span`,{className:`settings-error`,role:`alert`,title:w.error_detail??void 0,children:w.error}),w.restart_error&&P(`span`,{className:`settings-error`,role:`alert`,children:w.restart_error})]}),u&&P(`span`,{className:`settings-error`,role:`alert`,children:u}),m&&w&&V(`div`,{className:`model-status-confirm`,role:`alert`,children:[P(`span`,{children:e(`modelStatus.confirm`,{name:w.display_name??g(`modelStatus.theModel`),url:w.base_url??`—`})}),V(`div`,{className:`model-status-actions`,children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>h(!1),children:e(`modelStatus.cancel`)}),P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void v(!0),children:e(`modelStatus.reloadIt`)})]})]}),V(`div`,{className:`model-status-actions`,children:[V(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{s(!1),i(`model`)},children:[P(Ha,{size:13,"aria-hidden":`true`}),` `,e(`modelStatus.settings`)]}),A&&V(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>O?h(!0):void v(!1),disabled:E||!w||w.busy||w.active_remote&&w.state!==`loaded`,title:w?.busy?w.busy_reason===`warm_up`?e(`modelStatus.busyWarmUp`):e(`modelStatus.busyRequest`):w?.state===`stopped`?e(`modelStatus.startServer`):e(`modelStatus.reload`),children:[E?P(K,{size:13,className:`spin`}):P(Ra,{size:13,"aria-hidden":`true`}),e(E?`modelStatus.restarting`:`modelStatus.restart`)]})]})]})})]})}var Ms=1e3;function Ns(e){return e?e.state===`running`||e.state===`verifying`||!!e.models?.some(e=>e.state===`downloading`||e.state===`verifying`):!1}function Ps(e,t){if(!e)return null;if(e.state===`running`||e.state===`verifying`)return e;let n=(e.models??[]).filter(e=>t.includes(e.id)||e.state===`downloading`||e.state===`failed`||e.state===`cancelled`),r=n.filter(e=>e.state!==`skipped`),i=r.reduce((e,t)=>e+Math.min(t.bytes_done,t.bytes_total),0),a=r.reduce((e,t)=>e+t.bytes_total,0),o=r.filter(e=>e.state===`downloading`).reduce((e,t)=>e+t.speed_bps,0);return{...e,models:n,overall:{bytes_done:i,bytes_total:a,speed_bps:o,eta_s:o>0?Math.round((a-i)/o):null,percent:a?Math.floor(i*100/a):null,failed:r.filter(e=>e.state===`failed`).length}}}var Fs=null;function Is(e){return e instanceof Error?e.message:String(e)}var Ls=p((e,t)=>{let n=()=>{let e=Ns(t().status)||t().queue.length>0;e&&!Fs&&(Fs=setInterval(()=>{t().refresh()},Ms)),!e&&Fs&&(clearInterval(Fs),Fs=null)},r=async()=>{let{status:n,queue:r}=t();if(r.length===0||Ns(n))return;let[i,...a]=r;e({queue:a});try{e({status:await ve(i.id,i),error:null})}catch(t){e({error:Is(t)})}};return{status:null,error:null,queue:[],started:[],refresh:async()=>{try{e({status:await Ce(),error:null})}catch(t){e({error:`Lost contact with GAIA: ${Is(t)}`})}await r(),n()},enqueue:async(t,i={})=>{let a=t.map(e=>({id:e,acknowledgeLowDisk:!!i.acknowledgeLowDisk,keepTrying:!!i.keepTrying}));e(e=>({queue:[...e.queue.filter(e=>!t.includes(e.id)),...a],started:[...new Set([...e.started,...t])],error:null})),await r(),n()},cancel:async n=>{e(e=>({queue:n?e.queue.filter(e=>e.id!==n):[]}));try{await qt(n)}catch(t){e({error:Is(t)})}await t().refresh()}}});function Rs({placement:e=`sidebar`}){let t=T(),n=Ls(e=>e.status),r=Ls(e=>e.started),i=Ls(e=>e.queue),a=Ps(n,r),o=Ls(e=>e.refresh),s=k(e=>e.openSettings);(0,J.useEffect)(()=>{o()},[o]);let c=(a?.models??[]).filter(e=>e.state!==`skipped`),l=Ns(a)||i.length>0,u=c.some(e=>e.state===`failed`)&&a?.state!==`running`;if(!l&&!u)return null;let d=c.filter(e=>e.state!==`failed`&&e.state!==`cancelled`),f=d.length+i.length,p=d.filter(e=>e.state===`ready`||e.state===`verifying`||e.state===`unchecked`).length,m=a?.overall?.percent??0;return V(`button`,{type:`button`,className:`download-chip is-${e}${u&&!l?` is-failed`:``}`,onClick:()=>s(`model`),"aria-label":t(`download.chipAria`),title:t(`download.chipAria`),children:[P(u&&!l?Cr:qr,{size:13,"aria-hidden":`true`}),P(`span`,{children:u&&!l?t(`download.chipFailed`):t(`download.chip`,{done:String(Math.min(f,p+1)),count:String(f),pct:String(m)})}),l&&P(`span`,{className:`download-chip-bar`,"aria-hidden":`true`,children:P(`span`,{style:{inlineSize:`${m}%`}})})]})}var zs=500,Bs=`gaia_always_allow_tools`;function Vs(){try{localStorage.getItem(`gaia_always_allow_tools`)!==null&&(localStorage.removeItem(Bs),console.warn(`[notificationStore] Discarded a persisted "always allow" tool list from an earlier version. Grants now cover one call in one chat and are listed in Settings → Permissions.`))}catch(e){console.error(`[notificationStore] Could not clear the legacy always-allow list:`,e)}}var Hs=`allow_path_access`;function Us(e){let{path:t,kind:n}=e??{};return{target:typeof t==`string`&&t.trim()?t:null,kind:n}}function Ws(e,t=!1,n=z,r=e=>e){let{target:i,kind:a}=Us(e),o=i?g(a===`folder`?`prompt.path.what.folder`:a===`file`?`prompt.path.what.file`:`prompt.path.what.new`,{path:r(i)}):g(`prompt.path.what.unknown`);return n(t?`prompt.path.askAlso`:`prompt.path.ask`,{what:o})}function Gs(e,t=!1,n=z){let{kind:r}=Us(e);return n(`prompt.path.${t?`titleAlso`:`title`}.${r===`folder`?`folder`:r===`file`?`file`:`location`}`)}function Ks(e,t=z,n=e=>e){let r=e.toolArgs??{};if(e.tool===`allow_path_access`)return{heading:Gs(r,e.pathFollowUp,t),question:Ws(r,e.pathFollowUp,t,n)};let i=n(e.toolLabel??e.tool??``);return{heading:t(e.toolLabel?`prompt.title.tool`:`prompt.title.toolId`,{tool:i}),question:t(`prompt.needsOk`,{tool:i})}}function qs(e){return e.trim().replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase()}function Js(e){let t=[`file_path`,`path`,`directory`,`dir_path`,`destination`].map(t=>e?.[t]).find(e=>typeof e==`string`&&e.trim());return typeof t==`string`?t:null}function Ys(e,t,n){let r=e.find(e=>e.type===`permission_request`&&e.sessionId===t);if(!r||r.response!==`allow`||r.tool===`allow_path_access`)return!1;let i=Js(r.toolArgs),{path:a}=n??{};if(!i||typeof a!=`string`||!a.trim())return!1;let o=qs(i),s=qs(a);return o===s||o.startsWith(`${s}/`)?!0:!/^([a-z]:)?\//.test(o)&&!o.startsWith(`~`)&&s.endsWith(`/${o.replace(/^\.\//,``)}`)}function Xs(e){return e===`share_engineering_context`||e===`append_engineering_context`||e===`approve_engineering_code`||e===`allow_path_access`}function Zs(e,t){return!t.alwaysScope||!t.sessionId||Xs(t.tool)||t.risk===`destructive`?0:e.filter(e=>e.id!==t.id&&e.type===`permission_request`&&e.sessionId===t.sessionId&&e.response===`allow`&&e.tool===t.tool&&e.alwaysScope===t.alwaysScope&&e.risk===t.risk).length}var Qs=p((e,t)=>({notifications:[],showPanel:!1,typeFilter:null,addNotification:t=>e(e=>{let n=e.notifications.find(e=>e.id===t.id);return n?n.response?e:{notifications:e.notifications.map(e=>e.id===t.id?{...t,read:n.read}:e)}:{notifications:[t,...e.notifications].slice(0,zs)}}),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}),dismissSessionPrompts:t=>e(e=>({notifications:e.notifications.map(e=>e.type===`permission_request`&&e.sessionId===t&&!e.response?{...e,dismissed:!0}:e)})),respondToPermission:async(n,r)=>{let i=t().notifications.find(e=>e.id===n);if(!i)throw Error(`That permission request is no longer pending.`);let a=r!==`deny`,o=r===`always`&&!Xs(i.tool),s=window.gaiaAPI;if(i.sessionId)await jt(i.sessionId,a,{always:o,confirmId:i.confirmId});else if(s?.notification?.respondPermission)await s.notification.respondPermission(n,a?`allow`:`deny`,o);else throw Error(`No agent is waiting for this answer any more.`);e(e=>({notifications:e.notifications.map(e=>e.id===n?{...e,response:a?`allow`:`deny`,respondedAt:Date.now(),read:!0}:e)}));let c=k.getState();i.sessionId&&i.sessionId===c.currentSessionId&&c.awaitingUser&&c.setAwaitingUser(!1)}})),$s=e=>e.notifications.filter(e=>!e.read&&!e.dismissed).length,ec=e=>{let t=e.notifications.filter(e=>!e.dismissed);return e.typeFilter?t.filter(t=>t.type===e.typeFilter):t},tc=e=>t=>t.notifications.find(t=>t.type===`permission_request`&&t.sessionId===e&&!t.response&&!t.dismissed)??null,nc=e=>[...new Set(e.notifications.filter(e=>e.type===`permission_request`&&e.sessionId&&!e.response&&!e.dismissed).map(e=>e.sessionId))].sort(),rc=`gaia_alert_settings`,ic={modes:{needs_approval:`banner`,question:`banner`,finished:`banner`},sound:!1,flash:!0,keepAwake:!0,batteryFloor:20},ac=[`banner`,`badge`,`off`];function oc(){let e=null;try{e=localStorage.getItem(rc)}catch(e){return console.warn(`[alerts] Notification settings unreadable (site data blocked); using defaults.`,e),ic}if(!e)return ic;let t;try{t=JSON.parse(e)}catch(e){return console.warn(`[alerts] Saved notification settings are corrupt; using defaults.`,e),ic}let n={...ic.modes};for(let e of Object.keys(n)){let r=t.modes?.[e];r!==void 0&&ac.includes(r)?n[e]=r:r!==void 0&&console.warn(`[alerts] Ignored unknown mode ${String(r)} for ${e}.`)}let r=(e,t)=>typeof e==`boolean`?e:t,i=t.batteryFloor;return{modes:n,sound:r(t.sound,ic.sound),flash:r(t.flash,ic.flash),keepAwake:r(t.keepAwake,ic.keepAwake),batteryFloor:typeof i==`number`&&i>=0&&i<=100?i:ic.batteryFloor}}function sc(e){try{localStorage.setItem(rc,JSON.stringify(e))}catch(e){console.warn(`[alerts] Notification settings not saved; they will reset on reload.`,e)}}var cc=e=>({modes:e.modes,sound:e.sound,flash:e.flash,keepAwake:e.keepAwake,batteryFloor:e.batteryFloor}),lc=p((e,t)=>({...oc(),setMode:(n,r)=>{e({modes:{...t().modes,[n]:r}}),sc(cc(t()))},update:n=>{e(n),sc(cc(t()))}}));function uc(e){let t=new Date(e.updated_at).getTime();return Number.isNaN(t)?0:t}function dc(e,t=new Date){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=864e5,i=[{label:`Today`,sessions:[]},{label:`Yesterday`,sessions:[]},{label:`Previous 7 days`,sessions:[]},{label:`Previous 30 days`,sessions:[]},{label:`Older`,sessions:[]}],a=[...e].sort((e,t)=>uc(t)-uc(e));for(let e of a){let t=uc(e);i[t>=n?0:t>=n-r?1:t>=n-7*r?2:t>=n-30*r?3:4].sessions.push(e)}return i.filter(e=>e.sessions.length>0)}function fc(e,t){return t.awaiting[e.id]||t.prompting.includes(e.id)?`waiting`:t.queued.includes(e.id)?`queued`:t.running.includes(e.id)?`running`:e.last_run_status===`failed`?`failed`:e.last_run_status===`done`||e.last_run_status===`stopped`?`done`:null}function pc(e){return e.kind===`eval`||e.kind===`scheduled`}function mc(e,t,{showAutomated:n=!1,now:r=new Date}={}){let i=n?e:e.filter(e=>!pc(e)),a=(e,t)=>uc(t)-uc(e),o=i.filter(e=>fc(e,t)===`waiting`).sort(a),s=i.filter(e=>e.pinned&&!o.includes(e)).sort(a),c=i.filter(e=>!o.includes(e)&&!s.includes(e)),l=[];return o.length&&l.push({label:`Needs you`,sessions:o}),s.length&&l.push({label:`Pinned`,sessions:s}),[...l,...dc(c,r)]}function hc(e){return e.filter(pc).length}function gc(e,t,n){let r={};for(let t of e)r[t]=`running`;for(let[e,n]of Object.entries(t))r[e]=n;for(let e of n)r[e]=`permission`;return r}function _c(e,t){let n=[];for(let[r,i]of Object.entries(t))i!==e[r]&&(i===`permission`?n.push({sessionId:r,event:`needs_approval`}):i===`question`&&n.push({sessionId:r,event:`question`}));for(let r of Object.keys(e))r in t||n.push({sessionId:r,event:`finished`});return n}var vc={needs_approval:`GAIA needs your approval`,question:`GAIA has a question`,finished:`GAIA finished`};function yc(e,t){let n=t?.title||`A chat`;if(e!==`finished`)return{title:vc[e],body:n};switch(t?.last_run_status){case`done`:return{title:vc.finished,body:n};case`failed`:return{title:`GAIA hit a problem`,body:n};case`stopped`:return{title:`GAIA stopped`,body:n};default:return{title:`A chat stopped running`,body:n}}}function bc(e,t,n){return n&&e===t}function xc(e,t,n,r){let i=0;for(let a of e){if(a.kind===`eval`||a.kind===`scheduled`)continue;let e=t[a.id];(e===`permission`&&n.needs_approval!==`off`||e===`question`&&n.question!==`off`||!e&&a.unread&&a.id!==r&&n.finished!==`off`)&&i++}return i}function Sc(e,t){return!e||e.charging||t<=0?!0:e.level*100>=t}function Cc(){let e=window.AudioContext??window.webkitAudioContext;if(!e)throw Error(`This browser has no Web Audio, so GAIA cannot play the alert sound.`);let t=new e,n=t.currentTime;[660,880].forEach((e,r)=>{let i=t.createOscillator(),a=t.createGain();i.frequency.value=e,a.gain.setValueAtTime(1e-4,n+r*.12),a.gain.exponentialRampToValueAtTime(.15,n+r*.12+.02),a.gain.exponentialRampToValueAtTime(1e-4,n+r*.12+.18),i.connect(a).connect(t.destination),i.start(n+r*.12),i.stop(n+r*.12+.2)}),setTimeout(()=>void t.close(),600)}function wc(e){let t=e%100;return`${e}${t>=11&&t<=13?`th`:{1:`st`,2:`nd`,3:`rd`}[e%10]??`th`}`}function Tc(){return typeof navigator<`u`&&/Mac/i.test(navigator.platform)}function Ec(e=typeof navigator<`u`?navigator.platform:``){return/Mac/i.test(e)?`/Users/you/Documents/manual.pdf`:/Win/i.test(e)?`C:\\Users\\you\\Documents\\manual.pdf`:`/home/you/Documents/manual.pdf`}var Dc={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Mod:`⌘`},Oc=[`Ctrl`,`Alt`,`Shift`,`Mod`];function kc(e,t=Tc()){let n=e.split(`+`),r=n.pop(),i=n.filter(e=>!(e in Dc));if(i.length)throw Error(`formatShortcut: unknown modifier(s) ${i.join(`, `)} in "${e}"; use Ctrl, Alt, Shift or Mod`);return t?Oc.filter(e=>n.includes(e)).map(e=>Dc[e]).join(``)+r:[...n.map(e=>e===`Mod`?`Ctrl`:e),r].join(`+`)}var Ac=`New Task`;function jc(e,t){let n=t.sessions.find(t=>t.id===e);return!(!n||n.title!==Ac||(n.message_count??0)!==0||t.runningSessionIds.includes(e)||t.messageQueues?.[e]?.length||t.currentSessionId===e&&(t.messages.length!==0||t.isStreaming))}async function Mc(e){if(!e)return!1;let t=k.getState();if(!jc(e,{sessions:t.sessions,currentSessionId:t.currentSessionId,messages:t.messages,isStreaming:t.isStreaming,runningSessionIds:t.runningSessionIds,messageQueues:t.messageQueues}))return!1;d.chat.info(`Removing abandoned draft session ${e}`),t.addPendingDelete(e),t.removeSession(e);try{return await de(e),!0}catch(t){return d.chat.warn(`Failed to delete abandoned draft ${e}`,t),!1}finally{t.removePendingDelete(e)}}var Nc=32768,Pc=`Gemma-4-E4B-it-GGUF`,Fc=3e5,Ic=18e5,Lc=1e4,Rc=`GAIA is starting…`;function zc(e){let[t,n]=(0,J.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(e).matches);return(0,J.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var Bc=new URL(`gaia-robot-NKaQnEIp.png`,import.meta.url).href,Vc=16,Hc=`gaia-chat-sidebar-width`,Uc=e=>Math.round(Math.max(200,Math.min(420,e)));function Wc(){try{let e=Number(localStorage.getItem(Hc));return e?Uc(e):260}catch(e){return d.system.warn(`Saved sidebar width unreadable; using the default.`,e),260}}function Gc(e){try{localStorage.setItem(Hc,String(e))}catch(e){d.system.warn(`Sidebar width not saved; it resets on reload.`,e)}}function Kc(e){return getComputedStyle(e).direction===`rtl`}function qc(e){let[t,n]=(0,J.useState)(Wc),[r,i]=(0,J.useState)(null),a=(0,J.useCallback)(e=>{let t=Uc(e);n(t),Gc(t)},[]),o=(0,J.useCallback)(n=>{if(n.button!==0)return;n.preventDefault();let r=n.clientX,o=t,s=n.currentTarget,c=Kc(s)?-1:1;s.setPointerCapture?.(n.pointerId);let l=o,u=e=>{l=o+c*(e.clientX-r),i(l<150?l:Uc(l))},d=()=>{s.removeEventListener(`pointermove`,u),s.removeEventListener(`pointerup`,d),s.removeEventListener(`pointercancel`,d),i(null),l<150?e():a(l)};s.addEventListener(`pointermove`,u),s.addEventListener(`pointerup`,d),s.addEventListener(`pointercancel`,d)},[e,a,t]),s=(0,J.useCallback)(e=>{let n=Kc(e.currentTarget)?-16:Vc,r={ArrowLeft:t-n,ArrowRight:t+n,Home:200,End:420}[e.key];r!==void 0&&(e.preventDefault(),a(r))},[a,t]);return{width:r??t,resizing:r!=null,handle:P(`div`,{className:`sb-resize${r==null?``:` is-dragging`}`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,"aria-valuemin":200,"aria-valuemax":420,"aria-valuenow":Math.round(r??t),tabIndex:0,title:`Drag to resize, double-click to reset`,onPointerDown:o,onKeyDown:s,onDoubleClick:()=>a(260)})}}function Jc(e){return e.normalize(`NFKD`).replace(/\p{Mn}/gu,``).toLowerCase().replace(/ß/g,`ss`)}function Yc(e){return Array.from(e,Jc).join(``)}function Xc(e,t){let n=Yc(t.trim());if(!n)return null;let r=``,i=[],a=0;for(let t of e){let e=Jc(t);r+=e;for(let t=0;t<e.length;t++)i.push(a);a+=t.length}let o=r.indexOf(n);if(o<0)return null;let s=i[o],c=i[o+n.length-1],l=c+String.fromCodePoint(e.codePointAt(c)).length;return{before:e.slice(0,s),match:e.slice(s,l),after:e.slice(l)}}var Zc={running:`row.status.running`,queued:`row.status.queued`,waiting:`row.status.waiting`,done:`row.status.done`,failed:`row.status.failed`},Qc={"Needs you":`sidebar.group.needsYou`,Pinned:`sidebar.group.pinned`,Today:`sidebar.group.today`,Yesterday:`sidebar.group.yesterday`,"Previous 7 days":`sidebar.group.prev7`,"Previous 30 days":`sidebar.group.prev30`,Older:`sidebar.group.older`},$c=`gaia-show-automated-runs`,el=200,tl=new Map;function nl({parts:e}){return V(D.Fragment,{children:[e.before,P(`mark`,{className:`sb-hit`,children:e.match}),e.after]})}function rl(){try{return localStorage.getItem($c)===`1`}catch(e){return d.system.warn(`Chat-list filter unreadable (site data blocked); hiding eval and scheduled runs.`,e),!1}}var il=e=>`sb-result-${e}`;function al({session:e,active:t,phone:n,moved:r,status:i,queuePlace:a,unsent:o,failed:s,onSelect:c,onDelete:l,onPin:u,onRename:d,rowId:f,kbdActive:p,titleMatch:m,snippet:_}){let v=T(),[y,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(!1),C=(0,J.useRef)(null),w=(0,J.useCallback)(()=>{S(!1),b(!1)},[]),[E,O]=(0,J.useState)(null),k=E!==null,A=(0,J.useRef)(!1),j=()=>{A.current=!1,O(e.title)},M=t=>{E===null||A.current||(A.current=!0,O(null),t&&d(e.id,E))};(0,J.useEffect)(()=>{if(!y)return;let e=setTimeout(()=>b(!1),3e3);return()=>clearTimeout(e)},[y]);let N=(0,J.useRef)(null);(0,J.useEffect)(()=>{r&&N.current?.scrollIntoView?.({block:`nearest`})},[r]);let F=e=>e.preventDefault(),I=!!e.unread&&!t,L=i===`done`&&!I?null:i,ee=a>0?`${wc(a)} in line`:null,R=L?[v(Zc[L]),ee].filter(Boolean).join(`, `):void 0,z=s>0?`${s} not sent`:o>0?`${o} to send`:null,B=[ee,z].filter(Boolean).join(` · `),te=_?`${_.before}${_.match}${_.after}`:null,ne=P(`span`,{className:`sb-row-title`,children:m?P(nl,{parts:m}):e.title});return V(`li`,{ref:N,className:`sb-row${t?` is-active`:``}${I?` is-unread`:``}${r?` is-moved`:``}${p?` is-kbd-active`:``}`,"data-status":L??void 0,children:[k?P(`input`,{className:`sb-row-edit`,value:E,maxLength:200,onChange:e=>O(e.target.value),onBlur:()=>M(!0),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&M(!0),e.key===`Escape`&&(e.preventDefault(),M(!1))},...Ao,autoFocus:!0,onFocus:e=>e.currentTarget.select(),"aria-label":v(`row.renameAria`,{title:e.title}),dir:`auto`}):V(`button`,{type:`button`,id:f,className:`sb-row-main`,onClick:()=>c(e.id),onDoubleClick:j,"aria-current":t?`page`:void 0,"aria-label":[e.title,R,z,I?v(`row.unread`):null,te].filter(Boolean).join(`, `),title:e.title,children:[L&&P(`span`,{className:`sb-dot is-${L}`,"aria-hidden":`true`,title:R}),e.private&&P($r,{size:12,className:`sb-row-icon`,"aria-label":v(`row.private`)}),_?V(`span`,{className:`sb-row-text`,children:[ne,P(`span`,{className:`sb-row-snippet`,children:P(nl,{parts:_})})]}):ne,B&&P(`span`,{className:`sb-row-queue${s>0?` is-failed`:``}`,children:B})]}),n&&k&&V(D.Fragment,{children:[P(`button`,{type:`button`,className:`sb-row-edit-btn is-save`,onPointerDown:F,onMouseDown:F,onClick:()=>M(!0),"aria-label":v(`row.saveName`),children:P(pr,{size:18,"aria-hidden":`true`})}),P(`button`,{type:`button`,className:`sb-row-edit-btn`,onPointerDown:F,onMouseDown:F,onClick:()=>M(!1),"aria-label":v(`row.cancelRename`),children:P(So,{size:18,"aria-hidden":`true`})})]}),n?!k&&V(D.Fragment,{children:[P(`button`,{ref:C,type:`button`,className:`sb-row-more`,onClick:()=>x?w():S(!0),"aria-haspopup":`dialog`,"aria-expanded":x,"aria-label":v(`row.moreActions`,{title:e.title}),children:P(Yr,{size:18,"aria-hidden":`true`})}),P(Ro,{open:x,onClose:w,anchor:C,label:v(`row.actions`),placement:`below`,align:`end`,children:V(`div`,{className:`sb-row-menu`,children:[V(`button`,{type:`button`,className:`popover-item`,onClick:()=>{w(),j()},children:[P(Ea,{size:15,"aria-hidden":`true`}),v(`row.rename`)]}),V(`button`,{type:`button`,className:`popover-item`,onClick:()=>{w(),u(e.id,!e.pinned,!0)},children:[e.pinned?P(Oa,{size:15,"aria-hidden":`true`}):P(Aa,{size:15,"aria-hidden":`true`}),e.pinned?v(`row.unpin`):v(`row.pin`)]}),V(`button`,{type:`button`,className:`popover-item sb-row-menu-delete`,onClick:()=>y?l(e.id):b(!0),children:[P(co,{size:15,"aria-hidden":`true`}),y?v(`row.tapAgain`,{label:o>0?g(h(`row.deleteUnsent`,o),{n:o}):g(`row.deleteConfirm`)}):v(`row.delete`)]}),y&&P(`p`,{className:`sb-row-menu-note`,children:v(`row.deleteMemoryNote`)})]})})]}):V(D.Fragment,{children:[!k&&P(`button`,{type:`button`,className:`sb-row-rename`,onClick:j,"aria-label":v(`row.renameAria`,{title:e.title}),title:v(`row.rename`),children:P(Ea,{size:13})}),P(`button`,{type:`button`,className:`sb-row-pin${e.pinned?` is-pinned`:``}`,onClick:()=>u(e.id,!e.pinned),"aria-label":v(e.pinned?`row.unpinAria`:`row.pinAria`,{title:e.title}),"aria-pressed":!!e.pinned,title:e.pinned?v(`row.unpin`):v(`row.pinToTop`),children:e.pinned?P(Oa,{size:13}):P(Aa,{size:13})}),P(`button`,{type:`button`,className:`sb-row-delete${y?` is-confirm`:``}`,onClick:()=>y?l(e.id):b(!0),"aria-label":y?o>0?v.plural(`row.confirmDeleteUnsentAria`,o,{title:e.title}):v(`row.confirmDeleteAria`,{title:e.title}):v(`row.deleteAria`,{title:e.title}),title:y?`${o>0?v.plural(`row.clickAgainUnsent`,o):v(`row.clickAgain`)}\n${v(`row.deleteMemoryNote`)}`:v(`row.delete`),children:y?P(`span`,{className:`sb-row-delete-label`,children:o>0?v.plural(`row.deleteUnsent`,o):v(`row.deleteConfirm`)}):P(co,{size:13})})]})]})}function ol({onNewChat:e,onMobileAccess:t,tunnelActive:n}){let r=T(),i=k(e=>e.sessions),a=k(e=>e.currentSessionId),o=k(e=>e.runningSessionIds),s=k(e=>e.queuedSessionIds),c=k(e=>e.awaitingBySession),l=k(e=>e.messageQueues),u=k(e=>e.updateSessionInList),f=Qs(ko(nc)),p=k(e=>e.sidebarOpen),m=k(e=>e.sidebarCollapsed),h=k(e=>e.toggleSidebarCollapsed),g=k(e=>e.setSidebarOpen),_=k(e=>e.setCurrentSession),v=k(e=>e.setMessages),y=k(e=>e.removeSession),b=k(e=>e.addPendingDelete),x=k(e=>e.removePendingDelete),S=k(e=>e.openSettings),C=k(e=>e.setShowMemoryDashboard),w=k(e=>e.setShowSchedules),E=k(e=>e.setShowDocLibrary),D=k(e=>e.showMemoryDashboard),O=k(e=>e.showSchedules),A=Qs($s),j=Qs(e=>e.showPanel),M=Qs(e=>e.setShowPanel),[N,F]=(0,J.useState)(``),[I,L]=(0,J.useState)(null),[ee,R]=(0,J.useState)(null),[z,B]=(0,J.useState)(-1),[te,ne]=(0,J.useState)(null),[re,ie]=(0,J.useState)(null),[ae,oe]=(0,J.useState)(rl),H=zc(`(max-width: 768px)`),U=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=()=>{m&&h(),requestAnimationFrame(()=>U.current?.focus())};return window.addEventListener(`gaia:focus-search`,e),()=>window.removeEventListener(`gaia:focus-search`,e)},[m,h]);let se=(0,J.useMemo)(()=>({running:o,queued:s,awaiting:c,prompting:f}),[o,s,c,f]),W=N.trim();(0,J.useEffect)(()=>{if(B(-1),R(null),!W){L(null);return}let e=new AbortController,t=setTimeout(()=>{Gt(W,ae,e.signal).then(({results:e,truncated:t})=>L({query:W,results:e,truncated:!!t})).catch(t=>{e.signal.aborted||(d.chat.error(`Chat search failed`,t),R(`Could not search inside chats: ${t instanceof Error?t.message:t}`),L({query:W,results:[],truncated:!1}))})},el);return()=>{clearTimeout(t),e.abort()}},[W,ae]);let G=!!W&&I?.query!==W,ce=(0,J.useMemo)(()=>I&&I.query===W?new Map(I.results.map(e=>[e.session_id,e])):tl,[I,W]),le=hc(i),ue=(0,J.useMemo)(()=>{let e=Yc(W);return mc(W?i.filter(t=>Yc(t.title).includes(e)||ce.has(t.id)):i,se,{showAutomated:ae})},[i,W,ce,se,ae]),fe=(0,J.useMemo)(()=>W?ue.flatMap(e=>e.sessions):[],[W,ue]),pe=z>=0&&fe.length>0?fe[Math.min(z,fe.length-1)]:void 0;(0,J.useEffect)(()=>{pe&&document.getElementById(il(pe.id))?.scrollIntoView?.({block:`nearest`})},[pe]);let me=(0,J.useCallback)(()=>{oe(e=>{try{localStorage.setItem($c,e?`0`:`1`)}catch(e){d.system.warn(`Chat-list filter not saved; it will reset on reload.`,e)}return!e})},[]),he=(0,J.useCallback)(e=>{u(e,{unread:!1}),Lt(e).catch(t=>{d.chat.error(`Could not mark chat ${e} read`,t),ie(`Could not mark the chat read: ${t instanceof Error?t.message:t}`)})},[u]),ge=i.find(e=>e.id===a)?.unread;(0,J.useEffect)(()=>{if(!a||!ge)return;if(document.hasFocus()){he(a);return}let e=()=>he(a);return window.addEventListener(`focus`,e,{once:!0}),()=>window.removeEventListener(`focus`,e)},[a,ge,he]);let[_e,ve]=(0,J.useState)(null);(0,J.useEffect)(()=>{if(!_e)return;let e=setTimeout(()=>ve(null),1200);return()=>clearTimeout(e)},[_e]);let ye=(0,J.useCallback)(async(e,t)=>{ie(null),u(e,{pinned:t});try{await $e(e,t)}catch(n){d.chat.error(`Could not ${t?`pin`:`unpin`} chat ${e}`,n),u(e,{pinned:!t}),ie(n instanceof Error?n.message:`Could not ${t?`pin`:`unpin`} the chat.`)}},[u]),be=(0,J.useCallback)(async(e,t)=>{let n=t.trim().slice(0,200).trim(),r=k.getState().sessions.find(t=>t.id===e)?.title;if(n&&t!==r&&n!==r){ie(null),u(e,{title:n});try{await Se(e,{title:n,title_is_custom:!0})}catch(t){d.chat.error(`Could not rename chat ${e}`,t),r!==void 0&&u(e,{title:r}),ie(t instanceof Error?t.message:`Could not rename the chat.`)}}},[u]),xe=(0,J.useCallback)(()=>{window.innerWidth<=768&&g(!1)},[g]),Ce=(0,J.useCallback)(e=>{e===a?(_(e),xe()):(Mc(a),_(e),v([]),xe())},[a,_,v,xe]),we=e=>{if(e.key===`Escape`){e.preventDefault(),F(``),U.current?.blur();return}if(!W||fe.length===0||e.nativeEvent.isComposing)return;let t=pe?fe.indexOf(pe):-1;e.key===`ArrowDown`?(e.preventDefault(),B(Math.min(t+1,fe.length-1))):e.key===`ArrowUp`?(e.preventDefault(),B(Math.max(t-1,0))):e.key===`Enter`&&(e.preventDefault(),Ce((pe??fe[0]).id))},Te=(0,J.useCallback)(async e=>{ne(null),b(e);try{await de(e),y(e)}catch(t){d.chat.error(`Delete failed for session ${e}`,t),ne(t instanceof Error?t.message:`Could not delete the chat.`)}finally{x(e)}},[b,x,y]),Ee=typeof window<`u`&&window.innerWidth<=768,De=m&&!Ee,Oe=k(e=>e.setSidebarCollapsed),ke=qc((0,J.useCallback)(()=>Oe(!0),[Oe])),Ae=!Ee&&!De,je=[{key:`memory`,label:r(`sidebar.memory`),icon:rr,on:D,onClick:()=>{C(!0),xe()}},{key:`schedules`,label:r(`sidebar.schedules`),icon:Nr,on:O,onClick:()=>{w(!0),xe()}},{key:`documents`,label:r(`sidebar.documents`),icon:hi,on:!1,onClick:()=>{E(!0),xe()}}];return V(`aside`,{className:`sb${p?` is-open`:``}${De?` is-collapsed`:``}${ke.resizing?` is-resizing`:``}`,style:Ae?{width:ke.width,minWidth:ke.width}:void 0,"aria-label":r(`sidebar.label`),children:[Ae&&ke.handle,V(`div`,{className:`sb-top`,children:[V(`div`,{className:`sb-brand`,children:[P(`img`,{src:Bc,alt:``,width:22,height:22}),!De&&P(`span`,{children:`GAIA`})]}),P(`button`,{type:`button`,className:`sb-icon-btn`,onClick:Ee?()=>g(!1):h,"aria-label":r(De?`sidebar.expand`:`sidebar.collapse`),title:r.hint(r(De?`sidebar.expand`:`sidebar.collapse`),kc(`Mod+B`)),children:P(Ee?So:De?ga:ma,{size:17})})]}),V(`div`,{className:`sb-actions`,children:[De?P(`button`,{type:`button`,className:`sb-nav-item`,onClick:()=>window.dispatchEvent(new CustomEvent(`gaia:focus-search`)),"aria-label":r(`sidebar.search`),children:P(Ba,{size:16,"aria-hidden":`true`})}):V(`label`,{className:`sb-search`,children:[P(Ba,{size:14,"aria-hidden":`true`}),P(`input`,{ref:U,type:`search`,value:N,onChange:e=>F(e.target.value),onKeyDown:we,...Ao,placeholder:r(`sidebar.search`),"aria-label":r.hint(r(`sidebar.search`),kc(`Mod+K`)),"aria-controls":`sb-chat-list`,"aria-activedescendant":pe?il(pe.id):void 0,dir:`auto`})]}),P(`p`,{className:`sb-sr-only`,role:`status`,"aria-live":`polite`,children:W&&!G?fe.length===0?r(`sidebar.noMatch`):r.plural(`sidebar.matchCount`,fe.length):``}),V(`button`,{type:`button`,className:`sb-nav-item`,onClick:()=>{e(),xe()},title:r.hint(r(`sidebar.newChat`),kc(`Mod+Shift+O`)),children:[P(no,{size:16,"aria-hidden":`true`}),!De&&P(`span`,{children:r(`sidebar.newChat`)})]}),je.map(({key:e,label:t,icon:n,on:r,onClick:i})=>V(`button`,{type:`button`,className:`sb-nav-item${r?` is-active`:``}`,onClick:i,"aria-current":r?`page`:void 0,"aria-label":t,title:De?t:void 0,children:[P(n,{size:16,"aria-hidden":`true`}),!De&&P(`span`,{children:t})]},e))]}),!De&&V(`nav`,{className:`sb-list`,id:`sb-chat-list`,"aria-label":r(`sidebar.recent`),children:[ue.length===0&&P(`p`,{className:`sb-empty`,children:r(W?G?`sidebar.searching`:`sidebar.noMatch`:`sidebar.empty`)}),ue.map(e=>V(`section`,{className:`sb-group${e.label===`Needs you`?` is-needs-you`:``}`,children:[P(`h2`,{className:`sb-group-label`,children:r(Qc[e.label])}),P(`ul`,{children:e.sessions.map(e=>P(al,{session:e,active:e.id===a,phone:H,moved:e.id===_e,status:fc(e,se),queuePlace:s.indexOf(e.id)+1,unsent:l[e.id]?.length??0,failed:l[e.id]?.filter(e=>e.state===`failed`).length??0,onSelect:Ce,onDelete:Te,onPin:(e,t,n)=>{n&&ve(e),ye(e,t)},onRename:(e,t)=>void be(e,t),rowId:W?il(e.id):void 0,kbdActive:pe?.id===e.id,titleMatch:W?Xc(e.title,W):null,snippet:ce.get(e.id)?.field===`message`?ce.get(e.id).snippet:null},e.id))})]},e.label)),le>0&&P(`button`,{type:`button`,className:`sb-filter`,onClick:me,"aria-pressed":ae,children:ae?r(`sidebar.hideBackground`):r.plural(`sidebar.showBackground`,le)}),W&&I?.query===W&&I.truncated&&P(`p`,{className:`sb-empty`,children:r(`sidebar.searchCapped`,{n:I.results.length})}),ee&&P(`p`,{className:`sb-error`,role:`alert`,children:ee}),te&&P(`p`,{className:`sb-error`,role:`alert`,children:te}),re&&P(`p`,{className:`sb-error`,role:`alert`,children:re})]}),!De&&P(Rs,{}),V(`div`,{className:`sb-bottom`,children:[!De&&P(js,{}),V(`div`,{className:`sb-bottom-actions`,children:[V(`button`,{type:`button`,className:`sb-icon-btn${j?` is-active`:``}`,onClick:()=>M(!j),"aria-label":A>0?r(`sidebar.notificationsUnread`,{n:A}):r(`sidebar.notifications`),"aria-expanded":j,title:r(`sidebar.notifications`),children:[P($n,{size:16}),A>0&&P(`span`,{className:`sb-badge`,"aria-hidden":`true`,children:A>99?`99+`:A})]}),t&&P(`button`,{type:`button`,className:`sb-icon-btn${n?` is-active`:``}`,onClick:t,"aria-label":r(n?`sidebar.mobileAccessOn`:`sidebar.mobileAccess`),title:r(`sidebar.mobileAccess`),children:P(Qa,{size:16})}),P(`button`,{type:`button`,className:`sb-icon-btn`,onClick:()=>S(),"aria-label":r(`sidebar.settings`),title:r.hint(r(`sidebar.settings`),kc(`Mod+,`)),children:P(Ha,{size:16})})]})]})]})}function sl(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var cl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ll=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ul={};function dl(e,t){return((t||ul).jsx?ll:cl).test(e)}var fl=/[ \t\n\f\r]/g;function pl(e){return typeof e==`object`?e.type===`text`&&ml(e.value):ml(e)}function ml(e){return e.replace(fl,``)===``}var hl=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};hl.prototype.normal={},hl.prototype.property={},hl.prototype.space=void 0;function gl(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new hl(n,r,t)}function _l(e){return e.toLowerCase()}var vl=class{constructor(e,t){this.attribute=t,this.property=e}};vl.prototype.attribute=``,vl.prototype.booleanish=!1,vl.prototype.boolean=!1,vl.prototype.commaOrSpaceSeparated=!1,vl.prototype.commaSeparated=!1,vl.prototype.defined=!1,vl.prototype.mustUseProperty=!1,vl.prototype.number=!1,vl.prototype.overloadedBoolean=!1,vl.prototype.property=``,vl.prototype.spaceSeparated=!1,vl.prototype.space=void 0;var yl=e({boolean:()=>Y,booleanish:()=>xl,commaOrSpaceSeparated:()=>Tl,commaSeparated:()=>wl,number:()=>X,overloadedBoolean:()=>Sl,spaceSeparated:()=>Cl}),bl=0,Y=El(),xl=El(),Sl=El(),X=El(),Cl=El(),wl=El(),Tl=El();function El(){return 2**++bl}var Dl=Object.keys(yl),Ol=class extends vl{constructor(e,t,n,r){let i=-1;if(super(e,t),kl(this,`space`,r),typeof n==`number`)for(;++i<Dl.length;){let e=Dl[i];kl(this,Dl[i],(n&yl[e])===yl[e])}}};Ol.prototype.defined=!0;function kl(e,t,n){n&&(e[t]=n)}function Al(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Ol(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[_l(r)]=r,n[_l(a.attribute)]=r}return new hl(t,n,e.space)}var jl=Al({properties:{ariaActiveDescendant:null,ariaAtomic:xl,ariaAutoComplete:null,ariaBusy:xl,ariaChecked:xl,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:Cl,ariaCurrent:null,ariaDescribedBy:Cl,ariaDetails:null,ariaDisabled:xl,ariaDropEffect:Cl,ariaErrorMessage:null,ariaExpanded:xl,ariaFlowTo:Cl,ariaGrabbed:xl,ariaHasPopup:null,ariaHidden:xl,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Cl,ariaLevel:X,ariaLive:null,ariaModal:xl,ariaMultiLine:xl,ariaMultiSelectable:xl,ariaOrientation:null,ariaOwns:Cl,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:xl,ariaReadOnly:xl,ariaRelevant:null,ariaRequired:xl,ariaRoleDescription:Cl,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:xl,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Ml(e,t){return t in e?e[t]:t}function Nl(e,t){return Ml(e,t.toLowerCase())}var Pl=Al({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:wl,acceptCharset:Cl,accessKey:Cl,action:null,allow:null,allowFullScreen:Y,allowPaymentRequest:Y,allowUserMedia:Y,alt:null,as:null,async:Y,autoCapitalize:null,autoComplete:Cl,autoFocus:Y,autoPlay:Y,blocking:Cl,capture:null,charSet:null,checked:Y,cite:null,className:Cl,cols:X,colSpan:null,content:null,contentEditable:xl,controls:Y,controlsList:Cl,coords:X|wl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Y,defer:Y,dir:null,dirName:null,disabled:Y,download:Sl,draggable:xl,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Y,formTarget:null,headers:Cl,height:X,hidden:Sl,high:X,href:null,hrefLang:null,htmlFor:Cl,httpEquiv:Cl,id:null,imageSizes:null,imageSrcSet:null,inert:Y,inputMode:null,integrity:null,is:null,isMap:Y,itemId:null,itemProp:Cl,itemRef:Cl,itemScope:Y,itemType:Cl,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Y,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:Y,muted:Y,name:null,nonce:null,noModule:Y,noValidate:Y,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:Y,optimum:X,pattern:null,ping:Cl,placeholder:null,playsInline:Y,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Y,referrerPolicy:null,rel:Cl,required:Y,reversed:Y,rows:X,rowSpan:X,sandbox:Cl,scope:null,scoped:Y,seamless:Y,selected:Y,shadowRootClonable:Y,shadowRootDelegatesFocus:Y,shadowRootMode:null,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:xl,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:Y,useMap:null,value:xl,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Cl,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Y,declare:Y,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:Y,noHref:Y,noShade:Y,noWrap:Y,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:xl,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Y,disableRemotePlayback:Y,prefix:null,property:null,results:X,security:null,unselectable:null},space:`html`,transform:Nl}),Fl=Al({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:Tl,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,className:Cl,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:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:Y,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,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:wl,g2:wl,glyphName:wl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:Tl,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,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:X,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:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Cl,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tl,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tl,rev:Tl,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tl,requiredFeatures:Tl,requiredFonts:Tl,requiredFormats:Tl,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:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:Tl,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tl,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tl,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Ml}),Il=Al({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()}}),Ll=Al({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Nl}),Rl=Al({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),zl={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`},Bl=/[A-Z]/g,Vl=/-[a-z]/g,Hl=/^data[-\w.:]+$/i;function Ul(e,t){let n=_l(t),r=t,i=vl;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Hl.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Vl,Gl);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Vl.test(e)){let n=e.replace(Bl,Wl);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ol}return new i(r,t)}function Wl(e){return`-`+e.toLowerCase()}function Gl(e){return e.charAt(1).toUpperCase()}var Kl=gl([jl,Pl,Il,Ll,Rl],`html`),ql=gl([jl,Fl,Il,Ll,Rl],`svg`);function Jl(e){return e.join(` `).trim()}var Yl=n(((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
+ `);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})),Xl=n(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(Yl());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),Zl=n((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))}})),Ql=n(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Xl()),i=Zl();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a})),$l=tu(`end`),eu=tu(`start`);function tu(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 nu(e){let t=eu(e),n=$l(e);if(t&&n)return{start:t,end:n}}function ru(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?au(e.position):`start`in e||`end`in e?au(e):`line`in e||`column`in e?iu(e):``}function iu(e){return ou(e&&e.line)+`:`+ou(e&&e.column)}function au(e){return iu(e&&e.start)+`-`+iu(e&&e.end)}function ou(e){return e&&typeof e==`number`?e:1}var su=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=ru(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}};su.prototype.file=``,su.prototype.name=``,su.prototype.reason=``,su.prototype.message=``,su.prototype.stack=``,su.prototype.column=void 0,su.prototype.line=void 0,su.prototype.ancestors=void 0,su.prototype.cause=void 0,su.prototype.fatal=void 0,su.prototype.place=void 0,su.prototype.ruleId=void 0,su.prototype.source=void 0;var cu=t(Ql(),1),lu={}.hasOwnProperty,uu=new Map,du=/[A-Z]/g,fu=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),pu=new Set([`td`,`th`]),mu=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function hu(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=Eu(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=Tu(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`?ql:Kl,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=gu(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function gu(e,t,n){if(t.type===`element`)return _u(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return vu(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return bu(e,t,n);if(t.type===`mdxjsEsm`)return yu(e,t);if(t.type===`root`)return xu(e,t,n);if(t.type===`text`)return Su(e,t)}function _u(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=ql,e.schema=i),e.ancestors.push(t);let a=Mu(e,t.tagName,!1),o=Du(e,t),s=ku(e,t);return fu.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!pl(e)})),Cu(e,o,a,t),wu(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function vu(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)}Nu(e,t.position)}function yu(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Nu(e,t.position)}function bu(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=ql,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Mu(e,t.name,!0),o=Ou(e,t),s=ku(e,t);return Cu(e,o,a,t),wu(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function xu(e,t,n){let r={};return wu(r,ku(e,t)),e.create(t,e.Fragment,r,n)}function Su(e,t){return t.value}function Cu(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function wu(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Tu(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 Eu(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=eu(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 Du(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&lu.call(t.properties,i)){let a=Au(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&pu.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 Ou(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 Nu(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 Nu(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function ku(e,t){let n=[],r=-1,i=e.passKeys?new Map:uu;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=gu(e,a,o);s!==void 0&&n.push(s)}return n}function Au(e,t,n){let r=Ul(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?sl(n):Jl(n)),r.property===`style`){let t=typeof n==`object`?n:ju(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Pu(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?zl[r.property]||r.property:r.attribute,n]}}function ju(e,t){try{return(0,cu.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new su("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=mu+`#cannot-parse-style-attribute`,r}}function Mu(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=dl(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=dl(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return lu.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Nu(e)}function Nu(e,t){let n=new su("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=mu+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Pu(e){let t={},n;for(n in e)lu.call(e,n)&&(t[Fu(n)]=e[n]);return t}function Fu(e){let t=e.replace(du,Iu);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Iu(e){return`-`+e.toLowerCase()}var Lu={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`]},Ru={};function zu(e,t){let n=t||Ru;return Bu(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function Bu(e,t,n){if(Hu(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 Vu(e.children,t,n)}return Array.isArray(e)?Vu(e,t,n):``}function Vu(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Bu(e[i],t,n);return r.join(``)}function Hu(e){return!!(e&&typeof e==`object`)}var Uu=document.createElement(`i`);function Wu(e){let t=`&`+e+`;`;Uu.innerHTML=t;let n=Uu.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Gu(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 Ku(e,t){return e.length>0?(Gu(e,e.length,0,t),e):t}var qu={}.hasOwnProperty;function Ju(e){let t={},n=-1;for(;++n<e.length;)Yu(t,e[n]);return t}function Yu(e,t){let n;for(n in t){let r=(qu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){qu.call(r,a)||(r[a]=[]);let e=i[a];Xu(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Xu(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Gu(e,0,0,r)}function Zu(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 Z(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Qu=ld(/[A-Za-z]/),$u=ld(/[\dA-Za-z]/),ed=ld(/[#-'*+\--9=?A-Z^-~]/);function td(e){return e!==null&&(e<32||e===127)}var nd=ld(/\d/),rd=ld(/[\dA-Fa-f]/),id=ld(/[!-/:-@[-`{-~]/);function Q(e){return e!==null&&e<-2}function ad(e){return e!==null&&(e<0||e===32)}function od(e){return e===-2||e===-1||e===32}var sd=ld(/\p{P}|\p{S}/u),cd=ld(/\s/);function ld(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ud(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&$u(e.charCodeAt(n+1))&&$u(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 dd(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return od(r)?(e.enter(n),s(r)):t(r)}function s(r){return od(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var fd={tokenize:pd};function pd(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),dd(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);else return Q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var md={tokenize:gd},hd={tokenize:_d};function gd(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 Gu(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(hd,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(hd,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);else 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);else return Q(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++;Gu(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 _d(e,t,n){return dd(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function vd(e){if(e===null||ad(e)||cd(e))return 1;if(sd(e))return 2}function yd(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 bd={name:`attention`,resolveAll:xd,tokenize:Sd};function xd(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};Cd(d,-c),Cd(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=Ku(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Ku(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Ku(l,yd(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Ku(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=Ku(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Gu(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 Sd(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=vd(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=vd(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 Cd(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var wd={name:`autolink`,tokenize:Td};function Td(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 Qu(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||$u(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||$u(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||td(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):ed(t)?(e.consume(t),l):n(t)}function u(e){return $u(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||$u(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Ed={partial:!0,tokenize:Dd};function Dd(e,t,n){return r;function r(t){return od(t)?dd(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Q(e)?t(e):n(e)}}var Od={continuation:{tokenize:Ad},exit:jd,name:`blockQuote`,tokenize:kd};function kd(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 od(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Ad(e,t,n){let r=this;return i;function i(t){return od(t)?dd(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Od,t,n)(r)}}function jd(e){e.exit(`blockQuote`)}var Md={name:`characterEscape`,tokenize:Nd};function Nd(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 id(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Pd={name:`characterReference`,tokenize:Fd};function Fd(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=$u,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=rd,u):(e.enter(`characterReferenceValue`),a=7,o=nd,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===$u&&!Wu(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 Id={partial:!0,tokenize:zd},Ld={concrete:!0,name:`codeFenced`,tokenize:Rd};function Rd(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`),od(t)?dd(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Id,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):od(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),dd(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Q(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&&od(t)?dd(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Q(t)?e.check(Id,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Q(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`),od(t)?dd(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`),od(t)?dd(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function zd(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 Bd={name:`codeIndented`,tokenize:Hd},Vd={partial:!0,tokenize:Ud};function Hd(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),dd(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):Q(t)?e.attempt(Vd,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Ud(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):dd(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):Q(e)?i(e):n(e)}}var Wd={name:`codeText`,previous:Kd,resolve:Gd,tokenize:qd};function Gd(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 Kd(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function qd(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)):Q(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||Q(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 Jd=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&&Yd(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),Yd(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Yd(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);Yd(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Yd(this.left,t.reverse())}}}};function Yd(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 Xd(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Jd(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,Zd(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 Gu(e,0,1/0,u.slice(0)),!l}function Zd(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 Qd={resolve:ef,tokenize:tf},$d={partial:!0,tokenize:nf};function ef(e){return Xd(e),e}function tf(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):Q(t)?e.check($d,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 nf(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),dd(e,a,`linePrefix`)}function a(i){if(i===null||Q(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 rf(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||td(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||Q(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||ad(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||td(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 af(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):Q(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||Q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!od(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function of(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):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),dd(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Q(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 sf(e,t){let n;return r;function r(i){return Q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):od(i)?dd(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var cf={name:`definition`,tokenize:uf},lf={partial:!0,tokenize:df};function uf(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return af.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Z(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 ad(t)?sf(e,l)(t):l(t)}function l(t){return rf(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(lf,d,d)(t)}function d(t){return od(t)?dd(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function df(e,t,n){return r;function r(t){return ad(t)?sf(e,i)(t):n(t)}function i(t){return of(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return od(t)?dd(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Q(e)?t(e):n(e)}}var ff={name:`hardBreakEscape`,tokenize:pf};function pf(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var mf={name:`headingAtx`,resolve:hf,tokenize:gf};function hf(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`},Gu(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function gf(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||ad(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Q(n)?(e.exit(`atxHeading`),t(n)):od(n)?dd(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||ad(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var _f=`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(`.`),vf=[`pre`,`script`,`style`,`textarea`],yf={concrete:!0,name:`htmlFlow`,resolveTo:Sf,tokenize:Cf},bf={partial:!0,tokenize:Tf},xf={partial:!0,tokenize:wf};function Sf(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 Cf(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:I):Qu(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):Qu(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):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 Qu(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||ad(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&vf.includes(l)?(i=1,r.interrupt?t(s):O(s)):_f.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||$u(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 od(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Qu(t)?(e.consume(t),b):od(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||$u(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):od(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):od(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Q(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||ad(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||od(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Q(t)?O(t):od(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):Q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(bf,ee,k)(t)):t===null||Q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(xf,A,ee)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return vf.includes(n)?(e.consume(t),L):O(t)}return Qu(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||Q(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),L)}function ee(n){return e.exit(`htmlFlow`),t(n)}}function wf(e,t,n){let r=this;return i;function i(t){return Q(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 Tf(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Ed,t,n)}}var Ef={name:`htmlText`,tokenize:Df};function Df(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):Qu(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):Qu(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):Q(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(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):Q(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Q(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Q(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Qu(t)?(e.consume(t),S):n(t)}function S(t){return t===45||$u(t)?(e.consume(t),S):C(t)}function C(t){return Q(t)?(o=C,N(t)):od(t)?(e.consume(t),C):M(t)}function w(t){return t===45||$u(t)?(e.consume(t),w):t===47||t===62||ad(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Qu(t)?(e.consume(t),E):Q(t)?(o=T,N(t)):od(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||$u(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Q(t)?(o=D,N(t)):od(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):Q(t)?(o=O,N(t)):od(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Q(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||ad(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||ad(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return od(t)?dd(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var Of={name:`labelEnd`,resolveAll:Mf,resolveTo:Nf,tokenize:Pf},kf={tokenize:Ff},Af={tokenize:If},jf={tokenize:Lf};function Mf(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&&Gu(e,0,e.length,n),e}function Nf(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=Ku(s,e.slice(a+1,a+r+3)),s=Ku(s,[[`enter`,u,t]]),s=Ku(s,yd(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Ku(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Ku(s,e.slice(o+1)),s=Ku(s,[[`exit`,c,t]]),Gu(e,a,e.length,s),e}function Pf(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(Z(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(kf,u,o?u:d)(t):t===91?e.attempt(Af,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(jf,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Ff(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 ad(t)?sf(e,a)(t):a(t)}function a(t){return t===41?u(t):rf(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return ad(t)?sf(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?of(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return ad(t)?sf(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 If(e,t,n){let r=this;return i;function i(t){return af.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Z(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Lf(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 Rf={name:`labelStartImage`,resolveAll:Of.resolveAll,tokenize:zf};function zf(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 Bf={name:`labelStartLink`,resolveAll:Of.resolveAll,tokenize:Vf};function Vf(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 Hf={name:`lineEnding`,tokenize:Uf};function Uf(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),dd(e,t,`linePrefix`)}}var Wf={name:`thematicBreak`,tokenize:Gf};function Gf(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||Q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),od(t)?dd(e,s,`whitespace`)(t):s(t))}}var Kf={continuation:{tokenize:Xf},exit:Qf,name:`list`,tokenize:Yf},qf={partial:!0,tokenize:$f},Jf={partial:!0,tokenize:Zf};function Yf(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:nd(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(Wf,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 nd(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(Ed,r.interrupt?n:u,e.attempt(qf,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return od(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 Xf(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ed,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,dd(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!od(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(Jf,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,dd(e,e.attempt(Kf,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Zf(e,t,n){let r=this;return dd(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 Qf(e){e.exit(this.containerState.type)}function $f(e,t,n){let r=this;return dd(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!od(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var ep={name:`setextUnderline`,resolveTo:tp,tokenize:np};function tp(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 np(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`),od(t)?dd(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var rp={tokenize:ip};function ip(e){let t=this,n=e.attempt(Ed,r,e.attempt(this.parser.constructs.flowInitial,i,dd(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Qd,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ap={resolveAll:lp()},op=cp(`string`),sp=cp(`text`);function cp(e){return{resolveAll:lp(e===`text`?up: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);else 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 lp(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 up(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 dp=e({attentionMarkers:()=>yp,contentInitial:()=>pp,disable:()=>bp,document:()=>fp,flow:()=>hp,flowInitial:()=>mp,insideSpan:()=>vp,string:()=>gp,text:()=>_p}),fp={42:Kf,43:Kf,45:Kf,48:Kf,49:Kf,50:Kf,51:Kf,52:Kf,53:Kf,54:Kf,55:Kf,56:Kf,57:Kf,62:Od},pp={91:cf},mp={[-2]:Bd,[-1]:Bd,32:Bd},hp={35:mf,42:Wf,45:[ep,Wf],60:yf,61:ep,95:Wf,96:Ld,126:Ld},gp={38:Pd,92:Md},_p={[-5]:Hf,[-4]:Hf,[-3]:Hf,33:Rf,38:Pd,42:bd,60:[wd,Ef],91:Bf,92:[ff,Md],93:Of,95:bd,96:Wd},vp={null:[bd,ap]},yp={null:[42,95]},bp={null:[]};function xp(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=Ku(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=yd(a,l.events,l),l.events):[]}function f(e,t){return Cp(p(e),t)}function p(e){return Sp(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){Q(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&&Gu(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 Sp(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 Cp(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=`
12
+ `;break;case-3:o=`\r
13
+ `;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 wp(e){let t={constructs:Ju([dp,...(e||{}).extensions||[]]),content:n(fd),defined:[],document:n(md),flow:n(rp),lazy:{},string:n(op),text:n(sp)};return t;function n(e){return n;function n(n){return xp(t,e,n)}}}function Tp(e){for(;!Xd(e););return e}var Ep=/[\0\t\n\r]/g;function Dp(){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(Ep.lastIndex=u,c=Ep.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 Op=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function kp(e){return e.replace(Op,Ap)}function Ap(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Zu(n.slice(t?2:1),t?16:10)}return Wu(n)||e}var jp={}.hasOwnProperty;function Mp(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Np(n)(Tp(wp(n).document().write(Dp()(e,t,!0))))}function Np(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(le),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(se),blockQuote:a(ie),characterEscape:T,characterReference:T,codeFenced:a(ae),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ae,o),codeText:a(oe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(H),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(U),hardBreakEscape:a(W),hardBreakTrailing:a(W),htmlFlow:a(G,o),htmlFlowData:T,htmlText:a(G,o),htmlTextData:T,image:a(ce),label:o,link:a(le),listItem:a(de),listItemValue:f,listOrdered:a(ue,d),listUnordered:a(ue),paragraph:a(fe),reference:R,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(se),strong:a(pe),thematicBreak:a(he)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:re,autolinkProtocol:ne,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:B,characterReferenceMarkerNumeric:B,characterReferenceValue:te,characterReference:V,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),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(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:z,resourceDestinationString:I,resourceTitleString:L,resource:ee,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Fp(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]];jp.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]||Lp).call(a,void 0,e[0])}for(r.position={start:Pp(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Pp(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:Pp(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]||Lp).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+ru({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Pp(e.end)}function u(){return zu(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=Z(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=me(),n.position={start:Pp(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=Pp(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=Pp(e.end),this.data.atHardBreak=void 0}else!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 A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){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 N(){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 P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=kp(t),n.identifier=Z(t).toLowerCase()}function F(){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 I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ee(){this.data.inReference=void 0}function R(){this.data.referenceType=`collapsed`}function z(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Z(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function B(e){this.data.characterReferenceType=e.type}function te(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Zu(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Wu(t);let i=this.stack[this.stack.length-1];i.value+=r}function V(e){let t=this.stack.pop();t.position.end=Pp(e.end)}function ne(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function re(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ie(){return{type:`blockquote`,children:[]}}function ae(){return{type:`code`,lang:null,meta:null,value:``}}function oe(){return{type:`inlineCode`,value:``}}function H(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function U(){return{type:`emphasis`,children:[]}}function se(){return{type:`heading`,depth:0,children:[]}}function W(){return{type:`break`}}function G(){return{type:`html`,value:``}}function ce(){return{type:`image`,title:null,url:``,alt:null}}function le(){return{type:`link`,title:null,url:``,children:[]}}function ue(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function de(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function fe(){return{type:`paragraph`,children:[]}}function pe(){return{type:`strong`,children:[]}}function me(){return{type:`text`,value:``}}function he(){return{type:`thematicBreak`}}}function Pp(e){return{line:e.line,column:e.column,offset:e.offset}}function Fp(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Fp(e,r):Ip(e,r)}}function Ip(e,t){let n;for(n in t)if(jp.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 Lp(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+ru({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ru({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+ru({start:t.start,end:t.end})+`) is still open`)}function Rp(e){let t=this;t.parser=n;function n(n){return Mp(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function zp(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 Bp(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
14
+ `}]}function Vp(e,t){let n=t.value?t.value+`
15
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Hp(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Up(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Wp(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=ud(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Gp(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Kp(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function qp(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Jp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return qp(e,t);let i={src:ud(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Yp(e,t){let n={src:ud(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Xp(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Zp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return qp(e,t);let i={href:ud(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Qp(e,t){let n={href:ud(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function $p(e,t,n){let r=e.all(t),i=n?em(n):tm(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
16
+ `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
17
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function em(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=tm(n[r])}return t}function tm(e){return e.spread??e.children.length>1}function nm(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function rm(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function im(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function am(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function om(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=eu(t.children[1]),o=$l(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function sm(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function cm(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var lm=9,um=32;function dm(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(fm(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(fm(t.slice(i),i>0,!1)),a.join(``)}function fm(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===lm||t===um;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===lm||t===um;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function pm(e,t){let n={type:`text`,value:dm(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function mm(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var hm={blockquote:zp,break:Bp,code:Vp,delete:Hp,emphasis:Up,footnoteReference:Wp,heading:Gp,html:Kp,imageReference:Jp,image:Yp,inlineCode:Xp,linkReference:Zp,link:Qp,listItem:$p,list:nm,paragraph:rm,root:im,strong:am,table:om,tableCell:cm,tableRow:sm,text:pm,thematicBreak:mm,toml:gm,yaml:gm,definition:gm,footnoteDefinition:gm};function gm(){}var _m=typeof self==`object`?self:globalThis,vm=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new _m[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new _m[a](o),i)};return r},ym=e=>vm(new Map,e)(0),bm=``,{toString:xm}={},{keys:Sm}=Object,Cm=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=xm.call(e).slice(8,-1);switch(n){case`Array`:return[1,bm];case`Object`:return[2,bm];case`Date`:return[3,bm];case`RegExp`:return[4,bm];case`Map`:return[5,bm];case`Set`:return[6,bm];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},wm=([e,t])=>e===0&&(t===`function`||t===`symbol`),Tm=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Cm(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Sm(r))(e||!wm(Cm(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(wm(Cm(n))||wm(Cm(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!wm(Cm(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},Em=(e,{json:t,lossy:n}={})=>{let r=[];return Tm(!(t||n),!!t,new Map,r)(e),r},Dm=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?ym(Em(e,t)):structuredClone(e):(e,t)=>ym(Em(e,t));function Om(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function km(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Am(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Om,r=e.options.footnoteBackLabel||km,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=ud(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...Dm(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
18
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
19
+ `}]}}var jm=(function(e){if(e==null)return Im;if(typeof e==`function`)return Fm(e);if(typeof e==`object`)return Array.isArray(e)?Mm(e):Nm(e);if(typeof e==`string`)return Pm(e);throw Error(`Expected function, string, or object as test`)});function Mm(e){let t=[],n=-1;for(;++n<e.length;)t[n]=jm(e[n]);return Fm(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Nm(e){let t=e;return Fm(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Pm(e){return Fm(t);function t(t){return t&&t.type===e}}function Fm(e){return t;function t(t,n,r){return!!(Lm(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Im(){return!0}function Lm(e){return typeof e==`object`&&!!e&&`type`in e}function Rm(e){return e}var zm=[];function Bm(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=jm(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Rm(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=zm,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Vm(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Vm(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?zm:[e]}function Hm(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Bm(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var Um={}.hasOwnProperty,Wm={};function Gm(e,t){let n=t||Wm,r=new Map,i=new Map,a={all:s,applyData:qm,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...hm,...n.handlers},one:o,options:n,patch:Km,wrap:Ym};return Hm(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(Um.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=Dm(n);return r.children=a.all(e),r}return Dm(e)}return(a.options.unknownHandler||Jm)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=Xm(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Xm(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Km(e,t){e.position&&(t.position=nu(e))}function qm(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,Dm(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Jm(e,t){let n=t.data||{},r=`value`in t&&!(Um.call(n,`hProperties`)||Um.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ym(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
20
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
21
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
22
+ `}),n}function Xm(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Zm(e,t){let n=Gm(e,t),r=n.one(e,void 0),i=Am(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
23
+ `},i)),a}function Qm(e,t){return e&&`run`in e?async function(n,r){let i=Zm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Zm(n,{file:r,...e||t})}}function $m(e){if(e)throw e}var eh=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function th(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function nh(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?rh(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function rh(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var ih={basename:ah,dirname:oh,extname:sh,join:ch,sep:`/`};function ah(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);dh(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function oh(e){if(dh(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function sh(e){dh(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function ch(...e){let t=-1,n;for(;++t<e.length;)dh(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:lh(n)}function lh(e){dh(e);let t=e.codePointAt(0)===47,n=uh(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function uh(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function dh(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var fh={cwd:ph};function ph(){return`/`}function mh(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function hh(e){if(typeof e==`string`)e=new URL(e);else if(!mh(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return gh(e)}function gh(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var _h=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],vh=class{constructor(e){let t;t=e?mh(e)?{path:e}:typeof e==`string`||Sh(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:fh.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<_h.length;){let e=_h[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)_h.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?ih.basename(this.path):void 0}set basename(e){bh(e,`basename`),yh(e,`basename`),this.path=ih.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?ih.dirname(this.path):void 0}set dirname(e){xh(this.basename,`dirname`),this.path=ih.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?ih.extname(this.path):void 0}set extname(e){if(yh(e,`extname`),xh(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=ih.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){mh(e)&&(e=hh(e)),bh(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?ih.basename(this.path,this.extname):void 0}set stem(e){bh(e,`stem`),yh(e,`stem`),this.path=ih.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new su(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function yh(e,t){if(e&&e.includes(ih.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+ih.sep+"`")}function bh(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function xh(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Sh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Ch=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),wh=t(eh(),1),Th={}.hasOwnProperty,Eh=new class e extends Ch{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=nh()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,wh.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(kh(`data`,this.frozen),this.namespace[e]=t,this):Th.call(this.namespace,e)&&this.namespace[e]||void 0:e?(kh(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Mh(e),n=this.parser||this.Parser;return Dh(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Dh(`process`,this.parser||this.Parser),Oh(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Mh(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Ph(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Dh(`processSync`,this.parser||this.Parser),Oh(`processSync`,this.compiler||this.Compiler),this.process(e,r),jh(`processSync`,`process`,t),n;function r(e,r){t=!0,$m(e),n=r}}run(e,t,n){Ah(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Mh(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),jh(`runSync`,`run`,n),r;function i(e,t){$m(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Mh(t),r=this.compiler||this.Compiler;return Oh(`stringify`,r),Ah(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(kh(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,wh.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];th(o)&&th(r)&&(r=(0,wh.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Dh(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Oh(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function kh(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ah(e){if(!th(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function jh(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Mh(e){return Nh(e)?e:new vh(e)}function Nh(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Ph(e){return typeof e==`string`||Fh(e)}function Fh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Ih=O(),Lh=[],Rh={allowDangerousHtml:!0},zh=/^(https?|ircs?|mailto|xmpp)$/i,Bh=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Vh(e){let t=Hh(e),n=Uh(e);return Wh(t.runSync(t.parse(n),n),e)}function Hh(e){let t=e.rehypePlugins||Lh,n=e.remarkPlugins||Lh,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Rh}:Rh;return Eh().use(Rp).use(n).use(Qm,r).use(t)}function Uh(e){let t=e.children||``,n=new vh;return typeof t==`string`?n.value=t:``+t,n}function Wh(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Gh;for(let e of Bh)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Hm(e,l),hu(e,{Fragment:Ih.Fragment,components:i,ignoreInvalidStyle:!0,jsx:Ih.jsx,jsxs:Ih.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Lu)if(Object.hasOwn(Lu,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Lu[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Gh(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||zh.test(e.slice(0,t))?e:``}var Kh=[`script`,`iframe`,`object`,`embed`,`style`],qh=/^\/api\/files\/uploads\/([A-Za-z0-9][A-Za-z0-9._-]*)$/;function Jh(e){if(!e)return``;if(e.startsWith(`#`))return e;let t=qh.exec(e);if(t)return`${L()}/files/uploads/${t[1]}`;let n=e.indexOf(`:`);if(n===-1)return``;let r=e.slice(0,n).toLowerCase();return r===`https`||r===`http`||r===`mailto`?e:``}function Yh(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Xh(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Zh(e,t,n){let r=jm((n||{}).ignore||[]),i=Qh(t),a=-1;for(;++a<i.length;)Bm(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function Qh(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([$h(e[0]),eg(e[1])])}return t}function $h(e){return typeof e==`string`?new RegExp(Xh(e),`g`):e}function eg(e){return typeof e==`function`?e:function(){return e}}var tg=`phrasing`,ng=[`autolink`,`link`,`image`,`label`];function rg(){return{transforms:[dg],enter:{literalAutolink:ag,literalAutolinkEmail:og,literalAutolinkHttp:og,literalAutolinkWww:og},exit:{literalAutolink:ug,literalAutolinkEmail:lg,literalAutolinkHttp:sg,literalAutolinkWww:cg}}}function ig(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:tg,notInConstruct:ng},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:tg,notInConstruct:ng},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:tg,notInConstruct:ng}]}}function ag(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function og(e){this.config.enter.autolinkProtocol.call(this,e)}function sg(e){this.config.exit.autolinkProtocol.call(this,e)}function cg(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function lg(e){this.config.exit.autolinkEmail.call(this,e)}function ug(e){this.exit(e)}function dg(e){Zh(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,fg],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,pg]],{ignore:[`link`,`linkReference`]})}function fg(e,t,n,r,i){let a=``;if(!gg(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!mg(n)))return!1;let o=hg(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function pg(e,t,n,r){return!gg(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function mg(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function hg(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Yh(e,`(`),a=Yh(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function gg(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||cd(n)||sd(n))&&(!t||n!==47)}Eg.peek=Tg;function _g(){this.buffer()}function vg(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function yg(){this.buffer()}function bg(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function xg(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Z(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Sg(e){this.exit(e)}function Cg(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Z(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wg(e){this.exit(e)}function Tg(){return`[`}function Eg(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Dg(){return{enter:{gfmFootnoteCallString:_g,gfmFootnoteCall:vg,gfmFootnoteDefinitionLabelString:yg,gfmFootnoteDefinition:bg},exit:{gfmFootnoteCallString:xg,gfmFootnoteCall:Sg,gfmFootnoteDefinitionLabelString:Cg,gfmFootnoteDefinition:wg}}}function Og(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Eg},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
24
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Ag:kg))),s(),o}}function kg(e,t,n){return t===0?e:Ag(e,t,n)}function Ag(e,t,n){return(n?``:` `)+e}var jg=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Ig.peek=Lg;function Mg(){return{canContainEols:[`delete`],enter:{strikethrough:Pg},exit:{strikethrough:Fg}}}function Ng(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:jg}],handlers:{delete:Ig}}}function Pg(e){this.enter({type:`delete`,children:[]},e)}function Fg(e){this.exit(e)}function Ig(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Lg(){return`~`}function Rg(e){return e.length}function zg(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Rg,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=Bg(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=Vg(r[d]);else{let e=Vg(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
25
+ `)}function Bg(e){return e==null?``:String(e)}function Vg(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Hg(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),Ug);return i(),o}function Ug(e,t,n){return`>`+(n?``:` `)+e}function Wg(e,t){return Gg(e,t.inConstruct,!0)&&!Gg(e,t.notInConstruct,!1)}function Gg(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Kg(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
26
+ `&&Wg(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
27
+ `}function qg(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function Jg(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^ \r\n]/.test(e.value)||/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Yg(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Xg(e,t,n,r){let i=Yg(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(Jg(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,Zg);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(qg(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
28
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
29
+ `),a&&(u+=s.move(a+`
30
+ `)),u+=s.move(c),l(),u}function Zg(e,t,n){return(n?``:` `)+e}function Qg(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function $g(e,t,n,r){let i=Qg(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
31
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function e_(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function t_(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function n_(e,t,n){let r=vd(e),i=vd(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}r_.peek=i_;function r_(e,t,n,r){let i=e_(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=n_(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=t_(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=n_(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+t_(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function i_(e,t,n){return n.options.emphasis||`*`}function a_(e,t){let n=!1;return Hm(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&zu(e)&&(t.options.setext||n))}function o_(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(a_(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
32
+ `,after:`
33
+ `});return r(),t(),o+`
34
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
35
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
36
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=t_(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}s_.peek=c_;function s_(e){return e.value||``}function c_(){return`<`}l_.peek=u_;function l_(e,t,n,r){let i=Qg(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function u_(){return`!`}d_.peek=f_;function d_(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function f_(){return`!`}p_.peek=m_;function p_(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function m_(){return"`"}function h_(e,t){let n=zu(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][a-z+.-]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}g_.peek=__;function g_(e,t,n,r){let i=Qg(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(h_(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function __(e,t,n){return h_(e,n)?`<`:`[`}v_.peek=y_;function v_(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function y_(){return`[`}function b_(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function x_(e){let t=b_(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function S_(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function C_(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function w_(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?S_(n):b_(n),s=e.ordered?o===`.`?`)`:`.`:x_(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),C_(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function T_(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function E_(e,t,n,r){let i=T_(n),a=n.bulletCurrent||b_(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function D_(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var O_=jm([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function k_(e,t,n,r){return(e.children.some(function(e){return O_(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function A_(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}j_.peek=M_;function j_(e,t,n,r){let i=A_(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=n_(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=t_(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=n_(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+t_(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function M_(e,t,n){return n.options.strong||`*`}function N_(e,t,n,r){return n.safe(e.value,r)}function P_(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function F_(e,t,n){let r=(C_(n)+(n.options.ruleSpaces?` `:``)).repeat(P_(n));return n.options.ruleSpaces?r.slice(0,-1):r}var I_={blockquote:Hg,break:Kg,code:Xg,definition:$g,emphasis:r_,hardBreak:Kg,heading:o_,html:s_,image:l_,imageReference:d_,inlineCode:p_,link:g_,linkReference:v_,list:w_,listItem:E_,paragraph:D_,root:k_,strong:j_,text:N_,thematicBreak:F_};function L_(){return{enter:{table:R_,tableData:H_,tableHeader:H_,tableRow:B_},exit:{codeText:U_,table:z_,tableData:V_,tableHeader:V_,tableRow:V_}}}function R_(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function z_(e){this.exit(e),this.data.inTable=void 0}function B_(e){this.enter({type:`tableRow`,children:[]},e)}function V_(e){this.exit(e)}function H_(e){this.enter({type:`tableCell`,children:[]},e)}function U_(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,W_));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function W_(e,t){return t===`|`?t:e}function G_(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
37
+ `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
38
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return zg(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=I_.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function K_(){return{exit:{taskListCheckValueChecked:J_,taskListCheckValueUnchecked:J_,paragraph:Y_}}}function q_(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:X_}}}function J_(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Y_(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function X_(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=I_.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Z_(){return[rg(),Dg(),Mg(),L_(),K_()]}function Q_(e){return{extensions:[ig(),Og(e),Ng(),G_(e),q_()]}}var $_={tokenize:pv,partial:!0},ev={tokenize:mv,partial:!0},tv={tokenize:hv,partial:!0},nv={tokenize:gv,partial:!0},rv={tokenize:_v,partial:!0},iv={name:`wwwAutolink`,tokenize:dv,previous:vv},av={name:`protocolAutolink`,tokenize:fv,previous:yv},ov={name:`emailAutolink`,tokenize:uv,previous:bv},sv={};function cv(){return{text:sv}}for(var lv=48;lv<123;)sv[lv]=ov,lv++,lv===58?lv=65:lv===91&&(lv=97);sv[43]=ov,sv[45]=ov,sv[46]=ov,sv[95]=ov,sv[72]=[ov,av],sv[104]=[ov,av],sv[87]=[ov,iv],sv[119]=[ov,iv];function uv(e,t,n){let r=this,i,a;return o;function o(t){return!xv(t)||!bv.call(r,r.previous)||Sv(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return xv(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(rv,u,l)(t):t===45||t===95||$u(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Qu(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function dv(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!vv.call(r,r.previous)||Sv(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check($_,e.attempt(ev,e.attempt(tv,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function fv(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&yv.call(r,r.previous)&&!Sv(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Qu(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||td(t)||ad(t)||cd(t)||sd(t)?n(t):e.attempt(ev,e.attempt(tv,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function pv(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function mv(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(nv,c,s)(t):t===null||ad(t)||cd(t)||t!==45&&sd(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function hv(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(nv,t,a)(o):o===null||ad(o)||cd(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function gv(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||ad(o)||cd(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||ad(e)||cd(e)?t(e):r(e)}function a(e){return Qu(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Qu(t)?(e.consume(t),o):n(t)}}function _v(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return $u(e)?n(e):t(e)}}function vv(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ad(e)}function yv(e){return!Qu(e)}function bv(e){return!(e===47||xv(e))}function xv(e){return e===43||e===45||e===46||e===95||$u(e)}function Sv(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Cv={tokenize:jv,partial:!0};function wv(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Ov,continuation:{tokenize:kv},exit:Av}},text:{91:{name:`gfmFootnoteCall`,tokenize:Dv},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Tv,resolveTo:Ev}}}}function Tv(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Z(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Ev(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Dv(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||ad(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Z(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return ad(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Ov(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||ad(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Z(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return ad(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),dd(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function kv(e,t,n){return e.check(Ed,t,e.attempt(Cv,t,n))}function Av(e){e.exit(`gfmFootnoteDefinition`)}function jv(e,t,n){let r=this;return dd(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Mv(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Gu(o,o.length,0,yd(s,e.slice(r+1,n),t)),Gu(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Gu(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=vd(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=vd(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Nv=class{constructor(){this.map=[]}add(e,t,n){Pv(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function Pv(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Fv(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function Iv(){return{flow:{null:{name:`table`,tokenize:Lv,resolveAll:Rv}}}}function Lv(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):Q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):od(t)?dd(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||ad(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,od(t)?dd(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return od(t)?dd(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return od(t)?dd(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Q(n)?(e.exit(`tableRow`),t(n)):od(n)?dd(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||ad(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function Rv(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Nv;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(Bv(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=zv(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=zv(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=zv(f,t,o,i,n,d)):(o[0]=o[1],d=zv(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&Bv(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=Fv(t.events,n))}return e}function zv(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},Vv(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=Vv(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=Vv(t.events,n[2]),a=Vv(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},Vv(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Bv(e,t,n,r,i){let a=[],o=Vv(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function Vv(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Hv={name:`tasklistCheck`,tokenize:Wv};function Uv(){return{text:{91:Hv}}}function Wv(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return ad(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Q(r)?t(r):od(r)?e.check({tokenize:Gv},t,n)(r):n(r)}}function Gv(e,t,n){return dd(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Kv(e){return Ju([cv(),wv(),Mv(e),Iv(),Uv()])}var qv={};function Jv(e){let t=this,n=e||qv,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Kv(n)),a.push(Z_()),o.push(Q_(n))}var Yv=/(?<=["\u201c])(?:[A-Za-z]:\\|\\\\[A-Za-z0-9_.$-]+\\)(?:\\\*|[^"`<>|*\r\n\u201c\u201d])+(?=["\u201d])|(?:(?<![A-Za-z0-9])[A-Za-z]:\\|\\\\[A-Za-z0-9_.$-]+\\)(?:\\\*|[^\s"`()\]<>|*]|(?:(?<![,;])(?: +(?:[^\s"`()\]<>|*\\,;:]|\([^\s"`()\]<>|*\\,;:]*\))+)+|(?<=[,;]) +(?:[^\s"`()\]<>|*\\,;:]|\([^\s"`()\]<>|*\\,;:]*\))+)(?=\\)|\((?:\\\*|[^\s"`()\]<>|*])*\))*/g,Xv=/\\([!-/:-@[-`{-~])/g;function Zv(e){return e.replace(Xv,`$1`)}function Qv(e,t){if(e.type===`text`&&typeof e.value==`string`){let n=e.position?.start.offset,r=e.position?.end.offset;if(n===void 0||r===void 0)return;let i=t.slice(n,r);if(!i.includes(`\\`))return;let a=e.value,o=0;for(let e of i.matchAll(Yv)){let t=e[0],n=Zv(t);if(n===t){let e=a.indexOf(t,o);e!==-1&&(o=e+t.length);continue}let r=a.indexOf(n,o);r!==-1&&(a=a.slice(0,r)+t+a.slice(r+n.length),o=r+t.length)}e.value=a}else e.children?.forEach(e=>Qv(e,t))}function $v(){return(e,t)=>{typeof t.value==`string`&&Qv(e,t.value)}}function ey(e){if(!e.children)return;let t=[];for(let n of e.children)n.type===`text`&&n.value?.includes(`
39
+ `)?n.value.split(`
40
+ `).forEach((e,n)=>{n>0&&t.push({type:`break`}),e&&t.push({type:`text`,value:e})}):(ey(n),t.push(n));e.children=t}function ty(){return e=>{ey(e)}}var ny=e=>`${e}`,ry=/([^]*)/;function iy({text:e}){return P(D.Fragment,{children:e.split(ry).map((e,t)=>t%2?P(`bdi`,{dir:`ltr`,children:e},t):e)})}function ay({text:e}){let[t,n]=o(e);return n===void 0?P(iy,{text:t}):V(D.Fragment,{children:[P(iy,{text:t}),` `,P(`small`,{className:`i18n-gloss`,lang:`en`,children:P(iy,{text:n})})]})}function oy(e){let t=e.toolArgs??{},n=[`command`,`file_path`,`path`,`url`,`query`,`name`].map(e=>t[e]).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n:``}var sy=new Set([`run_shell_command`,`run_cli_command`,`wait_for_condition`]);function cy(e){let t=e.split(`
41
+ `);if(t.length<2)return null;let n=!t[t.length-1].startsWith(`in `),r=n?t[t.length-1].trim():``,i=n?t.slice(0,-1):t,a=-1;for(let e=i.length-1;e>0;e--)if(i[e].startsWith(`in `)){a=e;break}return a<0?{command:i.join(`
42
+ `),folder:``,extras:``,note:r}:{command:i.slice(0,a).join(`
43
+ `),folder:i[a].slice(3).trim(),extras:i.slice(a+1).join(` `).trim(),note:r}}function ly({code:e,previewLines:t=12,testId:n=`perm-code`}){let r=T(),[i,a]=(0,J.useState)(!1),o=e.replace(/^\n+|\n+$/g,``).split(`
44
+ `),s=o.length>t,c=(s&&!i?o.slice(0,t):o).join(`
45
+ `);return V(D.Fragment,{children:[P(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-code${i?` is-expanded`:``}`,"data-testid":n,children:c}),s&&P(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>a(e=>!e),"aria-expanded":i,children:i?r(`prompt.showLess`):r(`prompt.showAllLines`,{n:o.length})})]})}function uy({sessionId:e}){let t=Qs((0,J.useMemo)(()=>tc(e),[e]));return t?P(fy,{notification:t},t.id):null}function dy(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,`0`)}`}function fy({notification:e}){let t=T(),n=Qs(e=>e.respondToPermission),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),l=e.timeoutSeconds!=null&&e.timeoutSeconds>0,u=(0,J.useRef)(l?Date.now()+e.timeoutSeconds*1e3:null),[d,f]=(0,J.useState)(l?e.timeoutSeconds:null),p=(0,J.useRef)(null),m=Xs(e.tool),g=m?void 0:e.alwaysScope,_=e.alwaysLabel??g??``,v=Qs(t=>Zs(t.notifications,e)),y=!!g&&v>0,b=oy(e),x=e.toolArgs??{},S=Object.keys(x).length>0,C=typeof x._risk_note==`string`?x._risk_note:``,w=C&&typeof x.working_directory==`string`?x.working_directory:``,E=typeof x.code==`string`&&x.code.trim()?x.code:``,D=!S&&sy.has(e.tool??``)?cy(e.summary??``):null,O=e.tool===Hs,{heading:k,question:A}=Ks(e,t,ny);(0,J.useEffect)(()=>{p.current?.focus({preventScroll:!0})},[]),(0,J.useEffect)(()=>{if(u.current===null)return;let e=setInterval(()=>{let t=Math.max(0,Math.ceil((u.current-Date.now())/1e3));f(t),t===0&&clearInterval(e)},1e3);return()=>clearInterval(e)},[]);let j=(0,J.useCallback)(async t=>{i(!0),o(null);try{await n(e.id,t)}catch(e){o(e instanceof Error?e.message:String(e)),i(!1)}},[e.id,n]);(0,J.useEffect)(()=>{let e=e=>{e.key!==`Escape`||Po(e)||d!==null&&d<=0||(e.preventDefault(),r||j(`deny`))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[j,r,d]);let M=d!==null&&d<=0;return V(`section`,{ref:p,tabIndex:-1,className:`perm-card`,role:`alertdialog`,"aria-labelledby":`perm-${e.id}`,children:[V(`div`,{className:`perm-card-head`,children:[P(Ja,{size:16,className:`perm-card-icon`,"aria-hidden":`true`}),V(`div`,{className:`perm-card-text`,children:[P(`h2`,{id:`perm-${e.id}`,className:`perm-card-title`,children:P(ay,{text:k})}),b&&C&&P(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,children:b}),b&&!C&&P(`p`,{className:`perm-card-detail`,children:P(`code`,{dir:`ltr`,children:b})}),w&&V(`p`,{className:`perm-card-detail`,children:[t.bare(`prompt.in`),` `,P(`code`,{dir:`ltr`,children:w})]}),C&&P(`p`,{className:`perm-card-risk`,role:`note`,children:P(`bdi`,{children:C})}),E&&P(ly,{code:E}),D&&P(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,children:D.command}),D?.folder&&V(`p`,{className:`perm-card-detail`,children:[t.bare(`prompt.in`),` `,P(`code`,{dir:`ltr`,children:D.folder})]}),D?.extras&&P(`p`,{className:`perm-card-detail`,children:P(`bdi`,{children:D.extras})}),D?.note&&P(`p`,{className:`perm-card-risk`,role:`note`,children:P(`bdi`,{children:D.note})}),!b&&!E&&e.summary&&!D&&P(`p`,{className:`perm-card-detail`,children:P(`bdi`,{children:e.summary})}),m&&P(`p`,{className:`perm-card-detail perm-card-question`,children:P(ay,{text:A})})]}),d!==null&&!M&&P(`span`,{className:`perm-card-timer`,title:t(`prompt.timer`),children:dy(d)})]}),S&&V(`div`,{className:`perm-card-args`,children:[V(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>c(e=>!e),"aria-expanded":s,children:[P(yr,{size:13,className:s?`is-open`:``,"aria-hidden":`true`}),t(`prompt.details`)]}),s&&P(`pre`,{dir:`ltr`,className:`perm-card-pre`,children:JSON.stringify(x,null,2)})]}),y&&!M&&P(`p`,{className:`perm-card-hint`,children:t.compose(e=>`${e(h(`prompt.repeated`,v),{n:v})} ${e(`prompt.alwaysHint`,{scope:_})}`)}),M?P(`p`,{className:`perm-card-detail`,children:t(`prompt.expired`)}):V(`div`,{className:`perm-card-actions`,children:[P(`button`,{type:`button`,className:`perm-btn is-primary`,onClick:()=>j(`allow`),disabled:r,children:t(O?`prompt.allowForChat`:`prompt.allowOnce`)}),g&&P(`button`,{type:`button`,className:`perm-btn${y?` is-suggested`:``}`,onClick:()=>j(`always`),disabled:r,children:t(`prompt.alwaysAllow`,{scope:_})}),P(`button`,{type:`button`,className:`perm-btn`,onClick:()=>j(`deny`),disabled:r,children:t(`prompt.deny`)})]}),a&&P(`p`,{className:`perm-card-error`,role:`alert`,children:a})]})}function py(e){return e?e.split(`
46
+ `).length:0}function my(e){return py(e)>15||e.length>1500}function hy(e,t=15){let n=py(e);return n>t?`${n.toLocaleString(`en-US`)} lines`:`${e.length.toLocaleString(`en-US`)} characters`}function gy({expanded:e,onToggle:t,controls:n,collapsedLabel:r,expandedLabel:i,className:a}){return V(`button`,{type:`button`,className:`expand-toggle${a?` ${a}`:``}`,onClick:t,"aria-expanded":e,"aria-controls":n,children:[P(e?xr:hr,{size:13,"aria-hidden":`true`}),P(`span`,{children:e?i:r})]})}function _y(e){let t=e.replace(/\\(u[0-9a-fA-F]{0,3})?$/,``);try{return JSON.parse(`"${t}"`)}catch{return t}}function vy(e,t){let n=RegExp(`"${t}"\\s*:\\s*(\\d+)`).exec(e);return n?Number(n[1]):null}function yy(e,t){let n=RegExp(`"${t}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`).exec(e);return n?_y(n[1]):``}function by(e){let t=e.trim();if(!t.startsWith(`{`))return null;let n;try{n=JSON.parse(t)}catch{return!/^\{\s*"truncated"\s*:\s*true\b/.test(t)||!/"head"\s*:\s*"/.test(t)?null:{head:yy(t,`head`),tail:yy(t,`tail`),originalChars:vy(t,`original_chars`),omittedChars:vy(t,`omitted_chars`),partial:!0}}if(!n||typeof n!=`object`)return null;let r=n;return r.truncated!==!0||typeof r.head!=`string`?null:{head:r.head,tail:typeof r.tail==`string`?r.tail:``,originalChars:typeof r.original_chars==`number`?r.original_chars:null,omittedChars:typeof r.omitted_chars==`number`?r.omitted_chars:null,partial:!1}}function xy(e){let t=e=>e.toLocaleString(`en-US`);return`Showing ${e.partial?`part of the output`:e.tail?`the first ${t(e.head.length)} and last ${t(e.tail.length)} characters`:`the first ${t(e.head.length)} characters`}${e.originalChars==null?``:` of ${t(e.originalChars)}`}${e.omittedChars==null?``:` (${t(e.omittedChars)} omitted)`}.`}function Sy({text:e,renderShort:t}){let[n,r]=(0,J.useState)(!1),i=(0,J.useId)(),a=by(e),o=a?a.tail?`${a.head}\n…\n${a.tail}`:a.head:e,s=py(o)>25||o.length>2500;return V(D.Fragment,{children:[a&&P(`div`,{className:`detail-result-note`,children:xy(a)}),P(`div`,{id:i,className:`detail-result-content${s&&!n?` is-collapsed`:``}`,children:a||s?o:t(o)}),s&&P(gy,{expanded:n,onToggle:()=>r(e=>!e),controls:i,collapsedLabel:`Expand (${hy(o,25)})`,expandedLabel:`Collapse`,className:`step-expand-toggle`})]})}var Cy={"Thinking...":`msg.thinking`,"Reading your request":`live.readingRequest`,"Reading the tool results":`live.readingResults`,Reasoning:`live.reasoning`,"Reconnecting to the model server…":`live.reconnectingServer`,"Waiting for GAIA to start this answer…":`live.waitingStart`,"The model server stopped. GAIA is restarting it…":`live.serverRestarting`,"Starting the model server…":`live.serverStarting`};function wy(e,t){let n=Cy[t];if(n)return e(n);let r=/^Reasoning — ([\d,]+) words so far$/.exec(t);return r?e(`live.reasoningWords`,{n:r[1]}):(r=/^Connection lost\. Reconnecting \(attempt (\d+) of (\d+)\)…$/.exec(t),r?e(`live.reconnectingStream`,{attempt:r[1],max:r[2]}):(r=/^Loading (\S+) into memory$/.exec(t),r?e(`live.loadingModel`,{model:r[1]}):(r=/^Reading page (\d+) of (\d+)…$/.exec(t),r?e(`live.readingPage`,{page:r[1],total:r[2]}):(r=/^Downloading (\S+)$/.exec(t),r?e(`live.downloadingModel`,{model:r[1]}):t))))}var Ty={search_file:Ba,search_files:Ba,search_file_content:Ba,search_directory:Ba,read_file:hi,write_file:di,get_file_info:hi,browse_directory:yi,list_directory:yi,list_recent_files:yi,analyze_data_file:dr,run_shell_command:oo,execute_code:Lr,query_documents:tr,query_specific_file:tr,search_indexed_chunks:tr,semantic_search:tr,evaluate_retrieval:tr,index_document:Gr,index_documents:Gr,index_directory:Gr,index_file:Gr,list_indexed_documents:Gr,summarize_document:hi,dump_document:hi,rag_status:Gr,add_watch_directory:yi,transcribe_media:Zn,refine_transcript:hi,analyze_transcript:ta,export_transcript:lr,web_search:Ni,search_web:Ni,fetch_page:$i,fetch_webpage:$i,analyze_data:dr,find_files:Ba,edit_file:di,recall:rr,remember:rr,update_memory:rr,forget:rr,forget_everything:rr,search_past_conversations:rr,request_user_input:ca,load_skill:eo,use_skill:eo,unload_skill:eo,list_skills:eo,search_skill_hub:eo,install_skill:eo,capture_skill:eo,remove_skill:eo,skill_status:eo};for(let e of Object.keys(Ty))if(!N(`tool.${e}.done`)||!N(`tool.${e}.active`))throw Error(`AgentActivity: tool "${e}" has an icon but no tool.${e}.done/.active labels in src/i18n/locales/en.ts.`);var Ey=new Set([`load_skill`,`use_skill`]),Dy=new Set([`remember`,`recall`,`update_memory`,`forget`]);function Oy(e){return e.type===`tool`&&e.success!==!1&&Dy.has(e.tool??``)}var ky={label:g(`tool.default.done`),activeLabel:g(`tool.default.active`),icon:bo},Ay=(e,t)=>({label:g(`tool.named.done`,{what:e}),activeLabel:g(`tool.named.active`,{what:e}),icon:t}),jy=(e,t)=>e(t.ref,t.params);function My(e,t){if(!e)return ky;if(e.startsWith(`mcp_`)){let e=t?.mcpServerLabel;return e?Ay(t?.mcpTool?`${e}: ${t.mcpTool}`:e,Ni):{label:g(`tool.mcp.done`),activeLabel:g(`tool.mcp.active`),icon:Ni}}if(Object.prototype.hasOwnProperty.call(Ty,e))return{label:g(`tool.${e}.done`),activeLabel:g(`tool.${e}.active`),icon:Ty[e]};let n=e.replace(/[_-]+/g,` `).trim();return n?Ay(n,bo):ky}function Ny(e,t){let n=My(e.tool,e),r=e.success==null&&!e.result;return e.active?jy(t,n.activeLabel):e.success===!1?t(`tool.failed`,{label:n.activeLabel}):r?t(`tool.unfinished`,{label:n.activeLabel}):jy(t,n.label)}function Py(e,t=z){return e.mcpServerLabel?Ny(e,t):e.tool===`use_skill`&&e.detail?t(`activity.usingSkill`,{name:e.detail}):e.narration?Ry(e.narration):Ny(e,t)}var Fy=48,Iy=5,Ly=6;function Ry(e){let t=/^([^:\n]{1,40}): (.+)$/.exec(e);if(!t)return e;let[,n,r]=t;if(/^https?:\/\//i.test(r)){let e=r.replace(/^https?:\/\/(www\.)?/i,``).replace(/\/$/,``),t=e.split(`/`).filter(Boolean);return`${n}: ${e.length>Fy&&t.length>2?`${t[0]}/…/${t[t.length-1]}`:e}`}if(r.length>Fy&&/[\\/]/.test(r)&&!/\s/.test(r)){let e=r.includes(`\\`)?`\\`:`/`,t=r.split(/[\\/]/).filter(Boolean);if(t.length>2)return`${n}: …${e}${t.slice(-2).join(e)}`}return e}var zy=/^(?:Executing step \d+ of the plan\.?|Following the plan to [\s\S]*)$/;function By(e,t){return!!e&&!!t&&e.length===t.length&&e.every((e,n)=>e===t[n])}function Vy(e,t){return e.tool===t.tool&&(e.detail??``)===(t.detail??``)&&e.mcpServer===t.mcpServer}function Hy(e,t,n,r){if(t==null||t<0)return;let i=n[n.length-1],a;return a=i?.active?`running`:i?.success===!1?`failed`:i&&(i.success===!0||i.result)?`done`:r?`running`:i?`stopped`:`pending`,Array.from({length:e},(e,n)=>n<t?`done`:n===t?a:`pending`)}function Uy(e,t){let n=[],r=new Map,i,a=!1;e.forEach((t,o)=>{if(Oy(t))return;let s=n[n.length-1];if(!a||t.type!==`thinking`&&t.type!==`status`||!zy.test((t.detail||t.label||``).trim())){if(t.type===`plan`){if(a=!0,i&&By(i.planSteps,t.planSteps)){t.currentStep!=null&&(i.currentStep=t.currentStep),t.planNarrations&&(i.planNarrations=t.planNarrations),r.get(i.id).anchor=o;return}i&&(r.get(i.id).end=o),i={...t},n.push(i),r.set(t.id,{anchor:o,end:e.length})}else if(t.type===`tool`){let e=n.length-1;for(;e>=0&&(n[e].type===`thinking`||n[e].type===`status`);)e--;let r=e>=0?n[e]:void 0;if(r&&r.type===`tool`&&!r.active&&Vy(r,t)&&(t.active||r.success===t.success)){n[e]={...t,id:r.id,count:(r.count??1)+1};return}n.push({...t})}else if(t.type===`thinking`&&s&&s.type===`thinking`){let e=(s.detail||``)+(t.detail||``);n[n.length-1]={...t,timestamp:s.timestamp,detail:e||s.detail}}else t.type===`status`&&s&&s.type===`status`&&t.active!==!1?n[n.length-1]={...t,label:t.label||s.label}:t.type===`thinking`&&s&&s.type===`status`&&s.active!==!1?n[n.length-1]={...s,type:`thinking`,detail:t.detail||s.detail,active:t.active}:t.type===`status`&&t.success!==!1&&s&&s.type===`thinking`?n[n.length-1]={...s,label:t.label||s.label,active:t.active??s.active}:n.push({...t})}});for(let a of n){let n=r.get(a.id);if(a.type!==`plan`||!a.planSteps||!n)continue;let o=e.slice(n.anchor+1,n.end).filter(e=>e.type===`tool`),s=t&&a===i;a.planStatuses=Hy(a.planSteps.length,a.currentStep,o,s)}return n}function Wy(e){let t=Math.max(0,Math.floor(e));return t<60?`${t}s`:`${Math.floor(t/60)}m ${String(t%60).padStart(2,`0`)}s`}function Gy(e){let[t,n]=(0,J.useState)(()=>Date.now());return(0,J.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function Ky(e,t=``){let n=[];for(let r of e){if(r.type===`commentary`){let e=r.detail?.trim();e&&!t.trimStart().startsWith(e)&&n.push({kind:`note`,row:r});continue}let e=n[n.length-1];e?.kind===`steps`?e.rows.push(r):n.push({kind:`steps`,id:r.id,rows:[r]})}return n}function qy(e){if(!Ey.has(e.tool??``))return;let t=/:\s*(.+)$/.exec(e.narration??``)?.[1]?.trim();return t?g(`activity.usedSkill`,{name:t}):void 0}var Jy=3;function Yy(e,t=z){let n=[];for(let t of e){let e;if(t.type===`tool`)e=qy(t)??My(t.tool,t).label;else if(t.type===`policy_alert`)e=g(`activity.blocked`);else if(t.type===`error`)e=g(`activity.hitError`);else if(t.type===`plan`)e=g(`activity.madePlan`);else continue;let r=`${e.ref}:${JSON.stringify(e.params??{})}`,i=n.find(e=>e.id===r);i?i.count+=t.count??1:n.push({label:e,id:r,count:t.count??1})}return t.compose(e=>{if(n.length===0)return e(`activity.thoughtThrough`);let t=n.slice(0,Jy).map((t,n)=>{let r=e(t.label.ref,t.label.params),i=n===0?r:r.charAt(0).toLowerCase()+r.slice(1);return t.count>1?`${i} ×${t.count}`:i}),r=t.join(e(`activity.summarySep`)),i=n.length-t.length;return i>0?e(`activity.summaryMore`,{list:r,n:i}):r})}function Xy(e){return e.type===`error`||e.type===`policy_alert`}function Zy(e){return e.type===`status`&&e.success===!1}function Qy(e){return e.type!==`status`&&!(e.type===`thinking`&&!(e.detail||``).trim())}function $y(e){let t=new Map,n=[],r=e=>{let r=n[n.length-1],i=e==null?r?.latencyMs:e-n[0].timestamp;if(i!=null&&i>=0)for(let e of n)t.set(e.id,i);n=[]};for(let t of e)t.type===`thinking`||n.length>0&&t.type===`status`?t.type===`thinking`&&n.push(t):n.length>0&&r(t.timestamp);return n.length>0&&r(),t}function eb({steps:e,isActive:t,running:n=t,awaitingUser:r=!1,liveLine:i,toolStatus:a=null,answer:o}){let s=T(),[c,l]=(0,J.useState)(new Map),[u,d]=(0,J.useState)(new Set),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(`all`),g=(0,J.useMemo)(()=>Uy(e,n),[e,n]),_=(0,J.useMemo)(()=>Ky(g,o),[g,o]),v=(0,J.useMemo)(()=>$y(e),[e]),y=Gy(n),b=n?[...g].reverse().find(e=>e.type===`plan`&&e.planSteps?.length):void 0,x=n&&g.some(e=>e.active&&e.type!==`status`),S=n&&a?[...g].reverse().find(e=>e.type===`tool`&&e.active)?.id:void 0,C=!!f||m!==`all`,w=(0,J.useCallback)(e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),E=e=>{if(e.type!==`tool`||!C)return!0;let t=f.toLowerCase();return!(t&&!e.tool?.toLowerCase().includes(t)&&!Py(e,s).toLowerCase().includes(t)||m===`success`&&e.success!==!0||m===`error`&&e.success!==!1)},D=e=>e.type===`thinking`?P(ab,{step:e,live:n&&!!e.active,durationMs:v.get(e.id)},e.id):e.type===`tool`?P(cb,{step:e,isExpanded:u.has(e.id),now:y,awaitingUser:n&&r,status:e.id===S?a:null,onToggle:()=>w(e.id)},e.id):e.type===`plan`?e===b?null:P(db,{step:e},e.id):e.type===`status`?P(nb,{step:e},e.id):e.type===`error`?P(fb,{step:e},e.id):e.type===`policy_alert`?P(pb,{step:e},e.id):null;if(g.length===0)return i?P(`div`,{className:`agent-activity active`,children:P(`div`,{className:`flow-live-line`,children:i})}):null;let O=_.length-1,k=(e,t)=>e.filter(e=>(Qy(e)||t&&Zy(e))&&!tb(e,b)),A=_.reduce((e,t,r)=>{if(t.kind!==`steps`)return e;let i=n&&r===O,a=k(t.rows,i);return a.length<2&&!i?e:c.get(t.id)??(i||a.some(Xy))?e+a.filter(e=>e.type===`tool`).length:e},0);return V(`div`,{className:`agent-activity ${n?`active`:`done`}`,children:[P(`div`,{className:`agent-timeline`,children:_.map((e,t)=>{if(e.kind===`note`)return P(rb,{text:e.row.detail??``},e.row.id);let r=n&&t===O,i=k(e.rows,r);if(i.length===0)return null;let a=i.some(Xy);if(i.length===1&&!r)return E(i[0])?P(`div`,{className:`flow-steps single`,children:D(i[0])},e.id):null;let o=c.get(e.id)??(r||a),u=i.filter(E);return V(`div`,{className:`flow-steps ${o?`open`:`folded`} ${r?`live`:``}`,children:[!r&&V(`button`,{className:`flow-steps-summary`,onClick:()=>l(t=>new Map(t).set(e.id,!o)),"aria-expanded":o,children:[a?P(Cr,{size:13,className:`agent-icon-error`}):P(Dr,{size:13,className:`flow-steps-done`}),P(`span`,{className:`flow-steps-text`,children:Yy(i,s)}),P(yr,{size:12,className:`flow-tool-chevron ${o?`expanded`:``}`})]}),o&&P(`div`,{className:`flow-steps-rows`,children:u.map(D)})]},e.id)})}),b&&P(db,{step:b}),n&&!x&&i&&P(`div`,{className:`flow-live-line`,children:i}),!n&&A>=Ly&&V(`div`,{className:`activity-filter-bar`,children:[P(`input`,{type:`text`,className:`activity-filter-input`,placeholder:s(`activity.filterPlaceholder`),"aria-label":s(`activity.filterByTool`),value:f,onChange:e=>p(e.target.value)}),V(`select`,{className:`activity-filter-select`,"aria-label":s(`activity.filterByStatus`),value:m,onChange:e=>h(e.target.value),children:[P(`option`,{value:`all`,children:s.bare(`activity.filter.all`)}),P(`option`,{value:`success`,children:s.bare(`activity.filter.success`)}),P(`option`,{value:`error`,children:s.bare(`activity.filter.error`)})]})]})]})}function tb(e,t){return e.type===`plan`&&e===t}function nb({step:e}){return V(`div`,{className:`flow-warning`,role:`status`,children:[P(Cr,{size:13}),P(`span`,{children:e.label})]})}function rb({text:e}){return P(`div`,{className:`flow-note md-content`,children:P(Vh,{remarkPlugins:[Jv],disallowedElements:[...Kh],urlTransform:Jh,children:e})})}function ib(e,t,n=z){return e?n(`activity.thinking`):t==null||t<1e3?n(`activity.thought`):n(`activity.thoughtFor`,{time:Wy(t/1e3)})}function ab({step:e,live:t,durationMs:n}){let r=T(),i=(e.detail||``).trim(),[a,o]=(0,J.useState)(!1),s=(0,J.useRef)(null);return(0,J.useEffect)(()=>{t&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[i,t]),i?V(`div`,{className:`flow-reasoning ${t?`live`:``}`,children:[V(`button`,{className:`flow-reasoning-toggle`,onClick:()=>o(e=>!e),"aria-expanded":a,children:[t?P(K,{size:13,className:`flow-tool-spinner`}):P(rr,{size:13,className:`flow-tool-icon`}),P(`span`,{children:ib(t,n,r)}),P(yr,{size:12,className:`flow-tool-chevron ${a?`expanded`:``}`})]}),(a||t)&&V(`div`,{ref:s,className:`flow-thought-hacker ${a?``:`peek`}`,children:[P(`span`,{children:i}),t&&P(`span`,{className:`flow-thought-cursor`})]})]}):null}function ob(e,t=z){let n=/(['"`])([A-Z]:[\\/][^'"`\n]*?)\1|(?<![\w/\\])[A-Z]:[\\/](?:[^\s*?"'`<>|,;)}\]]+[\\/])*[^\s*?"'`<>|,;)}\]]*/gi,r=[],i=0,a;for(;(a=n.exec(e))!==null;){let n=a[1]??``;(a.index>i||n)&&r.push(e.slice(i,a.index)+n);let o=n?a[2]:a[0],s=o.replace(/[)}\]]+$/,``),c=()=>{En(s).catch(e=>d.ui.error(`Failed to open path`,e))};r.push(V(`span`,{className:`tool-result-path`,onClick:c,title:t(`activity.openPath`,{path:s}),role:`button`,tabIndex:0,onKeyDown:e=>{e.key===`Enter`&&c()},children:[P(yi,{size:10,style:{flexShrink:0,opacity:.7}}),s]},a.index)),(s.length<o.length||n)&&r.push(o.slice(s.length)+n),i=a.index+a[0].length}return r.length===0?e:(i<e.length&&r.push(e.slice(i)),P(D.Fragment,{children:r}))}function sb({fileList:e}){let t=T(),[n,r]=(0,J.useState)(!1),i=n?e.files:e.files.slice(0,5),a=e.total-5,o=(e,n)=>{let r=e.name||e.filename||e.file_name;return r?String(r):e.file_path&&String(e.file_path).replace(/\\/g,`/`).split(`/`).pop()||t(`activity.files.file`,{n:n+1})},s=e=>e.directory?String(e.directory):``;return V(`div`,{className:`file-list-view`,children:[i.map((e,t)=>V(`div`,{className:`file-list-item`,children:[P(_i,{size:11,className:`file-list-icon`}),P(`span`,{className:`file-list-name`,children:o(e,t)}),s(e)&&P(`span`,{className:`file-list-dir`,children:s(e)})]},t)),a>0&&!n&&P(`button`,{className:`file-list-more`,onClick:()=>r(!0),children:t(`activity.files.more`,{n:a})}),n&&e.files.length<e.total&&P(`span`,{className:`file-list-truncated`,children:t(`activity.files.showing`,{shown:e.files.length,total:e.total})})]})}function cb({step:e,isExpanded:t,onToggle:n,now:r,awaitingUser:i=!1,status:a=null}){let o=T(),s=My(e.tool,e).icon,c=!!e.active&&i,l=!c&&e.active&&a?wy(o,a):``,u=c?o(`activity.waiting`):l||Py(e,o),d=e.count??1,f=e.success===!1&&e.result?e.result:``,p=c?``:e.active?Wy((r-e.timestamp)/1e3):e.latencyMs==null?``:gb(e.latencyMs);return V(`div`,{className:`flow-tool ${e.active?`active`:``} ${e.success===!1?`error`:``} ${Ey.has(e.tool??``)?`skill`:``}`,children:[V(`button`,{className:`flow-tool-header`,onClick:n,"aria-expanded":t,title:c||l?Py(e,o):e.narration&&e.narration!==u?e.narration:void 0,children:[V(`div`,{className:`flow-tool-left`,children:[e.active&&!c?P(K,{size:13,className:`flow-tool-spinner`}):e.success===!1?P(Cr,{size:13,style:{color:`var(--danger)`}}):P(s,{size:13,className:`flow-tool-icon`}),P(`span`,{className:`flow-tool-label`,children:u}),d>1&&V(`span`,{className:`flow-tool-count`,"aria-label":o(`activity.identicalCalls`,{n:d}),children:[`×`,d]}),f&&P(`span`,{className:`flow-tool-failure`,children:f})]}),V(`div`,{className:`flow-tool-right`,children:[p&&P(`span`,{className:`flow-tool-latency`,children:p}),P(`span`,{className:`flow-tool-chevron ${t?`expanded`:``}`,children:P(yr,{size:12})})]})]}),t&&V(`div`,{className:`flow-tool-detail`,children:[V(`div`,{className:`flow-tool-raw`,children:[P(`span`,{className:`detail-section-label`,children:o(`activity.detail.tool`)}),P(`code`,{className:`flow-tool-badge`,children:e.tool||`unknown`}),e.mcpServer&&P(`span`,{className:`flow-tool-mcp-server`,children:o(`activity.detail.via`,{server:e.mcpServer})})]}),e.detail&&!e.commandOutput&&V(`div`,{className:`step-detail-args`,children:[P(`span`,{className:`detail-section-label`,children:o(`activity.detail.arguments`)}),P(`div`,{className:`detail-args-content`,children:yb(e.detail)})]}),e.commandOutput&&P(hb,{output:e.commandOutput}),e.mcpOutput&&V(`div`,{className:`step-detail-result result-success`,children:[P(`span`,{className:`detail-section-label`,children:o(`activity.detail.output`)}),P(ly,{code:e.mcpOutput.text,previewLines:Iy,testId:`mcp-output`}),e.mcpOutput.truncated&&P(`div`,{className:`cmd-truncated`,children:o(`activity.truncated`)})]}),e.result&&!e.commandOutput&&!e.mcpOutput&&V(`div`,{className:`step-detail-result ${e.success===!1?`result-error`:`result-success`}`,children:[P(`span`,{className:`detail-section-label`,children:e.success===!1?o(`activity.detail.error`):o(`activity.detail.result`)}),P(Sy,{text:e.result,renderShort:e=>ob(e,o)})]}),e.retrievalChunks&&e.retrievalChunks.length>0&&P(mb,{chunks:e.retrievalChunks}),e.fileList&&e.fileList.files.length>0&&P(sb,{fileList:e.fileList})]})]})}var lb={done:`activity.planStatus.done`,running:`activity.planStatus.running`,failed:`activity.planStatus.failed`,stopped:`activity.planStatus.stopped`,pending:`activity.planStatus.pending`};function ub({status:e}){return e===`done`?P(Dr,{size:13,className:`plan-icon-done`}):e===`running`?P(K,{size:13,className:`flow-tool-spinner`}):e===`failed`?P(Cr,{size:13,className:`plan-icon-failed`}):e===`stopped`?P(Cr,{size:13,className:`plan-icon-stopped`}):P(jr,{size:13,className:`plan-icon-pending`})}function db({step:e}){let t=T(),n=e.planSteps??[];if(n.length===0)return null;let r=e.planStatuses,i=r?.filter(e=>e===`done`).length??0;return V(`div`,{className:`flow-plan`,children:[V(`div`,{className:`flow-plan-header`,children:[P(ta,{size:13}),P(`span`,{children:t(`activity.plan`)}),r&&P(`span`,{className:`flow-plan-count`,children:t(`activity.planDone`,{done:i,total:n.length})})]}),P(`ol`,{className:`flow-plan-list`,children:n.map((n,i)=>{let a=r?.[i],o=Ry(e.planNarrations?.[i]||n);return V(`li`,{className:`flow-plan-item ${a??``}`,title:n,"aria-label":a?t(`activity.planItem`,{status:g(lb[a]),text:o}):void 0,children:[P(ub,{status:a}),P(`span`,{className:`flow-plan-text`,children:o})]},i)})})]})}function fb({step:e}){let t=T();return V(`div`,{className:`flow-error`,children:[P(Cr,{size:13}),P(`span`,{children:e.detail||e.label||t(`activity.errorOccurred`)})]})}function pb({step:e}){let t=T();return V(`div`,{className:`flow-policy-alert`,children:[V(`div`,{className:`flow-policy-alert-header`,children:[P(Wa,{size:14}),P(`span`,{className:`flow-policy-alert-title`,children:t(`activity.policy.title`)}),P(`span`,{className:`flow-policy-alert-decision`,children:e.decision||`BLOCK`})]}),V(`div`,{className:`flow-policy-alert-body`,children:[V(`div`,{className:`flow-policy-alert-line`,children:[P(`span`,{children:t(`activity.policy.tool`)}),P(`code`,{children:e.tool||`unknown tool`})]}),P(`div`,{className:`flow-policy-alert-reason`,children:e.reason||e.detail}),e.ruleIds&&e.ruleIds.length>0&&V(`div`,{className:`flow-policy-alert-line`,children:[P(`span`,{children:t(`activity.policy.rules`)}),P(`code`,{children:e.ruleIds.join(`, `)})]}),e.policyVersion&&V(`div`,{className:`flow-policy-alert-line`,children:[P(`span`,{children:t(`activity.policy.policy`)}),P(`code`,{children:e.policyVersion})]}),V(`div`,{className:`flow-policy-alert-line`,children:[P(`span`,{children:t(`activity.policy.receipt`)}),e.receiptId?P(`code`,{children:e.receiptId}):P(`em`,{children:t(`activity.policy.receiptUnavailable`)})]})]})]})}function mb({chunks:e}){let t=T(),[n,r]=(0,J.useState)(new Set),i=e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return V(`div`,{className:`chunks-view`,children:[P(`span`,{className:`detail-section-label`,children:t(`activity.chunks`,{n:e.length})}),P(`div`,{className:`chunks-list`,children:e.map(e=>{let r=n.has(e.id);return V(`div`,{className:`chunk-card ${r?`expanded`:``}`,children:[V(`button`,{className:`chunk-header`,onClick:()=>i(e.id),children:[V(`div`,{className:`chunk-header-left`,children:[P(tr,{size:11,style:{color:`var(--accent-cyan)`,flexShrink:0}}),e.source&&P(`span`,{className:`chunk-source`,children:e.source}),e.page!=null&&P(`span`,{className:`chunk-page`,children:t(`activity.chunkPage`,{page:e.page})}),e.score!=null&&e.score>0&&P(`span`,{className:`chunk-score`,children:e.score.toFixed(2)})]}),P(`span`,{className:`chunk-chevron ${r?`expanded`:``}`,children:P(yr,{size:11})})]}),P(`div`,{className:`chunk-body ${r?`show`:``}`,children:r?P(`pre`,{className:`chunk-content`,children:e.content}):P(`div`,{className:`chunk-preview`,children:e.preview})})]},e.id)})})]})}function hb({output:e}){let t=T(),[n,r]=(0,J.useState)(!1),i=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let a=(0,J.useCallback)(()=>{let t=e.stdout||e.stderr||``;navigator.clipboard.writeText(t).catch(()=>{}),r(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>r(!1),2e3)},[e]),o=!!(e.stdout||e.stderr),s=e.returnCode!==0&&!e.expectedExit;return V(`div`,{className:`cmd-output ${s?`cmd-error`:``}`,children:[V(`div`,{className:`cmd-header`,children:[V(`div`,{className:`cmd-header-left`,children:[P(oo,{size:12,className:`cmd-header-icon`}),P(`span`,{className:`cmd-header-title`,children:t(`activity.terminal`)}),e.cwd&&P(`span`,{className:`cmd-cwd`,children:e.cwd})]}),V(`div`,{className:`cmd-header-right`,children:[e.durationSeconds!=null&&V(`span`,{className:`cmd-duration`,children:[e.durationSeconds.toFixed(1),`s`]}),e.returnCode!==0&&P(`span`,{className:`cmd-exit-code${s?``:` cmd-exit-expected`}`,title:e.expectedExit??void 0,children:t(`activity.exit`,{code:e.returnCode})}),o&&P(`button`,{className:`cmd-copy ${n?`copied`:``}`,onClick:a,title:t(n?`msg.copied`:`activity.copyOutput`),"aria-label":t(n?`msg.copiedAria`:`activity.copyOutputAria`),children:P(n?pr:zr,{size:11})})]})]}),V(`div`,{className:`cmd-line`,children:[P(`span`,{className:`cmd-prompt`,children:`$`}),P(`span`,{className:`cmd-text`,children:e.command})]}),e.stdout&&P(`pre`,{className:`cmd-stdout`,children:e.stdout}),e.stderr&&P(`pre`,{className:`cmd-stderr`,children:e.stderr}),e.truncated&&P(`div`,{className:`cmd-truncated`,children:t(`activity.truncated`)}),!o&&P(`div`,{className:`cmd-empty`,children:t(`activity.noOutput`)})]})}function gb(e){return e<1?`<1ms`:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function _b(e){let t=/^\[(.*)\]$/s.exec(e);return t?t[1].split(/,\s*/).map(e=>e.trim().replace(/^(['"])(.*)\1$/s,`$2`)).filter(Boolean).join(`, `):e}var vb=/^([A-Za-z_][\w.-]{0,29}):(?:\s+([\s\S]*))?$/;function yb(e){let t=e.includes(`
47
+ `)?e.split(`
48
+ `).filter(Boolean):e.split(/, (?=[A-Za-z_][\w.-]{0,29}:(?:\s|$))/).filter(Boolean);return t.length<=1?P(`span`,{className:`arg-value`,children:e}):P(`div`,{className:`args-grid`,children:t.map((e,t)=>{let n=vb.exec(e.trim());if(n){let e=n[1],r=_b((n[2]??``).trim());return V(`div`,{className:`arg-row`,children:[P(`span`,{className:`arg-key`,children:e}),P(`span`,{className:`arg-value`,children:r})]},t)}return P(`div`,{className:`arg-row`,children:P(`span`,{className:`arg-value`,children:e})},t)})})}var bb=`email`;function xb(e,t){return e.filter(e=>e.id===bb&&!!e.namespaced_agent_id&&(e.required_connections?.some(e=>e.connector_id===t)??!1)).map(e=>e.namespaced_agent_id)}function Sb(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 Cb(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 wb(e){let t=window;t.gaia?.openExternal?t.gaia.openExternal(e):window.open(e,`_blank`,`noopener`)}function Tb({connectorId:e,label:t,grantAgents:n,done:r,onDone:i}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),l=(0,J.useCallback)(async()=>{o(!0),c(null);try{let t=await kn(e),r=t.available_scopes&&t.available_scopes.length>0?t.available_scopes:t.default_scopes;wb((await $t(e,r,n)).authorization_url),i()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e,n,i]);return V(`div`,{className:`email-connect-cta__provider-slot`,children:[V(`button`,{className:`email-connect-cta__button`,onClick:()=>void l(),disabled:a,"aria-label":r?`Reopen ${t} sign-in`:`Connect ${t}`,children:[a?P(K,{size:12,className:`email-connect-cta__spinner`}):P(Zr,{size:12}),P(`span`,{children:r?`Reopen ${t} sign-in`:`Connect ${t}`})]}),s&&P(`div`,{className:`email-connect-cta__error`,role:`alert`,children:s})]})}function Eb({content:e=``,connectorId:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),{agents:c}=k(),l=(0,J.useCallback)(e=>xb(c,e),[c]),u=t===`google`||t===`microsoft`||t===`microsoft_work`?t:Cb(e),d=u===`google`||u===`all`,f=u===`microsoft`||u===`all`,p=u===`microsoft_work`||u===`all`;return V(`div`,{className:`email-connect-cta`,role:`region`,"aria-label":`Connect email account`,children:[V(`div`,{className:`email-connect-cta__text`,children:[P(Cr,{size:14,className:`email-connect-cta__icon`}),P(`span`,{children:n||i||o?`A browser tab opened for sign-in. Return here when finished.`:`Connect your email account to use Email Triage.`})]}),V(`div`,{className:`email-connect-cta__buttons`,children:[d&&P(Tb,{connectorId:`google`,label:`Google`,grantAgents:l(`google`),done:n,onDone:()=>r(!0)}),f&&P(Tb,{connectorId:`microsoft`,label:`Microsoft`,grantAgents:l(`microsoft`),done:i,onDone:()=>a(!0)}),p&&P(Tb,{connectorId:`microsoft_work`,label:`Microsoft 365`,grantAgents:l(`microsoft_work`),done:o,onDone:()=>s(!0)})]})]})}function Db(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 Ob(e){e&&window.dispatchEvent(new CustomEvent(`gaia:send-message`,{detail:{text:e}}))}function kb(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 Ab(e){if(!e)return`(unknown)`;let t=e.trim(),n=t.indexOf(`<`);return n>0?t.slice(0,n).trim().replace(/^"|"$/g,``):t}function jb({payload:e}){let[t,n]=(0,J.useState)(()=>new Set),r=(0,J.useCallback)(e=>{n(t=>{let n=new Set(t);return n.add(e),n})},[]),[i,a]=(0,J.useState)(null),o=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=(0,J.useCallback)((e,t)=>{i||(a(e),o.current=setTimeout(()=>{a(t=>t===e?null:t)},5e3),Ob(t))},[i]),c=(0,J.useCallback)(e=>{s(e.message_id,`Archive message id ${e.message_id}.`)},[s]),l=(0,J.useCallback)(e=>{s(e.message_id,`Draft a reply to message id ${e.message_id}.`)},[s]),u=(0,J.useMemo)(()=>[{key:`urgent`,title:`Urgent`,icon:P(Cr,{size:14}),items:e.urgent.filter(e=>!t.has(e.message_id)),intent:`urgent`},{key:`actionable`,title:`Needs a response`,icon:P(ia,{size:14}),items:e.actionable.filter(e=>!t.has(e.message_id)),intent:`actionable`},{key:`archives`,title:`Suggested archives`,icon:P(Un,{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 V(`div`,{className:`email-pre-scan`,role:`region`,"aria-label":`Inbox pre-scan`,children:[V(`div`,{className:`email-pre-scan__header`,children:[P(zi,{size:16,"aria-hidden":`true`}),P(`span`,{className:`email-pre-scan__title`,children:`Inbox pre-scan`}),V(`span`,{className:`email-pre-scan__totals`,children:[d,` surfaced`,f>0?` · ${f} informational`:``]})]}),u.map(e=>e.items.length>0?P(Mb,{def:e,pendingRow:i,onApproveArchive:c,onReply:l,onDismiss:r,onOpen:kb},e.key):null),d===0&&V(`div`,{className:`email-pre-scan__empty`,children:[P(Dr,{size:14}),P(`span`,{children:`Nothing to surface — your inbox looks quiet.`})]}),P(Pb,{applied:e.preferences_applied})]})}function Mb({def:e,pendingRow:t,onApproveArchive:n,onReply:r,onDismiss:i,onOpen:a}){return V(`section`,{className:`email-pre-scan__section email-pre-scan__section--${e.intent}`,children:[V(`header`,{className:`email-pre-scan__section-header`,children:[e.icon,P(`span`,{className:`email-pre-scan__section-title`,children:e.title}),P(`span`,{className:`email-pre-scan__section-count`,children:e.items.length})]}),P(`ul`,{className:`email-pre-scan__list`,children:e.items.map(o=>P(Nb,{item:o,intent:e.intent,isPending:t!==null,onApproveArchive:n,onReply:r,onDismiss:i,onOpen:a},o.message_id))})]})}function Nb({item:e,intent:t,isPending:n,onApproveArchive:r,onReply:i,onDismiss:a,onOpen:o}){let s=e.reason??e.why??``,c=Ab(e.sender);return V(`li`,{className:`email-pre-scan__row`,children:[V(`div`,{className:`email-pre-scan__row-text`,children:[V(`div`,{className:`email-pre-scan__row-meta`,children:[P(`span`,{className:`email-pre-scan__row-sender`,title:e.sender,children:c}),P(`span`,{className:`email-pre-scan__row-subject`,title:e.subject,children:e.subject||`(no subject)`})]}),s&&P(`div`,{className:`email-pre-scan__row-reason`,title:s,children:s})]}),V(`div`,{className:`email-pre-scan__row-actions`,role:`group`,"aria-label":`Actions for this email`,children:[t===`archive`?V(`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:[P(Un,{size:12}),P(`span`,{children:`Archive`})]}):V(`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:[P(no,{size:12}),P(`span`,{children:`Reply`})]}),V(`button`,{className:`email-pre-scan__action`,onClick:()=>o(e),title:`Open in Gmail`,"aria-label":`Open "${e.subject}" in Gmail`,children:[P(Zr,{size:12}),P(`span`,{children:`Open`})]}),P(`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:P(So,{size:12})})]})]})}function Pb({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?V(`div`,{className:`email-pre-scan__preferences`,"aria-label":`Active session preferences`,children:[P(`span`,{className:`email-pre-scan__preferences-label`,children:`Session preferences:`}),t.length>0&&V(`span`,{className:`email-pre-scan__preferences-chip`,title:`Always urgent`,children:[`+ `,t.length,` priority sender`,t.length===1?``:`s`]}),n.length>0&&V(`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])=>V(`span`,{className:`email-pre-scan__preferences-chip`,title:`${e} → ${t}`,children:[e,` → `,t]},e))]}):null}var Fb=2e6;function Ib({variant:e,render:t,data:n}){let r;try{r=JSON.stringify(n)}catch{r=String(n)}let i=r.length>Fb,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 V(`div`,{className:`render-unsupported`,children:[P(`p`,{className:`render-unsupported__message`,children:o}),V(`details`,{className:`render-unsupported__details`,children:[P(`summary`,{children:`Raw payload`}),i?V(`p`,{className:`render-unsupported__too-large`,children:[`Payload too large to display (`,r.length,` bytes)`]}):P(`pre`,{className:`render-unsupported__json`,children:a})]})]})}function Lb(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function Rb(e){return e===null?``:String(e)}function zb(e){return e===void 0||typeof e==`string`}function Bb(e){return`+${e-500} more (truncated)`}function Vb(e){if(!e||typeof e!=`object`)return!1;let t=e;return zb(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(Lb))}function Hb({data:e}){if(!Vb(e))return P(Ib,{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 V(`div`,{className:`render-table-card`,children:[e.title&&P(`div`,{className:`render-table-card__title`,children:e.title}),P(`div`,{className:`render-table`,children:V(`table`,{children:[P(`thead`,{children:V(`tr`,{children:[i.map((e,t)=>P(`th`,{children:e},t)),r&&P(`th`,{children:Bb(e.columns.length)})]})}),P(`tbody`,{children:n.map((e,t)=>P(`tr`,{children:e.slice(0,i.length).map((e,t)=>P(`td`,{children:Rb(e)},t))},t))})]})}),t&&P(`div`,{className:`render-truncation`,children:Bb(e.rows.length)})]})}function Ub(e){if(!e||typeof e!=`object`)return!1;let t=e;return zb(t.title)&&Array.isArray(t.items)&&t.items.every(e=>e&&typeof e==`object`&&typeof e.key==`string`&&Lb(e.value))}function Wb({data:e}){if(!Ub(e))return P(Ib,{variant:`invalid`,render:`key_value`,data:e});let t=e.items.length>500,n=t?e.items.slice(0,500):e.items;return V(`div`,{className:`render-kv`,children:[e.title&&P(`div`,{className:`render-kv__title`,children:e.title}),P(`dl`,{className:`render-kv__list`,children:n.map((e,t)=>V(`div`,{className:`render-kv__row`,children:[P(`dt`,{className:`render-kv__key`,children:e.key}),P(`dd`,{className:`render-kv__value`,children:Rb(e.value)})]},t))}),t&&P(`div`,{className:`render-truncation`,children:Bb(e.items.length)})]})}function Gb(e){if(!e||typeof e!=`object`)return!1;let t=e;return zb(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 Kb({data:e}){if(!Gb(e))return P(Ib,{variant:`invalid`,render:`list`,data:e});let t=e.items.length>500,n=(t?e.items.slice(0,500):e.items).map((e,t)=>P(`li`,{children:String(e)},t));return V(`div`,{className:`render-list`,children:[e.title&&P(`div`,{className:`render-list__title`,children:e.title}),e.ordered?P(`ol`,{className:`render-list__items`,children:n}):P(`ul`,{className:`render-list__items`,children:n}),t&&P(`div`,{className:`render-truncation`,children:Bb(e.items.length)})]})}var qb=/^\/api\/media\/(image|audio)\/([A-Za-z0-9%._~-]+)$/;function Jb(e,t){let n=qb.exec(t);if(!n||n[1]!==e)return null;let r;try{r=decodeURIComponent(n[2])}catch{return null}return r===`.`||r===`..`||/[/\\:\0]/.test(r)?null:`${L()}/media/${e}/${n[2]}`}var Yb=/^data:image\/(png|jpe?g|gif|webp);base64,/;function Xb(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.src==`string`&&(Yb.test(t.src)||Jb(`image`,t.src)!==null)&&zb(t.alt)&&zb(t.caption)}function Zb({data:e}){let t=T(),[n,r]=(0,J.useState)(!1);if(!Xb(e))return P(Ib,{variant:`invalid`,render:`image`,data:e});let i=Yb.test(e.src)?e.src:Jb(`image`,e.src);return V(`figure`,{className:`render-image${n?` render-image--expanded`:``}`,children:[P(`button`,{type:`button`,className:`render-image__toggle`,"aria-expanded":n,"aria-label":t(n?`media.showSmaller`:`media.showFull`),onClick:()=>r(e=>!e),children:P(`img`,{className:`render-image__img`,src:i,alt:e.alt??``})}),e.caption&&P(`figcaption`,{className:`render-image__caption`,children:e.caption})]})}function Qb(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.src==`string`&&Jb(`audio`,t.src)!==null&&zb(t.caption)&&zb(t.path)&&(t.duration_seconds===void 0||typeof t.duration_seconds==`number`&&Number.isFinite(t.duration_seconds)&&t.duration_seconds>=0)}function $b(e){let t=Math.round(e),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}function ex({data:e}){let t=T(),[n,r]=(0,J.useState)(!1);if(!Qb(e))return P(Ib,{variant:`invalid`,render:`audio`,data:e});let i=Jb(`audio`,e.src),a=e.path?e.path.split(/[\\/]/).pop():void 0;return V(`figure`,{className:`render-audio`,children:[P(`audio`,{className:`render-audio__player`,controls:!0,preload:`metadata`,src:i,onError:()=>r(!0)}),V(`figcaption`,{className:`render-audio__caption`,children:[n&&P(`span`,{className:`render-audio__error`,role:`alert`,children:t(`media.audioUnplayable`)}),e.caption&&P(`span`,{className:`render-audio__text`,children:e.caption}),(a||e.duration_seconds!==void 0)&&V(`span`,{className:`render-audio__meta`,children:[a,a&&e.duration_seconds!==void 0&&` · `,e.duration_seconds!==void 0&&P(`bdi`,{dir:`ltr`,children:$b(e.duration_seconds)})]})]})]})}function tx(e){if(!e||typeof e!=`object`)return!1;let t=e;return zb(t.title)&&zb(t.badge)&&zb(t.note)&&typeof t.unified==`string`}function nx(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 rx({data:e}){if(!tx(e))return P(Ib,{variant:`invalid`,render:`diff`,data:e});let t=e.unified.replace(/\n$/,``).split(`
49
+ `).map(e=>e.replace(/\r$/,``));return V(`div`,{className:`render-diff`,children:[(e.title||e.badge)&&V(`div`,{className:`render-diff__title`,children:[e.badge&&P(`span`,{className:`render-diff__badge`,children:e.badge}),e.title]}),e.note&&P(`div`,{className:`render-diff__note`,children:e.note}),e.unified&&P(`pre`,{className:`render-diff__body`,children:t.map((e,t)=>P(`div`,{className:nx(e),children:e},t))})]})}function ix(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.action==`string`&&typeof t.summary==`string`}function ax(e){let t=e.replace(/_/g,` `).trim();return t.length>0?t:`action`}function ox({data:e}){let[t,n]=(0,J.useState)(!1);return ix(e)?t?P(`div`,{className:`render-confirmation render-confirmation--dismissed`,children:P(`span`,{className:`render-confirmation__dismissed-note`,children:`Confirmation dismissed`})}):V(`div`,{className:`render-confirmation`,children:[V(`div`,{className:`render-confirmation__header`,children:[P(`span`,{className:`render-confirmation__badge`,children:`Approval needed`}),P(`span`,{className:`render-confirmation__label`,children:ax(e.action)}),P(`code`,{className:`render-confirmation__action`,children:e.action})]}),P(`pre`,{className:`render-confirmation__summary`,children:e.summary}),V(`div`,{className:`render-confirmation__footer`,children:[P(`span`,{className:`render-confirmation__note`,children:`Nothing was executed. Follow the assistant's guidance below to approve this action.`}),P(`button`,{type:`button`,className:`render-confirmation__dismiss`,onClick:()=>n(!0),children:`Dismiss`})]})]}):P(Ib,{variant:`invalid`,render:`needs_confirmation`,data:e})}function sx(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 cx=`This question is no longer waiting for an answer. If you still want to answer it, say so in a new message.`,lx=`••••••`;function ux(e){return e?.httpStatus===404}function dx({data:e}){let[t,n]=(0,J.useState)({status:`pending`}),[r,i]=(0,J.useState)(``),a=sx(e)?e.request_id:``,o=k(e=>e.liveQuestions[a]),s=k(e=>e.closeQuestion);if((0,J.useEffect)(()=>{if(!o||o.expiresAt===null)return;let e=o.expiresAt-Date.now();if(e<=0){s(a);return}let t=setTimeout(()=>s(a),e);return()=>clearTimeout(t)},[o,a,s]),!sx(e))return P(Ib,{variant:`invalid`,render:`needs_input`,data:e});let c=t.status===`submitting`,l=async t=>{if(t.trim()&&!c&&o){n({status:`submitting`});try{await gn(e.session_id,e.request_id,t),n({status:`answered`}),s(e.request_id)}catch(t){if(ux(t)){s(e.request_id),n({status:`expired`,message:cx});return}n({status:`error`,message:t instanceof Error?t.message:`Failed to send the answer.`})}}};return t.status===`answered`?P(`div`,{className:`render-needs-input render-needs-input--answered`,children:P(`span`,{className:`render-needs-input__answered-note`,children:`Answered`})}):t.status===`expired`||!o&&!c?V(`div`,{className:`render-needs-input render-needs-input--expired`,"aria-disabled":`true`,children:[P(`div`,{className:`render-needs-input__header`,children:P(`span`,{className:`render-needs-input__badge`,children:`Question`})}),P(`p`,{className:`render-needs-input__question`,children:e.question}),P(`p`,{className:`render-needs-input__expired-note`,role:`status`,children:t.status===`expired`?t.message:cx})]}):V(`div`,{className:`render-needs-input`,children:[V(`div`,{className:`render-needs-input__header`,children:[P(`span`,{className:`render-needs-input__badge`,children:`Question`}),e.sensitive&&P(`span`,{className:`render-needs-input__sensitive-badge`,children:`Sensitive`})]}),P(`p`,{className:`render-needs-input__question`,children:e.question}),e.options.length>0&&P(`div`,{className:`render-needs-input__options`,children:e.options.map(e=>P(`button`,{type:`button`,className:`render-needs-input__option`,disabled:c,title:e.description||void 0,onClick:()=>l(e.value),children:e.label},e.value))}),e.allow_free_text&&V(`form`,{className:`render-needs-input__free-text`,onSubmit:e=>{e.preventDefault(),l(r)},children:[P(`input`,{type:e.sensitive?`password`:`text`,className:`render-needs-input__free-text-input`,value:r,disabled:c,placeholder:e.sensitive?`Type your answer (hidden as ${lx})`:`Type your answer…`,onChange:e=>i(e.target.value),autoComplete:`off`}),P(`button`,{type:`submit`,className:`render-needs-input__free-text-submit`,disabled:c||!r.trim(),children:`Send`})]}),t.status===`error`&&P(`p`,{className:`render-needs-input__error`,children:t.message})]})}function fx(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 px({data:e}){let t=fx(e);return Db(t)?P(jb,{payload:t}):P(Ib,{variant:`invalid`,render:`email_pre_scan`,data:e})}var mx={email_pre_scan:px,table:Hb,key_value:Wb,list:Kb,image:Zb,audio:ex,diff:rx,needs_confirmation:ox,needs_input:dx},hx=class extends J.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?P(`div`,{role:`alert`,className:`render-card-error`,children:`Card failed to render`}):this.props.children}};function gx({render:e,data:t}){let n=mx[e];return P(`div`,{className:`render-card`,children:n?P(hx,{children:P(n,{data:t})}):P(Ib,{variant:`unknown`,render:e,data:t})})}var _x=e=>e;function vx(e,t=z.bare,n=_x){if(e<1e3)return t(`answer.duration.underSecond`);let r=Math.round(e/1e3);if(r<60)return n(t(`answer.duration.sec`,{n:r}));let i=Math.floor(r/60),a=r%60;return n(a?t(`answer.duration.minSec`,{m:i,s:a}):t(`answer.duration.min`,{n:i}))}var yx={answered:[`answer.answeredIn`,`answer.answeredInPlace`],stopped:[`answer.stoppedAfter`,`answer.stoppedAfterPlace`],interrupted:[`answer.interruptedAfter`,`answer.interruptedAfterPlace`]},bx={GPU:`device.gpu`,NPU:`device.npu`,CPU:`device.cpu`};function xx(e){if(e===`on this PC`)return g(`answer.place.thisPc`);let t=/^via (.+)$/.exec(e);if(t)return g(`answer.place.via`,{provider:t[1]});let n=/^on your (.+)$/.exec(e)?.[1].split(` and `).map(e=>bx[e]);if(n?.every(Boolean)){let e=n.slice(1).reduce((e,t)=>g(`answer.place.pair`,{a:e,b:g(t)}),g(n[0]));return g(`answer.place.on`,{device:e})}return e}function Sx(e,t,n,r,i){let a=[],o=t?.place?xx(t.place):null;if(e!=null&&e>0){let[t,s]=yx[n??`answered`],c=vx(e,r,i);a.push(o?r(s,{time:c,place:o}):r(t,{time:c}))}else o&&a.push(r(n?`answer.ranPlace`:`answer.answeredPlace`,{place:o}));if(t?.time_to_first_token!=null&&t.time_to_first_token>0){let e=vx(t.time_to_first_token*1e3,r,i);a.push(r(a.length?`answer.firstWord`:`answer.firstWordLead`,{time:e}))}return t?.steps!=null&&t.steps>0&&a.push(r(h(`answer.steps`,t.steps),{n:t.steps})),a.length?a.join(` · `):null}function Cx(e,t,n,r,i){return Sx(e,t,n,z.bare,_x)===null?null:r.compose(r=>Sx(e,t,n,r,i)??``)}function wx(e,t,n=z,r=_x){let i=[];if(e!=null&&e>0&&i.push(n.compose(t=>t(`answer.exact.total`,{time:r(t(`answer.duration.sec`,{n:(e/1e3).toFixed(1)}))}))),t?.time_to_first_token!=null&&t.time_to_first_token>0){let e=(t.time_to_first_token*1e3).toFixed(0);i.push(n.compose(t=>t(`answer.exact.firstToken`,{time:r(t(`answer.duration.ms`,{n:e}))})))}if(t?.output_tokens!=null&&t.output_tokens>0){let e=r(`${(t.input_tokens??0).toLocaleString()} → ${t.output_tokens.toLocaleString()}`);i.push(n.compose(t=>t(`answer.exact.tokens`,{flow:e})))}return t?.tokens_per_second!=null&&t.tokens_per_second>0&&i.push(n(`answer.exact.rate`,{n:t.tokens_per_second})),i}function Tx({latencyMs:e,stats:t,ended:n}){let r=T(),[i,a]=(0,J.useState)(!1),o=Cx(e,t,n,r,ny),s=wx(e,t,r,ny);return!o&&s.length===0?null:V(D.Fragment,{children:[P(`span`,{children:P(`button`,{type:`button`,className:`msg-stats-summary`,"aria-expanded":i,title:wx(e,t,r).join(`
50
+ `),onClick:()=>a(e=>!e),children:o?P(ay,{text:o}):r(`answer.details`)})}),i&&s.map(e=>P(`span`,{children:P(ay,{text:e})},e))]})}function Ex(e){return!e||e===`Thinking...`||e.startsWith(`Reading `)||/— retrying (now|in \d+s)/.test(e)}var Dx=`(prefers-reduced-motion: reduce)`;function Ox(e){let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),n=/^([\d.]+)(ms|s)$/.exec(t);if(!n)throw Error(`Motion token ${e} is "${t}", not a duration; check styles/index.css.`);return parseFloat(n[1])*(n[2]===`s`?1e3:1)}function kx(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(Dx).matches}function Ax(){return kx()?`auto`:`smooth`}var jx=/failed to fetch|networkerror|load failed/i;function Mx(e){return e instanceof TypeError&&jx.test(e.message)}function Nx(e){return Mx(e)?g(`request.gaiaUnreachable`):e instanceof vn?e.detail||e.message:e instanceof Error?e.message:String(e)}function Px(e,t=I()){let n=Nx(e);return typeof n==`object`?t(n.ref,n.params):String(n)}var Fx=new Map;function Ix(e){let t=Fx.get(e);return t||(t={byMessage:new Map,checked:new Set,inFlight:null,listeners:new Set},Fx.set(e,t)),t}function Lx(e){let t=Ix(e);return t.inFlight||=Promise.resolve().then(()=>en(e)).then(e=>{if(!e||!Array.isArray(e.turns))throw Error(`the server sent no list of turns`);let{turns:n}=e;t.byMessage=new Map(n.filter(e=>e.message_id!=null).map(e=>[e.message_id,e])),t.listeners.forEach(e=>e())}).finally(()=>{t.inFlight=null}),t.inFlight}function Rx(e){return Lx(e)}function zx(e,t){let[n,r]=(0,J.useState)(()=>Fx.get(e)?.byMessage.get(t)??null),[i,a]=(0,J.useState)(null);return(0,J.useEffect)(()=>{if(t<=0)return;let n=Ix(e),i=()=>r(n.byMessage.get(t)??null);return n.listeners.add(i),!n.byMessage.has(t)&&!n.checked.has(t)?(n.checked.add(t),Lx(e).then(()=>a(null),e=>{n.checked.delete(t),a(Nx(e))})):i(),()=>{n.listeners.delete(i)}},[e,t]),{turn:n,error:i,refresh:(0,J.useCallback)(()=>Lx(e),[e])}}var Bx=`gaia:changes-undone`;function Vx(e){window.dispatchEvent(new CustomEvent(Bx,{detail:e}))}function Hx(e,t){let n=(0,J.useRef)(t);n.current=t,(0,J.useEffect)(()=>{let t=t=>{t.detail===e&&n.current()};return window.addEventListener(Bx,t),()=>window.removeEventListener(Bx,t)},[e])}var Ux={shell:{one:`command`,many:`commands`,prefix:`Command`},run_python:{one:`Python snippet`,many:`Python snippets`,prefix:`Python`},execute_python_file:{one:`Python script`,many:`Python scripts`,prefix:`Python script`},mcp:{one:`connected tool call`,many:`connected tool calls`,prefix:`Connected tool`},install_cli:{one:`install command`,many:`install commands`,prefix:`Install`},late_write:{one:`late file write`,many:`late file writes`,prefix:`File write`}},Wx=120;function Gx(e){return Ux[e]??{one:e,many:e,prefix:e}}function Kx(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qx(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Wx?`${t.slice(0,119).trimEnd()}…`:t}function Jx(e,t){return`${e} ${e===1?t.one:t.many}`}function Yx(e){let t=new Map;for(let n of e){let e=t.get(n.kind);e||(e={kind:n.kind,count:0,entries:new Map},t.set(n.kind,e)),e.count+=1;let r=(n.detail??``).trim(),i=e.entries.get(r);i?i.count+=1:e.entries.set(r,{label:qx(r),detail:r,count:1})}return[...t.values()].map(({kind:e,count:t,entries:n})=>{let r=Gx(e),i=[...n.values()],a;if(i.length===1){let e=i[0];a=e.label?`${r.prefix}: ${e.label}`:Kx(r.one),e.count>1&&(a+=` ×${e.count}`)}else a=`${Kx(r.many)} ×${t}`;return{kind:e,title:a,count:t,entries:i}})}function Xx(e){let t=Yx(e).map(e=>Jx(e.count,Gx(e.kind)));return t.length===0?`work`:t.length===1?t[0]:`${t.slice(0,-1).join(`, `)} and ${t[t.length-1]}`}function Zx(e,{also:t=!1,inChat:n=!1,undo:r=`Undo`}={}){let i=e.length===1;return`${n?`In this chat, GAIA`:`GAIA`} ${t?`also ran`:`ran`} ${Xx(e)} it can't track. If ${i?`it`:`they`} changed any files, ${r} won't restore them.`}var Qx=Ln(),$x=[`a[href]`,`area[href]`,`button`,`input:not([type="hidden"])`,`select`,`textarea`,`iframe`,`summary`,`[contenteditable]:not([contenteditable="false"])`,`[tabindex]`].join(`, `),eS=[];function tS(){let e=eS[eS.length-1];for(let t=!0;t;){t=!1;for(let n of eS)n!==e&&n.current&&e?.current?.contains(n.current)&&(e=n,t=!0)}return e}function nS(e,t){for(let n=e.parentElement?.closest(`details`);n&&t.contains(n);n=n.parentElement?.closest(`details`))if(!n.open&&!n.querySelector(`:scope > summary`)?.contains(e))return!0;return!1}function rS(e,t){let n=e.closest(`[inert]`);if(n&&t.contains(n)||nS(e,t))return!1;if(typeof e.checkVisibility==`function`)return e.checkVisibility({visibilityProperty:!0});if(getComputedStyle(e).visibility===`hidden`)return!1;for(let n=e;n&&n!==t.parentElement;n=n.parentElement)if(n.hidden||getComputedStyle(n).display===`none`)return!1;return!0}function iS(e){let t=Array.from(e.querySelectorAll($x)).filter(t=>{let n=t.getAttribute(`tabindex`);return n!==null&&Number(n)<0||t.matches(`:disabled`)?!1:rS(t,e)}),n=e=>e instanceof HTMLInputElement&&e.type===`radio`&&e.name!==``,r=new Map;for(let e of t){if(!n(e))continue;let t=r.get(e.name);(!t||e.checked&&!t.checked)&&r.set(e.name,e)}let i=new Set(r.values());return t.filter(e=>!n(e)||i.has(e))}function aS(e,t){(0,J.useEffect)(()=>{if(!t)return;let n=e;eS.push(n);let r=t=>{if(t.key!==`Tab`||t.defaultPrevented||tS()!==n)return;let r=e.current;if(!r)return;let i=iS(r);if(i.length===0){t.preventDefault();return}let a=document.activeElement,o=a&&r.contains(a)&&a!==r?a:null,s=(e,t)=>!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING),c=!!o&&!i.some(e=>s(e,o)),l=!!o&&!i.some(e=>s(o,e));t.shiftKey&&(!o||c)?(t.preventDefault(),i[i.length-1].focus()):!t.shiftKey&&(!o||l)&&(t.preventDefault(),i[0].focus())};return document.addEventListener(`keydown`,r),()=>{document.removeEventListener(`keydown`,r),eS.splice(eS.indexOf(n),1)}},[e,t])}var oS={edited:`Edited`,created:`Created`,deleted:`Deleted`};function sS(e){if(e.too_large)return`Too large to show: ${e.before_size} → ${e.after_size} bytes.`;if(e.binary)return`Binary file: ${e.before_size} → ${e.after_size} bytes. No text diff.`;if(e.truncated)return`Diff shortened: the change is too long to show in full.`}function cS({sessionId:e,turn:t,onClose:n}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null);Io(!0,n);let s=(0,J.useRef)(null);return aS(s,!0),(0,J.useEffect)(()=>{let n=!0;return nn(e,t.turn_id).then(e=>{n&&i(e.files)},e=>{n&&o(e instanceof Error?e.message:String(e))}),()=>{n=!1}},[e,t.turn_id]),(0,Qx.createPortal)(P(`div`,{ref:s,className:`modal-overlay`,onClick:n,role:`dialog`,"aria-modal":`true`,"aria-label":`Review changes`,children:V(`div`,{className:`modal-panel changes-review`,onClick:e=>e.stopPropagation(),children:[V(`div`,{className:`modal-header`,children:[P(`h3`,{children:`Changes in this turn`}),P(`button`,{type:`button`,className:`btn-icon`,onClick:n,"aria-label":`Close`,children:P(So,{size:18})})]}),V(`div`,{className:`modal-body changes-review-body`,children:[a&&V(`p`,{className:`settings-error`,role:`alert`,children:[`Could not load the changes: `,a]}),!r&&!a&&V(`p`,{className:`changes-review-loading`,children:[P(K,{size:13,className:`spin`}),` Loading changes…`]}),r?.map(e=>P(`section`,{className:`changes-review-file`,children:P(rx,{data:{title:e.path,badge:oS[e.change],note:sS(e),unified:e.binary||e.too_large?``:e.unified}})},e.path)),t.restored_at&&P(`p`,{className:`settings-hint`,children:`This turn was undone; these are the changes it had made.`})]})]})}),document.body)}function lS(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function uS({sessionId:e,messageId:t}){let n=T(),{turn:r,error:i,refresh:a}=zx(e,t),[o,s]=(0,J.useState)(`idle`),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=(0,J.useCallback)(async t=>{if(r){s(`working`),l(null);try{let n=await it(e,r.turn_id,t),i=[];n.restored.length&&i.push(`restored ${lS(n.restored.length,`file`)}`),n.removed.length&&i.push(`removed ${lS(n.removed.length,`new file`)}`);let o=`Undone: ${i.join(`, `)||`no files needed changing`}.`;n.kept_folders.length&&(o+=` Kept ${lS(n.kept_folders.length,`folder`)} it created, because they now hold other files.`),l(o),s(`done`),Vx(e),await a()}catch(e){let t=e instanceof vn&&e.reason===`conflict`;l(e instanceof vn?e.detail:String(e)),s(t?`conflict`:`idle`)}}},[a,e,r]);if(i)return V(`div`,{className:`turn-changes is-error`,role:`note`,children:[P(q,{size:12,"aria-hidden":`true`}),P(`span`,{children:n(`turnChanges.loadError`,{error:i})})]});if(!r||r.files.length===0&&!r.incomplete)return null;let p=r.files.length,m=!!r.restored_at,h=Yx(r.untracked);return V(`div`,{className:`turn-changes`,"aria-label":`File changes from this turn`,children:[p>0&&V(`div`,{className:`turn-changes-row`,children:[V(`span`,{className:`turn-changes-summary`,children:[`Changed `,lS(p,`file`),m&&` · undone`]}),V(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>d(!0),children:[P(ri,{size:12,"aria-hidden":`true`}),` Review changes`]}),!m&&o!==`confirm`&&o!==`conflict`&&V(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>s(`confirm`),disabled:o===`working`,children:[P(fo,{size:12,"aria-hidden":`true`}),` `,o===`working`?`Undoing…`:`Undo this turn`]}),o===`confirm`&&V(`span`,{className:`turn-changes-confirm`,role:`group`,"aria-label":`Confirm undo`,children:[`Put `,lS(p,`file`),` back the way `,p===1?`it was`:`they were`,` before this turn?`,P(`button`,{type:`button`,className:`turn-changes-btn is-primary`,onClick:()=>void f(!1),children:`Undo`}),P(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>s(`idle`),children:`Cancel`})]})]}),r.incomplete&&V(`div`,{className:`turn-changes-warning`,role:`note`,children:[P(q,{size:12,"aria-hidden":`true`}),V(`span`,{children:[Zx(r.untracked,{also:p>0}),h.length>0&&P(`ul`,{children:h.map(e=>P(`li`,{children:e.entries.length===1?P(`span`,{title:e.entries[0].detail||void 0,children:e.title}):V(`details`,{children:[P(`summary`,{children:e.title}),P(`ul`,{children:e.entries.map(e=>V(`li`,{title:e.detail||void 0,children:[e.label||`No description`,e.count>1&&` ×${e.count}`]},e.detail))})]})},e.kind))})]})]}),c&&V(`div`,{className:`turn-changes-message${o===`done`?` is-ok`:` is-error`}`,role:o===`done`?`status`:`alert`,children:[c,o===`conflict`&&V(`span`,{className:`turn-changes-confirm`,children:[P(`button`,{type:`button`,className:`turn-changes-btn is-danger`,onClick:()=>void f(!0),children:`Undo anyway and lose those changes`}),P(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>{s(`idle`),l(null)},children:`Keep them`})]})]}),u&&P(cS,{sessionId:e,turn:r,onClose:()=>d(!1)})]})}async function dS(){return Tt(`GET`,`/speech/settings`)}async function fS(e){return Tt(`PUT`,`/speech/settings`,e)}async function pS(){return Tt(`GET`,`/speech/model`)}var mS=1e3;async function hS(e,t={}){let n=`${L()}/speech`,r=d.api.time();d.api.info(`POST ${n}`,{chars:e.length,voice:t.voice});let i=await fetch(n,{method:`POST`,headers:{...Bt,"Content-Type":`application/json`},body:JSON.stringify({text:e,voice:t.voice,speed:t.speed}),signal:t.signal});if(!i.ok){let e=await i.text().catch(()=>``);d.api.error(`POST ${n} - HTTP ${i.status}`,{errorText:e});let t=An(e);throw new vn(jn(i.status,t),i.status,t,wt(e))}let a=await i.blob();return d.api.timed(`POST ${n} -> ${i.status} (${a.size} bytes)`,r),a}function gS(e){return e.replace(/```[\s\S]*?(```|$)/g,`
51
+ `).replace(/!\[[^\]]*\]\([^)]*\)/g,``).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/<\/?[a-z][^>]*>/gi,``).replace(/https?:\/\/\S+/g,``).replace(/`([^`]*)`/g,`$1`).replace(/^[ \t]*([-*_][ \t]*){3,}$/gm,``).replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm,``).replace(/^[ \t]*>[ \t]?/gm,``).replace(/^[ \t]*([-*+]|\d+[.)])[ \t]+/gm,``).replace(/^[ \t]*\|?[ \t:|-]+\|[ \t:|-]*$/gm,``).replace(/^[ \t]*\|(.*?)\|?[ \t]*$/gm,(e,t)=>t.split(`|`).map(e=>e.trim()).filter(Boolean).join(`, `)).replace(/(\*\*|\*|~~)(\S(?:[\s\S]*?\S)?)\1/g,`$2`).replace(/(?<!\w)(__|_)(\S(?:[\s\S]*?\S)?)\1(?!\w)/g,`$2`).split(`
52
+ `).map(e=>e.trim()).filter(Boolean).join(`
53
+ `).trim()}function _S(e,t){let n=[],r=e.trim();for(;r.length>t;){let e=r.slice(0,t),i=Math.max(e.lastIndexOf(`, `),e.lastIndexOf(`; `),e.lastIndexOf(` `)),a=i>t/3?i+1:t;n.push(r.slice(0,a).trim()),r=r.slice(a).trim()}return r&&n.push(r),n}function vS(e,t=1e3){let n=gS(e);if(!n)return[];let r=n.split(/(?<=[.!?…؟])\s+|\n+/).flatMap((e,n)=>_S(e,Math.min(n===0?180:600,t))),i=[],a=``;for(let e of r){let n=Math.min(i.length===0?180:600,t);a&&a.length+1+e.length>n?(i.push(a),a=e):a=a?`${a} ${e}`:e}return a&&i.push(a),i}var yS=class extends Error{};function bS(e,t){return t instanceof vn?{messageId:e,kind:t.httpStatus===503?`unreachable`:t.httpStatus===502?`speech`:`other`,detail:t.detail||t.message}:t instanceof yS||t instanceof DOMException&&t.name===`NotAllowedError`?{messageId:e,kind:`playback`,detail:t.message}:{messageId:e,kind:`other`,detail:t instanceof Error?t.message:String(t)}}var xS=null;function SS(e){e.abort.abort(),e.audio&&(e.audio.pause(),e.audio.src=``),e.urls.forEach(e=>URL.revokeObjectURL(e)),e.urls=[]}function CS(e,t){return new Promise((n,r)=>{let i=URL.createObjectURL(t);e.urls.push(i);let a=new Audio(i);e.audio=a;let o=()=>{e.abort.signal.removeEventListener(`abort`,o),n()};a.onended=o,a.onerror=()=>r(new yS(a.error?.message||`media error ${a.error?.code??``}`.trim())),e.abort.signal.addEventListener(`abort`,o),a.play().catch(r)})}var wS=p((e,t)=>({messageId:null,status:null,error:null,settings:null,voiceReady:!1,downloadGb:null,setSettings:t=>e({settings:t}),stop:()=>{xS&&SS(xS),xS=null,e({messageId:null,status:null,downloadGb:null})},clearError:()=>e({error:null}),read:async(n,r)=>{t().stop();let i=vS(r,mS);if(i.length===0)return;let a={abort:new AbortController,audio:null,urls:[]};xS=a,e({messageId:n,status:`loading`,error:null});let o=e=>{let t=hS(e,{signal:a.abort.signal});return t.catch(()=>void 0),t};try{if(!t().voiceReady){let t=await pS();if(xS!==a)return;t.downloaded||e({status:`downloading`,downloadGb:t.size_gb})}let n=o(i[0]);for(let t=0;t<i.length;t++){let r=await n;if(xS!==a||(t+1<i.length&&(n=o(i[t+1])),e({status:`playing`,voiceReady:!0,downloadGb:null}),await CS(a,r),xS!==a))return}}catch(t){if(xS!==a||a.abort.signal.aborted)return;d.ui.error(`Read aloud failed`,t),e({error:bS(n,t)})}xS===a&&(SS(a),xS=null,e({messageId:null,status:null,downloadGb:null}))}}));function TS({messageId:e,content:t}){let n=T(),r=wS(t=>t.messageId===e),i=wS(t=>t.messageId===e?t.status:null),a=wS(e=>e.read),o=wS(e=>e.stop),s=n(r?`readAloud.stop`:`readAloud.read`);return P(`button`,{type:`button`,className:`msg-action-btn msg-read-aloud${r?` is-active`:``}`,onClick:()=>r?o():void a(e,t),title:s,"aria-label":s,"aria-pressed":r,children:i===`loading`||i===`downloading`?P(K,{size:12,className:`spin`}):P(r?io:go,{size:12})})}function ES({messageId:e}){let t=T(),n=wS(t=>t.messageId===e&&t.status===`downloading`),r=wS(e=>e.downloadGb);return n?V(`p`,{className:`msg-read-aloud-note`,role:`status`,children:[t(`readAloud.downloading`),r!=null&&V(D.Fragment,{children:[` `,V(`bdi`,{dir:`ltr`,children:[`(~`,r,` GB)`]})]})]}):null}function DS({messageId:e}){let t=T(),n=wS(t=>t.error?.messageId===e?t.error:null),r=wS(e=>e.clearError);return n?V(`p`,{className:`msg-read-aloud-error`,role:`alert`,children:[V(`span`,{children:[t(`readAloud.error.${n.kind}`),n.detail&&P(`span`,{className:`msg-read-aloud-detail`,children:P(`bdi`,{children:n.detail})})]}),P(`button`,{type:`button`,className:`msg-action-btn`,onClick:r,"aria-label":t(`readAloud.dismiss`),title:t(`readAloud.dismiss`),children:P(So,{size:12})})]}):null}var OS=1e9;function $(e){return e>0&&e<1?`${Math.max(1,Math.round(e*1e3))} MB`:`${e.toFixed(1)} GB`}var kS=1024**3/OS;function AS(e,t){let n=e?Number.parseFloat(e):NaN;return Number.isFinite(n)&&e?.trim().toUpperCase().endsWith(`GB`)?$(n*kS):e||(t==null?null:$(t))}function jS(e){return`${e.toFixed(1)} GB`}function MS(e){return $(e/OS)}function NS(e){let t=e/1e6;return`${t>=10?Math.round(t):t.toFixed(1)} MB/s`}function PS(e,t){return _(e).meta.dir===`rtl`?r(t,`ltr`):t}function FS(e,t){return e<90?t(`setup.eta.sec`,{n:String(Math.max(1,Math.round(e)))}):e<=7200?t(`setup.eta.min`,{n:String(Math.round(e/60))}):t(`setup.eta.long`)}function IS(e,t){return e<90?t(`setup.eta.secSpoken`,{n:String(Math.max(1,Math.round(e)))}):e<=7200?t(`setup.eta.minSpoken`,{n:String(Math.round(e/60))}):t(`setup.eta.long`)}var LS=5,RS=class{start=null;lastAt=0;lastBytes=0;movedAt=0;speed=0;shownEta=null;shownAt=0;update(e,t,n){if(this.start===null||e<this.lastBytes)return this.start=n,this.lastAt=n,this.lastBytes=e,this.movedAt=n,this.speed=0,this.shownEta=null,{speed:null,eta:null,stalledFor:0};if(this.lastBytes===0&&e>0)return this.lastAt=n,this.lastBytes=e,this.movedAt=n,{speed:null,eta:null,stalledFor:0};let r=(n-this.lastAt)/1e3;if(r>0){let t=(e-this.lastBytes)/r,i=1-Math.exp(-r/LS);this.speed=this.speed===0?t:this.speed+i*(t-this.speed),e>this.lastBytes&&(this.movedAt=n),this.lastAt=n,this.lastBytes=e}let i=(n-this.movedAt)/1e3;if((n-this.start)/1e3<10)return{speed:null,eta:null,stalledFor:i};if(this.speed<=0)return this.shownEta=null,{speed:0,eta:null,stalledFor:i};let a=Math.max(0,t-e)/this.speed;if(this.shownEta===null)this.shownEta=a;else{let e=(n-this.shownAt)/1e3,t=this.shownEta-e;this.shownEta=a<t?this.shownEta-Math.max(e,(this.shownEta-a)/2):a>this.shownEta?this.shownEta+(a-this.shownEta)*.25:a}return this.shownAt=n,{speed:this.speed,eta:Math.max(0,this.shownEta),stalledFor:i}}},zS=[0,3e3,1e4],BS=`The answer to your last message was lost: its run stopped before it finished, most often because GAIA restarted. Send the message again.`;function VS(e){return e.name===`StreamStalledError`||e.name===`StreamDroppedError`}function HS(e){return e.name===`StreamDroppedError`&&e.unreachable===!0}function US(e){return HS(e)?!1:VS(e)||e instanceof fn}function WS(e,t=I()){if(HS(e))return t(`chatError.gaiaStopped`);if(VS(e))return t(`chatError.liveViewLost`,{n:4});if(e instanceof fn)return e.endpoint===`send`?`GAIA did not start this answer within ${Math.round(e.timeoutMs/1e3)} seconds; it may be busy or stuck. If the chat list shows this chat running, reopen it later to see the answer. Otherwise, send the message again.`:`GAIA did not respond when this chat reconnected to its running answer. The answer may still finish: reopen this chat once GAIA is answering again.`;if(e instanceof vn){let t=e.detail?An(e.detail):``;return e.httpStatus===429?`GAIA is busy with another chat, so this message was not sent. Send it again when that chat finishes.`:e.httpStatus===409?t||`This chat is already answering a message. Wait for it to finish, or press Stop.`:`GAIA could not take this message (HTTP ${e.httpStatus})${t?`: ${t}`:`.`}`}return null}var GS=/context (window|size|length|limit)|exceeds the available context|maximum context|too many tokens/i,KS=/lemonade|\bLLM\b|could not get response/i,qS=/failed to fetch|networkerror|\bfetch\b/i,JS=/timed out|timeout/i,YS=/\bGF-\d{8}-\d{6}-[0-9a-f]{4}\b/;function XS(e){return YS.exec(e)?.[0]??null}function ZS(e,t=I()){let n=QS(e,t),r=XS(e.message||``);return r?{...n,text:`${n.text}\n\n${t(`chatError.savedReport`,{id:r})}`}:n}function QS(e,t){let n=WS(e,t);if(n)return{kind:`stream`,text:n};let r=e.message||``;return GS.test(r)?{kind:`context`,text:t(`chatError.context`)}:KS.test(r)?{kind:`model_server`,text:t(`chatError.modelServer`)}:e instanceof TypeError||qS.test(r)?{kind:`connection`,text:t(`chatError.connection`)}:JS.test(r)?{kind:`timeout`,text:t(`chatError.timeout`)}:{kind:`unknown`,text:t(`chatError.unknown`)}}function $S(e){return XS(e)!==null}function eC(e){return e instanceof Error?e.message:String(e)}function tC({classes:e,note:t}){let n=T(),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=(0,J.useCallback)(async()=>{i(!0),c(null),o(null);try{let e=await ze(),t=await Te(e.name),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(n),6e4),o(e)}catch(e){c(n(`setup.logs.reportFailed`,{error:eC(e)}))}finally{i(!1)}},[n]);return V(`div`,{className:e.root,children:[V(`button`,{type:`button`,className:e.button,onClick:()=>void l(),disabled:r,children:[r?P(K,{size:13,className:`spin`,"aria-hidden":`true`}):P(ai,{size:13,"aria-hidden":`true`}),P(`span`,{children:n(`setup.logs.report`)})]}),t&&P(`span`,{className:e.hint,children:t}),a&&V(`p`,{className:e.hint,role:`status`,children:[n(`setup.logs.reportSaved`,{size:MS(a.size_bytes)}),` `,P(`bdi`,{dir:`ltr`,children:a.path})]}),s&&P(`p`,{className:e.error,role:`alert`,children:s})]})}var nC=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),rC=String.raw`(?:[A-Za-z]:[\\/](?:[^\s*?"<>|,;)}\]\\/]+[\\/])*)?`,iC=String.raw`(?<![\p{L}\p{N}_.\-])`,aC=String.raw`(?![\p{L}\p{N}_\-]|\.[\p{L}\p{N}])`;function oC(e){let t=new Map;for(let n of e)n.filename&&t.set(n.filename.toLowerCase(),n);if(t.size===0)return{re:null,byName:t};let n=[...t.keys()].sort((e,t)=>t.length-e.length).map(nC).join(`|`);return{re:RegExp(`${rC}${iC}(${n})${aC}`,`giu`),byName:t}}function sC(e,t){let n=t.trim().split(/[\\/]/).pop()??``;return e.byName.get(n.toLowerCase())??null}function cC(e,t){if(!e.re)return[];let n=[];for(let r of t.matchAll(e.re)){let t=e.byName.get(r[1].toLowerCase());t&&n.push({start:r.index,end:r.index+r[0].length,doc:t})}return n}var lC=`[0-9\\u0660-\\u0669\\u06F0-\\u06F9]+`,uC=[`pages?`,`pp?\\.`,`[وبفل]?(?:الصفحات|الصفحتان|الصفحتين|الصفحة|صفحات|صفحتي|صفحة)`,`ص\\.?`].join(`|`),dC=String.raw`\s*(?:,|،|&|and|to|و|إلى|[-–—])\s*`,fC=new RegExp(String.raw`(?<!\p{L})(?:${uC})(?!\p{L})\s*(${lC}(?:${dC}${lC})*)`,`iu`);function pC(e){return Number(e.replace(/[٠-٩۰-۹]/g,e=>String(e.charCodeAt(0)&15)))}function mC(e){let t=fC.exec(e);if(!t||t.index>40)return[];let n=t.index+t[0].length-t[1].length,r=[];for(let e of t[1].matchAll(new RegExp(lC,`g`))){let t=pC(e[0]);t>0&&r.push({start:n+e.index,end:n+e.index+e[0].length,page:t})}return r}function hC({active:e,label:t,awaitingUser:n=!1}){let r=T(),i=n?r(`activity.waiting`):t?wy(r,t):r(`msg.thinking`),[a]=(0,J.useState)(kx),[o,s]=(0,J.useState)(0),[c,l]=(0,J.useState)(a?`idle`:`typing`),u=(0,J.useRef)(e),d=(0,J.useRef)(i.length);d.current=i.length,(0,J.useEffect)(()=>{if(c!==`typing`)return;if(a||o>=i.length){l(`idle`);return}let e=setTimeout(()=>s(e=>e+1),30);return()=>clearTimeout(e)},[c,o,i.length,a]),(0,J.useEffect)(()=>{u.current&&!e&&(s(d.current),l(a?`done`:`erasing`)),u.current=e},[e,a]),(0,J.useEffect)(()=>{if(c!==`erasing`)return;if(o<=0){l(`done`);return}let e=setTimeout(()=>s(e=>e-1),20);return()=>clearTimeout(e)},[c,o]),(0,J.useEffect)(()=>{e&&c===`done`&&(s(0),l(`typing`))},[e,c]);let f=_C(e,i),p=e&&!n&&Ex(t),m=_C(p),h=hs();if(c===`done`)return null;let g=p&&m>=45;return V(`span`,{className:`thinking-indicator${e&&!n?` is-live`:``}`,children:[P(`span`,{className:`thinking-indicator-text`,children:c===`idle`?i:i.slice(0,o)}),e&&!n&&f>=gC&&V(`span`,{className:`thinking-indicator-elapsed`,children:[` · `,V(`bdi`,{dir:`ltr`,children:[f,`s`]})]}),e&&P(`span`,{className:`cursor`}),g&&P(`span`,{className:`thinking-indicator-hint`,role:`status`,children:r(h?.remote===!1?`live.localModelWaitHint`:`live.modelWaitHint`)})]})}var gC=3;function _C(e,t){let[n,r]=(0,J.useState)(0);return(0,J.useEffect)(()=>{if(r(0),!e)return;let t=Date.now(),n=setInterval(()=>r(Math.floor((Date.now()-t)/1e3)),1e3);return()=>clearInterval(n)},[e,t]),n}var vC={root:`msg-report`,button:`msg-try-again`,hint:`msg-report-hint`,error:`msg-report-error`};function yC(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 bC=e=>e.replace(/\s+/g,` `).trim();function xC(e,t){let n=bC(t);if(!n)return{steps:e,echoed:!1};let r=e.filter(e=>!(e.type===`error`&&e.detail&&bC(e.detail)===n));return{steps:r,echoed:r.length<e.length}}var SC=/\s*\{\s*"?tool"?\s*:\s*"[^"]+"\s*,\s*"?tool_args"?\s*:\s*\{[^}]*\}\s*\}/g,CC=new Set([`thought`,`answer`,`tool`,`tool_args`,`goal`]),wC=/^\{\s*"(thought|answer|tool|tool_args|goal)"\s*:/;function TC(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);else if(t===`"`)r=!0;else if(t===`{`)n++;else if(t===`}`&&(n--,n===0))return a}return-1}function EC(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,`
54
+ `).replace(/\\\\/g,`\\`)}function DC(e){let t;try{t=JSON.parse(e)}catch{let t=EC(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=>CC.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 OC(e,t){let n=``,r=0;for(;r<e.length;){let i=e.indexOf(`{`,r);if(i===-1){n+=e.slice(r);break}if(!wC.test(e.slice(i,i+40))){n+=e.slice(r,i+1),r=i+1;continue}let a=TC(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=DC(o);s.action===`answer`?n+=s.text:s.action===`keep`&&(n+=o),r=a+1}return n}var kC=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 AC(e){return e.replace(/```(\w*)[ \t]*\n([\s\S]*?)```/g,(e,t,n)=>{let r=t.toLowerCase();return r.length>0&&r.length<=2&&!kC.has(r)?n.trim():e})}var jC=/\n{1,2}Verification: unverified[^\n]*\s*$/;function MC(e){let t=e;for(;;){let e=t.replace(jC,``);if(e===t)return t;t=e}}function NC(e,t=!1){if(!e)return e;e=MC(e);let n=e;n=n.replace(SC,``),n=OC(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,`
55
+ `),n=n.replace(/\\"/g,`"`)),n=AC(n).trim(),PC(n)}function PC(e){let t=!1;return e.split(`
56
+ `).map(e=>(/^\s*(```|~~~)/.test(e)&&(t=!t),t?e:e.replace(/^(\s*\d+)\.(\s*)$/,`$1\\.$2`))).join(`
57
+ `)}function FC(e,t){return e?new Date(e).toLocaleString(te(t),{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,hour12:!0}):``}var IC=`Cancelled.`,LC=[[`This answer was interrupted when GAIA closed. Send again to retry.`,`msg.cutOff.interrupted`],[`This answer was interrupted before it finished. Send again to retry.`,`msg.cutOff.cancelled`],[`This answer ended before GAIA could save a reply. Send again to retry.`,`msg.cutOff.noReply`]],RC=/(?:^|\n\n)Before it stopped, it had started these tools: (.+)\.$/;function zC(e){let t=e.trim(),n=LC.find(([e])=>t.endsWith(e));if(!n)return null;t=t.slice(0,-n[0].length).trimEnd();let r=RC.exec(t);return r&&(t=t.slice(0,r.index).trimEnd()),{body:t,notice:n[1],tools:r?r[1]:null}}function BC(e,t){return t?`stopped`:zC(e)?`interrupted`:void 0}function VC({message:e,isStreaming:t,agentSteps:n,agentStepsActive:r,cards:i,onDelete:a,onResend:o,extraActions:s,onTryAgain:c,latencyMs:l,liveStatus:u,toolStatus:d,awaitingUser:f}){let p=T();ls();let m=(0,J.useMemo)(()=>e.role===`assistant`&&!t&&n?xC(n,e.content):{steps:n,echoed:!1},[n,e.content,e.role,t]),h=e.role===`assistant`&&(m.echoed||e.failed===!0||yC(e.content)),g=e.role===`assistant`?e.stopState??(e.content.trim()===IC?`stopped`:void 0):void 0,_=(0,J.useMemo)(()=>e.role===`assistant`&&!t?zC(e.content):null,[e.content,e.role,t]),v=(0,J.useMemo)(()=>e.role===`user`?e.content:NC(_?_.body:e.content,!!t),[e.content,e.role,t,_]),y=`${e.session_id}:${e.id}`,[b,x]=(0,J.useState)(!1),[S,C]=(0,J.useState)(!1),w=e.role===`user`&&my(e.content),[E,O]=(0,J.useState)(!1),k=(0,J.useId)(),A=(0,J.useRef)(null),j=(0,J.useRef)(!1),M=(0,J.useCallback)(()=>{E&&(j.current=!0),O(!E)},[E]);(0,J.useEffect)(()=>{!E&&j.current&&(j.current=!1,A.current?.scrollIntoView?.({block:`nearest`}))},[E]);let N=(0,J.useRef)(null),F=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{N.current&&clearTimeout(N.current),F.current&&clearTimeout(F.current)},[]);let I=(0,J.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)}x(!0),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>x(!1),2e3)},[e.content]),L=(0,J.useCallback)(()=>{S?(C(!1),F.current&&clearTimeout(F.current),a?.(e.id)):(C(!0),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>C(!1),3e3))},[S,e.id,a]),ee=(0,J.useCallback)(()=>{o?.(e)},[e,o]),R=e.created_at?p(e.role===`user`?`msg.sent`:`msg.replied`,{time:FC(e.created_at,p)}):void 0;return P(`div`,{className:`msg msg-${e.role} ${h?`msg-error`:``}`,title:R,children:V(`div`,{className:`msg-inner`,children:[V(`div`,{className:`msg-header`,children:[P(`div`,{className:`msg-header-left`}),!t&&V(`div`,{className:`msg-actions`,children:[e.role===`user`&&o&&P(`button`,{className:`msg-action-btn`,onClick:ee,title:p(`msg.resend`),"aria-label":p(`msg.resend`),children:P(Pa,{size:12})}),s,e.role===`assistant`&&!h&&v.trim()&&P(TS,{messageId:y,content:v}),P(`button`,{className:`msg-copy ${b?`copied`:``}`,onClick:I,title:p(b?`msg.copied`:`msg.copy`),"aria-label":p(b?`msg.copiedAria`:`msg.copy`),children:P(b?pr:zr,{size:12})}),a&&P(`button`,{className:`msg-action-btn msg-delete ${S?`confirm`:``}`,onClick:L,title:p(S?`msg.confirmDelete`:`msg.delete`),"aria-label":p(S?`msg.confirmDeleteAria`:`msg.delete`),children:P(co,{size:12})})]})]}),V(`div`,{className:`msg-body`,children:[e.role===`assistant`&&(m.steps&&m.steps.length>0||t)&&P(eb,{steps:m.steps??[],isActive:r??!1,running:!!t,awaitingUser:f,toolStatus:t?d:null,answer:t?void 0:v,liveLine:t&&P(hC,{active:!!r||!v,label:u,awaitingUser:f})}),h&&V(`div`,{className:`error-banner`,children:[P(q,{size:14}),P(`span`,{children:p(`msg.error`)})]}),(e.cards??i)?.map((e,t)=>P(gx,{render:e.render,data:e.data},t)),w?V(D.Fragment,{children:[P(`div`,{ref:A,id:k,className:`msg-collapsible${E?``:` is-collapsed`}`,children:P(ow,{content:v})}),P(gy,{expanded:E,onToggle:M,controls:k,collapsedLabel:p.hint(p(`msg.showAll`),hy(e.content)),expandedLabel:p(`msg.showLess`),className:`msg-expand-toggle`})]}):!(g&&v.trim()===IC)&&P(ow,{content:v,showCursor:t&&!!v&&!r,isStreaming:t}),g&&V(`div`,{className:`msg-stopped${g===`unconfirmed`||e.stopError?` is-unconfirmed`:``}`,role:`note`,children:[P(io,{size:9,fill:`currentColor`,"aria-hidden":`true`}),P(`span`,{children:g===`unconfirmed`?p(`msg.stoppedUnconfirmed`):e.stopError?p(`msg.stoppedError`,{error:e.stopError}):p(`msg.stopped`)})]}),_&&P(`p`,{className:`msg-cut-off`,role:`note`,children:p.compose(e=>_.tools?`${e(`msg.cutOff.toolsRan`,{tools:_.tools})} ${e(_.notice)}`:e(_.notice))}),c&&!t&&V(`button`,{type:`button`,className:`msg-try-again`,onClick:c,children:[P(Ra,{size:12,"aria-hidden":`true`}),p(`msg.tryAgain`)]}),e.role===`assistant`&&!t&&($S(e.content)||$S(e.failureText??``))&&P(tC,{classes:vC,note:p(`msg.reportNote`)}),e.role===`assistant`&&!t&&Sb(v)&&P(Eb,{content:v}),e.role===`assistant`&&!t&&(e.stats||l!=null||e.created_at)&&V(`div`,{className:`msg-stats`,"aria-label":p(`msg.about`),children:[e.created_at&&P(`span`,{className:`msg-stats-ts`,title:p(`msg.timestamp`),children:FC(e.created_at,p)}),e.stats?.retried&&e.stats.model&&P(`span`,{title:`This answer was kept from Retry with… (${e.stats.model})`,children:ds(e.stats.model)}),P(Tx,{latencyMs:l,stats:e.stats,ended:BC(e.content,g)})]}),e.role===`assistant`&&!t&&e.id>0&&e.session_id&&P(uS,{sessionId:e.session_id,messageId:e.id}),e.role===`assistant`&&P(ES,{messageId:y}),e.role===`assistant`&&P(DS,{messageId:y})]})]})})}var HC=(0,J.createContext)(!1);function UC({lang:e,code:t}){let n=T(),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(!1),s=(0,J.useContext)(HC),c=(0,J.useId)(),l=py(t),u=l>(s?20:25),d=u&&!a,f=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let p=(0,J.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)}i(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>i(!1),2e3)},[t]);return V(`div`,{className:`code-block${d?` is-collapsed`:``}`,dir:`ltr`,children:[V(`div`,{className:`code-header`,children:[P(`span`,{className:`code-lang`,children:e||`code`}),V(`button`,{className:`code-copy ${r?`copied`:``}`,onClick:p,title:n(r?`msg.copied`:`code.copy`),"aria-label":n(r?`msg.copiedAria`:`code.copyAria`),children:[P(r?pr:zr,{size:13}),P(`span`,{children:n(r?`code.copied`:`code.copy`)})]})]}),P(`pre`,{id:c,children:P(`code`,{children:t})}),u&&P(gy,{expanded:a,onToggle:()=>o(e=>!e),controls:c,collapsedLabel:`Expand (${l.toLocaleString(`en-US`)} lines)`,expandedLabel:`Collapse`,className:`code-expand-toggle`})]})}var WC=/(?<=["\u201c])[A-Z]:[\\/][^*?"<>|\r\n\u201c\u201d]+(?=["\u201d])|\b[A-Z]:[\\/](?=[^\s*?"<>|,;)}\]\\/])(?:[^\s*?"<>|,;)}\]\\/]+(?:(?: +(?:[^\s*?"<>|,;:)}\]\\/]+|\([^\s*?"<>|,;:)}\]\\/]+\)))+\\|[\\/]))*(?:(?:[^\s*?"<>|,;:.)}\]\\/]+ +){1,2}[^\s*?"<>|,;)}\]\\/]+\.[A-Za-z0-9]{1,5}\b|[^\s*?"<>|,;)}\]\\/]+)?/gi,GC=/[.:!']+$/,KC=RegExp(`^(?:${WC.source})$`,`i`);function qC(e){if(typeof e!=`string`)return null;let t=e.trim();return KC.test(t)?t:null}function JC({path:e}){let t=t=>{t.preventDefault(),En(e).catch(e=>{d.ui.error(`Failed to open path`,e)})};return V(`span`,{className:`file-path-link`,dir:`ltr`,onClick:t,title:`Open in file explorer: ${e}`,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t(e))},children:[P(yi,{size:12,className:`file-path-icon`}),e]})}function YC(e){return[...e.matchAll(new RegExp(WC.source,`gi`))].map(t=>{let n=t.index+t[0].length,r=`"“`.includes(e[t.index-1]??`
58
+ `)&&`"”`.includes(e[n]??`
59
+ `);return{start:t.index,path:r?t[0]:t[0].replace(GC,``)}})}function XC(e){let t=[],n=0;for(let{start:r,path:i}of YC(e))r>n&&t.push(e.slice(n,r)),t.push(P(JC,{path:i},r)),n=r+i.length;return t.length===0?e:(n<e.length&&t.push(e.slice(n)),P(D.Fragment,{children:t}))}var ZC=(0,J.createContext)(oC([]));function QC({doc:e,page:t,t:n}){return V(`a`,{className:`citation-link`,href:me(e.id,t),target:`_blank`,rel:`noopener noreferrer`,dir:`ltr`,title:t?n(`citation.openPage`,{page:t}):n(`citation.open`,{name:e.filename}),"data-doc-id":e.id,"data-page":t,children:[P(hi,{size:12,className:`citation-icon`,"aria-hidden":`true`}),e.filename]})}function $C({doc:e,page:t,label:n,t:r}){return P(`a`,{className:`citation-page`,href:me(e.id,t),target:`_blank`,rel:`noopener noreferrer`,title:r(`citation.openPage`,{page:t}),"data-doc-id":e.id,"data-page":t,children:n})}function ew(e,t){let n=cC(e,t)[0];return mC(n?t.slice(0,n.start):t)}function tw(e,t,n,r){let i=YC(e),a=cC(t,e).filter(e=>!i.some(t=>t.start<e.start&&e.start<t.start+t.path.length)),o=[],s=(t,r,i)=>{for(let a of r){let r=i+a.start,s=i+a.end;o.push({start:r,end:s,node:P($C,{doc:t,page:a.page,label:e.slice(r,s),t:n},`p${r}`)})}};if(r&&s(r,mC(e.slice(0,a[0]?.start??e.length)),0),a.forEach((t,r)=>{let i=mC(e.slice(t.end,a[r+1]?.start??e.length));o.push({start:t.start,end:t.end,node:P(QC,{doc:t.doc,page:i[0]?.page,t:n},`c${t.start}`)}),s(t.doc,i,t.end)}),o.length===0)return XC(e);o.sort((e,t)=>e.start-t.start);let c=[],l=0;for(let t of o)t.start>l&&c.push(P(J.Fragment,{children:XC(e.slice(l,t.start))},`t${l}`)),c.push(t.node),l=t.end;return l<e.length&&c.push(P(J.Fragment,{children:XC(e.slice(l))},`t${l}`)),P(D.Fragment,{children:c})}function nw(e,t){return typeof t==`string`?sC(e,t):null}function rw({children:e}){let t=(0,J.useContext)(ZC),n=T(),r=J.Children.toArray(e),i=null,a=r.map((e,a)=>{if(typeof e==`string`){let r=tw(e,t,n,i);return i=null,P(J.Fragment,{children:r},`s${a}`)}if(i=null,J.isValidElement(e)&&e.type===iw){let o=nw(t,e.props.children);if(o){let e=r[a+1],s=typeof e==`string`?ew(t,e):[];return i=o,P(QC,{doc:o,page:s[0]?.page,t:n},`k${a}`)}}return e});return P(D.Fragment,{children:a})}function iw({className:e,children:t,node:n,...r}){let i=(0,J.useContext)(ZC),a=T(),o=nw(i,t);if(o)return P(QC,{doc:o,t:a});let s=qC(t);return s?P(JC,{path:s}):P(`code`,{className:`inline-code`,dir:`ltr`,...r,children:t})}var aw={code:iw,pre({children:e}){let t=J.Children.toArray(e)[0];if(J.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 P(UC,{lang:a,code:i})}return P(`pre`,{dir:`ltr`,children:e})},table({children:e}){return P(`div`,{className:`md-table-wrap`,children:P(`table`,{className:`md-table`,dir:`auto`,children:e})})},a({href:e,children:t}){return P(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`md-link`,children:t})},p({children:e}){return P(`p`,{className:`md-p`,dir:`auto`,children:P(rw,{children:e})})},h1({children:e}){return P(`h2`,{className:`md-h2`,dir:`auto`,children:P(rw,{children:e})})},h2({children:e}){return P(`h3`,{className:`md-h3`,dir:`auto`,children:P(rw,{children:e})})},h3({children:e}){return P(`h4`,{className:`md-h4`,dir:`auto`,children:P(rw,{children:e})})},h4({children:e}){return P(`h5`,{className:`md-h4`,dir:`auto`,children:P(rw,{children:e})})},ul({children:e}){return P(`ul`,{className:`md-ul`,dir:`auto`,children:e})},ol({children:e,start:t}){return P(`ol`,{className:`md-ol`,start:t,dir:`auto`,children:e})},li({children:e}){return P(`li`,{className:`md-li`,dir:`auto`,children:P(rw,{children:e})})},blockquote({children:e}){return P(`blockquote`,{className:`md-blockquote`,dir:`auto`,children:P(rw,{children:e})})},hr(){return P(`hr`,{className:`md-hr`})},td({children:e}){return P(`td`,{dir:`auto`,children:P(rw,{children:e})})},th({children:e}){return P(`th`,{dir:`auto`,children:P(rw,{children:e})})}};function ow({content:e,showCursor:t,isStreaming:n=!1}){let r=k(e=>e.documents),i=(0,J.useMemo)(()=>oC(r),[r]);return!e&&!t?null:!e&&t?P(`span`,{className:`cursor`}):P(HC.Provider,{value:n,children:P(ZC.Provider,{value:i,children:V(`div`,{className:`md-content`,children:[P(Vh,{remarkPlugins:[Jv,$v,ty],disallowedElements:[...Kh],urlTransform:Jh,components:aw,children:e}),t&&P(`span`,{className:`cursor`})]})})})}function sw(e){return e.type===`status`&&e.status===`working`&&!e.phase&&(e.message??``).startsWith(`Model is processing`)}function cw(e){return e.phase===`loading_tools`?I()(`chat.loadingTools`):(e.message||``).trim()}function lw(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`commentary`:return{id:n,type:`commentary`,label:`Commentary`,detail:e.content,active:!1,timestamp:r};case`tool_start`:return{id:n,type:`tool`,label:`Using tool`,tool:e.tool,detail:e.detail,narration:e.narration,active:!0,timestamp:r,mcpServer:e.mcp_server,mcpServerLabel:e.mcp_server_label,mcpTool:e.mcp_tool};case`skill_use`:return{id:n,type:`tool`,label:`Using tool`,tool:`use_skill`,detail:e.skill,narration:`Using skill: ${e.skill}`,active:!1,success:!0,timestamp:r};case`plan`:return{id:n,type:`plan`,label:`Created plan`,planSteps:e.steps,planNarrations:e.step_narrations,currentStep:e.current_step,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`,...e.status===`warning`?{success:!1}:{},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}}var uw=new Set([`tool`,`waiting`]);function dw(e){return e.livePhase&&!uw.has(e.livePhase)?e.liveStatus:null}function fw(e,t){let n=k.getState(),r=e.status,i=cw(e);if(e.phase===`recording_found`&&e.section!=null){n.addRecordingSection({section:e.section,sections:e.sections??e.section,start:e.start??``,end:e.end??``,summary:e.summary??``,items:e.items??[]});return}if(e.phase===`recording`&&e.stage!=null){n.setRecordingStage(e.stage,{state:e.state??0,percent:e.percent,etaSeconds:e.eta_seconds});return}if(e.phase&&i&&n.setLiveStatus(i,e.phase),e.phase===`waiting`||sw(e)||i.toLowerCase().startsWith(`executing `)||r!==`working`&&r!==`warning`&&r!==`info`)return;let a=n.agentSteps[n.agentSteps.length-1];if(a&&a.type===`status`&&a.active){n.updateLastAgentStep({label:i||`Working`,detail:i});return}if(a&&a.type===`thinking`&&a.active){n.updateLastAgentStep({label:i||`Thinking`});return}let o=lw({...e,message:i},t);o&&n.addAgentStep(o)}var pw=/\s*\{\s*"?(?:tool|thought|goal)"?\s*:\s*"[^"]*"[^}]*(?:"?tool_args"?\s*:\s*\{[^}]*\})?\s*\}/g;function mw(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,`
60
+ `).replace(/\\\\/g,`\\`)}function hw(e,t){if(e.type!==`agent_error`||e.recoverable!==!0)return!1;let n=t[t.length-1];return!n||n.type!==`tool`?!1:n.success===!1||!!n.active&&n.success==null}function gw(e){let t=(e||[]).filter(e=>typeof e.render==`string`&&e.render.length>0).map(e=>({render:e.render,data:e.data}));return t.length>0?t:void 0}function _w(e){return(e||[]).map(e=>{let t=e.agentSteps||e.agent_steps||void 0;return{...e,agentSteps:t,cards:e.cards||gw(t),stats:e.stats||e.inference_stats||void 0,turnSummary:e.turnSummary||e.turn_summary||void 0,stopState:e.stopState??(e.stopped?`stopped`:void 0)}})}function vw(e,t,n){let r=e.find(e=>e.id===n.id&&e.role===`user`);if(r)return r;let i=t.findIndex(e=>e.id===n.id);if(i<0)throw Error(`Message ${n.id} is no longer in this chat.`);let a=new Set(e.map(e=>e.id)),o=i-1;for(;o>=0&&!a.has(t[o].id);)o--;let s=o<0?0:e.findIndex(e=>e.id===t[o].id)+1,c=e.slice(s).filter(e=>e.role===`user`),l=0;for(let e of t.slice(o+1,i))e.role===`user`&&c[l]?.content===e.content&&l++;return c[l]?.content===n.content?c[l]:null}function yw(e,t){return!!e&&e.role===`assistant`&&!!t.failureText&&e.content.trim()===t.failureText.trim()}function bw(e,t,n){let r=e.slice(e.findIndex(e=>e.id===t.id)+1);return r.length===0||r.length===1&&(r[0].id===n.id||yw(r[0],n))}function xw(e,t){let n=e[e.length-1],r=t[t.length-1];if(!n?.failed||!yw(r,n))return t;let i=e=>[...e].reverse().find(e=>e.role===`user`)?.content;return i(e)===i(t)?[...t.slice(0,-1),{...r,failed:!0,failureText:n.failureText}]:t}function Sw(e){return`policy-receipt-${encodeURIComponent(e)}`}function Cw(e){let t=e.content.trim();return!t||e.stopState||e.failed||e.failure||yC(t)?!1:!xC(e.agentSteps??[],t).echoed}function ww(){(0,J.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await dS();e&&t&&wS.getState().setSettings(t)}catch(e){d.ui.error(`Could not load the read-aloud settings; replies will not be read automatically`,e)}};return t(),window.addEventListener(`focus`,t),()=>{e=!1,window.removeEventListener(`focus`,t)}},[])}var Tw=[`download`,`decode`,`transcribe`,`voices`,`prepare`,`analyze`],Ew=0,Dw=5;function Ow(e,t){return e==null?``:e<60?t(`recording.leftUnderMinute`):t(`recording.leftMinutes`,{minutes:Math.ceil(e/60)})}function kw(e){return Tw.map((e,t)=>t).filter(t=>t!==Ew&&t!==Dw||t in e)}function Aw({state:e}){return e===1?P(pr,{size:14,"aria-hidden":`true`}):e===2?P(ua,{size:14,"aria-hidden":`true`}):P(`span`,{className:`recording-progress-dot`,"aria-hidden":`true`})}function jw({index:e,stage:t}){let n=T(),r=n(`recording.stage.${Tw[e]}`),i=t?.state===0,a=t?.percent,o=i?Ow(t?.etaSeconds,n):``,s=t?.state===2?n(`recording.skipped`):o;return V(`li`,{className:`recording-progress-row${i?` is-running`:``}${t?``:` is-waiting`}${t?.state===1?` is-done`:``}`,children:[P(`span`,{className:`recording-progress-mark`,children:P(Aw,{state:t?.state})}),P(`span`,{className:`recording-progress-label`,children:r}),i&&a!=null&&V(`bdi`,{className:`recording-progress-percent`,dir:`ltr`,children:[a,`%`]}),s&&P(`span`,{className:`recording-progress-left`,children:s}),i&&P(`div`,{className:`recording-progress-track${a==null?` is-indeterminate`:``}`,role:`progressbar`,"aria-label":r,"aria-valuemin":a==null?void 0:0,"aria-valuemax":a==null?void 0:100,"aria-valuenow":a??void 0,children:P(`div`,{className:`recording-progress-fill`,style:a==null?void 0:{inlineSize:`${a}%`}})})]})}var Mw=120;function Nw(e){let t=[];return Object.values(e).sort((e,t)=>e.section-t.section).map(e=>{let n=e.items.filter(e=>{let n=e.title.trim().toLowerCase(),r=t.some(t=>t.title===n&&Math.abs(t.seconds-e.seconds)<Mw);return r||t.push({title:n,seconds:e.seconds}),!r});return{...e,items:n}})}function Pw({sections:e}){let t=T(),n=Nw(e),r=n[0]?.sections??0;return V(`section`,{className:`recording-found`,"aria-label":t(`recording.found.title`),children:[V(`h4`,{className:`recording-found-title`,children:[t(`recording.found.title`),P(`span`,{className:`recording-found-count`,children:t(`recording.found.count`,{done:n.length,total:r})})]}),n.map(e=>V(`div`,{className:`recording-found-section`,children:[V(`p`,{className:`recording-found-span`,children:[V(`bdi`,{dir:`ltr`,className:`recording-found-time`,children:[e.start,`–`,e.end]}),e.summary&&P(`span`,{dir:`auto`,children:e.summary})]}),e.items.length>0&&P(`ul`,{className:`recording-found-items`,children:e.items.map(e=>V(`li`,{children:[P(`bdi`,{dir:`ltr`,className:`recording-found-time`,children:e.start}),P(`span`,{dir:`auto`,children:e.title})]},`${e.seconds}-${e.title}`))})]},e.section))]})}function Fw(){let e=T(),t=k(e=>e.recordingStages),n=k(e=>e.recordingSections);return t?V(`section`,{className:`recording-progress`,"aria-label":e(`recording.title`),children:[P(`ol`,{className:`recording-progress-list`,children:kw(t).map(e=>P(jw,{index:e,stage:t[e]},e))}),n&&P(Pw,{sections:n})]}):null}var Iw=5e3,Lw=2e3,Rw=3e4,zw=6e4;function Bw(e){return e?.init_state===`initializing`?!e.init_tasks||e.init_tasks.some(e=>e.status===`pending`||e.status===`running`):!1}function Vw(e){return e.lemonade_running?`up`:e.lemonade_error?`unresponsive`:`down`}function Hw(e){return e.kind===`slow`||e.kind===`error`||e.kind===`ok`&&Vw(e.status)===`unresponsive`}function Uw(e){let t=e.kind===`ok`?e.status.download_progress?.state:void 0;return t===`downloading`||t===`starting`}function Ww(e){let t=null,n=0,r=!1,i=null,a=0,o=null,s=async()=>{let e={controller:new AbortController,cancelled:!1};o=e;let{controller:t}=e,n=setTimeout(()=>t.abort(),zw);try{return{kind:`ok`,status:await Nt(t.signal)}}catch(n){if(e.cancelled)return null;if(t.signal.aborted)return{kind:`slow`};let r=n?.httpStatus;return r===504?{kind:`slow`}:n?.name===`ApiError`&&typeof r==`number`&&r!==502?{kind:`error`,httpStatus:r,message:n.message}:{kind:`unreachable`,error:n}}finally{clearTimeout(n),o===e&&(o=null)}},c=()=>{if(t)return t;let i=s().then(t=>{if(t!==null){n=Hw(t)?n+1:0,r=Uw(t);try{e(t)}catch(e){d.system.error(`Could not apply the system status; the next poll will try again`,e)}}}).finally(()=>{t===i&&(t=null)});return t=i,i},l=()=>Math.min((r?Lw:Iw)*2**n,Rw),u=e=>{c().finally(()=>{e===a&&(i=setTimeout(()=>u(e),l()))})};return{check:c,start:()=>{let e=++a;return u(e),()=>{e===a&&(a++,i&&clearTimeout(i),i=null,o&&(o.cancelled=!0,o.controller.abort(),o=null,t=null))}}}}var Gw=1e3,Kw=15e3,qw=null,Jw=null,Yw=Gw,Xw=0,Zw=null;function Qw(){if(qw)return qw;let e=Date.now();return qw=yn().then(t=>k.getState().setActiveRuns(t,e)).catch(e=>{d.api.warn(`Could not read which chats are running`,e),Mx(e)&&k.getState().loseActiveRuns()}).finally(()=>{qw=null}),qw}function $w(){let e=k.getState();return e.isStreaming||e.runningSessionIds.length>0}function eT(){return $w()?(Yw=Gw,Gw):(Yw=Math.min(Yw*2,Kw),Yw)}function tT(e){Qw().then(()=>{e===Xw&&(Jw=setTimeout(()=>tT(e),eT()))})}function nT(){Zw&&(Jw&&clearTimeout(Jw),Jw=null,Yw=Gw,tT(++Xw))}function rT(){Zw?.();let e=k.subscribe((e,t)=>{e.isStreaming&&!t.isStreaming&&nT()}),t=()=>nT();window.addEventListener(`focus`,t);let n=()=>{Xw++,Jw&&clearTimeout(Jw),Jw=null,e(),window.removeEventListener(`focus`,t),Zw===n&&(Zw=null)};return Zw=n,Yw=Gw,tT(++Xw),n}var iT=3e3,aT=new Set,oT=new Map,sT=new Set,cT=null;function lT(e,t=Date.now()){oT.set(e,t)}function uT(e){let t=k.getState();return t.activeRunsAt>0&&t.activeRunsAt>=(oT.get(e)??0)&&!t.runningSessionIds.includes(e)&&!t.queuedSessionIds.includes(e)}function dT(e){return sT.add(e),()=>{sT.delete(e),cT?.()}}function fT(e){return e instanceof Error?WS(e)??(e.message||`Unknown error`):String(e)}function pT(e){let t=e?.httpStatus;return typeof t==`number`?t:void 0}function mT(e){let t=pT(e);return t===409||t===429}function hT(e){d.chat.warn(`Chat ${e} no longer exists; dropping its queued messages`),k.getState().updateQueue(e,()=>[])}function gT(e){k.getState().setQueueHold(e,!0),setTimeout(()=>k.getState().setQueueHold(e,!1),iT)}function _T(e,t,n){return pT(n)===409&&(d.chat.info(`Chat ${e} was busy; queueing the message to try again`),k.getState().updateQueue(e,e=>ee(e,t,`queued`)),gT(e),!0)}async function vT(e,t,n){let r=k.getState;if(aT.has(e)||r().queueHolds[e])return;let i=r().messageQueues[e]??[];if(i.some(e=>e.state===`sending`))return;let a=A(i);if(a||w(i)){aT.add(e);try{if(a){let t;try{t=await Vt(e)}catch(t){if(pT(t)===409){d.chat.info(`Chat ${e} is answering again; its queue waits for that turn to end`);return}if(pT(t)===404){hT(e);return}d.chat.error(`Could not learn what chat ${e}'s last reply did with the messages added to it`,t),r().updateQueue(e,e=>F(e,`GAIA could not say whether it read this message: ${fT(t)}`));return}r().updateQueue(e,e=>E(e,t))}let i=w(r().messageQueues[e]??[]);if(!i||!n())return;r().updateQueue(e,e=>ae(e,i.id,`queued`,`starting`));let o;try{o=await t(e,i.text)}catch(e){o={kind:`failed`,error:fT(e)}}if(o.kind===`accepted`){lT(e),r().updateQueue(e,e=>ie(e,i.id)),nT();return}if(o.kind===`busy`){d.chat.info(`Queued message found chat ${e} busy; holding it`),r().updateQueue(e,e=>ne(e,i.id)),gT(e);return}if(o.kind===`gone`){hT(e);return}d.chat.error(`Queued message for chat ${e} was not sent: ${o.error}`),r().updateQueue(e,e=>ne(e,i.id,o.error))}finally{aT.delete(e)}}}function yT(e){return e.type!==`status`||e.phase!==`waiting`}var bT=(e,t)=>new Promise(n=>{let r=!1,i=null,a=!1,o=e=>{r||(r=!0,e.kind===`accepted`&&(i?i.abort():a=!0),n(e))},s=()=>o({kind:`accepted`});d.chat.info(`Sending queued message for chat ${e} in the background`),i=Be(e,t,{onChunk:s,onAgentEvent:e=>{yT(e)&&s()},onDone:s,onError:e=>{VS(e)?s():mT(e)?o({kind:`busy`}):pT(e)===404?o({kind:`gone`}):o({kind:`failed`,error:fT(e)})}}),a&&i.abort()});function xT(e=bT){let t=()=>{let t=k.getState();if(!Bw(t.systemStatus))for(let n of Object.keys(t.messageQueues))!sT.has(n)&&uT(n)&&vT(n,e,()=>!sT.has(n))},n=k.subscribe((e,n)=>{(e.messageQueues!==n.messageQueues||e.queueHolds!==n.queueHolds||e.activeRunsAt!==n.activeRunsAt||e.runningSessionIds!==n.runningSessionIds||e.systemStatus!==n.systemStatus)&&t()});return cT=t,t(),()=>{n(),cT===t&&(cT=null)}}var ST=new Set([`.3g2`,`.3gp`,`.asf`,`.avi`,`.divx`,`.f4v`,`.flv`,`.m2ts`,`.m2v`,`.m4v`,`.mkv`,`.mov`,`.mp4`,`.mpeg`,`.mpg`,`.mts`,`.mxf`,`.ogv`,`.rm`,`.rmvb`,`.vob`,`.webm`,`.wmv`]),CT=new Set([`.aac`,`.ac3`,`.aif`,`.aiff`,`.amr`,`.ape`,`.au`,`.caf`,`.dts`,`.eac3`,`.flac`,`.m4a`,`.m4b`,`.mka`,`.mp2`,`.mp3`,`.oga`,`.ogg`,`.opus`,`.spx`,`.wav`,`.wma`,`.wv`]);function wT(e){let t=e.lastIndexOf(`.`);return t<0?``:e.slice(t).toLowerCase()}function TT(e){return ST.has(wT(e))}function ET(e){let t=wT(e);return ST.has(t)||CT.has(t)}var DT=`https://github.com/amd/gaia/issues/new`,OT=[{label:`Image`,extensions:new Set([`.ico`,`.heic`,`.heif`]),message:`This image format cannot be indexed.`,alternatives:[`Convert it to PNG or JPEG — GAIA reads the text in those images`],featureTitle:`Support HEIC and ICO image indexing`},{label:`Video`,extensions:ST,message:`Video files can't go in the document library.`,alternatives:[`Attach the video to a chat, and GAIA will transcribe it`],featureTitle:`Support video files in the document library`},{label:`Audio`,extensions:CT,message:`Audio files can't go in the document library.`,alternatives:[`Attach the recording to a chat, and GAIA will transcribe it`],featureTitle:`Support audio files in the document library`},{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 kT(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;for(let e of OT)if(e.extensions.has(t))return e;return null}var AT=new Set(`.pdf,.pptx,.docx,.epub,.png,.jpg,.jpeg,.webp,.bmp,.gif,.tif,.tiff,.txt,.md,.mdx,.markdown,.rst,.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 jT(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;return AT.has(t)}function MT(){let e=navigator.userAgent;return`**Environment:**\n- GAIA Version: 0.26.0rc1\n- Platform: ${navigator.platform||`unknown`}\n- User Agent: ${e}\n- Interface: Agent UI (Web)`}function NT(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?_`,``,`---`,MT(),``,`_Submitted from GAIA Agent UI_`].join(`
61
+ `);return`${DT}?${new URLSearchParams({title:`[Feature] ${e}`,body:n,labels:`enhancement,agent-ui`}).toString()}`}function PT(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?_`,``,`---`,MT(),``,`_Submitted from GAIA Agent UI_`].join(`
62
+ `);return`${DT}?${new URLSearchParams({title:`[Bug] ${e}`,body:n,labels:`bug,agent-ui`}).toString()}`}var FT={corrupted:`The file looks damaged. Re-download or re-export it, then index the new copy.`,encrypted:`The PDF needs a password to open. Save a copy without the password, then index that.`,empty:`The PDF has no readable text, which usually means it is a scan. Run OCR on it, then index it again.`,empty_file:`This file is empty. Add content to it, then index it again.`,unsupported_workbook:`This is an old .xls workbook or has a password. Open it in Excel, save a copy as .xlsx without a password, then index that.`};function IT(e,t){return e.startsWith(t)?e.slice(t.length).trim():e}function LT({filename:e,error:t,status:n,kind:r,onDismiss:i,timeout:a=15e3}){let o=(0,J.useRef)(null);(0,J.useEffect)(()=>(a>0&&(o.current=setTimeout(i,a)),()=>{o.current&&clearTimeout(o.current)}),[i,a]);let s=e.includes(`.`)?`.`+e.split(`.`).pop()?.toLowerCase():``,c=s?kT(s):null,l=t.toLowerCase().includes(`unsupported file type`)||t.toLowerCase().includes(`not supported for indexing`)||t.toLowerCase().includes(`file type not allowed`)||c!==null,u=t.toLowerCase().includes(`fetch`)||t.toLowerCase().includes(`network`)||t.toLowerCase().includes(`connect`),d,f,p,m=Cr,h=r?FT[r]:void 0;return h?(d=`"${e}" can't be read`,f=h,p=null,m=q):n===404?(d=`"${e}" doesn't exist`,f=IT(t,`File not found:`),p=null,m=q):n===403?(d=`GAIA can't read files in that location`,f=`${t} Or drop the file here instead (up to 20 MB) and GAIA keeps its own copy.`,p=null,m=q):l&&c?(d=`${c.label} files not supported`,f=c.message,p=NT(c.featureTitle),m=q):l&&!s?(d=`"${e}" has no file extension`,f=IT(t,`File type not allowed:`),p=null,m=q):l?(d=`File type not supported: ${s}`,f=`This file format cannot be indexed. Supported: PDF, DOCX, PPTX, XLSX, EPUB, images (PNG, JPG, WEBP, ...), TXT, MD, CSV, JSON, HTML, XML, YAML, and 30+ code file formats.`,p=NT(`Support ${s} file indexing`),m=q):u?(d=`Connection error`,f=`Could not reach the GAIA server. Make sure the backend is running.`,p=PT(`Upload connection error for ${e}`),m=Cr):(d=`Failed to index "${e}"`,f=t||`An unexpected error occurred during indexing.`,p=PT(`Indexing error: ${t.slice(0,80)}`),m=ar),V(`div`,{className:`upload-error-toast`,role:`alert`,children:[P(m,{size:16}),V(`div`,{className:`upload-error-content`,children:[P(`div`,{className:`upload-error-title`,children:d}),V(`div`,{className:`upload-error-detail`,children:[f,p&&` `,p===null?null:l?P(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,children:`Request this feature →`}):P(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,children:`Report this issue →`})]})]}),P(`button`,{className:`upload-error-dismiss`,onClick:i,"aria-label":`Dismiss`,children:P(So,{size:14})})]})}function RT(e,t){let n=e=>t.some(t=>t.id===e&&t.configured),r=Cb(e);return r===`google`?n(`google`):r===`microsoft`?n(`microsoft`):r===`microsoft_work`?n(`microsoft_work`):n(`google`)||n(`microsoft`)||n(`microsoft_work`)}function zT(e,t){let n=e=>t.some(t=>t.id===e&&t.configured),r=Cb(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 BT=4e3;function VT({content:e,onRetry:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(()=>{he().then(e=>r(e.connectors||[])).catch(e=>d.ui.warn(`ConnectorRetryBanner: connector fetch failed`,e))},[]),s=RT(e,n);if((0,J.useEffect)(()=>{o();let e=()=>o();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[o]),(0,J.useEffect)(()=>{if(s)return;let e=setInterval(o,BT);return()=>clearInterval(e)},[s,o]),!s||i)return null;let c=zT(e,n);return V(`div`,{className:`connector-retry-banner`,role:`status`,children:[P(Dr,{size:14,className:`connector-retry-banner__icon`}),V(`span`,{className:`connector-retry-banner__text`,children:[c,` connected since this reply — ask again to run it now.`]}),V(`button`,{type:`button`,className:`connector-retry-banner__btn`,onClick:()=>{a(!0),t()},children:[P(Pa,{size:12}),P(`span`,{children:`Ask again`})]}),P(`button`,{type:`button`,className:`connector-retry-banner__dismiss`,onClick:()=>a(!0),"aria-label":`Dismiss`,children:`×`})]})}function HT(e){return e.isMedia?TT(e.name)?pi:si:hi}var UT=240,WT=1e5;function GT({value:e,onChange:t,onSubmit:n,onStop:r,streaming:i=!1,stopping:a=!1,queueWhileStreaming:o=!1,disabledReason:s,attachments:c,placeholder:l,autoFocus:u,inputRef:d,leftControls:f,rightControls:p}){let m=T(),h=(0,J.useRef)(null),g=d??h,_=(0,J.useRef)(null),v=!!s,y=e.trim().length>0||c.hasUploaded,b=c.compose(e.trim()).length,x=b>WT,S=!v&&(!i||o)&&!c.uploading&&y&&!x,C=s||l||m(`composer.placeholder`);(0,J.useLayoutEffect)(()=>{let e=g.current;if(!e)return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,UT)}px`};if(t(),typeof ResizeObserver>`u`)return;let n=e.clientWidth,r=new ResizeObserver(()=>{e.clientWidth!==n&&(n=e.clientWidth,t())});return r.observe(e),()=>r.disconnect()},[e,C,g]);let w=(0,J.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),S&&n())},[S,n]),E=(0,J.useCallback)(e=>{e.dataTransfer?.files?.length&&(e.preventDefault(),e.stopPropagation(),c.addFiles(Array.from(e.dataTransfer.files)))},[c]);return V(`div`,{className:`composer${v?` composer-disabled`:``}`,onDrop:E,onDragOver:e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault()},children:[c.attachments.length>0&&P(`ul`,{className:`composer-attachments`,"aria-label":m(`composer.attached`),children:c.attachments.map(e=>{let t=HT(e);return V(`li`,{className:`composer-attachment${e.error?` has-error`:``}${e.isMedia?` is-media`:``}`,children:[e.isImage&&e.url?P(`img`,{src:e.url,alt:``,className:`composer-attachment-thumb`}):P(t,{size:14,"aria-hidden":`true`}),P(`span`,{className:`composer-attachment-name`,title:e.name,dir:`auto`,children:e.name}),e.uploading&&P(`span`,{className:`composer-attachment-state`,children:e.progress===void 0?m(`composer.uploading`):m(`composer.uploadingPercent`,{percent:e.progress})}),e.uploaded&&e.isMedia&&P(`span`,{className:`composer-attachment-state`,children:m(`composer.mediaReady`)}),e.error&&P(`span`,{className:`composer-attachment-state`,role:`alert`,title:e.error,children:e.error}),P(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>c.remove(e.id),"aria-label":m(`composer.remove`,{name:e.name}),children:P(So,{size:12})})]},e.id)})}),P(`textarea`,{ref:g,className:`composer-input`,value:e,onChange:e=>t(e.target.value),onKeyDown:w,onPaste:e=>{c.handlePaste(e)},placeholder:C,rows:1,disabled:v,autoFocus:u,"aria-label":m(`composer.message`),dir:`auto`}),x&&V(`p`,{className:`composer-limit-error`,role:`alert`,children:[m(`composer.tooLong`,{sent:b.toLocaleString(),max:1e5.toLocaleString()}),` `,m(`composer.tooLongHint`)]}),V(`div`,{className:`composer-row`,children:[V(`div`,{className:`composer-row-left`,children:[P(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>_.current?.click(),disabled:v,"aria-label":m(`composer.attach`),title:m(`composer.attach`),children:P(Ma,{size:16})}),P(`input`,{ref:_,type:`file`,multiple:!0,hidden:!0,onChange:e=>{e.target.files&&c.addFiles(Array.from(e.target.files)),e.target.value=``}}),f]}),V(`div`,{className:`composer-row-right`,children:[p,i&&o&&y&&P(`button`,{type:`button`,className:`composer-send`,onClick:n,disabled:!S,"aria-label":m(`composer.queue`),title:m(`composer.queueTitle`),children:P(Yn,{size:16})}),i?P(`button`,{type:`button`,className:`composer-send is-stop`,onClick:r,disabled:a,"aria-label":m(`composer.stop`),title:a?m(`composer.stopping`):m.hint(m(`composer.stop`),`Esc`),children:P(io,{size:12,fill:`currentColor`})}):P(`button`,{type:`button`,className:`composer-send`,onClick:n,disabled:!S,"aria-label":m(`composer.send`),title:m.hint(m(`composer.send`),`Enter`),children:P(Yn,{size:16})})]})]})]})}var KT=8,qT=8;function JT({label:e,warning:t,children:n,id:r,pinned:i=!1,onUnpin:a,tabIndex:o}){let s=(0,J.useId)(),c=r??s,l=(0,J.useRef)(null),u=(0,J.useRef)(null),[d,f]=(0,J.useState)(!1),p=d||i,[m,h]=(0,J.useState)(null);return(0,J.useLayoutEffect)(()=>{if(!p){h(null);return}let e=l.current?.getBoundingClientRect(),t=u.current?.getBoundingClientRect(),n=l.current?.closest(`[role="dialog"]`)?.getBoundingClientRect()??e;if(!e||!t||!n)return;let r=window.innerWidth,i=window.innerHeight,a,o;n.right+KT+t.width<=r-qT?(a=n.right+KT,o=e.top+e.height/2-t.height/2):n.left-KT-t.width>=qT?(a=n.left-KT-t.width,o=e.top+e.height/2-t.height/2):(a=Math.min(Math.max(qT,e.right-t.width),r-qT-t.width),o=e.top-KT-t.height>=qT?e.top-KT-t.height:e.bottom+KT),o=Math.min(Math.max(qT,o),i-qT-t.height),h({left:a,top:o})},[p]),(0,J.useEffect)(()=>{if(!p)return;let e=()=>{f(!1),a?.()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[p,a]),V(D.Fragment,{children:[P(`button`,{ref:l,type:`button`,className:`info-bubble-icon${t?` is-warning`:``}`,"aria-label":e,tabIndex:o,"aria-describedby":p?c:void 0,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onFocus:()=>f(!0),onBlur:()=>f(!1),onClick:e=>{e.stopPropagation(),f(e=>!e)},onKeyDown:e=>{e.key===`Escape`&&p&&(e.stopPropagation(),f(!1))},children:P(Vi,{size:13,"aria-hidden":`true`})}),p&&(0,Qx.createPortal)(P(`div`,{ref:u,id:c,role:`tooltip`,className:`info-bubble`,style:m?{left:m.left,top:m.top}:{left:0,top:0,visibility:`hidden`},children:n}),document.body)]})}function YT(e){return e<.1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function XT(e,t=z){return e?t(`settings.price.perMillion`,{input:YT(e.input_per_million),output:YT(e.output_per_million)}):t(`settings.price.unknown`)}function ZT(e){return`$${e.toFixed(2)}`}var QT=2e3,$T=`waiting_for_os_permission`,eE=5;function tE(e,t){let n=e.rank?`#${e.rank} ${e.note??``}`.trim():null;return t?[n,XT(e.price)].filter(e=>!!e):[Ss(e.placement),e.size_gb?`${e.size_gb} GB`:null,e.tokens_per_second?`${Math.round(e.tokens_per_second)} tok/s on this PC`:null,n,e.custom?`added by you`:null].filter(e=>!!e)}function nE({m:e,onDownload:t,busy:n}){if(Ts(e)){let t=Math.round(e.download_progress?.percent??0);return V(`span`,{className:`model-state is-downloading`,title:`Downloading, ${t}%`,children:[P(K,{size:12,className:`spin`,"aria-hidden":`true`}),` `,t,`%`]})}let r=ws(e);return r===`not_downloaded`?P(`button`,{type:`button`,className:`model-state-btn`,onClick:e=>{e.stopPropagation(),t()},disabled:n,"aria-label":`Download ${e.display_name??e.id}`,title:xs.not_downloaded,tabIndex:-1,children:P(qr,{size:13,"aria-hidden":`true`})}):r===`loaded`?P(`span`,{className:`model-state is-loaded`,role:`img`,"aria-label":xs.loaded,title:xs.loaded}):P(`span`,{className:`model-state is-ready`,title:xs.downloaded,children:`Ready`})}function rE(){let e=cs(e=>e.active),t=cs(e=>e.select),n=cs(e=>e.queued),r=cs(e=>e.queue),i=cs(e=>e.queueError),a=cs(e=>e.rememberNames);cs(e=>e.names);let o=hs(),s=k(t=>gs(e,t.sessions,t.currentSessionId)),c=k(e=>e.isStreaming),l=k(e=>e.openSettings),u=(0,J.useRef)(null),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(0),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(null),[D,O]=(0,J.useState)(0),[A,j]=(0,J.useState)(null),M=(0,J.useRef)(0),N=(0,J.useRef)(null),F=(0,J.useId)(),I=(0,J.useRef)(null),L=(0,J.useRef)(null),[ee,R]=(0,J.useState)(null),[z,B]=(0,J.useState)(null),te=(0,J.useCallback)(()=>B(null),[]),ne=(0,J.useCallback)(()=>f(!1),[]),re=(0,J.useRef)(!1),ie=(0,J.useCallback)(async(e=!1)=>{e||(re.current=!1,v(null),m(null));try{let{providers:t,lemonade_error:n}=await wn();if(n)throw Error(n);let r=t.filter(e=>!e.remote||e.models_discovered||e.id===`fireworks`||e.registered),i=await Promise.all(r.map(async e=>{if(e.remote&&!e.models_discovered)return{provider:e,models:[]};try{return{provider:e,models:(await Zt(e.id)).models}}catch(t){return{provider:e,models:[],error:Px(t)}}}));a(i.flatMap(e=>e.models)),g(i.flatMap(e=>e.models).filter(e=>e.available===!1).length),e||(re.current=!0),m(i.map(e=>({...e,models:e.models.filter(e=>e.available!==!1)})))}catch(e){v(Px(e))}},[a]);(0,J.useEffect)(()=>{d&&(b(null),R(null),B(null),ie())},[d,ie]),(0,J.useEffect)(()=>{if(!d||!p||!re.current)return;let e=I.current?.querySelector(`[role="option"][tabindex="0"]`);e&&(re.current=!1,e.focus(),e.scrollIntoView?.({block:`nearest`}))},[d,p]),(0,J.useEffect)(()=>{y&&L.current?.scrollIntoView?.({block:`nearest`})},[y]);let ae=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=Array.from(I.current?.querySelectorAll(`[role="option"]:not(:disabled)`)??[]);if(!t.length)return;let n=t.indexOf(document.activeElement),r;switch(e.key){case`ArrowDown`:r=n<0?0:Math.min(n+1,t.length-1);break;case`ArrowUp`:r=n<0?t.length-1:Math.max(n-1,0);break;case`Home`:r=0;break;case`End`:r=t.length-1;break;case`ArrowRight`:case`i`:{let r=n<0?void 0:t[n].dataset.row;if(!r)return;e.preventDefault(),B(t=>e.key===`i`&&t===r?null:r);return}case`ArrowLeft`:e.preventDefault(),B(null);return;default:return}e.preventDefault(),t[r].focus(),t[r].scrollIntoView?.({block:`nearest`})},oe=!!p?.some(e=>e.models.some(Ts)),H=!!p?.some(e=>e.provider.key_state===$T);(0,J.useEffect)(()=>{if(!(d||T)||!(oe||T||H))return;let e=setInterval(()=>{ie(!0)},QT);return()=>clearInterval(e)},[d,oe,T,H,ie]);let U=(0,J.useCallback)(async e=>{w(e),O(e=>e+1),v(null);try{await fe(e),await ie(!0)}catch(t){E(t=>t?.model===e?null:t),v(Px(t))}finally{w(null),O(e=>e-1)}},[ie]),se=(0,J.useCallback)(async(n,i)=>{if(i.remote&&!e?.remote&&y?.model!==n)return b({model:n,provider:i}),null;if(b(null),c)return r(n===e?.model?null:n),f(!1),null;S(n),v(null);try{return await t(n),j(null),f(!1),null}catch(e){let t=Px(e);return v(t),t}finally{S(null)}},[e?.model,e?.remote,y,r,t,c]);(0,J.useEffect)(()=>{if(!T||!p||D>0)return;let{model:e,provider:t}=T,n=()=>(N.current!==p&&(N.current=p,M.current+=1),M.current>=eE),r=p.flatMap(e=>e.models).find(t=>t.id===e);if(!r){if(!n())return;E(null),j(`${ds(e)} is no longer in the model list, so it wasn't switched to.`);return}if(Ts(r)){M.current=0;return}let i=r.download_progress;if(i?.state===`error`)E(null),j(`Downloading ${ds(e)} failed: ${i.message??`no reason given`}`);else if(i?.state!==`complete`&&ws(r)===`not_downloaded`){if(!n())return;E(null),j(`The download of ${ds(e)} never started. Try the download button again.`)}else E(null),se(e,t).then(t=>{t&&j(`${ds(e)} downloaded, but switching to it failed: ${t}`)})},[p,T,D,se]);let W=p?.flatMap(({provider:e,models:t})=>[...e.remote&&!e.models_discovered?[`key:${e.id}`]:[],...t.filter(e=>x===null&&!Ts(e)).map(e=>e.id)])??[],G=n??e?.model,ce=ee&&W.includes(ee)?ee:G&&W.includes(G)?G:W[0],le=e=>({role:`option`,tabIndex:e===ce?0:-1,"data-row":e,onFocus:()=>R(e),onBlur:()=>B(null)}),ue=o?.remote?Fr:o?Ur:kr,de=s?ds(s):`Model`,pe=`${de}${o?` · ${o.label}`:``}`,me=Object.fromEntries((p??[]).map(e=>[e.provider.id,ys(e.models)])),he=e?.downloaded===!1&&s===e.model,ge=A||i||(n?`${ds(n)} is used from your next message.`:e?.config_error?e.config_error:he?`${de} isn't downloaded yet. Open the list to download it.`:o?o.description?.replace(/`/g,``)??(o.remote?`Runs on ${o.label} — chat history leaves this PC`:`Runs on this PC`):ms);return V(`div`,{className:`composer-chip-wrap`,children:[V(`button`,{ref:u,type:`button`,className:`composer-chip${he||i||A?` is-warning`:``}`,onClick:()=>f(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":d,title:ge,children:[P(ue,{size:13,"aria-hidden":`true`}),P(`span`,{className:`composer-chip-label`,dir:`auto`,children:pe}),n&&V(`span`,{className:`composer-chip-next`,children:[`→ `,ds(n),` next`]}),he&&P(qr,{size:12,"aria-label":`Not downloaded`}),A&&P(Cr,{size:12,"aria-label":`Model switch failed`}),P(hr,{size:12,"aria-hidden":`true`})]}),V(Ro,{open:d,onClose:ne,anchor:u,label:`Choose a model`,align:`end`,children:[c&&V(`div`,{className:`popover-message`,role:`status`,children:[`This reply keeps `,s?ds(s):`its model`,`. A model you pick here is used from your next message.`]}),A&&P(`div`,{className:`popover-message is-error`,role:`alert`,children:A}),i&&P(`div`,{className:`popover-message is-error`,role:`alert`,children:i}),_&&P(`div`,{className:`popover-message is-error`,role:`alert`,children:_}),!p&&!_&&V(`div`,{className:`popover-message`,children:[P(K,{size:13,className:`spin`}),` Loading models…`]}),p&&P(`div`,{ref:I,role:`listbox`,"aria-label":`Models`,onKeyDown:ae,children:p.map(({provider:t,models:r,error:i})=>V(`div`,{role:`group`,"aria-labelledby":`${F}-${t.id}`,children:[P(`div`,{className:`popover-heading`,id:`${F}-${t.id}`,children:t.name}),i&&P(`div`,{className:`popover-message is-error`,children:i}),t.key_state===$T?V(`div`,{className:`popover-message`,role:`status`,children:[P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,t.key_message]}):t.remote&&!t.models_discovered&&V(`button`,{type:`button`,className:`popover-item`,...le(`key:${t.id}`),"aria-selected":!1,onClick:()=>{f(!1),l(`model`,t.id)},children:[P(`span`,{className:`popover-item-check`,children:P(Ui,{size:13,"aria-hidden":`true`})}),V(`span`,{className:`popover-item-body`,children:[P(`span`,{className:`popover-item-title`,children:`Add your key`}),V(`span`,{className:`popover-item-note`,children:[`Connect `,t.name,` in Settings`]})]})]}),!i&&r.length===0&&t.models_discovered!==!1&&P(`div`,{className:`popover-message`,children:`No models yet.`}),r.map(r=>{let i=us(n??e?.model,r.id),a=!t.remote&&ws(r)===`not_downloaded`,o=me[t.id][r.id],s=tE(r,t.remote),c=`${F}-info-${t.id}-${r.id}`;return V(J.Fragment,{children:[V(`div`,{className:`popover-row`,children:[V(`button`,{type:`button`,className:`popover-item`,onClick:()=>{a?(M.current=0,j(null),E({model:r.id,provider:t}),U(r.id)):(E(null),se(r.id,t))},disabled:x!==null||Ts(r),...le(r.id),"aria-selected":i,"aria-describedby":z===r.id?c:void 0,children:[P(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:x===r.id?P(K,{size:13,className:`spin`}):i?P(pr,{size:13}):null}),P(`span`,{className:`popover-item-body`,children:P(`span`,{className:`popover-item-title`,children:o})})]}),V(JT,{label:`About ${o}`,warning:!!r.placement?.warning,id:c,pinned:z===r.id,onUnpin:te,tabIndex:-1,children:[P(`div`,{className:`info-bubble-title`,children:o}),s.length>0&&P(`ul`,{className:`info-bubble-lines`,children:s.map(e=>P(`li`,{children:e},e))}),r.placement?.warning&&P(`ul`,{className:`info-bubble-lines`,children:P(`li`,{className:`is-warning`,children:r.placement.warning})}),P(`div`,{className:`info-bubble-id`,children:r.id})]}),P(`span`,{className:`popover-row-state`,children:!t.remote&&P(nE,{m:r,busy:C!==null,onDownload:()=>void U(r.id)})})]}),y?.model===r.id&&y.provider.id===t.id&&V(`div`,{ref:L,className:`popover-message`,role:`alert`,children:[y.provider.privacy_notice,` `,V(`button`,{type:`button`,className:`link-btn`,onClick:()=>se(y.model,y.provider),children:[`Use `,ds(y.model)]})]})]},r.id)})]},t.id))}),h>0&&V(`button`,{type:`button`,className:`popover-item`,onClick:()=>{f(!1),l(`model`)},children:[P(`span`,{className:`popover-item-check`}),P(`span`,{className:`popover-item-body`,children:V(`span`,{className:`popover-item-note`,children:[h,` `,h===1?`model isn’t`:`models aren’t`,` available on this PC — see why in Settings`]})})]}),P(`div`,{className:`popover-divider`}),V(`button`,{type:`button`,className:`popover-item`,onClick:()=>{f(!1),l(`model`)},children:[P(`span`,{className:`popover-item-check`,children:P(Zi,{size:13,"aria-hidden":`true`})}),V(`span`,{className:`popover-item-body`,children:[P(`span`,{className:`popover-item-title`,children:`Add a model from a link…`}),P(`span`,{className:`popover-item-note`,children:`Any GGUF chat model on Hugging Face`})]})]}),V(`button`,{type:`button`,className:`popover-item`,onClick:()=>{f(!1),l(`model`)},children:[P(`span`,{className:`popover-item-check`}),P(`span`,{className:`popover-item-body`,children:P(`span`,{className:`popover-item-title`,children:`Providers and keys…`})})]})]})]})}function iE(e,t,n){if(e==null||!t(e))throw Error(`the server sent no ${n}`);return e}var aE=e=>e.startsWith(`.`);function oE({onPick:e,onClose:t}){let n=T(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(!1);Io(!0,t);let p=(0,J.useRef)(null);aS(p,!0);let m=(0,J.useCallback)(e=>{u(!0),c(null),Promise.resolve().then(()=>Ot(e)).then(e=>{let t=iE(e,e=>Array.isArray(e.entries),`folder listing`);i(t),o(t.current_path)}).catch(e=>c(e instanceof vn?e.detail||e.message:String(e))).finally(()=>u(!1))},[]);(0,J.useEffect)(()=>m(),[m]);let h=r?.entries.filter(e=>e.type===`folder`)??[],g=d?h:h.filter(e=>!aE(e.name));return P(`div`,{className:`modal-overlay`,onClick:t,children:V(`div`,{ref:p,className:`modal-panel sp-picker`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`pick.label`),onClick:e=>e.stopPropagation(),children:[V(`div`,{className:`modal-header`,children:[P(`h3`,{children:n(`pick.title`)}),P(`button`,{type:`button`,className:`btn-icon`,onClick:t,"aria-label":n(`sp.closeShort`),children:P(So,{size:18})})]}),V(`div`,{className:`modal-body sp-picker-body`,children:[P(`p`,{className:`sp-meta`,children:n(`pick.note`)}),V(`form`,{className:`sp-picker-path`,onSubmit:e=>{e.preventDefault(),a.trim()&&m(a.trim())},children:[P(`input`,{value:a,onChange:e=>o(e.target.value),"aria-label":n(`pick.path`),spellCheck:!1,dir:`ltr`}),P(`button`,{type:`submit`,className:`sp-action`,children:n(`pick.go`)})]}),r&&V(`div`,{className:`sp-picker-quick`,children:[r.quick_links.map(e=>P(`button`,{type:`button`,className:`sp-action`,onClick:()=>m(e.path),children:e.name},e.path)),V(`label`,{className:`sp-picker-hidden`,children:[P(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),n(`pick.showHidden`)]})]}),V(`ul`,{className:`sp-picker-list`,"aria-busy":l,children:[r?.parent_path&&P(`li`,{children:V(`button`,{type:`button`,onClick:()=>m(r.parent_path??void 0),children:[P(Yn,{size:13,"aria-hidden":`true`}),` `,n(`pick.up`)]})}),g.map(e=>P(`li`,{children:V(`button`,{type:`button`,onClick:()=>m(e.path),children:[P(Ti,{size:13,"aria-hidden":`true`}),` `,e.name]})},e.path)),r&&g.length===0&&P(`li`,{className:`sp-meta`,children:n(h.length>0?`pick.onlyHidden`:`pick.none`)}),l&&V(`li`,{className:`sp-meta`,children:[P(K,{size:12,className:`spin`,"aria-hidden":`true`}),` `,n(`pick.loading`)]})]}),s&&P(`p`,{className:`sp-error`,role:`alert`,children:s})]}),V(`div`,{className:`sp-picker-actions`,children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:t,children:n(`sp.cancel`)}),P(`button`,{type:`button`,className:`btn-primary`,disabled:!r,onClick:()=>r&&e(r.current_path),children:n(`pick.use`)})]})]})})}function sE(e){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)(null);return{open:t=>{i(null);let r=window.gaiaAPI?.dialog;r?r.pickFolder(t).then(t=>{t&&e(t)}).catch(e=>i(`Couldn't open the folder picker: ${e instanceof Error?e.message:String(e)}`)):n(!0)},picker:t?P(oE,{onPick:t=>{n(!1),e(t)},onClose:()=>n(!1)}):null,error:r}}var cE=new Map;function lE(e){let t=cE.get(e);return t||(t={env:null,error:null,inFlight:null,version:0,listeners:new Set},cE.set(e,t)),t}function uE(e,t,n){let r=lE(e);r.env=t??r.env,r.error=n,r.listeners.forEach(e=>e())}function dE(e){let t=lE(e);if(t.inFlight)return t.inFlight;let n=t.version;return t.inFlight=Promise.resolve().then(()=>Me(e)).then(r=>{let i=iE(r,e=>Array.isArray(e.folders),`chat's environment`);t.version===n&&uE(e,i,null)}).catch(t=>uE(e,null,t instanceof Error?t.message:String(t))).finally(()=>{t.inFlight=null}),t.inFlight}function fE(e){let[,t]=(0,J.useState)(0);(0,J.useEffect)(()=>{let n=lE(e),r=()=>t(e=>e+1);return n.listeners.add(r),!n.env&&!n.inFlight&&dE(e),()=>{n.listeners.delete(r)}},[e]);let n=(0,J.useCallback)(()=>dE(e),[e]),r=(0,J.useCallback)(async t=>{let n=await t();return lE(e).version+=1,uE(e,n,null),n},[e]),i=lE(e);return{env:i.env,error:i.error,refresh:n,change:r}}var pE=e=>e.split(/[\\/]/).filter(Boolean).pop()??e;function mE({folder:e,disabled:t}){let n=k(e=>e.draftFolder),r=k(e=>e.setDraftFolder),{open:i,picker:a,error:o}=sE(r),s=e.gaia_folder?`GAIA works in its own folder, ${e.path}.`:`GAIA works in ${e.path}.`;return e.choosable?V(D.Fragment,{children:[V(`button`,{type:`button`,className:`new-chat-folder is-button${n?` is-on`:``}`,onClick:()=>i(e.path),disabled:t,"aria-haspopup":`dialog`,"aria-label":n?`Folder for this chat: ${e.name}, plus ${pE(n)}`:`Folder for this chat: ${e.name}`,title:n?`This chat can read and write ${n}. Click to pick another folder.`:`${s} Click to give this chat another folder.`,children:[P(Ti,{size:13,"aria-hidden":`true`}),P(`span`,{className:`new-chat-folder-name`,dir:`auto`,children:n?`${e.name} + ${pE(n)}`:e.name}),P(hr,{size:12,"aria-hidden":`true`})]}),n&&P(`button`,{type:`button`,className:`btn-icon-sm new-chat-folder-clear`,onClick:()=>r(null),disabled:t,"aria-label":`Don't give this chat ${pE(n)}`,title:`Don't add this folder`,children:P(So,{size:12})}),o&&P(`span`,{className:`new-chat-folder-error`,role:`alert`,children:o}),a]}):V(`span`,{className:`new-chat-folder`,title:e.gaia_folder?`${s} Attach a file or start GAIA from a project folder to work there.`:s,children:[P(Ti,{size:13,"aria-hidden":`true`}),P(`span`,{className:`new-chat-folder-name`,dir:`auto`,children:e.name})]})}function hE({sessionId:e,onOpen:t}){let{env:n}=fE(e),r=n?.folders.find(e=>e.source===`working_folder`);if(!r)return null;let i=pE(r.path);return V(`button`,{type:`button`,className:`composer-chip folder-chip`,title:`GAIA works in ${r.path}`,"aria-label":`Working folder ${i}, show the chat's folders`,onClick:t,children:[P(Ti,{size:13,"aria-hidden":`true`}),P(`span`,{className:`composer-chip-label`,dir:`auto`,children:i})]})}var gE=`gaia:permission-mode`;function _E(e,t){window.dispatchEvent(new CustomEvent(gE,{detail:{sessionId:e,mode:t}}))}function vE(e,t){let n=(0,J.useRef)(t);n.current=t,(0,J.useEffect)(()=>{if(!e)return;let t=t=>{let r=t.detail;r?.sessionId===e&&n.current(r.mode)};return window.addEventListener(gE,t),()=>window.removeEventListener(gE,t)},[e])}var yE=[{mode:`ask`,label:`perm.ask`,note:`perm.askNote`},{mode:`full_access`,label:`perm.full`,note:`perm.fullNote`}];function bE({sessionId:e,disabled:t}){let n=T(),r=k(e=>e.draftPermissionMode),i=k(e=>e.setDraftPermissionMode),[a,o]=(0,J.useState)(e?`ask`:r),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),p=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(!e){o(r);return}let t=!1;return St(e).then(e=>{t||o(e.mode)}).catch(e=>{t||f(Px(e))}),()=>{t=!0}},[e,r]),vE(e,o);let m=(0,J.useCallback)(async t=>{if(t===`full_access`&&!l)u(!0);else{f(null);try{if(e){let n=(await Pt(e,t)).mode;o(n),_E(e,n)}else i(t),o(t);c(!1)}catch(t){f(Px(t)),e&&St(e).then(e=>o(e.mode)).catch(e=>f(t=>`${t??``} Couldn't re-read the saved mode: ${Px(e)}`.trim()))}finally{u(!1)}}},[l,e,i]),h=a===`full_access`,_=h?Wa:Ka;return V(`div`,{className:`composer-chip-wrap`,children:[V(`button`,{ref:p,type:`button`,className:`composer-chip${h?` is-warning`:``}`,onClick:()=>{u(!1),c(e=>!e)},disabled:t,"aria-haspopup":`dialog`,"aria-expanded":s,"aria-label":n(`perm.chipAria`,{mode:g(h?`perm.fullLower`:`perm.askLower`)}),children:[P(_,{size:13,"aria-hidden":`true`}),P(`span`,{className:`composer-chip-label`,dir:`auto`,children:n(h?`perm.full`:`env.ask`)}),P(hr,{size:12,"aria-hidden":`true`})]}),V(Ro,{open:s,onClose:()=>c(!1),anchor:p,label:n(`env.permission`),children:[yE.map(e=>V(`button`,{type:`button`,className:`popover-item`,onClick:()=>m(e.mode),"aria-pressed":a===e.mode,children:[P(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:a===e.mode&&P(pr,{size:13})}),V(`span`,{className:`popover-item-body`,children:[P(`span`,{className:`popover-item-title`,children:n(e.label)}),P(`span`,{className:`popover-item-note`,children:n(e.note)})]})]},e.mode)),l&&V(`div`,{className:`popover-message`,role:`alert`,children:[n(`env.fullAccessWarn`),` `,P(`button`,{type:`button`,className:`link-btn`,onClick:()=>m(`full_access`),children:n(`env.turnOn`)})]}),d&&P(`div`,{className:`popover-message is-error`,role:`alert`,children:d})]})]})}var xE={sending:`Adding to the running reply…`,delivered:`Added to the running reply. GAIA reads it at its next step.`,queued:`Queued. Sends when this reply ends.`};function SE(e,t){return e?xE.queued:t?`GAIA is still busy in this chat. Trying again in a few seconds.`:`Sending next.`}function CE({items:e,onRemove:t,onSteer:n,onRetry:r,replying:i=!0,busyRetry:a=!1}){let o=e.filter(e=>e.state!==`starting`);return o.length===0?null:P(`ul`,{className:`queued-messages`,"aria-label":`Messages waiting to send`,"aria-live":`polite`,children:o.map(e=>V(`li`,{className:`queued-message is-${e.state}`,children:[e.state===`failed`?P(Cr,{size:12,"aria-hidden":`true`}):e.state===`queued`?P(Nr,{size:12,"aria-hidden":`true`}):P(Vr,{size:12,"aria-hidden":`true`}),P(`span`,{className:`queued-message-text`,title:e.text,children:e.text}),P(`span`,{className:`queued-message-state`,title:e.error,children:e.state===`failed`?`Not sent. ${e.error??``}`.trim():e.state===`queued`?i&&e.note||SE(i,a):xE[e.state]}),e.state===`failed`&&V(`button`,{type:`button`,className:`queued-message-steer`,onClick:()=>r(e.id),"aria-label":`Send again: ${e.text}`,children:[P(Ra,{size:11,"aria-hidden":`true`}),` Send again`]}),e.state===`queued`&&n&&P(`button`,{type:`button`,className:`queued-message-steer`,onClick:()=>n(e.id),title:`GAIA reads it at its next step, without starting over. It may not answer it separately.`,children:`Add to this reply`}),(e.state===`queued`||e.state===`failed`)&&P(`button`,{type:`button`,className:`queued-message-remove`,onClick:()=>t(e.id),"aria-label":`Remove queued message: ${e.text}`,title:`Remove`,children:P(So,{size:12})})]},e.id))})}var wE=e=>e.toLocaleString(`en-US`);function TE({n:e}){let t=T();if(e==null)return P(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)});let n=e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}K`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`;return P(`span`,{title:t(`ctx.tokens`,{n:wE(e)}),dir:`ltr`,children:n})}function EE({s:e}){let t=T();if(e==null)return P(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)});let n=e<.1?e===0?`0 s`:`<0.1 s`:e<10?`${e.toFixed(1)} s`:`${Math.round(e)} s`;return P(`span`,{title:`${(e*1e3).toFixed(0)} ms`,dir:`ltr`,children:n})}function DE({r:e}){let t=T();return e==null?P(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)}):P(`span`,{title:t(`ctx.rateTitle`,{n:e}),children:t(`ctx.rate`,{n:Math.round(e).toLocaleString(`en-US`)})})}var OE=(e,t)=>t>0?Math.round(e/t*100):0,kE=(e,t)=>{let n=OE(e,t);return n===0&&e>0?`<1`:String(n)},AE=(e,t)=>t&&e!=null?Math.floor(e/t*100):null,jE=256;function ME(e,t=z){if(e.provider===`unknown`)return t(`ctx.unknown`);if(e.provider===`cloud`)return t(`ctx.cloud`);if(e.provider!==`local`)return t(`ctx.cloudVia`,{provider:bs(e.provider)});if(!e.device)return e.loaded===!1?t(`ctx.notLoadedNow`):t(`ctx.unknown`);let n=e.device.toUpperCase(),r=e.backend===`npu`?`FLM`:e.backend;return r&&r!==e.device?`${n} · ${r.charAt(0).toUpperCase()}${r.slice(1)}`:n}function NE({label:e,children:t,hint:n}){return V(`div`,{className:`cp-row`,title:n,children:[P(`dt`,{children:e}),P(`dd`,{children:t})]})}function PE({t:e}){let t=T();if(e.model_seconds==null||e.gaia_seconds==null)return V(NE,{label:t(`ctx.took`),children:[P(EE,{s:e.wall_seconds}),` · `,t.bare(`ctx.split`),` `,P(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)})]});let n=[{key:`model`,label:t(`ctx.inModel`),s:e.model_seconds},{key:`tools`,label:t(`ctx.runningTools`),s:e.tool_seconds},{key:`waiting`,label:t(`ctx.waitingOnYou`),s:e.waiting_seconds},{key:`gaia`,label:t(`ctx.gaiaItself`),s:e.own_seconds??0}];return V(D.Fragment,{children:[P(NE,{label:t(`ctx.took`),hint:t(`ctx.tookHint`),children:P(EE,{s:e.wall_seconds})}),P(`div`,{className:`cp-stack`,"aria-hidden":`true`,children:n.map(t=>P(`span`,{className:`cp-time-${t.key}`,style:{width:`${OE(t.s,e.wall_seconds)}%`}},t.key))}),V(`dl`,{className:`cp-rows cp-indent`,children:[P(NE,{label:t(`ctx.inModel`),children:P(EE,{s:e.model_seconds})}),P(NE,{label:t(`ctx.inGaia`),hint:t(`ctx.inGaiaHint`),children:P(EE,{s:e.gaia_seconds})}),n.slice(1).filter(e=>e.s>0).map(e=>V(NE,{label:`· ${e.label}`,children:[P(`span`,{className:`swatch cp-time-${e.key}`,"aria-hidden":`true`}),` `,P(EE,{s:e.s})]},e.key))]})]})}function FE({why:e}){let t=T();return P(`span`,{className:`cp-unknown`,title:e,children:t(`ctx.unknown`)})}var IE={server:`ctx.src.server`,client:`ctx.src.client`};function LE(e,t){return e?t(IE[e]):void 0}function RE({turn:e}){let t=T(),n=AE(e.tokens_cached,e.tokens_in),r=e.unknown??{},i=e.tools.map(e=>`${e.name??t(`ctx.toolOutside`)}: ${e.seconds??`?`} s`).join(`
63
+ `);return V(D.Fragment,{children:[P(PE,{t:e.time}),V(`dl`,{className:`cp-rows`,children:[P(NE,{label:t(`ctx.firstWord`),hint:LE(e.first_token_source,t),children:e.first_token_seconds==null?P(FE,{why:r.first_token_seconds}):V(D.Fragment,{children:[t.bare(`ctx.in`),` `,P(EE,{s:e.first_token_seconds})]})}),P(NE,{label:t(`ctx.readingPrompt`),hint:t(`ctx.readingHint`),children:e.tokens_new!=null&&e.tokens_new<jE?P(`span`,{title:t(`ctx.tooFewTitle`),children:t(`ctx.onlyNew`,{n:e.tokens_new})}):e.prefill_tokens_per_second==null?P(FE,{why:r.prefill_tokens_per_second}):V(D.Fragment,{children:[P(DE,{r:e.prefill_tokens_per_second}),e.prefill_source===`client`&&P(`span`,{className:`cp-chip`,title:t(`ctx.approxTitle`),children:t(`ctx.approx`)})]})}),P(NE,{label:t(`ctx.writing`),hint:LE(e.generation_source,t)??t(`ctx.writingHint`),children:e.generation_tokens_per_second==null?P(FE,{why:r.generation_tokens_per_second}):P(DE,{r:e.generation_tokens_per_second})}),P(NE,{label:t(`ctx.tokensInOut`),hint:r.tokens,children:V(`span`,{dir:`ltr`,children:[P(TE,{n:e.tokens_in}),` → `,P(TE,{n:e.tokens_out})]})}),P(NE,{label:t(`ctx.cache`),hint:t(`ctx.cacheHint`),children:e.tokens_cached==null?P(FE,{why:r.tokens_cached}):V(D.Fragment,{children:[P(TE,{n:e.tokens_cached}),n!=null&&` (${n}%)`]})}),P(NE,{label:t(`ctx.modelCalls`),children:e.model_calls}),P(NE,{label:t(`ctx.toolCalls`),hint:i||void 0,children:e.tool_calls===0&&!e.tool_seconds_total?t(`ctx.none`):V(D.Fragment,{children:[e.tool_calls,` · `,P(EE,{s:e.tool_seconds_total??0})]})}),P(NE,{label:t(`ctx.loads`),children:e.loads.length===0?t(`ctx.none`):V(`span`,{title:e.loads.map(e=>`${e.model}${e.replaced?.length?` replaced ${e.replaced.join(`, `)}`:``}: ${e.seconds} s`).join(`
64
+ `),children:[e.loads.length,` · `,P(EE,{s:e.loads.reduce((e,t)=>e+t.seconds,0)})]})}),P(NE,{label:t(`rail.cost`),children:P(zE,{cost:e.cost})})]})]})}function zE({cost:e}){let t=T();return e.kind===`local`?P(`span`,{title:t(`ctx.costLocalTitle`),children:t(`ctx.costLocal`)}):e.kind===`unreported`?P(`span`,{className:`cp-unknown`,children:t(`ctx.costUnreported`)}):e.kind===`estimate`&&e.usd!=null?P(`span`,{title:t(`ctx.listPriceTitle`,{usd:e.usd}),children:t(`ctx.about`,{usd:e.usd<.01?e.usd.toFixed(4):e.usd.toFixed(2)})}):P(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)})}function BE({totals:e}){let t=T(),n=AE(e.tokens_cached,e.tokens_in),r=P(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)});return V(`dl`,{className:`cp-rows`,children:[P(NE,{label:t(`ctx.turns`),children:e.turns}),P(NE,{label:t(`ctx.totalTime`),children:P(EE,{s:e.wall_seconds})}),P(NE,{label:t(`ctx.inModel`),children:P(EE,{s:e.model_seconds})}),P(NE,{label:t(`ctx.inGaia`),children:P(EE,{s:e.gaia_seconds})}),P(NE,{label:t(`ctx.tokensInOut`),children:V(`span`,{dir:`ltr`,children:[P(TE,{n:e.tokens_in}),` → `,P(TE,{n:e.tokens_out})]})}),P(NE,{label:t(`ctx.cache`),children:e.tokens_cached==null?r:V(D.Fragment,{children:[P(TE,{n:e.tokens_cached}),n!=null&&` (${n}%)`]})}),P(NE,{label:t(`ctx.toolCalls`),children:e.tool_calls??r}),P(NE,{label:t(`ctx.loads`),children:e.loads===0?t(`ctx.none`):V(D.Fragment,{children:[e.loads,` · `,P(EE,{s:e.load_seconds})]})}),P(NE,{label:t(`rail.cost`),children:e.usd==null?r:e.unpriced_turns>0?P(`span`,{title:t(`ctx.unpricedTitle`,{n:e.unpriced_turns}),children:t(`ctx.unpriced`,{usd:e.usd.toFixed(2),n:e.unpriced_turns})}):e.usd===0?`$0`:t(`ctx.about`,{usd:e.usd.toFixed(2)})})]})}function VE({usage:e}){let t=T(),n=e.context_state?.put_away,r=e.context_state?.summarized;return V(`div`,{className:`cp-full`,children:[V(`dl`,{className:`cp-rows`,children:[P(NE,{label:t(`ctx.live`),children:P(TE,{n:e.used})}),n&&n.results>0&&V(NE,{label:t(`ctx.putAway`),hint:t(`ctx.putAwayHint`),children:[t.plural(`ctx.results`,n.results),` · `,P(TE,{n:n.tokens})]}),r&&r.turns>0&&V(NE,{label:t(`ctx.summarized`),hint:t(`ctx.summarizedHint`),children:[t.plural(`ctx.earlier`,r.turns),` · `,P(TE,{n:r.tokens}),` → `,P(TE,{n:r.summary_tokens})]})]}),r&&r.turns>0&&P(`p`,{className:`cp-note cp-summarized`,children:t(`ctx.summarizedNote`)}),e.at_risk.length>0&&P(`p`,{className:`cp-warning`,role:`status`,children:t(`ctx.filling`)})]})}function HE({sessionId:e,busy:t,onUsage:n}){let r=T(),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(null),[h,_]=(0,J.useState)(`turn`),v=(0,J.useRef)(n);v.current=n;let y=(0,J.useCallback)(()=>{let t=!1,n=(n,r)=>i=>{t||(d.chat.error(`Could not read the ${n} for session=${e}`,i),r(i instanceof Error?i.message:String(i)))};return pn(e).then(e=>{t||(e.available?(a(e),s(null),v.current?.(e)):(a(null),s(e.reason)),f(null))}).catch(n(`context usage`,f)),tn(e).then(e=>{t||(l(e),m(null))}).catch(n(`performance`,m)),()=>{t=!0}},[e]);(0,J.useEffect)(()=>y(),[y]);let b=(0,J.useRef)(t);(0,J.useEffect)(()=>{let e=b.current&&!t;return b.current=t,e?y():void 0},[t,y]);let x=c?.turns[c.turns.length-1]??null,S=x&&x.message_id===c?.latest_message_id?x:null,C=i?Math.max(0,i.window-i.used):0;return V(D.Fragment,{children:[V(`section`,{"aria-labelledby":`cp-context`,children:[P(`h3`,{id:`cp-context`,children:r(`ctx.context`)}),u&&P(`p`,{className:`cp-error`,role:`alert`,children:u}),!i&&!u&&P(`p`,{className:`cp-note`,children:o??r(`ctx.measuring`)}),i&&V(D.Fragment,{children:[V(`p`,{className:`cp-lead`,children:[P(`strong`,{children:r(`ctx.used`,{pct:OE(i.used,i.window)})}),` · `,P(TE,{n:i.used}),` `,r.bare(`ctx.of`),` `,P(TE,{n:i.window}),` `,r.bare(`ctx.tokensWord`),i.model&&V(D.Fragment,{children:[` · `,P(`span`,{className:`cp-model`,dir:`ltr`,children:i.model})]}),i.model_window!=null&&i.model_window>i.window&&V(`span`,{className:`cp-window-note`,title:r(`ctx.windowTitle`),children:[` `,`· `,r.bare(`ctx.gaiaUses`),` `,P(TE,{n:i.window}),` `,r.bare(`ctx.ofModel`),` `,P(TE,{n:i.model_window})]}),i.tokenizer&&!i.tokenizer.exact&&P(`span`,{className:`cp-chip`,title:i.tokenizer.reason,children:r(`ctx.approx`)})]}),P(`div`,{className:`cp-stack`,"aria-hidden":`true`,children:(i.categories??[]).map(e=>P(`span`,{className:`cp-cat-${e.key}`,style:{width:`${e.tokens/i.window*100}%`}},e.key))}),V(`dl`,{className:`cp-rows`,children:[(i.categories??[]).map(e=>V(`div`,{className:`cp-row`,children:[V(`dt`,{children:[P(`span`,{className:`swatch cp-cat-${e.key}`,"aria-hidden":`true`}),e.label]}),V(`dd`,{children:[P(TE,{n:e.tokens}),` `,V(`span`,{className:`cp-pct`,children:[kE(e.tokens,i.window),`%`]})]})]},e.key)),V(`div`,{className:`cp-row is-quiet`,children:[V(`dt`,{children:[P(`span`,{className:`swatch cp-cat-free`,"aria-hidden":`true`}),r(`ctx.freeRow`)]}),V(`dd`,{children:[P(TE,{n:C}),` `,V(`span`,{className:`cp-pct`,children:[OE(C,i.window),`%`]})]})]}),V(`div`,{className:`cp-row is-quiet cp-indent`,children:[P(`dt`,{children:r(`ctx.reserve`)}),P(`dd`,{children:P(TE,{n:Math.min(C,i.reply_reserve)})})]})]}),V(`p`,{className:`cp-note`,children:[i.tokenizer?.exact?r(`ctx.exactTokenizer`,{model:i.tokenizer.model}):r(`ctx.estimated`,{reason:i.tokenizer?.reason??g(`ctx.sharedTokenizer`)}),S?.last_prompt_tokens!=null&&V(D.Fragment,{children:[` `,r(`ctx.lastRequest`,{n:wE(S.last_prompt_tokens)})]})]}),i.tool_loading&&i.tool_loading.on_demand.length>0&&V(`details`,{className:`cp-details`,children:[P(`summary`,{children:r(`ctx.onDemand`,{n:i.tool_loading.on_demand.length})}),P(`p`,{className:`cp-note`,children:r(`ctx.sentNow`,{n:i.tool_loading.loaded.length})}),P(`ul`,{className:`cp-tools`,children:i.tool_loading.on_demand.map(e=>P(`li`,{children:e},e))})]}),P(VE,{usage:i})]})]}),V(`section`,{"aria-labelledby":`cp-hood`,children:[V(`div`,{className:`cp-section-head`,children:[P(`h3`,{id:`cp-hood`,children:r(`ctx.hood`)}),V(`div`,{className:`cp-toggle`,role:`group`,"aria-label":r(`ctx.show`),children:[P(`button`,{type:`button`,"aria-pressed":h===`turn`,onClick:()=>_(`turn`),children:r(`ctx.lastTurn`)}),P(`button`,{type:`button`,"aria-pressed":h===`chat`,onClick:()=>_(`chat`),children:r(`sp.title`)})]})]}),c&&V(`dl`,{className:`cp-rows`,children:[P(NE,{label:r(`env.runsOn`),hint:c.now.error??void 0,children:ME(c.now,r)}),c.now.provider===`local`&&V(NE,{label:r(`ctx.memory`),hint:r(`ctx.memoryHint`),children:[c.now.weights_gb==null?P(`span`,{className:`cp-unknown`,children:r(`ctx.unknown`)}):V(D.Fragment,{children:[r(`ctx.gbModel`,{gb:c.now.weights_gb.toFixed(1)}),c.now.kv_cache_gb!=null&&` + ${r(`ctx.gbCache`,{gb:c.now.kv_cache_gb.toFixed(1)})}`]}),` · `,c.now.free_gb==null?P(`span`,{className:`cp-unknown`,children:r(`ctx.freeUnknown`)}):r(`env.free`,{gb:c.now.free_gb.toFixed(1)})]})]}),p&&P(`p`,{className:`cp-error`,role:`alert`,children:p}),!c&&!p&&P(`p`,{className:`cp-note`,children:r(`ctx.measuring`)}),c&&h===`turn`&&(S?P(RE,{turn:S}):P(`p`,{className:`cp-note`,children:c.latest_message_id==null?r(`ctx.afterNext`):V(D.Fragment,{children:[r.bare(`ctx.latestAnswer`),` `,P(`span`,{className:`cp-unknown`,children:r(`ctx.unknown`)}),`. `,r.bare(`ctx.notMeasured`)]})})),c&&h===`chat`&&P(BE,{totals:c.totals})]})]})}function UE({sessionId:e,busy:t,onClose:n,onUsage:r}){let i=T(),a=(0,J.useRef)(null),o=(0,J.useRef)(n);o.current=n,(0,J.useEffect)(()=>{a.current?.focus()},[]),Io(!0,(0,J.useCallback)(()=>o.current(),[]));let s=(0,J.useRef)(null);return aS(s,!0),P(`div`,{className:`cp-overlay`,onClick:n,children:V(`aside`,{ref:s,className:`cp-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":i(`ctx.sheetAria`),onClick:e=>e.stopPropagation(),children:[V(`header`,{className:`cp-header`,children:[P(`h2`,{children:i(`sp.section.context`)}),P(`button`,{ref:a,type:`button`,className:`cp-icon`,onClick:n,"aria-label":i(`sp.closeShort`),children:P(So,{size:16})})]}),P(`div`,{className:`cp-body`,children:P(HE,{sessionId:e,busy:t,onUsage:r})})]})})}function WE(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}K`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`}var GE=[{key:`system`,label:`ctx.meter.part.system`},{key:`tools`,label:`ctx.meter.part.tools`},{key:`documents`,label:`ctx.meter.part.documents`},{key:`history`,label:`ctx.meter.part.history`},{key:`query`,label:`ctx.meter.part.query`}];function KE({usage:e,unavailable:t,sessionId:n,busy:r=!1,onUsage:i,onDetails:a}){let o=T(),s=(0,J.useRef)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),f=u&&n?P(UE,{sessionId:n,busy:r,onUsage:i,onClose:()=>d(!1)}):null;if(!e)return t?V(`span`,{className:`context-meter is-empty`,title:t,children:[P(`span`,{className:`context-meter-bar`,"aria-hidden":`true`,children:P(`span`,{style:{width:0}})}),P(`span`,{className:`context-meter-label`,children:o(`ctx.context`)})]}):null;let p=Math.min(100,Math.round(e.used/e.window*100)),m=e.at_risk.length>0,g=Math.max(0,e.window-e.used-e.reply_reserve),_=e.model_window!=null&&e.model_window>e.window?e.model_window:null,v=_?{gaia:WE(e.window),model:WE(_)}:null;return V(`div`,{className:`composer-chip-wrap context-meter-wrap`,children:[V(`button`,{ref:s,type:`button`,className:`context-meter${m?` is-warning`:``}`,onClick:()=>l(e=>!e),"aria-expanded":c,"aria-label":o.compose(t=>{let n=t(`ctx.meter.aria`,{pct:p,used:WE(e.used),window:WE(e.window)});return v?`${n} (${t(`ctx.meter.capNote`,v)})`:n}),title:v?o(`ctx.meter.titleCapped`,v):o(`ctx.meter.title`),children:[P(`span`,{className:`context-meter-bar`,"aria-hidden":`true`,children:P(`span`,{style:{width:`${p}%`}})}),P(`span`,{className:`context-meter-label`,children:V(`bdi`,{dir:`ltr`,children:[p,`%`]})})]}),P(Ro,{open:c,onClose:()=>l(!1),anchor:s,label:o(`ctx.meter.window`),align:`end`,children:V(`div`,{className:`context-meter-panel`,children:[V(`div`,{className:`context-meter-head`,children:[P(`strong`,{children:P(`bdi`,{dir:`ltr`,children:WE(e.used)})}),` `,o.bare(`ctx.of`),` `,P(`bdi`,{dir:`ltr`,children:WE(e.window)}),` `,o.bare(`ctx.tokensWord`),v&&V(`span`,{className:`context-meter-cap`,title:o(`ctx.windowTitle`),children:[` · `,o.bare(`ctx.gaiaUses`),` `,P(`bdi`,{dir:`ltr`,children:v.gaia}),` `,o.bare(`ctx.ofModel`),` `,P(`bdi`,{dir:`ltr`,children:v.model})]})]}),P(`div`,{className:`context-meter-stack`,"aria-hidden":`true`,children:GE.map(({key:t})=>P(`span`,{className:`part-${t}`,style:{width:`${e[t]/e.window*100}%`}},t))}),V(`dl`,{className:`context-meter-rows`,children:[GE.filter(({key:t})=>t!==`query`||e.query>0).map(({key:t,label:n})=>V(`div`,{className:`context-meter-row`,children:[V(`dt`,{children:[P(`span`,{className:`swatch part-${t}`,"aria-hidden":`true`}),o(n)]}),P(`dd`,{children:P(`bdi`,{dir:`ltr`,children:WE(e[t])})})]},t)),V(`div`,{className:`context-meter-row is-quiet`,children:[P(`dt`,{children:o(`ctx.meter.reserve`)}),P(`dd`,{children:P(`bdi`,{dir:`ltr`,children:WE(e.reply_reserve)})})]}),V(`div`,{className:`context-meter-row is-quiet`,children:[P(`dt`,{children:o(`ctx.freeRow`)}),P(`dd`,{children:P(`bdi`,{dir:`ltr`,children:WE(g)})})]})]}),P(`p`,{className:`context-meter-note`,children:o.compose(t=>[t(h(`ctx.meter.inView`,e.turns_in_view),{n:e.turns_in_view}),e.turns_hidden>0?t(h(`ctx.meter.hidden`,e.turns_hidden),{n:e.turns_hidden}):``,`. `,t(e.tokenizer?.exact?`ctx.meter.exact`:`ctx.meter.estimates`),` `,t(`ctx.meter.saved`)].join(``))}),n&&P(`button`,{type:`button`,className:`context-meter-details`,onClick:()=>{l(!1),a?a():d(!0)},children:o(`ctx.meter.details`)})]})}),f]})}function qE({usage:e}){let t=T();if(!e||e.at_risk.length===0)return null;let n=e.at_risk.length;return V(`div`,{className:`context-warning`,role:`status`,children:[P(q,{size:13,"aria-hidden":`true`}),V(`span`,{children:[t.plural(`ctx.meter.warning`,n),` `,e.at_risk.map((e,t)=>V(`span`,{children:[t>0&&`, `,P(`q`,{children:e})]},t)),`. `,t(`ctx.meter.warningSaved`)]})]})}function JE(e){return`$${e>0&&e<.01?e.toFixed(4):e.toFixed(2)}`}function YE(e=new Date){let t=new Date(e);return t.setHours(0,0,0,0),t.toISOString()}function XE({sessionId:e,busy:t}){let n=T(),r=cs(e=>e.active),i=k(e=>gs(r,e.sessions,e.currentSessionId)),a=k(e=>e.openSettings),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),f=(0,J.useCallback)(()=>c(!1),[]),p=(0,J.useCallback)(()=>{let t=!1;return(async()=>{try{let n=await Re(e,YE(),i??null);t||u(n??null)}catch(n){t||d.chat.error(`Could not read cloud spending for session=${e}`,n)}})(),()=>{t=!0}},[e,i]);(0,J.useEffect)(()=>p(),[p]);let m=(0,J.useRef)(t);if((0,J.useEffect)(()=>{let e=m.current&&!t;return m.current=t,e?p():void 0},[t,p]),(0,J.useEffect)(()=>s?p():void 0,[s,p]),(0,J.useEffect)(()=>{let e,t=()=>{e?.(),e=p()};return window.addEventListener(`focus`,t),()=>{window.removeEventListener(`focus`,t),e?.()}},[p]),!l?.paid||l.model!==(i??null))return null;let{chat:h,today:g}=l,_=e=>`${e.unpriced_answers>0?`≥ `:``}${JE(e.usd)}`,v=h.unpriced_answers+g.unpriced_answers>0,y=[...h.items].reverse(),b=e=>new Date(e).toLocaleTimeString(te(n),{hour:`numeric`,minute:`2-digit`});return V(`div`,{className:`composer-chip-wrap spend-meter-wrap`,children:[V(`button`,{ref:o,type:`button`,className:`context-meter spend-meter`,onClick:()=>c(e=>!e),"aria-expanded":s,"aria-label":n(`spend.aria`,{chat:_(h),today:_(g)}),title:n(v?`spend.titleExcluded`:`spend.title`),children:[P(`bdi`,{dir:`ltr`,children:_(h)}),V(`span`,{className:`spend-meter-today`,children:[`· `,n.bare(`spend.today`),` `,P(`bdi`,{dir:`ltr`,children:_(g)})]})]}),P(Ro,{open:s,onClose:f,anchor:o,label:n(`spend.window`),align:`end`,children:V(`div`,{className:`context-meter-panel spend-meter-panel`,children:[V(`dl`,{className:`context-meter-rows`,children:[V(`div`,{className:`context-meter-row`,children:[P(`dt`,{children:n(`spend.thisChat`)}),P(`dd`,{children:P(`bdi`,{dir:`ltr`,children:_(h)})})]}),V(`div`,{className:`context-meter-row`,children:[P(`dt`,{children:n.plural(`spend.todayChats`,g.chats)}),P(`dd`,{children:P(`bdi`,{dir:`ltr`,children:_(g)})})]})]}),v&&P(`p`,{className:`context-meter-note spend-meter-excluded`,role:`note`,children:n(`spend.excluded`,{chat:h.unpriced_answers,today:g.unpriced_answers})}),y.length>0&&V(D.Fragment,{children:[P(`div`,{className:`spend-meter-heading`,children:n(`spend.perAnswer`)}),P(`dl`,{className:`context-meter-rows spend-meter-answers`,children:y.map(e=>V(`div`,{className:`context-meter-row`,children:[P(`dt`,{children:P(`bdi`,{dir:`ltr`,children:b(e.created_at)})}),P(`dd`,{children:e.kind===`estimate`&&e.usd!=null?P(`bdi`,{dir:`ltr`,children:JE(e.usd)}):P(`span`,{className:`spend-meter-unknown`,children:n(e.kind===`unreported`?`ctx.costUnreported`:`ctx.unknown`)})})]},e.message_id))})]}),P(`p`,{className:`context-meter-note`,children:n(`spend.note`)}),P(`button`,{type:`button`,className:`context-meter-details`,onClick:()=>{c(!1),a(`model`)},children:n(`spend.month`)})]})})]})}async function ZE(){let{providers:e,lemonade_error:t}=await wn();if(t)throw Error(t);return(await Promise.all(e.filter(e=>!e.remote).map(e=>Zt(e.id)))).flatMap(e=>e.models.filter(e=>e.downloaded).map(e=>({id:e.id,name:e.display_name??ds(e.id)})))}function QE({answeredBy:e,onPick:t}){let n=(0,J.useRef)(null),r=T(),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),u=(0,J.useCallback)(async()=>{s(null),l(null);try{s(await ZE())}catch(e){l(e instanceof Error?e.message:String(e))}},[]);(0,J.useEffect)(()=>{i&&u()},[i,u]);let d=o?.filter(t=>t.id!==e)??[];return V(D.Fragment,{children:[P(`button`,{ref:n,type:`button`,className:`msg-action-btn`,onClick:()=>a(e=>!e),title:r(`retry.button`),"aria-label":r(`retry.button`),"aria-expanded":i,children:P(Xa,{size:12})}),P(Ro,{open:i,onClose:()=>a(!1),anchor:n,label:`Retry with`,placement:`below`,align:`end`,children:V(`div`,{className:`retry-menu`,children:[P(`div`,{className:`retry-menu-head`,children:r(`retry.head`)}),c&&P(`div`,{className:`retry-menu-error`,role:`alert`,children:c}),!c&&o===null&&V(`div`,{className:`retry-menu-empty`,children:[P(K,{size:12,className:`spin`,"aria-hidden":`true`}),` Loading models…`]}),o!==null&&d.length===0&&P(`div`,{className:`retry-menu-empty`,children:`No other model is downloaded on this PC. Add one in Settings → Model.`}),d.map(e=>P(`button`,{type:`button`,className:`retry-menu-item`,title:e.id,onClick:()=>{a(!1),t(e.id)},children:e.name},e.id))]})})]})}function $E(e){return e!=null&&e>0?`${(e/1e3).toFixed(1)} s`:null}function eD({parts:e}){let t=e.filter(Boolean);return t.length?P(`div`,{className:`compare-meta`,children:t.join(` · `)}):null}function tD({original:e,originalModel:t,originalLatencyMs:n,state:r,keeping:i,onKeep:a,onClose:o}){ls();let s=r.status===`ready`?r.result.model:r.model,c=e.stats?.tokens_per_second;return V(`section`,{className:`answer-compare`,"aria-label":`Compare answers`,children:[V(`header`,{className:`answer-compare-head`,children:[P(`span`,{children:`Compare answers`}),P(`button`,{type:`button`,className:`msg-action-btn`,onClick:o,"aria-label":`Close comparison`,disabled:!!i,children:P(So,{size:12})})]}),V(`div`,{className:`answer-compare-cols`,children:[V(`article`,{className:`compare-col`,"aria-label":`Answer from ${t??`the original model`}`,children:[P(`h4`,{children:t?ds(t):`Original answer`}),P(eD,{parts:[$E(n),c?`${c} tok/s`:null]}),P(`div`,{className:`compare-body`,children:P(ow,{content:e.content})}),P(`button`,{type:`button`,className:`compare-keep`,onClick:()=>a(`original`),disabled:!!i||r.status===`running`,children:i===`original`?`Keeping…`:`Keep this answer`})]}),V(`article`,{className:`compare-col`,"aria-label":`Answer from ${s}`,children:[P(`h4`,{children:ds(s)}),r.status===`running`&&V(`div`,{className:`compare-wait`,children:[P(K,{size:14,className:`spin`,"aria-hidden":`true`}),V(`span`,{children:[`Loading `,ds(s),`, then answering from the same evidence. Tools are not run again.`]})]}),r.status===`failed`&&P(`div`,{className:`compare-error`,role:`alert`,children:r.error}),r.status===`ready`&&V(D.Fragment,{children:[P(eD,{parts:[`${r.result.stats.seconds.toFixed(1)} s`,r.result.stats.load_seconds>=1?`incl. ${r.result.stats.load_seconds.toFixed(1)} s loading`:null,r.result.stats.tokens_per_second?`${r.result.stats.tokens_per_second} tok/s`:null]}),P(`div`,{className:`compare-body`,children:P(ow,{content:r.result.content})}),P(`button`,{type:`button`,className:`compare-keep`,onClick:()=>a(`retry`),disabled:!!i,children:i===`retry`?`Keeping…`:`Keep this answer`})]})]})]})]})}var nD=`gaia.sessionPanel.open`,rD=`gaia.sessionPanel.width`,iD=`gaia.sessionPanel.sections`,aD={answer:!0,environment:!0,context:!1,outputs:!0,changes:!0,skills:!0,tools:!1};function oD(e,t,n){try{let r=window.localStorage.getItem(e);return r==null?n:t(r)}catch(t){return d.ui.warn(`Session panel setting ${e} unavailable; using the default`,t),n}}function sD(e,t){try{window.localStorage.setItem(e,t)}catch(t){d.ui.warn(`Could not remember session panel setting ${e}`,t)}}function cD(e){let t=typeof window<`u`?Math.floor(window.innerWidth*.5):640;return Math.round(Math.max(280,Math.min(e,640,Math.max(280,t))))}function lD(){return{open:oD(nD,e=>e!==`0`,!0),width:cD(oD(rD,e=>Number(e)||320,320)),sections:{...aD,...oD(iD,e=>JSON.parse(e),{})}}}var uD=p((e,t)=>({...lD(),overlayOpen:!1,focus:null,setOpen:t=>{sD(nD,t?`1`:`0`),e({open:t})},setOverlayOpen:t=>e({overlayOpen:t}),setWidth:t=>{let n=cD(t);sD(rD,String(n)),e({width:n})},setSection:(n,r)=>{let i={...t().sections,[n]:r};sD(iD,JSON.stringify(i)),e({sections:i})},reveal:n=>{let r={...t().sections,[n]:!0};sD(iD,JSON.stringify(r)),sD(nD,`1`),e({sections:r,open:!0,overlayOpen:!0,focus:{section:n,nonce:Date.now()}})},reload:()=>e({...lD(),overlayOpen:!1,focus:null})}));function dD(e,t){if(t)return e.some(e=>e.turnSummary)?{kind:`busy`}:null;let n=e[e.length-1];return!n||n.role!==`assistant`||!n.turnSummary?null:{kind:`turn`,turn:n}}function fD(e){let t=e.live_data?.attempted??0;return t>0&&(e.live_data?.failed??0)>=t}function pD(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}function mD(e,t,n){let r=[];return t&&t.length>0&&r.push(e(h(`rail.pages`,t.length),{list:t.join(`, `)})),r.push(e(h(`rail.passages`,n),{n})),r.join(` · `)}function hD(e,t=z,n=!1){let{cost:r}=e;return r.kind===`local`?t(`rail.costLocal`):r.kind===`unreported`?t(n?`rail.costUnreportedStopped`:`rail.costUnreported`):r.kind===`estimate`&&typeof r.usd==`number`?t(`rail.costAbout`,{usd:r.usd<.01?r.usd.toFixed(4):r.usd.toFixed(2)}):t(e.model?`rail.costUnknownModel`:`rail.costUnknown`)}function gD(e){return e instanceof vn?e.detail||e.message:e instanceof Error?e.message:String(e)}function _D({messages:e,busy:t=!1}){let n=T(),r=dD(e,t);if(!r)return null;let i=r.kind===`turn`?r.turn.turnSummary??null:null,a=i?fD(i):!1;return V(`div`,{className:`side-rail-body`,children:[!i&&P(`p`,{className:`side-rail-pending`,role:`status`,children:n(`rail.pending`)}),a&&V(`div`,{className:`side-rail-warn`,role:`status`,children:[P(q,{size:14,"aria-hidden":`true`}),V(`div`,{children:[P(`strong`,{children:n(`rail.noLive`)}),P(`span`,{children:n(`rail.noLiveWhy`)})]})]}),i&&(i.error?P(`p`,{className:`side-rail-error`,role:`alert`,children:n(`rail.error`,{error:i.error})}):V(D.Fragment,{children:[P(yD,{summary:i}),P(SD,{summary:i}),P(CD,{summary:i,stopped:r.kind===`turn`&&!!r.turn.stopState})]}))]})}function vD({title:e,children:t}){let[n,r]=(0,J.useState)(!0);return V(`section`,{className:`side-rail-section`,children:[V(`button`,{type:`button`,className:`side-rail-section-head`,onClick:()=>r(!n),"aria-expanded":n,children:[P(yr,{size:12,className:`side-rail-chevron${n?` open`:``}`,"aria-hidden":`true`}),e]}),n&&P(`div`,{className:`side-rail-section-body`,children:t})]})}function yD({summary:e}){let t=T(),n=e.pages??[],r=e.documents??[];return n.length===0&&r.length===0?null:P(vD,{title:t(`rail.sources`),children:V(`ul`,{className:`side-rail-list`,children:[n.map(e=>V(`li`,{className:`side-rail-item`,children:[P(Ni,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),V(`div`,{className:`side-rail-item-text`,children:[V(`a`,{href:Jh(e.url)||void 0,target:`_blank`,rel:`noopener noreferrer`,className:`side-rail-link`,title:e.url,children:[P(`span`,{className:`side-rail-link-text`,children:e.title||pD(e.url)}),P(Zr,{size:10,"aria-hidden":`true`,className:`side-rail-link-icon`})]}),V(`span`,{className:`side-rail-meta`,children:[pD(e.url),e.kind===`search_result`?` · ${t(`rail.searchResult`)}`:``]})]})]},e.url)),r.map(e=>{let n=e.passages??0;return V(`li`,{className:`side-rail-item`,children:[P(hi,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),V(`div`,{className:`side-rail-item-text`,children:[P(`span`,{className:`side-rail-name`,title:e.name,dir:`auto`,children:e.name}),P(`span`,{className:`side-rail-meta`,children:t.compose(t=>mD(t,e.pages,n))})]})]},e.path)})]})})}var bD=4e3;function xD(e){let t=e.join(`
65
+ `),[n,r]=(0,J.useState)(()=>new Map),[i,a]=(0,J.useState)(null);return(0,J.useEffect)(()=>{if(!t)return;let e=t.split(`
66
+ `),n=!1,i=()=>{document.visibilityState!==`hidden`&&Ye(e).then(e=>{n||(r(new Map(e.files.map(e=>[e.path,e]))),a(null))},e=>{n||(d.ui.warn(`Could not re-check the files this turn wrote`,e),a(gD(e)))})};i();let o=window.setInterval(i,bD);return window.addEventListener(`focus`,i),()=>{n=!0,window.clearInterval(o),window.removeEventListener(`focus`,i)}},[t]),{status:n,error:i}}function SD({summary:e}){let t=T(),n=e.files??[],[r,i]=(0,J.useState)(null),{status:a,error:o}=xD(n.map(e=>e.path));if(n.length===0)return null;let s=(e,n)=>{i(null),e.catch(e=>{d.ui.error(`Failed to open ${n}`,e),i(t(`sp.couldntOpen`,{name:n,error:gD(e)}))})};return V(vD,{title:t(`rail.files`),children:[P(`ul`,{className:`side-rail-list`,children:n.map(e=>{let n=a.get(e.path);if(n?.exists===!1)return V(`li`,{className:`side-rail-item side-rail-item-gone`,children:[P(hi,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),V(`div`,{className:`side-rail-item-text`,children:[P(`span`,{className:`side-rail-name`,title:e.path,children:e.name}),P(`span`,{className:`side-rail-meta`,children:t(`sp.gone`)})]})]},e.path);let r=n?.exists===!0&&typeof n.mtime==`number`&&typeof e.mtime==`number`&&n.mtime!==e.mtime;return V(`li`,{className:`side-rail-item`,children:[P(hi,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),V(`div`,{className:`side-rail-item-text`,children:[P(`span`,{className:`side-rail-name`,title:e.path,children:e.name}),r&&P(`span`,{className:`side-rail-meta`,children:t(`rail.changedSince`)}),V(`span`,{className:`side-rail-actions`,children:[e.openable&&P(`button`,{type:`button`,className:`side-rail-action`,onClick:()=>s(bt(e.path),e.name),children:t(`sp.open`)}),V(`button`,{type:`button`,className:`side-rail-action`,onClick:()=>s(En(e.path,!0),e.name),children:[P(yi,{size:11,"aria-hidden":`true`}),t(`sp.showInFolder`)]})]})]})]},e.path)})}),r&&P(`p`,{className:`side-rail-error`,role:`alert`,children:r}),o&&P(`p`,{className:`side-rail-error`,children:t(`rail.checkFailed`,{error:o})})]})}function CD({summary:e,stopped:t}){let n=T();ls();let{model:r}=e,i=e.sites??[],a=(e.documents??[]).length>0;return P(vD,{title:n(`rail.thisTurn`),children:V(`dl`,{className:`side-rail-facts`,children:[P(`dt`,{children:n(`rail.model`)}),V(`dd`,{children:[r?V(`span`,{className:`side-rail-where${r.remote?` remote`:``}`,children:[r.remote?P(Fr,{size:12,"aria-hidden":`true`}):P(fa,{size:12,"aria-hidden":`true`}),r.remote?n(`rail.cloudModel`,{name:r.provider_name}):n(`rail.thisPc`)]}):P(`span`,{className:`side-rail-where`,children:n(`rail.notReported`)}),r?.name&&P(`span`,{className:`side-rail-meta`,title:r.name,dir:`ltr`,children:ds(r.name)})]}),a&&V(D.Fragment,{children:[P(`dt`,{children:n(`rail.documents`)}),P(`dd`,{children:r?.remote?n(`rail.docsSent`,{provider:r.provider_name}):n(r?`rail.docsLocal`:`rail.docsSearched`)})]}),P(`dt`,{children:n(`rail.websites`)}),P(`dd`,{children:i.length>0?P(`span`,{dir:`ltr`,children:i.join(`, `)}):n(`rail.noSites`)}),P(`dt`,{children:n(`rail.cost`)}),P(`dd`,{children:hD(e,n,t)})]})})}function wD({id:e,title:t,summary:n,children:r}){let i=uD(t=>t.sections[e]),a=uD(e=>e.setSection),o=uD(e=>e.focus),s=(0,J.useRef)(null),c=`sp-section-${e}`;return(0,J.useEffect)(()=>{o?.section===e&&s.current?.scrollIntoView?.({block:`start`,behavior:Ax()})},[o,e]),V(`section`,{ref:s,className:`sp-section`,"aria-labelledby":`${c}-title`,children:[P(`h3`,{className:`sp-section-heading`,children:V(`button`,{type:`button`,id:`${c}-title`,className:`sp-section-head`,"aria-expanded":i,"aria-controls":c,onClick:()=>a(e,!i),children:[P(yr,{size:13,className:`sp-chevron${i?` is-open`:``}`,"aria-hidden":`true`}),P(`span`,{className:`sp-section-title`,children:t}),n!=null&&P(`span`,{className:`sp-section-summary`,children:n})]})}),i&&P(`div`,{id:c,className:`sp-section-body`,children:r})]})}function TD(e,t){let n=(0,J.useRef)(e),r=(0,J.useRef)(t);r.current=t,(0,J.useEffect)(()=>{let t=n.current&&!e;n.current=e,t&&r.current()},[e])}var ED=`gaia:mobile-access-request`,DD=`gaia:mobile-access-state`;function OD(e){window.dispatchEvent(new CustomEvent(ED,{detail:e}))}function kD(e){window.dispatchEvent(new CustomEvent(DD,{detail:e}))}function AD(e,t){let n=(0,J.useRef)(t);n.current=t,(0,J.useEffect)(()=>{let t=e=>n.current(!!e.detail);return window.addEventListener(e,t),()=>window.removeEventListener(e,t)},[e])}var jD=e=>AD(ED,e),MD=e=>AD(DD,e);function ND({checked:e,onChange:t,label:n,text:r,disabled:i}){return V(`span`,{className:`sp-switch-wrap`,children:[P(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,className:`sp-switch${e?` is-on`:``}`,onClick:()=>t(!e),disabled:i,children:P(`span`,{className:`sp-switch-knob`,"aria-hidden":`true`})}),r&&P(`span`,{className:`sp-state-text`,children:r})]})}var PD={added:`env.source.added`,gaia_documents:`env.source.gaia_documents`,scratch:`env.source.scratch`,document:`env.source.document`,working_folder:`env.source.working_folder`,approved:`env.source.approved`,allowed_paths:`env.source.allowed_paths`},FD=3;function ID(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function LD({sessionId:e,busy:t}){let n=T(),{env:r}=fE(e),i=r&&!r.internet?n(`env.offline`):null;return V(wD,{id:`environment`,title:n(`env.title`),summary:i,children:[P(BD,{sessionId:e,busy:t}),P(VD,{sessionId:e}),P(HD,{sessionId:e}),P(UD,{}),P(WD,{sessionId:e})]})}function RD({label:e,children:t}){return V(`div`,{className:`sp-env-row`,children:[P(`div`,{className:`sp-env-label`,children:e}),P(`div`,{className:`sp-env-value`,children:t})]})}function zD(e,t){let n=e=>e.toLowerCase().replace(/^user\./,``);return n(e)===n(t)}function BD({sessionId:e,busy:t}){let n=T(),r=hs(),i=cs(e=>e.active),a=k(t=>gs(i,t.sessions,e)),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),u=r?.remote===!0,f=(0,J.useCallback)(()=>{u||Promise.resolve().then(()=>at()).then(e=>{s(iE(e,e=>typeof e.state==`string`,`model status`)),l(null)}).catch(e=>{d.ui.warn(`Could not read where the local model runs`,e),l(Px(e))})},[u]);if((0,J.useEffect)(f,[f]),TD(t,f),u)return V(RD,{label:n(`env.runsOn`),children:[V(`span`,{className:`sp-place is-remote`,children:[P(Fr,{size:13,"aria-hidden":`true`}),` `,n(`env.cloudPlace`,{name:r?.label??``})]}),r?.description&&P(`span`,{className:`sp-meta`,children:r.description})]});if(!r)return P(RD,{label:n(`env.runsOn`),children:P(`span`,{className:`sp-meta`,title:ms,children:n(`env.notKnownYet`)})});let p=!!(o?.model&&a&&!zD(o.model,a)),m=p?null:o?.memory;return V(RD,{label:n(`env.runsOn`),children:[V(`span`,{className:`sp-place`,children:[P(fa,{size:13,"aria-hidden":`true`}),` `,n(`env.thisPc`),!p&&o?.placement?.label?` · ${o.placement.label}`:``]}),p?P(`span`,{className:`sp-meta`,children:n(`env.notLoaded`,{model:ds(a)})}):o?.display_name&&V(`span`,{className:`sp-meta`,dir:`ltr`,children:[o.display_name,o.state===`loaded`?``:` · ${o.state}`]}),m&&V(`span`,{className:`sp-meta`,children:[m.model_gb==null?n(`env.inUseUnknown`):n(`env.inUse`,{gb:m.model_gb.toFixed(1)}),m.free_gb==null?``:` · ${n(`env.free`,{gb:m.free_gb.toFixed(1)})}`]}),(c||o?.error)&&P(`span`,{className:`sp-error`,children:c??o?.error})]})}function VD({sessionId:e}){let t=T(),{env:n,error:r,change:i}=fE(e),a=k(t=>t.sessions.find(t=>t.id===e)?.agent_type===`gaia`),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=async(e,t)=>{l(e),s(null);try{await t()}catch(e){s(Px(e))}finally{l(null)}},p=t=>f(t.path,()=>i(()=>ge(e,t.path))),{open:m,picker:h,error:g}=sE(t=>{f(t,()=>i(()=>rn(e,t)))}),_=n?.folders.filter(e=>e.kind===`folder`)??[],v=n?.folders.filter(e=>e.kind===`file`)??[],y=u?v:v.slice(0,FD),b=!n||!n.enforced,x=e=>V(`li`,{className:`sp-scope-item`,children:[e.kind===`folder`?P(Ti,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}):P(_i,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}),V(`div`,{className:`sp-item-text`,children:[P(`span`,{className:`sp-item-name`,dir:`auto`,title:e.path,children:ID(e.path)}),V(`span`,{className:`sp-meta`,title:e.path,children:[t(PD[e.source]),` · `,P(`span`,{className:`sp-item-path`,dir:`ltr`,children:e.path})]})]}),e.removable&&!b&&P(`button`,{type:`button`,className:`btn-icon-sm sp-item-remove`,onClick:()=>void p(e),disabled:c!==null,"aria-label":t(`env.remove`,{path:e.path}),title:t(`env.removeShort`),children:P(So,{size:12})})]},e.path);return V(RD,{label:n&&!n.enforced?t(`env.reach`):t(`env.readWrite`),children:[!n&&!r&&P(`span`,{className:`sp-meta`,children:t(`sp.checking`)}),n&&!n.enforced&&P(`span`,{className:`sp-meta`,children:t(a?`env.flagshipScope`:`env.agentScope`)}),r&&P(`span`,{className:`sp-error`,children:t(`env.foldersError`,{error:r})}),n&&V(D.Fragment,{children:[n.folders.length===0&&P(`span`,{className:`sp-meta`,children:t(`env.nothing`)}),V(`ul`,{className:`sp-list`,children:[_.map(x),y.map(x)]}),v.length>FD&&P(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>d(e=>!e),children:u?t(`env.fewerFiles`):t(`env.allFiles`,{n:v.length})}),!n.enforced&&P(`span`,{className:`sp-meta`,children:t(`env.ownProcess`)}),n.removed.length>0&&P(`span`,{className:`sp-meta`,children:t(`env.removed`,{names:n.removed.map(ID).join(`, `)})}),!b&&V(`button`,{type:`button`,className:`sp-action`,onClick:()=>m(),disabled:c!==null,children:[P(xi,{size:12,"aria-hidden":`true`}),` `,t(`env.addFolder`)]})]}),(o??g)&&P(`span`,{className:`sp-error`,role:`alert`,children:o??g}),h]})}function HD({sessionId:e}){let t=T(),{env:n,change:r,refresh:i}=fE(e),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1);if(!n)return null;let l=async t=>{c(!0),o(null);try{await r(()=>ye(e,t))}catch(e){o(Px(e)),i()}finally{c(!1)}};return n.internet_enforced?V(RD,{label:t(`env.internet`),children:[P(ND,{checked:n.internet,onChange:e=>void l(e),disabled:s,label:t(`env.internetFor`),text:n.internet?t(`env.on`):t(`env.offBlocked`)}),a&&P(`span`,{className:`sp-error`,role:`alert`,children:a})]}):P(RD,{label:t(`env.internet`),children:P(`span`,{className:`sp-state-text`,children:n.internet?t(`env.on`):t(`env.off`)})})}function UD(){let e=T(),[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),s=(0,J.useCallback)(()=>{Promise.resolve().then(()=>xn()).then(e=>{n(iE(e,e=>typeof e.active==`boolean`,`phone access status`)),o(null)}).catch(e=>o(Px(e)))},[]);(0,J.useEffect)(s,[s]),MD(()=>{i(!1),s()});let c=t?.active===!0;return V(RD,{label:e(`env.phone`),children:[P(ND,{checked:c,onChange:e=>{i(!0),OD(e)},disabled:r,label:e(`env.phone`),text:e(r?c?`env.stopping`:`env.starting`:c?`env.on`:`env.off`)}),c&&V(`span`,{className:`sp-meta`,children:[P(Qa,{size:12,"aria-hidden":`true`}),` `,t?.device?e(`env.phoneConnected`,{name:t.device.name}):e(`env.noPhone`)]}),c&&P(`button`,{type:`button`,className:`sp-action`,onClick:()=>OD(!0),children:e(`env.qr`)}),(a||t?.error)&&P(`span`,{className:`sp-error`,children:a??t?.error})]})}function WD({sessionId:e}){let t=T(),[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(null);(0,J.useEffect)(()=>{let t=!0;return Promise.resolve().then(()=>St(e)).then(e=>{t&&r(iE(e,e=>typeof e.mode==`string`,`permission mode`).mode)}).catch(e=>{t&&s(Px(e))}),()=>{t=!1}},[e]),vE(e,r);let c=async t=>{a(!1),s(null);try{let n=(await Pt(e,t)).mode;r(n),_E(e,n)}catch(e){s(Px(e))}},l=yE.find(e=>e.mode===n)?.note;return V(RD,{label:t(`env.permission`),children:[P(`div`,{className:`sp-segmented`,role:`radiogroup`,"aria-label":t(`env.permission`),children:yE.map(e=>V(`button`,{type:`button`,role:`radio`,"aria-checked":n===e.mode,className:n===e.mode?`is-selected`:void 0,onClick:()=>e.mode===`full_access`?a(!0):void c(e.mode),children:[e.mode===`full_access`?P(Wa,{size:12,"aria-hidden":`true`}):P(Ka,{size:12,"aria-hidden":`true`}),e.mode===`ask`?t(`env.ask`):t(e.label)]},e.mode))}),l&&P(`span`,{className:`sp-meta`,children:t(l)}),i&&V(`span`,{className:`sp-confirm`,role:`alert`,children:[t(`env.fullAccessWarn`),P(`button`,{type:`button`,className:`sp-action is-warning`,onClick:()=>void c(`full_access`),children:t(`env.turnOn`)}),P(`button`,{type:`button`,className:`sp-action`,onClick:()=>a(!1),children:t(`sp.cancel`)})]}),o&&P(`span`,{className:`sp-error`,role:`alert`,children:o})]})}var GD={file:{label:`out.kind.file`,Icon:hi},export:{label:`out.kind.export`,Icon:li},image:{label:`out.kind.image`,Icon:Li},document:{label:`out.kind.document`,Icon:Yi},memory:{label:`out.kind.memory`,Icon:rr},schedule:{label:`out.kind.schedule`,Icon:sr}},KD={created:`out.change.created`,edited:`out.change.edited`,deleted:`out.change.deleted`};function qD(e,t,n){if(!e)return null;let r=Date.parse(`${e.replace(` `,`T`)}Z`);if(Number.isNaN(r))return null;let i=Math.max(0,Math.round((t-r)/1e3));return i<60?{key:`out.justNow`}:i<3600?{key:`out.minAgo`,params:{n:Math.floor(i/60)}}:i<86400?{key:`out.hAgo`,params:{n:Math.floor(i/3600)}}:new Date(r).toLocaleDateString(n,{month:`short`,day:`numeric`})}function JD(e){return e.state===`undone`?`out.undone`:e.state===`gone`?`sp.gone`:null}function YD({sessionId:e,busy:t,onJumpToMessage:n}){let r=T();return P(wD,{id:`outputs`,title:r(`out.title`),children:P(XD,{sessionId:e,busy:t,onJumpToMessage:n})})}function XD({sessionId:e,busy:t,onJumpToMessage:n}){let r=T(),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,f]=(0,J.useState)(!1),p=(0,J.useCallback)(()=>{let t=!0;return Promise.resolve().then(()=>Ae(e)).then(e=>{t&&(a(iE(e,e=>Array.isArray(e.items),`list of outputs`).items),s(null))}).catch(n=>{t&&(d.ui.warn(`Could not list what session=${e} produced`,n),s(Nx(n)))}),()=>{t=!1}},[e]);(0,J.useEffect)(p,[p]),TD(t,p),Hx(e,p);let m=(e,t)=>{l(null),e.catch(e=>l(r(`sp.couldntOpen`,{name:t,error:Nx(e)})))};if(o)return P(`p`,{className:`sp-error`,children:r(`out.listError`,{error:o})});if(!i)return P(`p`,{className:`sp-meta`,children:r(`sp.checking`)});if(i.length===0)return P(`p`,{className:`sp-meta`,children:r(`out.empty`)});let h=u?i:i.slice(0,5);return V(D.Fragment,{children:[P(`ul`,{className:`sp-list`,"aria-label":r(`out.listLabel`),children:h.map(e=>{let{label:t,Icon:i}=GD[e.kind],a=JD(e),o=e.change&&e.kind!==`document`?KD[e.change]:void 0,s=qD(e.created_at,Date.now(),te(r)),c=r.compose(e=>[o?e(`out.kindChanged`,{kind:g(t),change:g(o)}):e(t),s==null?``:typeof s==`string`?s:e(s.key,s.params),a?e(a):``].filter(Boolean).join(` · `));return V(`li`,{className:`sp-output${e.state===`present`?``:` is-inactive`}`,children:[P(i,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}),V(`div`,{className:`sp-item-text`,children:[P(`span`,{className:`sp-item-name`,dir:`auto`,title:e.path??e.name,children:e.name}),P(`span`,{className:`sp-meta`,children:c}),V(`span`,{className:`sp-item-actions`,children:[e.message_id!=null&&V(`button`,{type:`button`,className:`sp-action`,onClick:()=>{n(e.message_id)||l(r(`out.notLoaded`))},"aria-label":r(`out.goToAria`,{name:e.name}),children:[P(Vr,{size:11,"aria-hidden":`true`}),` `,r(`sp.goToTurn`)]}),e.openable&&e.path&&P(`button`,{type:`button`,className:`sp-action`,onClick:()=>m(bt(e.path),e.name),children:r(`sp.open`)}),e.revealable&&e.path&&V(`button`,{type:`button`,className:`sp-action`,onClick:()=>m(En(e.path,!0),e.name),children:[P(yi,{size:11,"aria-hidden":`true`}),` `,r(`sp.showInFolder`)]})]})]})]},e.id)})}),i.length>5&&P(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>f(e=>!e),children:u?r(`out.fewer`):r(`out.more`,{n:i.length-5})}),c&&P(`p`,{className:`sp-error`,role:`alert`,children:c})]})}function ZD(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function QD(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}var $D=e=>g(e===1?`chg.files.one`:`chg.files.other`,{n:e});function eO(e,t=z){let{files:n,additions:r,deletions:i}=e.totals;return t(`chg.total`,{files:$D(n),add:r,del:i})}var tO={edited:`Edited`,created:`Created`,deleted:`Deleted`},nO={edited:`chg.edited`,created:`chg.created`,deleted:`chg.deleted`};function rO({sessionId:e,busy:t,onJumpToMessage:n}){let r=T(),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),u=(0,J.useCallback)(()=>{Promise.resolve().then(()=>dt(e)).then(e=>{a(iE(e,e=>Array.isArray(e.files),`list of this chat's changes`)),s(null)}).catch(t=>{d.ui.warn(`Could not total what session=${e} changed`,t),s(Nx(t))})},[e]);(0,J.useEffect)(u,[u]),TD(t,()=>{l(null),u()}),Hx(e,u);let f=!i||i.files.length===0;return!o&&f&&!c?null:V(wD,{id:`changes`,title:r(`chg.title`),summary:i&&!f?r(`chg.summary`,{files:$D(i.totals.files),add:i.totals.additions,del:i.totals.deletions}):null,children:[o&&P(`p`,{className:`sp-error`,children:r(`chg.error`,{error:o})}),i&&!f&&P(iO,{sessionId:e,busy:t,changes:i,onChanged:u,onUndone:l,onJumpToMessage:n}),f&&c&&P(`p`,{className:`sp-ok`,role:`status`,children:c})]})}function iO({sessionId:e,busy:t,changes:n,onChanged:r,onUndone:i,onJumpToMessage:a}){let o=T(),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(`idle`),[d,f]=(0,J.useState)(null),p=n.files.length,m=async t=>{u(`working`),f(null);try{let n=await we(e,t),r=[];n.restored.length&&r.push(`restored ${ZD(n.restored.length,`file`)}`),n.removed.length&&r.push(`removed ${ZD(n.removed.length,`new file`)}`);let a=`Undone: ${r.join(`, `)||`no files needed changing`}.`;n.kept_folders.length&&(a+=` Kept ${ZD(n.kept_folders.length,`folder`)} the chat created, because they now hold other files.`),f(a),u(`done`),i(a),Vx(e),await Rx(e)}catch(e){let t=e?.reason===`conflict`;f(Px(e)),u(t?`conflict`:`idle`)}};return V(`div`,{className:`sp-changes`,children:[V(`p`,{className:`sp-changes-total`,"aria-live":`polite`,children:[P(`strong`,{children:eO(n,o)}),n.totals.uncounted>0&&V(`span`,{className:`sp-meta`,children:[` · `,o.plural(`chg.uncounted`,n.totals.uncounted)]})]}),n.pending&&P(`p`,{className:`sp-meta`,children:o(`chg.pending`)}),P(`ul`,{className:`sp-list`,children:n.files.map(e=>{let t=e.message_ids[e.message_ids.length-1];return V(`li`,{className:`sp-change`,children:[V(`div`,{className:`sp-item-text`,children:[P(`span`,{className:`sp-item-name`,dir:`auto`,title:e.path,children:QD(e.path)}),V(`span`,{className:`sp-meta`,children:[o(nO[e.change]),e.additions!=null&&V(D.Fragment,{children:[` · `,V(`span`,{className:`sp-add`,children:[`+`,e.additions]}),` `,V(`span`,{className:`sp-del`,children:[`−`,e.deletions]})]}),e.message_ids.length>1&&` · ${o(`chg.turns`,{n:e.message_ids.length})}`]}),e.changed_since&&V(`span`,{className:`sp-warn-text`,children:[P(q,{size:11,"aria-hidden":`true`}),` `,o(`chg.outside`,{when:e.changed_since})]})]}),t!=null&&P(`button`,{type:`button`,className:`btn-icon-sm`,onClick:()=>a(t),"aria-label":o(`chg.goToLast`,{name:QD(e.path)}),title:o(`sp.goToTurn`),children:P(Vr,{size:12})})]},e.path)})}),n.incomplete&&V(`p`,{className:`sp-warn-text`,role:`note`,children:[P(q,{size:11,"aria-hidden":`true`}),` `,Zx(n.untracked,{inChat:!0,undo:`Undo all`})]}),V(`div`,{className:`sp-actions-row`,children:[V(`button`,{type:`button`,className:`sp-action`,onClick:()=>c(!0),children:[P(ri,{size:12,"aria-hidden":`true`}),` `,o(`chg.review`)]}),l!==`confirm`&&l!==`conflict`&&V(`button`,{type:`button`,className:`sp-action`,onClick:()=>u(`confirm`),disabled:l===`working`||t,title:t?o(`chg.wait`):void 0,children:[P(fo,{size:12,"aria-hidden":`true`}),` `,o(l===`working`?`chg.undoing`:`chg.undoAll`)]})]}),l===`confirm`&&V(`div`,{className:`sp-confirm`,role:`group`,"aria-label":o(`chg.confirmLabel`),children:[o(p===1?`chg.confirm.one`:`chg.confirm.other`,{files:$D(p)}),V(`span`,{className:`sp-actions-row`,children:[P(`button`,{type:`button`,className:`sp-action is-danger`,onClick:()=>void m(!1),children:o(`chg.undoAll`)}),P(`button`,{type:`button`,className:`sp-action`,onClick:()=>u(`idle`),children:o(`sp.cancel`)})]})]}),d&&V(`div`,{className:l===`done`?`sp-ok`:`sp-error`,role:l===`done`?`status`:`alert`,children:[d,l===`conflict`&&V(`span`,{className:`sp-actions-row`,children:[P(`button`,{type:`button`,className:`sp-action is-danger`,onClick:()=>void m(!0),children:o(`chg.undoAnyway`)}),P(`button`,{type:`button`,className:`sp-action`,onClick:()=>{u(`idle`),f(null)},children:o(`chg.keep`)})]})]}),P(sO,{sessionId:e,busy:t,onCommitted:r}),s&&P(oO,{changes:n,onClose:()=>c(!1)})]})}function aO(e){if(e.too_large)return`Too large to show: ${e.before_size} → ${e.after_size} bytes.`;if(e.binary)return`Binary file: ${e.before_size} → ${e.after_size} bytes. No text diff.`;if(e.truncated)return`Diff shortened: the change is too long to show in full.`}function oO({changes:e,onClose:t}){Io(!0,t);let n=(0,J.useRef)(null);return aS(n,!0),P(`div`,{ref:n,className:`modal-overlay`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Review this chat's changes`,children:V(`div`,{className:`modal-panel changes-review`,onClick:e=>e.stopPropagation(),children:[V(`div`,{className:`modal-header`,children:[V(`h3`,{children:[`Changes in this chat · `,eO(e)]}),P(`button`,{type:`button`,className:`btn-icon`,onClick:t,"aria-label":`Close`,children:P(So,{size:18})})]}),P(`div`,{className:`modal-body changes-review-body`,children:e.files.map(e=>P(`section`,{className:`changes-review-file`,children:P(rx,{data:{title:e.path,badge:tO[e.change],note:aO(e),unified:e.binary||e.too_large?``:e.unified}})},e.path))})]})})}function sO({sessionId:e,busy:t,onCommitted:n}){let r=T(),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),f=(0,J.useCallback)(()=>{Promise.resolve().then(()=>gt(e)).then(e=>{a(iE(e,e=>Array.isArray(e.repos),`list of git repositories`)),s(null)}).catch(e=>s(Nx(e)))},[e]);return(0,J.useEffect)(f,[f]),TD(t,f),Hx(e,f),o?P(`p`,{className:`sp-error`,children:r(`chg.gitError`,{error:o})}):!i||!i.available||i.repos.length===0?null:V(`div`,{className:`sp-git`,children:[i.repos.map(e=>V(`div`,{className:`sp-git-repo`,children:[V(`span`,{className:`sp-meta`,title:e.root,children:[P(Di,{size:12,"aria-hidden":`true`}),` `,QD(e.root),` · `,e.branch,e.uncommitted.length===0&&e.files.length>0&&` · committed`]}),V(`span`,{className:`sp-actions-row`,children:[V(`button`,{type:`button`,className:`sp-action`,disabled:t||e.uncommitted.length===0,onClick:()=>{d(null),l({kind:`commit`,repo:e})},children:[P(ki,{size:12,"aria-hidden":`true`}),` Commit…`]}),V(`button`,{type:`button`,className:`sp-action`,disabled:t||e.pr_blocked!=null,title:e.pr_blocked??void 0,onClick:()=>{d(null),l({kind:`pr`,repo:e})},children:[P(ji,{size:12,"aria-hidden":`true`}),` Create PR…`]})]}),e.pr_blocked&&P(`span`,{className:`sp-meta`,children:e.pr_blocked})]},e.root)),u&&P(`p`,{className:`sp-ok`,role:`status`,children:u}),c&&P(cO,{sessionId:e,kind:c.kind,repo:c.repo,onClose:()=>l(null),onDone:e=>{l(null),d(e),f(),n()}})]})}function cO({sessionId:e,kind:t,repo:n,onClose:r,onDone:i}){let[a,o]=(0,J.useState)(n.draft.title),[s,c]=(0,J.useState)(n.draft.body),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null);Io(!0,r,!l);let p=(0,J.useRef)(null);aS(p,!0);let m=async()=>{u(!0),f(null);try{if(t===`commit`){let t=await Qt(e,n.root,`${a.trim()}\n\n${s.trim()}`.trim());i(`Committed ${ZD(t.files.length,`file`)} as ${t.commit}.`)}else i(`Opened ${(await It(e,n.root,a,s)).url}`)}catch(e){f(Px(e)),u(!1)}},h=t===`commit`?n.uncommitted:n.files;return P(`div`,{className:`modal-overlay`,onClick:l?void 0:r,children:V(`div`,{ref:p,className:`modal-panel sp-git-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":t===`commit`?`Commit this chat’s changes`:`Create a pull request`,onClick:e=>e.stopPropagation(),children:[V(`div`,{className:`modal-header`,children:[P(`h3`,{children:t===`commit`?`Commit this chat’s changes`:`Create a pull request`}),P(`button`,{type:`button`,className:`btn-icon`,onClick:r,disabled:l,"aria-label":`Close`,children:P(So,{size:18})})]}),V(`div`,{className:`modal-body sp-git-body`,children:[P(`p`,{className:`sp-meta`,children:t===`commit`?`In ${n.root} on ${n.branch}. Only the files below are committed; anything else you changed stays as it is.`:`Pushes ${n.branch} to ${n.remote} (never forced), then opens a pull request with GitHub's gh tool.`}),V(`label`,{className:`sp-field`,children:[P(`span`,{children:t===`commit`?`Summary`:`Title`}),P(`input`,{value:a,onChange:e=>o(e.target.value),disabled:l})]}),V(`label`,{className:`sp-field`,children:[P(`span`,{children:t===`commit`?`Details`:`Description`}),P(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:7,disabled:l})]}),V(`div`,{className:`sp-meta`,children:[ZD(h.length,`file`),`: `,h.join(`, `)]}),t===`commit`&&n.ignored.length>0&&V(`div`,{className:`sp-meta`,children:[`Left out, because git ignores `,n.ignored.length===1?`it`:`them`,`: `,n.ignored.join(`, `)]}),d&&P(`p`,{className:`sp-error`,role:`alert`,children:d})]}),V(`div`,{className:`sp-picker-actions`,children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:r,disabled:l,children:`Cancel`}),V(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void m(),disabled:l||!a.trim(),children:[l&&P(K,{size:13,className:`spin`,"aria-hidden":`true`}),t===`commit`?`Commit ${ZD(h.length,`file`)}`:`Push and open PR`]})]})]})})}var lO={mcp:`tools.cat.mcp`,skill:`tools.cat.skill`,agent:`tools.cat.agent`};function uO(e,t){let n=lO[e];return n?t(n):e.replace(/_/g,` `)}function dO(e){let t=new Map;for(let n of e){let e=t.get(n.category);e?e.push(n):t.set(n.category,[n])}return[...t.entries()]}function fO(e){return e.split(`
67
+ `,1)[0].trim()}function pO({sessionId:e,busy:t}){let n=T();return P(wD,{id:`tools`,title:n(`tools.title`),children:P(mO,{sessionId:e,busy:t})})}function mO({sessionId:e,busy:t}){let n=T(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),s=(0,J.useCallback)(()=>{let t=!0;return Promise.resolve().then(()=>Fe(e)).then(e=>{t&&(i(iE(e,e=>Array.isArray(e.tools),`list of tools`).tools),o(null))}).catch(n=>{if(!t)return;let r=n.httpStatus,a=n.detail;d.ui.warn(`Could not list the tools of session=${e}`,n),i(null),o({notRunning:r===409,text:a||Nx(n)})}),()=>{t=!1}},[e]);return(0,J.useEffect)(s,[s]),TD(t,s),a?.notRunning?P(`p`,{className:`sp-meta`,role:`status`,children:n(`tools.notRunning`)}):a?P(`p`,{className:`sp-error`,role:`alert`,children:n(`tools.listError`,{error:a.text})}):r?r.length===0?P(`p`,{className:`sp-meta`,children:n(`tools.empty`)}):P(`div`,{className:`sp-tools`,"aria-label":n(`tools.listLabel`),role:`group`,children:dO(r).map(([e,t])=>{let r=uO(e,n);return V(`section`,{className:`sp-tool-group`,"aria-label":r,children:[V(`h4`,{className:`sp-tool-group-title`,children:[r,` `,P(`span`,{className:`sp-meta`,children:t.length})]}),P(`ul`,{className:`sp-list`,children:t.map(e=>V(`li`,{className:`sp-tool`,children:[P(`code`,{className:`sp-item-name`,dir:`ltr`,children:e.name}),e.description&&P(`span`,{className:`sp-meta`,title:e.description,children:fO(e.description)})]},e.name))})]},e)})}):P(`p`,{className:`sp-meta`,children:n(`sp.checking`)})}var hO={model:`skills.how.model`,auto:`skills.how.auto`,always:`skills.how.always`};function gO({sessionId:e,busy:t}){let n=T();return P(wD,{id:`skills`,title:n(`skills.title`),children:P(_O,{sessionId:e,busy:t})})}function _O({sessionId:e,busy:t}){let n=T(),r=k(e=>e.skillUses),[i,a]=(0,J.useState)(void 0),[o,s]=(0,J.useState)(null),c=(0,J.useCallback)(()=>{let t=!0;return Promise.resolve().then(()=>Fe(e)).then(e=>{if(!t)return;let n=iE(e,e=>e.skills===null||Array.isArray(e.skills),`list of skills`);a(n.skills??null),s(null)}).catch(n=>{if(!t)return;let r=n.httpStatus,i=n.detail;d.ui.warn(`Could not list the skills of session=${e}`,n),a(void 0),s({notRunning:r===409,text:i||(n instanceof Error?n.message:String(n))})}),()=>{t=!1}},[e]);return(0,J.useEffect)(c,[c,r]),TD(t,c),o?.notRunning?P(`p`,{className:`sp-meta`,role:`status`,children:n(`skills.notRunning`)}):o?P(`p`,{className:`sp-error`,children:n(`skills.listError`,{error:o.text})}):i===void 0?P(`p`,{className:`sp-meta`,children:n(`sp.checking`)}):i===null?P(`p`,{className:`sp-meta`,children:n(`skills.notReported`)}):i.length===0?P(`p`,{className:`sp-meta`,children:n(`skills.empty`)}):P(`ul`,{className:`sp-list`,"aria-label":n(`skills.listLabel`),children:i.map(e=>V(`li`,{className:`sp-tool sp-skill`,children:[V(`span`,{className:`sp-skill-name`,children:[P(eo,{size:12,"aria-hidden":`true`}),P(`code`,{className:`sp-item-name`,dir:`ltr`,children:e.name})]}),P(`span`,{className:`sp-meta`,children:n(hO[e.how]??`skills.how.always`)})]},e.name))})}var vO=`(max-width: 1099px)`,yO=16;function bO({sessionId:e,messages:t,busy:n,onUsage:r,onJumpToMessage:i}){let a=T(),o=zc(vO),s=uD(e=>o?e.overlayOpen:e.open),c=uD(e=>e.width),l=uD(e=>e.setWidth),u=uD(e=>e.setOpen),d=uD(e=>e.setOverlayOpen),f=uD(e=>e.focus),p=(0,J.useRef)(null),[m,h]=(0,J.useState)(null),g=(0,J.useCallback)(()=>{o?d(!1):u(!1)},[o,u,d]);Io(s&&o,g);let _=(0,J.useRef)(null);aS(_,s&&o),(0,J.useEffect)(()=>{s&&o&&p.current?.focus()},[s,o]),(0,J.useEffect)(()=>{f&&o&&d(!0)},[f,o,d]);let v=(0,J.useCallback)(e=>{if(e.button!==0)return;e.preventDefault();let t=e.clientX,n=c,r=e.currentTarget;r.setPointerCapture?.(e.pointerId);let i=getComputedStyle(r).direction===`rtl`?-1:1,a=n,o=e=>{a=cD(n+i*(t-e.clientX)),h(a)},s=()=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),h(null),l(a)};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s)},[l,c]),y=(0,J.useCallback)(e=>{let t=getComputedStyle(e.currentTarget).direction===`rtl`?-16:yO,n={ArrowLeft:c+t,ArrowRight:c-t,Home:280,End:640}[e.key];n!==void 0&&(e.preventDefault(),l(n))},[l,c]);if(!s)return null;let b=m??c,x=dD(t,n);return V(D.Fragment,{children:[o&&P(`div`,{className:`sp-backdrop`,onClick:g,"aria-hidden":`true`}),V(`aside`,{ref:_,className:`session-panel ${o?`is-overlay`:`is-docked`}`,style:o?void 0:{width:b},"aria-label":a(`sp.label`),role:o?`dialog`:`complementary`,"aria-modal":o?!0:void 0,children:[!o&&P(`div`,{className:`sp-resize${m==null?``:` is-dragging`}`,role:`separator`,"aria-orientation":`vertical`,"aria-label":a(`sp.resize`),"aria-valuemin":280,"aria-valuemax":640,"aria-valuenow":b,tabIndex:0,onPointerDown:v,onKeyDown:y,onDoubleClick:()=>l(320)}),V(`header`,{className:`sp-header`,children:[P(`h2`,{className:`sp-title`,children:a(`sp.title`)}),P(`button`,{ref:p,type:`button`,className:`btn-icon-sm`,onClick:g,"aria-label":a(`sp.close`),title:a(`sp.closeShort`),children:P(o?So:va,{size:14})})]}),V(`div`,{className:`sp-body`,children:[x&&P(wD,{id:`answer`,title:a(`sp.section.answer`),children:P(_D,{messages:t,busy:n})}),P(LD,{sessionId:e,busy:n}),P(wD,{id:`context`,title:a(`sp.section.context`),children:P(`div`,{className:`sp-context`,children:P(HE,{sessionId:e,busy:n,onUsage:r})})}),P(YD,{sessionId:e,busy:n,onJumpToMessage:i}),P(rO,{sessionId:e,busy:n,onJumpToMessage:i}),P(gO,{sessionId:e,busy:n}),P(pO,{sessionId:e,busy:n})]})]})]})}function xO({messages:e,busy:t}){let n=T(),r=zc(vO),i=uD(e=>r?e.overlayOpen:e.open),a=uD(e=>e.setOpen),o=uD(e=>e.setOverlayOpen),s=dD(e,t),c=!i&&s?.kind===`turn`&&s.turn.turnSummary?fD(s.turn.turnSummary):!1,l=n(i?`sp.hide`:c?`sp.showWarn`:`sp.show`);return P(`button`,{type:`button`,className:`btn-icon-sm sp-toggle${i?` active`:``}${c?` is-warn`:``}`,onClick:()=>r?o(!i):a(!i),"aria-label":l,"aria-pressed":i,title:l,children:P(c?q:i?va:ba,{size:15})})}function SO({isPrivate:e,onToggle:t}){return P(`button`,{className:`btn-icon-sm task-header-private`,onClick:t,title:e?`Turn off private chat. This chat isn't saved to memory.`:`Turn on private chat. It won't be saved to memory.`,"aria-label":e?`Turn off private chat`:`Turn on private chat`,"data-private":e?`true`:void 0,children:P(e?$r:ti,{size:15})})}var CO=5e3;function wO(e){let[t,n]=(0,J.useState)({usage:null,error:null});return(0,J.useEffect)(()=>{if(!e)return;let t,r=null,i=!1,a=e=>{i||document.hidden||(t=setTimeout(o,e))};async function o(){r=new AbortController;try{let e=await ln(r.signal);if(i)return;n({usage:e,error:null}),a(e.interval_ms)}catch(e){if(i||r.signal.aborted)return;d.ui.warn(`Could not read resource usage`,e),n(t=>({usage:t.usage,error:e instanceof Error?e.message:String(e)})),a(CO)}}let s=()=>{document.hidden?(clearTimeout(t),r?.abort()):(clearTimeout(t),o())};return o(),document.addEventListener(`visibilitychange`,s),()=>{i=!0,clearTimeout(t),r?.abort(),document.removeEventListener(`visibilitychange`,s)}},[e]),e?t:{usage:null,error:null}}var TO=1024**3;function EO(e){return(e/TO).toFixed(1)}function DO(e){return`${Math.round(e)}%`}var OO=[[1e9,`Gbps`],[1e6,`Mbps`],[1e3,`Kbps`]];function kO(e){return OO.find(([t])=>e>=t)??OO[OO.length-1]}function AO(e,[t]){let n=e/t;return n<.05?`0`:n>=100?n.toFixed(0):n.toFixed(1)}function jO(e){let t=Math.max(1e5,...e),n=10**Math.floor(Math.log10(t));return[1,2,5,10].find(e=>t<=e*n)*n}function MO(e,t){let n=e.slice(-60),r=60-n.length;return n.map((e,n)=>[(r+n)/59*100,98-Math.max(0,Math.min(t,e))/t*96])}function NO(e){return e.map(([e,t],n)=>`${n?`L`:`M`}${e.toFixed(2)} ${t.toFixed(2)}`).join(` `)}function PO({values:e,max:t=100,dashed:n}){let r=MO(e,t),i=NO(r),a=r.length>1?`${i} L100 100 L${r[0][0].toFixed(2)} 100 Z`:``,o=n?MO(n,t):[];return V(`svg`,{className:`resource-spark`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[P(`path`,{className:`resource-spark-grid`,d:`M0 25H100M0 50H100M0 75H100M25 0V100M50 0V100M75 0V100`,vectorEffect:`non-scaling-stroke`}),a&&P(`path`,{className:`resource-spark-area`,d:a}),r.length>1&&P(`path`,{className:`resource-spark-line`,d:i,vectorEffect:`non-scaling-stroke`}),o.length>1&&P(`path`,{className:`resource-spark-line is-dashed`,d:NO(o),vectorEffect:`non-scaling-stroke`})]})}var FO={gpu:`resources.gpu`,npu:`resources.npu`,ethernet:`resources.ethernet`,wifi:`resources.wifi`,network:`resources.network`};function IO(e,t,n){let r=e(FO[t.kind]),i=n.filter(e=>e.kind===t.kind);return i.length>1?e(`resources.numbered`,{label:r,n:i.indexOf(t)}):r}function LO(e){let t=kO(e);return`${AO(e,t)} ${t[1]}`}function RO(e,t,n,r){return{key:`${t}-unavailable`,tone:t,label:n,value:``,detail:e(`resources.unavailable`),title:e(`resources.unavailableWhy`,{label:n,reason:r}),history:[]}}function zO(e,t){let n=[];if(t.cpu){let r=t.cpu.ghz==null?void 0:`${t.cpu.ghz.toFixed(2)} GHz`;n.push({key:`cpu`,tone:`cpu`,label:e(`resources.cpu`),value:DO(t.cpu.percent),detail:r,title:[e(`resources.cpu`),DO(t.cpu.percent),r].filter(Boolean).join(` · `),history:t.cpu.history})}if(t.memory){let r=t.memory,i=`${EO(r.used_bytes)}/${EO(r.total_bytes)} GB`;n.push({key:`memory`,tone:`memory`,label:e(`resources.memory`),value:DO(r.percent),detail:i,title:`${e(`resources.memory`)} · ${i} (${DO(r.percent)})`,history:r.history})}let r=t.devices??[];for(let t of r){let i=t.memory_used_bytes==null?void 0:`${EO(t.memory_used_bytes)} GB`;n.push({key:t.id,tone:t.kind,label:IO(e,t,r),value:DO(t.percent),detail:i,name:t.name,title:[t.name,DO(t.percent),i&&e(`resources.inUse`,{size:i})].filter(Boolean).join(` · `),history:t.history})}t.devices_error&&n.push(RO(e,`gpu`,e(`resources.gpu`),t.devices_error));let i=t.networks??[];for(let t of i){let r=kO(Math.max(t.send_bps,t.recv_bps)),a=AO(t.send_bps,r),o=AO(t.recv_bps,r);n.push({key:t.id,tone:`network`,label:IO(e,t,i),value:``,detail:`${e(`resources.sendRecv`,{send:a,recv:o})} ${r[1]}`,name:t.name,title:[t.name,t.description,e(`resources.send`,{rate:LO(t.send_bps)}),e(`resources.receive`,{rate:LO(t.recv_bps)})].join(` · `),history:t.recv_history,dashed:t.send_history,max:jO([...t.recv_history,...t.send_history])})}return t.networks_error&&n.push(RO(e,`network`,e(`resources.network`),t.networks_error)),n}function BO({onClose:e}){let t=T(),{usage:n,error:r}=wO(!0),i=n?.ready?zO(t,n):[];return V(`section`,{className:`resource-strip`,"aria-label":t(`resources.region`),children:[i.length>0?P(`ul`,{className:`resource-tiles${r?` is-stale`:``}`,children:i.map(e=>V(`li`,{className:`resource-tile tone-${e.tone}`,title:e.title,children:[P(PO,{values:e.history,max:e.max,dashed:e.dashed}),V(`span`,{className:`resource-text`,children:[V(`span`,{className:`resource-label`,children:[e.label,e.name&&P(`span`,{className:`resource-sr-only`,children:` (${e.name})`})]}),V(`span`,{className:`resource-reading`,children:[e.value&&P(`bdi`,{dir:`ltr`,className:`resource-value`,children:e.value}),e.detail&&P(`bdi`,{dir:`ltr`,className:`resource-detail`,children:e.detail})]})]})]},e.key))}):P(`p`,{className:`resource-status`,role:`status`,children:t(r?`resources.error`:`resources.reading`)}),r&&i.length>0&&P(`p`,{className:`resource-status is-error`,role:`status`,title:r,children:t(`resources.error`)}),P(`button`,{type:`button`,className:`btn-icon-sm resource-close`,onClick:e,"aria-label":t(`resources.hide`),title:t(`resources.hide`),children:P(So,{size:14,"aria-hidden":`true`})})]})}function VO({sessionId:e}){let t=T(),{env:n,change:r}=fE(e),[i,a]=(0,J.useState)(null);return!n||n.internet?null:V(`div`,{className:`offline-notice`,role:`status`,children:[P(vo,{size:13,"aria-hidden":`true`}),V(`span`,{children:[t(`offline.text`),i&&V(`span`,{className:`offline-notice-error`,children:[` `,t(`offline.error`,{error:i})]})]}),P(`button`,{type:`button`,className:`link-btn`,onClick:()=>{a(null),r(()=>ye(e,!0)).catch(e=>{a(e instanceof vn?e.detail||e.message:String(e))})},children:t(`offline.turnOn`)})]})}function HO({message:e,onDismiss:t}){return e?V(`div`,{className:`export-error-bar`,role:`alert`,children:[P(`span`,{children:e}),P(`button`,{type:`button`,className:`btn-icon-sm`,onClick:t,"aria-label":`Dismiss export error`,children:P(So,{size:13})})]}):null}var UO=`gaia.resourceMonitor.visible`;function WO(){try{return window.localStorage.getItem(UO)!==`0`}catch(e){return d.ui.warn(`Resource usage setting unavailable; showing it`,e),!0}}var GO=p(e=>({visible:WO(),setVisible:t=>{try{window.localStorage.setItem(UO,t?`1`:`0`)}catch(e){d.ui.warn(`Could not remember the resource usage setting`,e)}e({visible:t})},reload:()=>e({visible:WO()})}));function KO(){return`screenshot-${new Date().toISOString().slice(0,19).replace(/[T:]/g,`-`)}.png`}function qO(){let e=T(),[t,n]=(0,J.useState)([]),r=(0,J.useRef)(!0),i=(0,J.useRef)(new Map);(0,J.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]);let a=(0,J.useCallback)(async e=>{let t=new AbortController;i.current.set(e.id,t);try{let i=e.isMedia?await vt(e.file,t=>{r.current&&n(n=>n.map(n=>n.id===e.id?{...n,progress:t}:n))},t.signal):await pt(e.file);if(!r.current)return;n(t=>t.map(t=>t.id===e.id?{...t,uploading:!1,uploaded:!0,serverUrl:i.url}:t))}catch(i){if(t.signal.aborted||(d.chat.error(`Upload failed: ${e.name}`,i),!r.current))return;let a=i instanceof Error?i.message:`Upload failed`;n(t=>t.map(t=>t.id===e.id?{...t,uploading:!1,error:a}:t))}finally{i.current.delete(e.id)}},[]),o=(0,J.useCallback)(e=>{for(let t of e){let e=t.type.startsWith(`image/`),r={id:`attach-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,file:t,name:t.name||(e?KO():`file`),url:e?URL.createObjectURL(t):``,uploading:!0,uploaded:!1,isImage:e,isMedia:ET(t.name)};n(e=>[...e,r]),a(r)}},[a]),s=(0,J.useCallback)(e=>{let t=Array.from(e.clipboardData?.items??[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);return t.length!==0&&(e.preventDefault(),o(t),!0)},[o]),c=(0,J.useCallback)(e=>{i.current.get(e)?.abort(),n(t=>{let n=t.find(t=>t.id===e);return n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)})},[]),l=(0,J.useCallback)(()=>{n(e=>(e.forEach(e=>{e.url&&URL.revokeObjectURL(e.url)}),[]))},[]),u=(0,J.useCallback)(n=>{let r=t.filter(e=>e.uploaded&&e.serverUrl).map(e=>{let t=e.name.replace(/[[\]]/g,` `).trim();return e.isImage?`![${t}](${e.serverUrl})`:`[${t}](${e.serverUrl})`}).join(`
68
+ `);if(!r)return n;let i=n||(t.some(e=>e.uploaded&&e.isMedia)?e(`composer.mediaPrompt`):``);return i?`${i}\n\n${r}`:r},[t,e]);return{attachments:t,addFiles:o,handlePaste:s,remove:c,clear:l,hasUploaded:t.some(e=>e.uploaded),hasImage:t.some(e=>e.uploaded&&e.isImage),uploading:t.some(e=>e.uploading),compose:u}}function JO({sessionId:e,isStreaming:t,isStale:n,setMessages:r,refreshContext:i}){let[a,o]=(0,J.useState)(null),s=a?.state.status===`running`,c=(0,J.useRef)(!1);c.current=s;let l=(0,J.useRef)(a);l.current=a,(0,J.useEffect)(()=>{o(null)},[e]);let u=(0,J.useCallback)((r,i)=>{t||c.current||(d.chat.info(`Retrying message ${r.id} with ${i}`),o({messageId:r.id,state:{status:`running`,model:i},keeping:null}),Et(e,r.id,i).then(e=>{n()||o(t=>t&&t.messageId===r.id?{...t,state:{status:`ready`,result:e}}:t)}).catch(e=>{d.chat.error(`Retry with ${i} failed`,e),!n()&&o(t=>t&&t.messageId===r.id?{...t,state:{status:`failed`,model:i,error:e instanceof Error?e.message:String(e)}}:t)}))},[e,t,n]),f=(0,J.useCallback)(async t=>{if(!a)return;let{messageId:s}=a;o({...a,keeping:t});try{let a=await se(e,s,t);if(n())return;if(a.kept===`retry`){let e=a.stats;r(k.getState().messages.map(t=>t.id===s?{...t,content:a.content,stats:{...t.stats,...e,tokens_per_second:e.tokens_per_second??0,time_to_first_token:e.time_to_first_token??0,input_tokens:e.input_tokens??0,output_tokens:e.output_tokens??0,retried:!0}}:t)),i()}o(null)}catch(e){if(d.chat.error(`Could not keep the chosen answer`,e),n())return;o(t=>t&&{...t,keeping:null,state:{status:`failed`,model:t.state.status===`ready`?t.state.result.model:t.state.model,error:e instanceof Error?e.message:String(e)}})}},[a,e,r,n,i]);return{comparison:a,comparing:s,comparingRef:c,handleRetryWith:u,handleKeepAnswer:f,handleCloseComparison:(0,J.useCallback)(()=>{a?.state.status===`ready`?f(`original`):o(null)},[a,f]),closeForNewTurn:(0,J.useCallback)(()=>{let t=l.current;t&&(t.state.status===`ready`&&se(e,t.messageId,`original`).catch(e=>d.chat.error(`Could not close the answer comparison`,e)),o(null))},[e])}}function YO(e,t){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{r(null),a(null)},[e]);let o=(0,J.useCallback)(()=>{pn(e).then(e=>{t()||(e.available?(r(e),a(null)):(r(null),a(e.reason)))}).catch(t=>d.chat.error(`Could not measure the context for session=${e}`,t))},[e,t]);return(0,J.useEffect)(()=>{o()},[o]),{contextUsage:n,contextUnavailable:i,refreshContext:o,showContextUsage:(0,J.useCallback)(e=>{r(e),a(null)},[])}}function XO(e,t){return(0,J.useCallback)(n=>{let r=e.current?.querySelector(`[data-message-id="${n}"]`);if(!r)return!1;let i=r.previousElementSibling,a=i?.dataset.role===`user`?i:r;return t.current=!1,a.scrollIntoView?.({block:`start`,behavior:Ax()}),r.classList.add(`msg-jump-target`),window.setTimeout(()=>r.classList.remove(`msg-jump-target`),1600),!0},[e,t])}var ZO=1,QO=80,$O=500,ek=new Set([`PageUp`,`ArrowUp`,`Home`]),tk=new Set([`PageDown`,`ArrowDown`,`End`]);function nk(e,t,n){let r=(0,J.useRef)(0),i=(0,J.useRef)(0),a=(0,J.useRef)(0),o=(0,J.useRef)(!1),s=(0,J.useCallback)(()=>o.current||Date.now()-a.current<$O,[]),c=(0,J.useCallback)(()=>{a.current=Date.now()},[]),l=(0,J.useCallback)(()=>{a.current=0},[]),u=(0,J.useCallback)(()=>{let a=e.current;if(!a)return;let o=a.scrollHeight-a.scrollTop-a.clientHeight,c=i.current,l=a.scrollTop<r.current&&s();r.current=a.scrollTop,i.current=o,o<=ZO?t.current=!0:l?t.current=!1:o<=QO&&o<c&&(t.current=!0),n(o)},[e,t,n,s]),d=(0,J.useCallback)(e=>{e.deltaY<0?c():e.deltaY>0&&l()},[c,l]),f=(0,J.useCallback)(e=>{e.target===e.currentTarget&&(o.current=!0)},[]);return(0,J.useEffect)(()=>{let e=()=>{o.current=!1},t=e=>{let t=e.target;t instanceof Element&&t.closest(`input, textarea, select, [contenteditable="true"]`)||(ek.has(e.key)||e.key===` `&&e.shiftKey?c():(tk.has(e.key)||e.key===` `)&&l())};return window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`keydown`,t)}},[c,l]),{userScrolling:s,clearUserScroll:l,listProps:{onScroll:u,onWheel:d,onTouchMove:c,onPointerDown:f}}}function rk(e,t){let[n,r]=(0,J.useState)(null);(0,J.useEffect)(()=>{r(null)},[e]);let i=(0,J.useCallback)(()=>r(null),[]);return{exportChat:(0,J.useCallback)(async()=>{r(null);try{let n=await Ve(e),r=new Blob([n.content],{type:`text/markdown`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${(t||`chat`).replace(/[/\\:*?"<>|]/g,`_`).slice(0,100)}.md`,a.click(),URL.revokeObjectURL(i)}catch(e){d.chat.error(`Export failed`,e),r(e instanceof vn?`Couldn't export this chat: GAIA's backend returned an error (HTTP ${e.httpStatus}). Try Export again; if it keeps failing, check the backend log.`:`Couldn't export this chat because GAIA's backend isn't reachable. Try Export again once GAIA is answering.`)}},[e,t]),exportError:n,clearExportError:i}}var ik=5200;function ak(e=ik){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(null),i=(0,J.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null)},[]),a=(0,J.useCallback)(()=>{i(),n(null)},[i]),o=(0,J.useCallback)(t=>{i(),n(t),r.current=setTimeout(()=>{r.current=null,n(null)},e)},[i,e]);return(0,J.useEffect)(()=>i,[i]),{policyToast:t,showPolicyToast:o,dismissPolicyToast:a}}var ok=`gaia`;function sk(e){return e.some(e=>e.id===ok)}function ck(e){let t=e;return t?.httpStatus===422&&`${typeof t.detail==`string`?t.detail:``} ${typeof t.message==`string`?t.message:``}`.includes(`Unknown agent_type '${ok}'`)}var lk=new Set([``,`new chat`,`new task`,`untitled`,`untitled session`,`chat`]);function uk(e){return lk.has((e??``).trim().toLowerCase())}function dk(e,t){let n=k.getState(),r=n.sessions.find(t=>t.id===e)?.document_ids??[],i=t.filter(e=>!r.includes(e));i.length>0&&n.updateSessionInList(e,{document_ids:[...r,...i]})}function fk(e,t){if(t.length===0)return;let n=k.getState(),r=new Set(t.map(e=>e.id));n.setDocuments([...t,...n.documents.filter(e=>!r.has(e.id))]),dk(e,t.map(e=>e.id))}async function pk(e,t){for(let n of t){d.doc.info(`Dropped on chat view: ${n.name}`);try{let t=await ke(n);if(e&&t?.id)try{await Yt(e,t.id),dk(e,[t.id]),d.doc.info(`Auto-attached "${n.name}" to session ${e}`)}catch(e){d.doc.warn(`Could not attach dropped document to session: ${e}`)}}catch(e){d.doc.error(`Upload failed: ${n.name}`,e)}}try{let e=await Dt();k.getState().setDocuments(e.documents||[])}catch(e){d.doc.error(`Could not refresh the document list after a drop`,e)}}function mk(e,t){let n=()=>typeof document<`u`&&document.visibilityState===`hidden`,r=setInterval(()=>{n()||e()},t),i=()=>{n()||e()};return document.addEventListener(`visibilitychange`,i),()=>{clearInterval(r),document.removeEventListener(`visibilitychange`,i)}}function hk(e){let t=()=>typeof document<`u`&&document.visibilityState===`hidden`,n=t()?null:e(),r=()=>{t()?(n?.(),n=null):n||=e()};return document.addEventListener(`visibilitychange`,r),()=>{document.removeEventListener(`visibilitychange`,r),n?.(),n=null}}var gk=2e3,_k=9e4;function vk(){let e=T(),[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(`idle`),[s,c]=(0,J.useState)(null),l=(0,J.useRef)(!0),u=(0,J.useCallback)(async()=>{try{let e=await at();return l.current&&n(e),e}catch(e){return l.current&&c(e instanceof Error?e.message:String(e)),null}},[]);(0,J.useEffect)(()=>(l.current=!0,u(),ce().then(e=>{l.current&&i(e)}).catch(e=>{l.current&&c(e instanceof Error?e.message:String(e))}),()=>{l.current=!1}),[u]);let d=(0,J.useCallback)(async()=>{c(null);let e=await u();e&&o(e.state===`stopped`?`still_down`:`back`)},[u]),f=(0,J.useCallback)(async()=>{o(`starting`),c(null);try{await Ue(!1)}catch(e){if(!l.current)return;c(e instanceof Error?e.message:String(e)),o(`idle`);return}let e=Date.now()+_k;for(;l.current&&Date.now()<e;){await new Promise(e=>setTimeout(e,gk));let e=await u();if(!l.current)return;if(e?.restart_error){c(e.restart_error),o(`idle`);return}if(e&&e.state!==`stopped`&&!e.restarting){o(`back`);return}}l.current&&o(`still_down`)},[u]),p=(0,J.useCallback)(async()=>{o(`switching`),c(null);try{let e=await Ee({mode:`gaia`});if(!l.current)return;i(e),o(`back`)}catch(e){if(!l.current)return;c(e instanceof Error?e.message:String(e)),o(`idle`)}},[]),m=a===`starting`||a===`switching`,h=t?.owner===`gaia`,g=!h&&r?.mode===`external`&&r.source!==`env`;return a===`back`?P(`div`,{className:`server-down-notice server-down-notice--ok`,role:`status`,children:P(`p`,{children:e(`serverDown.back`)})}):V(`div`,{className:`server-down-notice`,role:`alert`,children:[V(`strong`,{className:`server-down-notice__title`,children:[P(q,{size:14,"aria-hidden":`true`}),` `,e(`serverDown.title`)]}),P(`p`,{children:e(`serverDown.body`)}),t&&!h&&!g&&P(`p`,{children:e(`serverDown.notOurs`)}),a===`still_down`&&P(`p`,{children:e(`serverDown.stillDown`)}),s&&P(`p`,{children:P(`bdi`,{dir:`ltr`,className:`server-down-notice__raw`,children:s})}),V(`div`,{className:`server-down-notice__actions`,children:[h&&P(`button`,{type:`button`,className:`btn-primary`,disabled:m,onClick:()=>void f(),children:a===`starting`?V(D.Fragment,{children:[P(K,{size:13,className:`btn-spinner`,"aria-hidden":`true`}),` `,e(`serverDown.starting`)]}):e(`serverDown.start`)}),g&&P(`button`,{type:`button`,className:`btn-primary`,disabled:m,onClick:()=>void p(),children:a===`switching`?V(D.Fragment,{children:[P(K,{size:13,className:`btn-spinner`,"aria-hidden":`true`}),` `,e(`serverDown.switching`)]}):e(`serverDown.useOwn`)}),P(`button`,{type:`button`,className:`btn-secondary`,disabled:m,onClick:()=>void d(),children:e(`settings.key.checkAgain`)})]})]})}function yk(e,t=``){let[n,r]=(0,J.useState)(()=>e&&Mt(e)||t),i=(0,J.useRef)(e);return(0,J.useEffect)(()=>{i.current!==e&&(i.current=e,r(e?Mt(e):``))},[e]),(0,J.useEffect)(()=>{e&&i.current===e&&bn(e,n)},[e,n]),[n,r]}function bk(e,t){return yk(t?null:qe(e))}var xk=new Set([`tool_start`,`tool_end`,`tool_result`]),Sk=`Connection lost. Reconnecting`,Ck=15e3,wk=[],Tk=new Map;function Ek({text:e}){return P(`div`,{className:`history-notice`,role:`note`,children:e})}function Dk({sessionId:e}){let t=T(),{sessions:n,messages:r,setMessages:i,addMessage:o,removeMessage:s,removeMessagesFrom:c,updateSessionInList:l,isStreaming:u,streamingContent:f,setStreaming:p,setStreamContent:m,clearStreamContent:h,agentSteps:g,addAgentStep:_,updateLastAgentStep:v,appendThinkingContent:b,updateLastToolStep:x,clearAgentSteps:S,cards:C,appendCard:w,clearCards:E,documents:O,setDocuments:A,setShowDocLibrary:j,setShowFileBrowser:M,isLoadingMessages:N,setLoadingMessages:F,systemStatus:L}=k(),R=Qs(e=>e.addNotification),z=Qs(e=>e.showPanel),B=Qs(e=>e.setShowPanel),te=Qs(e=>e.setTypeFilter),ne=k(t=>t.pendingPrompt?.sessionId===e?t.pendingPrompt:null),oe=k(e=>e.liveStatus),H=k(dw),U=k(e=>e.awaitingUser),se=k(t=>Object.values(t.liveQuestions).some(t=>t.sessionId===e)),W=Qs(t=>tc(e)(t)!==null),G=n.find(t=>t.id===e),ce=new Set(G?.document_ids??[]),le=O.filter(e=>ce.has(e.id)),[ue,de]=bk(e,G?.private),[fe,pe]=(0,J.useState)(!1),[me,he]=(0,J.useState)(``),[ge,_e]=(0,J.useState)(!1),[ve,ye]=(0,J.useState)(!1),be=qO(),[xe,Ce]=(0,J.useState)(!1),[we,Te]=(0,J.useState)(null),{policyToast:Ee,showPolicyToast:De,dismissPolicyToast:Oe}=ak(),[ke,Ae]=(0,J.useState)(null),{exportChat:je,exportError:Me,clearExportError:Ne}=rk(e,G?.title),Pe=G?.agent_type&&G.agent_type!==`gaia`?G.agent_type:null,[Fe,Ie]=(0,J.useState)(!1),[Le,Re]=(0,J.useState)(null),ze=(0,J.useRef)(``),Ve=(0,J.useRef)([]),He=(0,J.useRef)([]),Ue=(0,J.useRef)(!1);(0,J.useEffect)(()=>{f&&(ze.current=f)},[f]),(0,J.useEffect)(()=>{g.length>0&&(Ve.current=g.map(e=>({...e,active:!1})))},[g]),(0,J.useEffect)(()=>{C.length>0&&(He.current=[...C])},[C]),ww(),(0,J.useEffect)(()=>{if(!u&&Ue.current){Ie(!0);let e=setTimeout(()=>{Ie(!1),ze.current=``,Ve.current=[],He.current=[]},350);return()=>clearTimeout(e)}Ue.current=u},[u]);let We=(0,J.useRef)(null),Ge=(0,J.useRef)(null),Ke=(0,J.useRef)(null),qe=(0,J.useRef)(null),Ye=(0,J.useRef)(0),Xe=(0,J.useRef)(!1),Ze=(0,J.useRef)(0),Qe=(0,J.useRef)(null),[$e,et]=(0,J.useState)(!1),tt=(0,J.useRef)(!1),rt=(0,J.useRef)(null),it=(0,J.useRef)(null),at=(0,J.useRef)(0),ot=(0,J.useRef)(!1),lt=(0,J.useRef)(()=>{}),ut=(0,J.useRef)(!1),dt=k(t=>t.messageQueues[e]??wk),ft=(0,J.useCallback)(t=>k.getState().updateQueue(e,t),[e]),pt=(0,J.useRef)(!1),[ht,gt]=(0,J.useState)(!1),_t=(0,J.useRef)(!1),vt=(0,J.useRef)(!1),yt=(0,J.useRef)(u);yt.current=u;let bt=k(t=>!!t.queueHolds[e]),xt=(0,J.useRef)(``),St=(0,J.useRef)(null),wt=(0,J.useRef)(null),Tt=(0,J.useRef)(0),Et=(0,J.useRef)(!0),{userScrolling:Ot,clearUserScroll:kt,listProps:At}=nk(Ge,Et,e=>ye(e>200)),jt=(0,J.useCallback)(()=>k.getState().currentSessionId!==e,[e]),Mt=(0,J.useCallback)(()=>{St.current=null,!jt()&&xt.current&&m(xt.current)},[m,jt]),Nt=(0,J.useRef)(0),Pt=(0,J.useRef)(0);(0,J.useEffect)(()=>{d.chat.info(`ChatView mounted for session=${e}, loading messages...`);let t=d.chat.time();F(!0);let n=!1,r=!1,a=async(a=!1)=>{if(n||r)return;r=!0;let o=Pt.current;try{if(!a){if(k.getState().isStreaming)return;let t=await nt(e);if(n||t===Nt.current||k.getState().isStreaming)return}let r=await ct(e);if(n)return;let s=_w(r.messages);a&&Pt.current!==o?Nt.current=s.length:a?(i(s),Nt.current=s.length,d.chat.timed(`Loaded ${s.length} message(s) for session=${e}`,t)):s.length!==Nt.current&&!k.getState().isStreaming&&(d.chat.info(`Messages changed externally: ${Nt.current} -> ${s.length}`),i(xw(k.getState().messages,s)),Nt.current=s.length)}catch(t){if(n)return;a&&(d.chat.error(`Failed to load messages for session=${e}`,t),i([]))}finally{r=!1,!n&&a&&F(!1)}};a(!0);let o=mk(()=>a(!1),3e3);return()=>{n=!0,o()}},[e,i,F]),(0,J.useEffect)(()=>{Dt().then(e=>A(e.documents||[])).catch(e=>d.doc.error(`Could not load the document list`,e))},[A]);let Ft=(0,J.useRef)(!0),It=(0,J.useRef)(!1),Lt=Bw(L);(0,J.useEffect)(()=>(Ft.current=!0,()=>{Ft.current=!1}),[]),(0,J.useEffect)(()=>{let e=ne?.text;!e||k.getState().isLoadingMessages||Lt||(k.getState().setPendingPrompt(null),It.current=!0,setTimeout(()=>{It.current=!1,Ft.current&&lt.current(e,{opening:!0})},0))},[ne,N,Lt]),(0,J.useEffect)(()=>{if(!Et.current)return;let e=Date.now()-Tt.current,t=()=>{Et.current&&!Ot()&&(Tt.current=Date.now(),We.current?.scrollIntoView({behavior:`instant`}))};e>=100&&t(),wt.current&&clearTimeout(wt.current),wt.current=setTimeout(t,100)},[r,f,g]),(0,J.useEffect)(()=>{Ke.current?.focus()},[e]),(0,J.useEffect)(()=>{pt.current=!1},[e]);let{contextUsage:Rt,contextUnavailable:zt,refreshContext:Bt,showContextUsage:Vt}=YO(e,jt),{comparison:Ht,comparing:Ut,comparingRef:Wt,handleRetryWith:Gt,handleKeepAnswer:Kt,handleCloseComparison:qt,closeForNewTurn:Jt}=JO({sessionId:e,isStreaming:u,isStale:jt,setMessages:i,refreshContext:Bt});(0,J.useEffect)(()=>()=>{yt.current&&lT(e),qe.current&&!vt.current&&qe.current.abort(),qe.current&&=null,rt.current&&=(clearTimeout(rt.current),null),tt.current=!1,it.current=null,et(!1),St.current!==null&&(cancelAnimationFrame(St.current),St.current=null),wt.current&&=(clearTimeout(wt.current),null),Qe.current&&=(clearTimeout(Qe.current),null),Oe(),xt.current=``,k.getState().resetStreaming()},[e]),(0,J.useEffect)(()=>{ke&&z&&(document.getElementById(Sw(ke))?.scrollIntoView({behavior:Ax(),block:`center`}),Ae(null))},[ke,z]);let Yt=uD(e=>e.width),Xt=uD(e=>e.reveal),Zt=GO(e=>e.visible),Qt=GO(e=>e.setVisible),$t=(0,J.useRef)(null),en=(0,J.useCallback)(()=>{Qt(!1),$t.current?.focus()},[Qt]),tn=XO(Ge,Et),nn=(0,J.useCallback)(()=>{Et.current=!0,kt(),We.current?.scrollIntoView({behavior:Ax()})},[kt]),rn=(0,J.useCallback)(()=>{tt.current||(tt.current=!0,pt.current=!0,et(!0),Qs.getState().dismissSessionPrompts(e),k.getState().closeSessionQuestions(e),d.stream.warn(`User stopped generation; waiting for the server to close the turn`),Je(e).catch(e=>{d.stream.error(`Stop request failed; waiting for the stream to close`,e)}),Qe.current?(clearTimeout(Qe.current),Qe.current=null,it.current?.()):rt.current=setTimeout(()=>{d.stream.error(`No closing event ${Ck}ms after Stop; closing the turn locally (session=${e})`),it.current?.()},Ck))},[e]);(0,J.useEffect)(()=>{let e=e=>{e.key===`Escape`&&u&&!Po(e)&&(e.preventDefault(),rn())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u,rn]);let an=(0,J.useCallback)(async(t,n)=>{let r=n?.attach===!0,a=n?.queued===!0,c=r?n?.reconnect??0:0,f=(t||ue).trim(),g=!a&&be.hasUploaded;Et.current=!0;let C=Bw(L),T=e=>{a&&n?.onQueuedOutcome?.(e)};if(!r&&Pe){d.chat.warn(`Send blocked: chat ${e} belongs to the retired "${Pe}" agent`),T({kind:`failed`,error:`This chat's "${Pe}" agent was retired, so it cannot take new messages.`});return}let D=!n?.opening&&(k.getState().messageQueues[e]??wk).length>0;if(r){if(u&&!c)return}else if(!a&&(f||g)&&!C&&(u||Wt.current||D)){ft(e=>ee(e,be.compose(f),`queued`)),de(``),be.clear(),Ke.current?.focus();return}else if(!f&&!g||u||C){T({kind:`busy`}),!f&&!g&&d.chat.debug(`Send blocked: empty message`),u&&d.chat.debug(`Send blocked: already streaming`),C&&d.chat.debug(`Send blocked: system initializing`);return}if(!r&&!a&&(!Ho(`chat`)||be.hasImage&&!Ho(`vision`))){if(ut.current)return;ut.current=!0;try{if(!await Go(`chat`)||be.hasImage&&!await Go(`vision`))return}finally{ut.current=!1}}let O=f,A=null;if(r)d.chat.info(`Re-attaching to background run for session=${e}${c?` (reconnect ${c})`:``}`);else{O=a?f:be.compose(f),d.chat.info(`Sending message to session=${e}`,{length:O.length,preview:O.slice(0,80)}),a||(de(``),Ke.current?.focus(),be.clear()),Jt();let t={id:Date.now(),session_id:e,role:`user`,content:O,created_at:new Date().toISOString(),rag_sources:null};o(t),A=t,Pt.current+=1}c||(Ze.current=0),p(!0),h(),S(),E(),at.current=0,ot.current=!1,c&&k.getState().setLiveStatus(`${Sk} (attempt ${c} of 3)…`),d.stream.info(`Starting agent stream...`);let j=d.stream.time(),M=``,N;Re(null);let P=!1;_t.current=!1,r||gt(!1);let F=null,z=!a;vt.current=a;let B=e=>{z||(z=!0,vt.current=!1,n?.onQueuedOutcome?.(e),e.kind===`accepted`&&jt()&&F?.abort())},te=r||!!G&&!uk(G.title),V=()=>{B({kind:`accepted`}),!te&&(te=!0,mt(e).then(t=>l(e,{title:t.title})).catch(e=>d.chat.warn(`Could not refresh the chat title`,e)))};xt.current=``,tt.current=!1,et(!1);let ne=()=>{rt.current&&=(clearTimeout(rt.current),null),tt.current=!1,it.current=null,et(!1)},ie=()=>{let{agentSteps:e,cards:t}=k.getState();return{steps:e.map(e=>({...e,active:!1})),cards:[...t]}};it.current=()=>{if(P)return;P=!0,Xe.current=!0,Ye.current=Date.now(),ne(),B({kind:`failed`,error:`Stopped before GAIA confirmed it got this message.`}),qe.current?.abort(),qe.current=null,St.current!==null&&(cancelAnimationFrame(St.current),St.current=null);let t=xt.current||k.getState().streamingContent;if(xt.current=``,jt())return;let{steps:n,cards:r}=ie();o({id:Date.now()+1,session_id:e,role:`assistant`,content:t,created_at:new Date().toISOString(),rag_sources:null,agentSteps:n.length>0?n:void 0,cards:r.length>0?r:void 0,stopState:`unconfirmed`}),p(!1),h(),S(),E()};let ae={onConnected:()=>{if(jt())return;let e=k.getState();(e.liveStatus===`Waiting for GAIA to start this answer…`||e.liveStatus?.startsWith(Sk))&&e.setLiveStatus(null)},onChunk:t=>{if(V(),jt())return;k.getState().awaitingUser&&k.getState().setAwaitingUser(!1);let n=t.content||``;if(n&&Qs.getState().dismissSessionPrompts(e),n){if(t.type===`answer`)M=n;else{ot.current&&=(M.length>0&&(M+=`
69
+
70
+ `),!1),M+=n;let e=k.getState().agentSteps,t=e[e.length-1];t?.type===`thinking`&&t.active&&v({active:!1,latencyMs:Date.now()-t.timestamp})}let e=M.replace(pw,``).trim();if(e=mw(e),e){let t=e.lastIndexOf(`{`);if(t>-1){let n=e.slice(t);/^\{\s*"(?:thought|answer|goal|tool)"/.test(n)&&(n.match(/\{/g)||[]).length>(n.match(/\}/g)||[]).length&&(e=e.slice(0,t).trim())}}xt.current=e,St.current===null&&(St.current=requestAnimationFrame(Mt))}},onAgentEvent:t=>{if((t.type!==`status`||t.phase!==`waiting`)&&V(),t.type===`followup_taken`&&t.text){let n=t.text;if(ft(e=>re(e,n)),jt())return;o({id:Date.now(),session_id:e,role:`user`,content:n,created_at:new Date().toISOString(),rag_sources:null});return}if(t.type===`followup_unavailable`){jt()||gt(!0);return}if(t.type===`followup_returned`){let e=t.texts??[];ft(t=>y(t,e));return}if(jt())return;if(t.type===`context_usage`){Vt(t);return}let n=t.type===`permission_request`||t.type===`needs_input`;if(k.getState().awaitingUser!==n&&k.getState().setAwaitingUser(n),xk.has(t.type)&&Qs.getState().dismissSessionPrompts(e),t.type===`permission_request`){let n=t.tool||``,r=t.tool_label||n,{addNotification:i,notifications:a}=Qs.getState(),o=t.confirm_id?a.find(e=>e.id===t.confirm_id):void 0;if(o){!o.response&&o.dismissed&&Qs.setState(e=>({notifications:e.notifications.map(e=>e.id===o.id?{...e,dismissed:!1}:e)}));return}let s=n===Hs,c=s&&Ys(a,e,t.args);i({id:t.confirm_id??`perm-${Date.now()}`,type:`permission_request`,agentId:e,sessionId:e,agentName:`GAIA`,title:s?Gs(t.args,c):`Allow ${r}?`,message:s?Ws(t.args,c):`GAIA needs your OK before ${r}.`,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,tool:n,toolArgs:t.args,confirmId:t.confirm_id,alwaysScope:typeof t.always_scope==`string`?t.always_scope:void 0,alwaysLabel:typeof t.always_label==`string`&&t.always_label?t.always_label:void 0,toolLabel:t.tool_label||void 0,risk:typeof t.risk==`string`?t.risk:void 0,summary:typeof t.summary==`string`&&t.summary?t.summary:void 0,pathFollowUp:c||void 0,timeoutSeconds:t.timeout_seconds});return}if(t.type===`needs_confirmation`){w({render:`needs_confirmation`,data:{action:typeof t.action==`string`?t.action:``,summary:typeof t.summary==`string`?t.summary:``}});return}if(t.type===`needs_input`){if(!t.request_id){console.error(`[ChatView] needs_input event missing request_id, ignoring`);return}k.getState().openQuestion(t.request_id,e,typeof t.timeout_seconds==`number`?t.timeout_seconds:null),w({render:`needs_input`,data:{session_id:e,request_id:t.request_id,question:typeof t.question==`string`?t.question:``,options:Array.isArray(t.options)?t.options:[],allow_free_text:t.allow_free_text!==!1,sensitive:!!t.sensitive}});return}if(t.type===`policy_alert`){let n=t.tool||`unknown tool`,r=t.reason||t.message||t.content||`Tool execution was blocked by governance policy.`,i={id:t.receipt_id??`policy-${Date.now()}-${at.current+1}`,type:`policy_alert`,agentId:e,agentName:`GAIA`,title:`Blocked: ${n} is restricted by policy.`,message:r,timestamp:Date.now(),read:!1,dismissed:!1,priority:`critical`,tool:n,decision:t.decision||`BLOCK`,reason:r,ruleIds:t.rule_ids??[],policyVersion:t.policy_version,receiptId:t.receipt_id};R(i);let a=lw(t,at);a&&_(a),De({tool:n,receiptId:t.receipt_id});return}if((t.type===`tool_end`||t.type===`tool_result`)&&k.getState().livePhase===`tool`&&k.getState().setLiveStatus(null),t.type===`tool_end`){x({active:!1,success:t.success!==!1});return}if(t.type===`tool_result`){typeof t.render==`string`&&t.render.length>0&&w({render:t.render,data:t.data});let e={result:t.summary||t.title||`Done`,active:!1,success:t.success!==!1,latencyMs:t.latency_ms};t.command_output&&(e.commandOutput={command:t.command_output.command,stdout:t.command_output.stdout,stderr:t.command_output.stderr,returnCode:t.command_output.return_code,expectedExit:t.command_output.expected_exit,cwd:t.command_output.cwd,durationSeconds:t.command_output.duration_seconds,truncated:t.command_output.truncated}),t.mcp_output?.text&&(e.mcpOutput=t.mcp_output),t.result_data?.chunks&&t.result_data.chunks.length>0&&(e.retrievalChunks=t.result_data.chunks.map(e=>({id:e.id,source:e.source,sourcePath:e.sourcePath,page:e.page,score:e.score,preview:e.preview,content:e.content}))),t.result_data?.type===`file_list`&&t.result_data.files?.length>0&&(e.fileList={files:t.result_data.files,total:t.result_data.total??t.result_data.files.length}),x(e);return}if(t.type===`tool_args`){let e=!!t.args&&Object.keys(t.args).length>0,n=t.detail||(e?JSON.stringify(t.args):``);x({...n?{detail:n}:{},...t.narration?{narration:t.narration}:{}});let r=k.getState(),i=[...r.agentSteps].reverse().find(e=>e.type===`tool`);t.narration&&i?.active&&r.livePhase===`tool`&&r.setLiveStatus(Py(i,I()),`tool`);return}if(t.type===`skill_use`){k.getState().addSkillStep(t.how===`model`?null:lw(t,at));return}if(t.type===`commentary`){M=``,ot.current=!1,xt.current=``,m(``);let e=lw(t,at);e&&_(e);return}if(t.retracts_answer&&(M=``,ot.current=!1,xt.current=``,m(``),t.type===`status`)){let e=lw({type:`status`,status:`warning`,message:I()(`live.answerRestarted`)},at);e&&_(e);return}if(t.type===`thinking`){let e=k.getState().agentSteps,n=e[e.length-1];if(n&&n.type===`thinking`){b(t.content||``);return}let r=lw(t,at);r&&_(r);return}if(t.type===`status`){if(t.status===`history_cut`){N=(t.message||``).trim()||void 0,Re(N??null);return}fw(t,at);return}if(t.type===`step`||t.type===`agent_error`&&hw(t,k.getState().agentSteps))return;let r=lw(t,at);r&&(_(r),t.type===`tool_start`&&(ot.current=!0,k.getState().setLiveStatus(Py(r,I()),`tool`)))},onDone:t=>{if(V(),Qs.getState().dismissSessionPrompts(e),k.getState().closeSessionQuestions(e),P)return;P=!0;let n=t.cancelled===!0?`stopped`:tt.current&&t.message_id==null?`unconfirmed`:void 0;if(ne(),St.current!==null&&(cancelAnimationFrame(St.current),St.current=null),xt.current=``,fk(e,t.documents_added??[]),jt())return;Ye.current=Date.now(),_t.current=!0;let a=k.getState();a.setRunningSessions(a.runningSessionIds.filter(t=>t!==e));let s=t.content||M;d.chat.timed(`Agent response complete: ${s.length} chars${n?` (${n})`:``}`,j);let{steps:c,cards:l}=ie(),u=c.some(e=>e.type===`policy_alert`);if(s||u||n){Nt.current=k.getState().messages.length+1;let r={id:t.message_id||Date.now()+1,session_id:e,role:`assistant`,content:s,created_at:new Date().toISOString(),rag_sources:null,agentSteps:c.length>0?c:void 0,stats:t.stats||void 0,turnSummary:t.turn_summary||void 0,cards:l.length>0?l:void 0,stopState:n,historyNotice:N,failure:t.failed?t.failure:void 0};N&&Tk.set(r.id,N),o(r);let i=wS.getState();i.settings?.auto&&Cw(r)&&i.read(`${e}:${r.id}`,NC(s))}p(!1),h(),S(),E(),Ke.current&&Ke.current.focus(),setTimeout(()=>{ct(e).then(t=>{if(jt()||k.getState().isStreaming)return;let n=k.getState().messages,a=n.filter(e=>e.cards&&e.cards.length>0),c=_w(t.messages).map(e=>{let t=a.find(t=>t.id===e.id||t.role===e.role&&t.content===e.content);return{...e,cards:t?.cards??e.cards,stopState:e.stopState??n.find(t=>t.id===e.id)?.stopState,failure:e.failure??n.find(t=>t.id===e.id)?.failure}});i(c),Nt.current=c.length,r&&!s&&c[c.length-1]?.role===`user`&&o({id:Date.now()+2,session_id:e,role:`assistant`,content:BS,created_at:new Date().toISOString(),rag_sources:null})}).catch(t=>d.chat.error(`Could not refresh messages for session=${e}`,t))},300)},onError:t=>{let n=VS(t),i=z&&!r&&!n&&!!A&&_T(e,O,t);if(!z||i){if(n)V();else{if(B(mT(t)?{kind:`busy`}:{kind:`failed`,error:ZS(t).text}),Ye.current=Date.now(),ne(),St.current!==null&&(cancelAnimationFrame(St.current),St.current=null),xt.current=``,jt())return;d.chat.info(`Queued message for session=${e} not taken: ${t.message}`),A&&s(A.id),_t.current=!0,p(!1),h(),S(),E();return}}if(n&&tt.current&&!P){d.chat.warn(`Stream for session=${e} was lost while stopping; closing the turn locally`),it.current?.();return}if(n&&!Ft.current)return;if(n&&!P&&!jt()&&Ze.current<3){let n=++Ze.current,r=zS[n-1]??0;d.chat.warn(`Stream for session=${e} lost (${t.name}); reconnecting in ${r}ms (${n}/3)`),k.getState().setLiveStatus(`${Sk} (attempt ${n} of 3)…`);let i=()=>{Qe.current=null,!(!Ft.current||jt()||tt.current)&&lt.current(void 0,{attach:!0,reconnect:n})};r>0?Qe.current=setTimeout(i,r):i();return}Ye.current=Date.now(),Qs.getState().dismissSessionPrompts(e),k.getState().closeSessionQuestions(e);let a=tt.current;if(ne(),St.current!==null&&(cancelAnimationFrame(St.current),St.current=null),xt.current=``,jt())return;if(n||(_t.current=!0),d.chat.error(`Chat error for session=${e}`,t),a){let{steps:n,cards:r}=ie();o({id:Date.now()+2,session_id:e,role:`assistant`,content:M,created_at:new Date().toISOString(),rag_sources:null,agentSteps:n.length>0?n:void 0,cards:r.length>0?r:void 0,stopState:`stopped`,stopError:t.message||`Unknown error`}),Nt.current=k.getState().messages.length,p(!1),h(),S(),E();return}let{kind:c,text:l}=ZS(t),u=c===`stream`?l:l+`
71
+
72
+ ---
73
+ *Unexpected error?* [Report it on GitHub](${PT((t.message||``).slice(0,80))})`,f={id:Date.now()+2,session_id:e,role:`assistant`,content:u,created_at:new Date().toISOString(),rag_sources:null,failed:!US(t),failureText:t.message||void 0};o(f),p(!1),h(),S(),E()}},oe=r?Sn(e,ae):Be(e,O,ae);F=oe,qe.current=oe},[ue,be,u,e,G,Pe,o,s,i,p,Mt,h,l,_,v,b,x,S,w,E,R,jt]);lt.current=an;let on=k(t=>t.runningSessionIds.includes(e)),sn=k(e=>e.activeRunsAt>Ye.current);(0,J.useEffect)(()=>{Qw()},[e]),(0,J.useEffect)(()=>{on?!sn||u||Xe.current||(d.chat.info(`Resuming live view of background run for session=${e}`),lt.current(void 0,{attach:!0})):Xe.current=!1},[e,on,sn,u]),(0,J.useEffect)(()=>{let e=e=>{let t=e.detail?.text;typeof t==`string`&&t.trim()&&lt.current(t)};return window.addEventListener(`gaia:send-message`,e),()=>window.removeEventListener(`gaia:send-message`,e)},[]),(0,J.useEffect)(()=>{!u&&Ke.current&&Ke.current.focus()},[u]);let cn=(0,J.useCallback)(async t=>{u||(d.chat.info(`Deleting message ${t} from session=${e}`),Te(t),setTimeout(async()=>{s(t),Te(null);try{await Ct(e,t)}catch(n){d.chat.error(`Failed to delete message ${t}`,n),ct(e).then(e=>{jt()||i(_w(e.messages))}).catch(t=>d.chat.error(`Could not reload messages for session=${e}`,t))}},250))},[e,u,s,i,jt]),ln=(0,J.useRef)(!1),un=(0,J.useCallback)(async(n,r)=>{if(u||n.role!==`user`||ln.current)return;ln.current=!0;let a=n.content;d.chat.info(`Resending message ${n.id} from session=${e}`,{preview:a.slice(0,80)});try{let t=await ct(e);if(jt())return;let o=_w(t.messages),s=vw(o,k.getState().messages,n);if(s&&r&&!bw(o,s,r)){d.chat.info(`Message ${n.id} was answered since it failed; not resending`),i(o),Nt.current=o.length;return}if(s&&await On(e,s.id),jt()){let{sessions:t,pendingDeleteIds:n}=k.getState();t.some(t=>t.id===e)&&!n.includes(e)&&ft(e=>ee(e,a,`queued`));return}}catch(r){d.chat.error(`Could not resend message ${n.id} in session=${e}`,r);let i=r instanceof Error?ZS(r):null,a=i?.kind===`connection`||i?.kind===`timeout`;R({id:`resend-failed-${e}-${Date.now()}`,type:`error`,agentId:e,agentName:`GAIA`,title:t(`chatError.resendFailed`),message:a?i.text:t(`chatError.resendStale`),timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,sessionId:e});return}finally{ln.current=!1}c(n.id),an(a)},[e,u,c,i,ft,an,jt,R,t]);(0,J.useEffect)(()=>dT(e),[e]);let dn=k(()=>uT(e)),fn=(0,J.useCallback)((e,t)=>new Promise(e=>{lt.current(t,{queued:!0,onQueuedOutcome:e})}),[]),pn=u||Ut;(0,J.useEffect)(()=>{if(!pn){if(pt.current){pt.current=!1;let e=dt.map(e=>e.text);e.length&&(ft(()=>[]),de(t=>[t.trim(),...e].filter(Boolean).join(`
74
+
75
+ `)))}else dt.length===0||bt||N||ne||It.current||Pe||Lt||jt()||!_t.current&&!dn||vT(e,fn,()=>Ft.current&&!jt()&&!k.getState().isStreaming&&!Wt.current)}},[pn,dt,bt,dn,N,ne,Pe,Lt,e,fn,jt]);let mn=(0,J.useRef)(!1);(0,J.useEffect)(()=>{mn.current&&!pn&&Bt(),mn.current=pn},[pn,Bt]);let hn=(0,J.useCallback)(t=>{let n=dt.find(e=>e.id===t&&e.state===`queued`);n&&u&&(ft(e=>ae(e,t,`queued`,`sending`)),Cn(e,n.text).then(()=>ft(e=>ae(e,t,`sending`,`delivered`))).catch(e=>{d.chat.info(`Follow-up not taken by the running reply; it stays queued: ${e instanceof Error?e.message:e}`),ft(e=>a(e,t))}))},[dt,u,e,ft]),gn=(0,J.useCallback)(()=>{for(let e=r.length-1;e>=0;e--)if(r[e].role===`user`){un(r[e]);return}},[r,un]),_n=(0,J.useCallback)(e=>{let t=r.indexOf(e);for(let n=t-1;n>=0;n--)if(r[n].role===`user`){un(r[n],e);return}},[r,un]),vn=()=>{he(G?.title||``),pe(!0)},yn=async()=>{let t=me.trim().slice(0,200).trim();t&&me!==G?.title&&t!==G?.title&&(await Se(e,{title:t,title_is_custom:!0}),l(e,{title:t})),pe(!1)},bn=(0,J.useCallback)(async()=>{if(e)try{let t=await st(e);l(e,{private:t.private})}catch(e){d.ui.warn(`Failed to toggle private mode`,e)}},[e,l]),xn=(0,J.useCallback)(async(t,n)=>{t.stopPropagation();let r=O.find(e=>e.id===n);d.doc.info(`Detaching document from session: ${r?.filename||n}`);try{await Dn(e,n);let t=(k.getState().sessions.find(t=>t.id===e)?.document_ids??[]).filter(e=>e!==n);l(e,{document_ids:t}),t.length<=3&&Ce(!1),d.doc.info(`Detached document from session: ${r?.filename||n}`)}catch(e){d.doc.error(`Failed to detach document: ${r?.filename||n}`,e)}},[O,e,l]),wn=(0,J.useCallback)(async t=>{if(t.preventDefault(),t.stopPropagation(),_e(!1),t.dataTransfer.files.length===0)return;let n=Array.from(t.dataTransfer.files),r=n.filter(e=>ET(e.name));r.length>0&&be.addFiles(r);let i=n.filter(e=>!ET(e.name));i.length!==0&&await Go(`embedding`)&&await pk(e,i)},[e,be]),Tn=e=>{e.preventDefault(),e.stopPropagation(),_e(!0)},En=e=>{e.preventDefault(),e.stopPropagation(),_e(!1)},kn=r.length>0?r[r.length-1]:void 0,An=!u&&!N&&kn?.role===`assistant`&&Sb(kn.content),jn=(0,J.useMemo)(()=>{let e=new Map,t;for(let n of r)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},[r]),Mn=Pe?`This chat used the retired "${Pe}" agent and is read-only. Start a new chat.`:Bw(L)?Rc:null;return V(`main`,{className:`task-view ${ge?`drag-active`:``}`,style:{"--session-panel-w":`${Yt}px`},onDrop:wn,onDragOver:Tn,onDragLeave:En,"aria-label":G?.title||`Chat`,children:[V(`header`,{className:`task-header`,children:[P(`div`,{className:`task-header-left`,children:fe?P(`input`,{className:`title-edit`,value:me,maxLength:200,onChange:e=>he(e.target.value),onBlur:yn,onKeyDown:e=>{e.key===`Enter`&&yn(),e.key===`Escape`&&(e.preventDefault(),pe(!1))},...Ao,autoFocus:!0,"aria-label":`Chat title`,dir:`auto`}):V(`button`,{type:`button`,className:`task-title`,onClick:vn,title:t(`row.rename`),children:[P(`span`,{children:G?.title||t(`sidebar.newChat`)}),P(wa,{size:12,"aria-hidden":`true`,className:`task-title-edit`})]})}),V(`div`,{className:`task-header-right`,children:[P(`button`,{ref:$t,className:`btn-icon-sm task-header-resources`,onClick:()=>Qt(!Zt),"aria-pressed":Zt,"aria-label":t(`resources.toggle`),title:t(Zt?`resources.hide`:`resources.show`),children:P(Vn,{size:15,"aria-hidden":`true`})}),P(SO,{isPrivate:!!G?.private,onToggle:bn}),P(`button`,{className:`btn-icon-sm`,onClick:()=>M(!0),title:`Browse files on this PC`,"aria-label":`Browse files on this PC`,children:P(Ci,{size:15})}),P(`button`,{className:`btn-icon-sm`,onClick:je,title:`Export as Markdown`,"aria-label":`Export chat`,children:P(qr,{size:15})}),P(xO,{messages:r,busy:u})]})]}),Zt&&P(BO,{onClose:en}),le.length>0&&(()=>{let e=[...le].sort((e,t)=>{let n=e.last_accessed_at||e.indexed_at||``;return(t.last_accessed_at||t.indexed_at||``).localeCompare(n)}),t=xe?e:e.slice(0,3),n=e.length-3;return V(`div`,{className:`doc-context-bar${xe?` doc-context-expanded`:``}`,"aria-label":`${le.length} indexed document${le.length===1?``:`s`}`,children:[P(Dr,{size:12,className:`doc-context-icon`,"aria-hidden":`true`}),V(`button`,{type:`button`,className:`doc-context-label`,onClick:()=>j(!0),title:`Manage documents`,children:[le.length,` indexed`]}),V(`div`,{className:`doc-context-pills${xe?` doc-context-pills-expanded`:``}`,children:[t.map(e=>V(`span`,{className:`doc-pill`,title:e.filepath||e.filename,children:[P(hi,{size:9,className:`doc-pill-icon`,"aria-hidden":`true`}),P(`span`,{className:`doc-pill-name`,dir:`auto`,children:e.filename}),P(`button`,{className:`doc-pill-remove`,onClick:t=>xn(t,e.id),"aria-label":`Remove ${e.filename} from this chat`,children:P(So,{size:10})})]},e.id)),!xe&&n>0&&V(`button`,{className:`doc-pill-more`,onClick:e=>{e.stopPropagation(),Ce(!0)},children:[`+`,n,` more`]}),xe&&n>0&&P(`button`,{className:`doc-pill-collapse`,onClick:e=>{e.stopPropagation(),Ce(!1)},children:`show less`})]})]})})(),P(`div`,{className:`messages-scroll`,ref:Ge,...At,children:V(`div`,{className:`messages-column`,children:[N&&P(`div`,{className:`skeleton-messages`,"aria-label":`Loading messages`,children:[0,1,2].map(e=>P(`div`,{className:`skeleton-msg`,children:V(`div`,{className:`skeleton-lines`,children:[P(`div`,{className:`skeleton-line`}),P(`div`,{className:`skeleton-line`}),e!==2&&P(`div`,{className:`skeleton-line`})]})},e))}),r.map((e,t)=>{if(Fe&&e.role===`assistant`&&t===r.length-1)return null;let n=e.role===`assistant`?e.historyNotice??Tk.get(e.id):void 0,i=e.role===`assistant`&&BC(e.content,e.stopState)===`interrupted`,a=(e.failed===!0||i)&&!pn&&!Pe&&!Fe&&t===r.length-1,o=!a&&!pn&&!Ht&&!Pe&&!Fe&&e.role===`assistant`&&t===r.length-1&&!e.stopState&&!e.failed&&!yC(e.content),s=e.stats?.seconds==null?jn.get(e.id):e.stats.seconds*1e3;return V(`div`,{className:we===e.id?`msg-deleting`:void 0,"data-message-id":e.id,"data-role":e.role,children:[n&&P(Ek,{text:n}),P(VC,{message:e,agentSteps:e.role===`assistant`?e.agentSteps:void 0,onDelete:pn?void 0:cn,onResend:!pn&&e.role===`user`&&!Pe?un:void 0,extraActions:o?P(QE,{answeredBy:e.stats?.model??G?.effective_model,onPick:t=>Gt(e,t)}):void 0,onTryAgain:a?()=>_n(e):void 0,latencyMs:s}),e.failure===`model_server_down`&&t===r.length-1&&!pn&&P(vk,{}),Ht?.messageId===e.id&&P(tD,{original:e,originalModel:e.stats?.model??G?.effective_model,originalLatencyMs:s,state:Ht.state,keeping:Ht.keeping,onKeep:e=>{Kt(e)},onClose:qt})]},e.id)}),(u||Fe)&&Le&&P(Ek,{text:Le}),u&&P(Fw,{}),(u||Fe)&&P(`div`,{className:`streaming-bubble ${Fe?`stream-ending`:`stream-active`}`,children:P(VC,{message:{id:-1,session_id:e,role:`assistant`,content:(u?f:ze.current)||``,created_at:``,rag_sources:null},isStreaming:u,agentSteps:u?g:Ve.current,agentStepsActive:u&&g.some(e=>e.active),cards:u?C:He.current,liveStatus:u?oe:null,toolStatus:u?H:null,awaitingUser:u&&(U||se||W)})}),P(`div`,{ref:We})]})}),P(bO,{sessionId:e,messages:r,busy:pn,onUsage:Vt,onJumpToMessage:tn}),ve&&P(`button`,{className:`scroll-bottom-btn`,onClick:nn,title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:P(Gn,{size:16})}),ge&&V(`div`,{className:`drag-overlay`,children:[P(mo,{size:32,strokeWidth:1.5,"aria-hidden":`true`}),P(`span`,{children:`Drop files to index them for this chat`})]}),Ee&&V(`div`,{className:`toast policy-alert-toast`,role:`alert`,children:[V(`span`,{children:[`Blocked: `,Ee.tool,` is restricted by policy.`]}),Ee.receiptId?P(`button`,{type:`button`,className:`policy-alert-toast-link`,onClick:()=>{let e=Ee.receiptId;e&&(te(`policy_alert`),B(!0),Ae(e))},children:`View receipt`}):P(`span`,{className:`policy-alert-toast-missing`,children:`Receipt unavailable`})]}),P(`div`,{className:`input-area`,children:V(`div`,{className:`input-column`,children:[P(HO,{message:Me,onDismiss:Ne}),An&&kn&&P(VT,{content:kn.content,onRetry:gn}),P(uy,{sessionId:e}),P(qE,{usage:Rt}),P(VO,{sessionId:e}),ne&&Lt&&P(`ul`,{className:`queued-messages`,"aria-label":t(`composer.heldLabel`),"aria-live":`polite`,children:V(`li`,{className:`queued-message is-queued`,children:[P(Nr,{size:12,"aria-hidden":`true`}),P(`span`,{className:`queued-message-text`,title:ne.text,children:ne.text}),P(`span`,{className:`queued-message-state`,children:t(`composer.heldUntilStarted`)})]})}),P(CE,{items:dt,onRemove:e=>ft(t=>ie(t,e)),onRetry:e=>ft(t=>ae(t,e,`failed`,`queued`)),onSteer:u&&!$e&&!ht?hn:void 0,replying:u,busyRetry:!!bt}),P(GT,{value:ue,onChange:de,onSubmit:()=>an(),onStop:rn,streaming:u,stopping:$e,queueWhileStreaming:!0,disabledReason:Mn,attachments:be,inputRef:Ke,placeholder:u?t(`composer.queueNext`):r.length===0?t(`composer.placeholder`):t(`composer.reply`),leftControls:P(bE,{sessionId:e,disabled:!!Pe}),rightControls:V(D.Fragment,{children:[P(KE,{usage:Rt,unavailable:zt,sessionId:e,busy:pn,onUsage:Vt,onDetails:()=>Xt(`context`)}),P(XE,{sessionId:e,busy:pn}),P(hE,{sessionId:e,onOpen:()=>Xt(`environment`)}),P(rE,{})]})})]})})]})}var Ok=1.1,kk=60,Ak=110,jk=24,Mk=2.4,Nk=Math.PI*2,Pk=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)};function Fk(e){let t=e;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}var Ik=class{cols=0;rows=0;w=0;h=0;ox=0;oy=0;time=0;energy=new Float32Array;offset=new Float32Array;mask=new Float32Array;phase=new Float32Array;waves=[];ripples=[];waveIn=1.5;dragIn=0;activity=`idle`;progress=0;pointer=null;exit=null;done=!1;settled=!1;rand;constructor(e=7){this.rand=Fk(e)}get cleared(){return this.done}get dissolving(){return this.exit!==null||this.done}resize(e,t,n){this.w=e,this.h=t,this.cols=Math.ceil(e/30),this.rows=Math.ceil(t/30),this.ox=(e-this.cols*30)/2,this.oy=(t-this.rows*30)/2;let r=this.cols*this.rows;this.energy=new Float32Array(r),this.offset=new Float32Array(r*2),this.phase=Float32Array.from({length:r},()=>this.rand()*Nk),this.setHole(n)}setHole(e){this.mask.length!==this.cols*this.rows&&(this.mask=new Float32Array(this.cols*this.rows));for(let t=0;t<this.rows;t++)for(let n=0;n<this.cols;n++){let[r,i]=this.center(n,t),a=Math.hypot((r-e.cx)/e.rx,(i-e.cy)/e.ry);this.mask[t*this.cols+n]=(.3+.7*Pk(.75,1.5,a))*Pk(0,50,i)*Pk(0,50,this.h-i)}}setActivity(e){e!==this.activity&&(this.activity=e,this.waveIn=0)}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}setPointer(e,t,n,r=0){this.pointer={x:e,y:t,down:n,speed:r}}clearPointer(){this.pointer=null}ripple(e,t,n){this.ripples.length>24&&this.ripples.shift(),this.ripples.push({x:e,y:t,r:0,t:0,life:1.2+n*.6,strength:n,speed:150+this.rand()*50,phase:this.rand()*Nk})}dissolve(e,t){this.ripple(e,t,1);let n=Math.hypot(Math.max(e,this.w-e),Math.max(t,this.h-t))*1.15;this.exit={x:e,y:t,t:0,reach:n,phase:this.rand()*Nk},this.done=!1}restore(){this.exit=null,this.done=!1,this.settled=!1,this.energy.fill(0),this.offset.fill(0),this.ripples=[],this.waves=[]}energyAt(e,t){return this.energy[t*this.cols+e]}offsetAt(e,t){let n=t*this.cols+e;return[this.offset[n*2],this.offset[n*2+1]]}center(e,t){return[this.ox+(e+.5)*30,this.oy+(t+.5)*30]}step(e){if(this.done)return!1;if(this.settled&&this.activity===`idle`&&!this.pointer&&!this.ripples.length&&!this.waves.length&&!this.exit&&this.waveIn>e)return this.waveIn-=e,!1;this.time+=e;let t=this.time,n=this.cols+this.rows*.6;if(this.waveIn-=e,this.waveIn<=0){if(this.activity===`loading`)this.waveIn=.9+this.rand()*.5,this.waves.push({front:-3,speed:14+this.rand()*6,dir:1,span:n,strength:.5+this.rand()*.2});else if(this.activity===`idle`){this.waveIn=3+this.rand()*4;let e=this.rand()<.5?1:-1;this.waves.push({front:e>0?-3:n+3,speed:7+this.rand()*4,dir:e,span:n,strength:.45})}else this.waveIn=1}let r=this.pointer;r?.down&&(this.dragIn-=e,this.dragIn<=0&&(this.dragIn=.12,this.ripple(r.x,r.y,.7)));let i=Math.exp(-e*Mk),a=Math.min(1,e*14),o=Math.min(1,e*9),s=r?kk+Math.min(80,r.speed*.08):0,c=r?.5+Math.min(.45,r.speed/2e3):0,l=this.activity===`download`?this.progress*this.rows:-1,{cols:u,rows:d,energy:f,offset:p}=this,m=0,h=0;for(let e=0;e<d;e++)for(let n=0;n<u;n++){let g=e*u+n,[_,v]=this.center(n,e),y=f[g]*i,b=0,x=0,S=0,C=.55+.45*Math.sin(n*1.7+e*2.3+t*.6),w=n+e*.6+.9*Math.sin(e*.45+t*.8)+.5*Math.sin(n*.21-t*1.1);for(let e of this.waves){let t=1-Math.abs(w-e.front)/1.5;t>0&&(b=Math.max(b,t*e.strength*C))}for(let e of this.ripples){let t=_-e.x,n=v-e.y,r=Math.hypot(t,n)||1;if(Math.abs(r-e.r)>jk+.11*e.r)continue;let i=Math.atan2(n,t),a=e.r*(1+.07*Math.sin(5*i+e.phase)+.04*Math.sin(9*i-e.phase*2)),o=1-Math.abs(r-a)/jk;if(o<=0)continue;let s=(1-e.t/e.life)**1.3;b=Math.max(b,o*.85*e.strength*s),x+=t/r*o*7*e.strength*s,S+=n/r*o*7*e.strength*s}if(r){let e=_-r.x,t=v-r.y,n=Math.hypot(e,t)||1;if(n<s&&(b=Math.max(b,(1-n/s)**1.4*c)),n<Ak){let i=(1-n/Ak)**2*(10+Math.min(10,r.speed/120));x+=e/n*i,S+=t/n*i}}let T=0;if(l>=0){let r=l-(d-1-e+.5+.35*Math.sin(n*.55+t*2.1)+.2*Math.sin(n*1.31-t*1.3));r>0&&(T=.16),r>-1&&r<1&&(b=Math.max(b,(1-Math.abs(r))*(.45+.35*Math.sin(t*3+this.phase[g]))))}f[g]=Math.max(T,b>y?y+(b-y)*a:y),p[g*2]+=(x-p[g*2])*o,p[g*2+1]+=(S-p[g*2+1])*o,m=Math.max(m,f[g]),h=Math.max(h,Math.abs(p[g*2]),Math.abs(p[g*2+1]))}return this.settled=m<.04&&h<.05,this.waves=this.waves.filter(t=>(t.front+=t.dir*t.speed*e,t.front>=-4&&t.front<=t.span+4)),this.ripples=this.ripples.filter(t=>(t.t+=e,t.r+=t.speed*e*(1-.35*t.t/t.life),t.t<t.life)),this.exit&&(this.exit.t+=e,this.exit.t>=1.1&&(this.exit=null,this.done=!0)),!0}draw(e,t){if(e.clearRect(0,0,this.w,this.h),this.done)return;let{cols:n,rows:r,energy:i,offset:a,mask:o}=this,s=t.dark?.17:.14;e.lineWidth=1;for(let c=0;c<r;c++)for(let r=0;r<n;r++){let l=c*n+r,[u,d]=this.center(r,c),f=u+a[l*2],p=d+a[l*2+1],m=i[l],h=o[l];if(m<.04){e.fillStyle=t.fg,e.globalAlpha=s*h,e.fillRect(f-1,p-1,2,2);continue}let g=2+m*19,_=Math.max(1,6-m*3);e.beginPath(),e.roundRect(f-g/2,p-g/2,g,g,_),e.fillStyle=t.accent,e.globalAlpha=(.12+m*.22)*h,e.fill(),e.strokeStyle=t.accent,e.globalAlpha=m*.5*h,e.stroke()}this.exit&&this.drawExit(e,t),e.globalAlpha=1}drawExit(e,t){let n=this.exit,r=Math.min(1,n.t/Ok),i=(1-(1-r)**3)*n.reach,a=new Path2D;for(let e=0;e<=180;e++){let t=e/180*Nk,r=i*(1+.06*Math.sin(3*t+n.phase+n.t*1.5)+.03*Math.sin(5*t-n.phase*1.7-n.t*2.2)),o=n.x+Math.cos(t)*r,s=n.y+Math.sin(t)*r;e?a.lineTo(o,s):a.moveTo(o,s)}a.closePath(),e.globalAlpha=1,e.globalCompositeOperation=`destination-out`,e.fill(a),e.globalCompositeOperation=`source-over`,e.strokeStyle=t.accent,e.lineWidth=1.4,e.globalAlpha=.55*(1-r)**.7,e.stroke(a)}},Lk=90;function Rk(){let e=getComputedStyle(document.documentElement);return{fg:e.getPropertyValue(`--text-primary`).trim(),accent:e.getPropertyValue(`--accent-solid`).trim(),dark:document.documentElement.getAttribute(`data-theme`)===`dark`}}function zk(e,t,n){let r=e.getBoundingClientRect();return r.width?{cx:r.left-t.left+r.width/2,cy:r.top-t.top+r.height/2,rx:r.width/2+n,ry:r.height/2+n+10}:null}function Bk({activity:e,progress:t=0,pulse:n,docked:r,contentRef:i,composerRef:a}){let o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(()=>{}),u=(0,J.useRef)(()=>{}),f=(0,J.useRef)(r),p=(0,J.useRef)({value:n,at:0});f.current=r,(0,J.useEffect)(()=>{let e=o.current,t=e?.parentElement;if(!e||!t)return;let n=e.getContext(`2d`);if(!n){d.ui.warn(`New-chat background is off: the browser gave no 2D canvas context (often low graphics memory).`);return}c.current=t;let r=new Ik;s.current=r;let p=typeof window.matchMedia==`function`?window.matchMedia(Dx):null,m=Rk(),h=0,g=0,_=!1,v=``,y={x:0,y:0,at:0,speed:0},b=()=>r.draw(n,m),x=(e,t=!1)=>{let n=f.current?a.current:i.current,r=(n&&zk(n,e,f.current?24:40))??{cx:e.width/2,cy:e.height/2,rx:1,ry:1},o=`${Math.round(r.cx)},${Math.round(r.cy)},${Math.round(r.rx)},${Math.round(r.ry)}`;return t||o!==v?(v=o,r):null},S=()=>{let i=t.getBoundingClientRect();if(!i.width||!i.height)return;let a=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(i.width*a),e.height=Math.round(i.height*a),n.setTransform(a,0,0,a,0,0),r.resize(i.width,i.height,x(i,!0)),b()},C=e=>{if(h=requestAnimationFrame(C),e-g<31.833333333333336)return;let n=Math.min(.1,(e-g)/1e3);g=e;let i=x(t.getBoundingClientRect());i&&r.setHole(i),e-y.at>80&&(y.speed*=.8),(r.step(n)||i)&&b(),r.cleared&&T()},w=()=>{_||document.hidden||p?.matches||r.cleared||(_=!0,g=performance.now(),h=requestAnimationFrame(C))},T=()=>{_=!1,cancelAnimationFrame(h)};l.current=w,u.current=()=>{let e=x(t.getBoundingClientRect());e&&r.setHole(e),_||b()};let E=()=>document.hidden?T():w(),D=()=>{T(),b(),w()},O=()=>{m=Rk(),b()},k=e=>{let n=t.getBoundingClientRect(),i=e.clientX-n.left,a=e.clientY-n.top,o=performance.now();if(y.at&&o>y.at){let e=Math.hypot(i-y.x,a-y.y)/((o-y.at)/1e3);y.speed+=(Math.min(4e3,e)-y.speed)*.35}Object.assign(y,{x:i,y:a,at:o});let s=e.target instanceof Element&&e.target.closest(`button, a, input, textarea, .composer`);r.setPointer(i,a,(e.buttons&1)==1&&!s,y.speed)},A=()=>{y.at=0,y.speed=0,r.clearPointer()},j=typeof ResizeObserver>`u`?null:new ResizeObserver(S);j?.observe(t,{box:`border-box`});let M=new MutationObserver(O);return M.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`data-palette`,`style`]}),document.addEventListener(`visibilitychange`,E),p?.addEventListener(`change`,D),t.addEventListener(`pointermove`,k),t.addEventListener(`pointerleave`,A),S(),w(),()=>{T(),j?.disconnect(),M.disconnect(),document.removeEventListener(`visibilitychange`,E),p?.removeEventListener(`change`,D),t.removeEventListener(`pointermove`,k),t.removeEventListener(`pointerleave`,A),s.current=null,l.current=()=>{},u.current=()=>{}}},[i,a]);let m=(0,J.useCallback)(()=>{let e=c.current,t=a.current;if(!e||!t)return null;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return[r.left-n.left+r.width/2,r.top-n.top+r.height/2]},[a]);return(0,J.useEffect)(()=>{let t=s.current;if(t){if(t.setActivity(e),e===`sending`){let e=m();e&&t.dissolve(...e)}else t.dissolving&&(t.restore(),l.current())}},[e,m]),(0,J.useEffect)(()=>{s.current?.setProgress(t)},[t]),(0,J.useEffect)(()=>{u.current()},[r]),(0,J.useEffect)(()=>{let e=p.current;if(n===e.value)return;let t=performance.now();if(e.value=n,t-e.at<Lk)return;e.at=t;let r=m();r&&s.current?.ripple(...r,.45)},[n,m]),P(`canvas`,{ref:o,className:`npu-backdrop`,"aria-hidden":`true`})}async function Vk(e,t,n){let r=`${L()}${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.status!==204&&(o.headers.get(`content-type`)||``).includes(`application/json`))return o.json()}function Hk(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 Uk(){return Vk(`GET`,`/memory/stats`)}function Wk(e=30){return Vk(`GET`,`/memory/activity?days=${e}`)}function Gk(e={}){return Vk(`GET`,`/memory/knowledge${Hk(e)}`)}function Kk(e){return Vk(`POST`,`/memory/knowledge`,e)}function qk(e,t){return Vk(`PUT`,`/memory/knowledge/${encodeURIComponent(e)}`,t)}function Jk(e){return Vk(`DELETE`,`/memory/knowledge/${encodeURIComponent(e)}`)}function Yk(){return Vk(`GET`,`/memory/entities`)}function Xk(){return Vk(`GET`,`/memory/tools`)}function Zk(e=20){return Vk(`GET`,`/memory/conversations?limit=${e}`)}function Qk(e,t=20){return Vk(`GET`,`/memory/conversations/search?query=${encodeURIComponent(e)}&limit=${t}`)}function $k(e){return Vk(`GET`,`/memory/conversations/${encodeURIComponent(e)}`)}function eA(e=7){return Vk(`GET`,`/memory/upcoming?days=${e}`)}function tA(){return Vk(`GET`,`/memory/embedding-coverage`)}function nA(){return Vk(`POST`,`/memory/consolidate`)}function rA(){return Vk(`POST`,`/memory/rebuild-embeddings`)}function iA(){return Vk(`POST`,`/memory/reconcile`)}function aA(){return Vk(`POST`,`/memory/rebuild-fts`)}function oA(){return Vk(`POST`,`/memory/refresh-system-context`)}function sA(){return new EventSource(`${L()}/memory/stream-discovery`)}function cA(e){return new EventSource(`${L()}/memory/stream-inference?include_browser=${e}`)}function lA(e){return Vk(`POST`,`/memory/commit-discovery`,{items:e})}function uA(e){return Vk(`POST`,`/memory/commit-inference`,{insights:e})}function dA(){return Vk(`GET`,`/memory/settings`)}function fA(e){return Vk(`PUT`,`/memory/settings`,e)}function pA(){return Vk(`DELETE`,`/memory/all`)}function mA(){return Vk(`POST`,`/memory/reinitialize`)}function hA(){return Vk(`GET`,`/goals/stats`)}function gA(e={}){return Vk(`GET`,`/goals${Hk(e)}`)}function _A(e){return Vk(`POST`,`/goals`,e)}function vA(e){return Vk(`PUT`,`/goals/${encodeURIComponent(e)}/approve`)}function yA(e){return Vk(`PUT`,`/goals/${encodeURIComponent(e)}/reject`)}function bA(e){return Vk(`PUT`,`/goals/${encodeURIComponent(e)}/cancel`)}function xA(e){return Vk(`DELETE`,`/goals/${encodeURIComponent(e)}`)}function SA({disabled:e}){let t=T(),n=k(e=>e.draftPrivate),r=k(e=>e.setDraftPrivate),i=k(e=>e.settingsSection!==null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(i)return;let e=!1;return dA().then(t=>{e||(o(t.memory_enabled),c(!1))}).catch(t=>{e||(d.ui.error(`Could not read the memory setting for the Private chip`,t),o(null),c(!0))}),()=>{e=!0}},[i]),(0,J.useEffect)(()=>{a===!1&&n&&r(!1)},[a,n,r]),a===!1?V(`button`,{type:`button`,className:`composer-chip composer-chip-memory is-unavailable`,disabled:!0,"aria-label":t(`composer.memoryOff`),title:t(`composer.memoryOffTitle`),children:[P($r,{size:13,"aria-hidden":`true`}),P(`span`,{className:`composer-chip-label`,dir:`auto`,children:t(`composer.memoryOff`)})]}):V(`button`,{type:`button`,className:`composer-chip composer-chip-memory${n?` is-on`:``}`,onClick:()=>r(!n),disabled:e,"aria-label":t(n?`composer.privateOff`:`composer.privateOn`),title:t(n?`composer.privateOffTitle`:s?`composer.memoryUnknownTitle`:`composer.privateOnTitle`),children:[P(n?$r:ti,{size:13,"aria-hidden":`true`}),P(`span`,{className:`composer-chip-label`,dir:`auto`,children:t(n?`composer.private`:s?`composer.memoryUnknown`:`composer.memoryOn`)})]})}var CA=1e3;function wA(){let[e,t]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let e=!1,n,r=a=>{e||(a.state===`warming`?(t({seconds:Math.floor(a.elapsed_seconds??0),model:a.model??null,device:a.device??null}),n=setTimeout(()=>{Ht().then(r,i)},CA)):t(null))},i=n=>{e||(d.system.warn(`Warm-up status unavailable`,n),t(null))};return pe().then(r,i),()=>{e=!0,n&&clearTimeout(n)}},[]),e}function TA(e){return e===`gpu`?`your GPU`:e===`npu`?`your NPU`:e===`cpu`?`the CPU`:null}function EA(e){return e<1?`under 1 GB`:`${e.toFixed(1)} GB`}var DA=15e3;function OA(e=new Date,t=z){let n=e.getHours();return t(`newChat.greeting.${n<5?`evening`:n<12?`morning`:n<18?`afternoon`:`evening`}`)}var kA={gpu:`device.gpu`,npu:`device.npu`,cpu:`device.cpu`};function AA({seconds:e,model:t,device:n},r=z){if(!t)return r(`newChat.warmup.ready`,{s:e});let i=ds(t),a=n?kA[n]:void 0;if(a)return r(`newChat.warmup.loadingOn`,{model:i,where:g(a),s:e});let o=TA(n);return o?r(`newChat.warmup.loadingOn`,{model:i,where:o,s:e}):r(`newChat.warmup.loading`,{model:i,s:e})}function jA({detail:e,onRetry:t}){let n=T(),[r,i]=(0,J.useState)(!1);return V(`div`,{className:`new-chat-note`,children:[V(`p`,{children:[n(`newChat.assistantUnavailable`),` `,P(`button`,{type:`button`,className:`link-btn`,onClick:t,children:n(`newChat.tryAgain`)})]}),V(`button`,{type:`button`,className:`new-chat-details`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[P(yr,{size:12,className:r?`is-open`:``,"aria-hidden":`true`}),` `,n(`newChat.details`)]}),r&&P(`pre`,{className:`new-chat-details-text`,children:e})]})}function MA(){let{documents:e,draftDocumentIds:t,addDraftDocuments:n}=k.getState();n(e.filter(e=>e.indexing_status===`complete`&&!t.includes(e.id)).map(e=>e.id))}function NA(){let e=T(),t=k(e=>e.documents),n=k(e=>e.draftDocumentIds),r=k(e=>e.removeDraftDocument),i=k(e=>e.setShowDocLibrary),a=t.filter(e=>n.includes(e.id)),o=t.filter(e=>e.indexing_status===`complete`&&!n.includes(e.id));if(!a.length&&!o.length)return null;let s=o.length;return V(`div`,{className:`new-chat-docs`,children:[a.length>0&&P(`ul`,{className:`new-chat-doc-list`,"aria-label":e(`newChat.docs.forChat`),children:a.map(t=>V(`li`,{className:`new-chat-doc`,children:[P(hi,{size:12,"aria-hidden":`true`}),P(`span`,{dir:`auto`,children:t.filename}),P(`button`,{type:`button`,className:`new-chat-doc-remove`,onClick:()=>r(t.id),"aria-label":e(`newChat.docs.dontAttach`,{name:t.filename}),children:P(So,{size:12,"aria-hidden":`true`})})]},t.id))}),s>0&&V(`p`,{className:`new-chat-note`,children:[a.length?e.plural(`newChat.docs.more`,s):e.plural(`newChat.docs.library`,s),` `,P(`button`,{type:`button`,className:`link-btn`,onClick:MA,children:s===1?e(`newChat.docs.attachIt`):e(`newChat.docs.attachAll`,{n:s})}),s>1&&V(D.Fragment,{children:[` · `,P(`button`,{type:`button`,className:`link-btn`,onClick:()=>i(!0),children:e(`newChat.docs.choose`)})]})]})]})}function PA({error:e}){let t=T(),n=k(e=>e.openSettings);return V(`div`,{className:`new-chat-setup-failed`,role:`alert`,children:[P(`p`,{className:`new-chat-setup-failed-title`,children:t(`newChat.setupFailed.title`)}),P(`p`,{className:`new-chat-setup-failed-error`,children:e}),V(`p`,{children:[t(`newChat.setupFailed.hint`),` `,P(`button`,{type:`button`,className:`link-btn`,onClick:()=>n(`model`),children:t(`newChat.setupFailed.choose`)})]})]})}function FA({onSend:e,initialText:t=``,focusRequest:n=0}){let r=T(),i=k(e=>Bw(e.systemStatus)),a=k(e=>e.systemStatus?.download_progress??null),o=k(e=>e.systemStatus?.model_loaded?null:e.systemStatus?.setup_error??null),s=cs(e=>!!e.active?.remote),[c,l]=yk(_t,t),[u,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),y=(0,J.useRef)(null),b=(0,J.useRef)(null),x=(0,J.useRef)(null),S=qO(),C=wA();ls();let w=(0,J.useRef)(!0),E=(0,J.useCallback)((e=!1)=>{e||v(null),rt().then(e=>{w.current&&(g(e),v(e.skills_error??null))}).catch(e=>{d.api.warn(`New-chat start screen unavailable`,e),w.current&&v(Px(e))})},[]);(0,J.useEffect)(()=>(w.current=!0,E(),()=>{w.current=!1}),[E]),(0,J.useEffect)(()=>{Dt().then(e=>k.getState().setDocuments(e.documents||[])).catch(e=>d.api.warn(`Document library unavailable; not offering its documents`,e))},[]),(0,J.useEffect)(()=>{if(_)return mk(()=>E(!0),DA)},[_,E]);let O=(0,J.useRef)(!1),A=(0,J.useRef)([]),M=(0,J.useCallback)(async(t,n=``)=>{if(t){if(O.current)A.current.push(n||t),l(``);else{O.current=!0,m(!0),f(null),l(``);try{let n=await e(t);S.clear();let r=A.current.splice(0),i=k.getState().currentSessionId;if(r.length>0&&i){let e=(e,t)=>n===!1?[...e,{...j(t,`failed`),error:`The first message was not sent.`}]:ee(e,t,`queued`);k.getState().updateQueue(i,t=>r.reduce(e,t))}}catch(e){let r=A.current.splice(0);l([n||t,...r].join(`
76
+
77
+ `)),f(Px(e))}finally{O.current=!1,m(!1)}}}},[S,e]),N=(0,J.useCallback)(()=>M(S.compose(c.trim()),c.trim()),[S,M,c]);(0,J.useEffect)(()=>{n&&y.current?.focus()},[n]);let F=c.length>0||p,I=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let e=b.current;if(!e)return;typeof e.getAnimations==`function`&&e.getAnimations().forEach(e=>e.cancel());let t=e.getBoundingClientRect().top,n=I.current;if(I.current={top:t,docked:F},!n||n.docked===F||kx()||typeof e.animate!=`function`)return;let r=getComputedStyle(document.documentElement).getPropertyValue(`--ease`).trim();if(!r)throw Error(`Motion token --ease is not set; check styles/index.css.`);e.animate([{transform:`translateY(${n.top-t}px)`},{transform:`none`}],{duration:Ox(`--duration-spring`),easing:r})});let L=a?.state===`starting`||a?.state===`downloading`,R=p?`sending`:L?`download`:i||C!==null?`loading`:`idle`,z=h?.working_folder;return V(`main`,{className:`new-chat${F?` is-docked`:``}`,"aria-label":r(`newChat.label`),children:[P(Bk,{activity:R,progress:(a?.percent??0)/100,pulse:c.length,docked:F,contentRef:b,composerRef:x}),V(`div`,{className:`new-chat-inner`,ref:b,children:[P(`h1`,{className:`new-chat-greeting`,"aria-hidden":F,children:OA(new Date,r)}),o&&!s&&P(PA,{error:o}),P(`div`,{ref:x,children:P(GT,{value:c,onChange:l,onSubmit:N,attachments:S,disabledReason:i?r(`composer.starting`):null,autoFocus:!0,inputRef:y,leftControls:V(D.Fragment,{children:[P(bE,{sessionId:null}),P(SA,{disabled:p})]}),rightControls:P(rE,{})})}),P(`div`,{className:`new-chat-meta`,children:z&&P(mE,{folder:z,disabled:i||p})}),P(NA,{}),C!==null&&!i&&P(`p`,{className:`new-chat-warmup`,role:`status`,children:AA(C,r)}),u&&P(`p`,{className:`new-chat-error`,role:`alert`,children:u}),_&&P(jA,{detail:_,onRetry:()=>E()})]})]})}var IA=1e3,LA=15,RA=5,zA=new Map;function BA(){let e=T(),t=Wo(e=>e.need),n=Wo(e=>e.settle),r=(0,J.useRef)(null),i=(0,J.useRef)(null),a=(0,J.useRef)(0),o=(0,J.useRef)(0),s=(0,J.useRef)(null);s.current=t;let[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=(0,J.useCallback)(()=>{i.current&&clearInterval(i.current),i.current=null},[]);(0,J.useEffect)(()=>(l(null),d(!1),p(null),h(!1),g),[t,g]);let _=(0,J.useCallback)(()=>{g(),u&&t?.model&&qt(t.model.id).catch(e=>console.warn(`[ModelNeededDialog] could not cancel the download`,e)),n(!1)},[u,t,n,g]);Io(!!t,_),aS(r,!!t);let v=(0,J.useCallback)(async r=>{if(!t?.model)return;let c=t,u=t.model.id,f=(zA.get(u)??0)+1;zA.set(u,f),p(null),d(!0),a.current=0,o.current=0;try{await ve(u,{acknowledgeLowDisk:r})}catch(e){if(s.current!==c)return;d(!1),p(e instanceof Error?e.message:String(e)),e instanceof vn&&e.body?.code===`low_disk`&&h(!0);return}s.current===c?(g(),i.current=setInterval(()=>{Ce().then(t=>{if(s.current!==c){g();return}o.current=0;let r=t.models?.find(e=>e.id===u);if(r)r.bytes_total>0&&l(Math.floor(r.bytes_done*100/r.bytes_total)),r.state===`ready`||r.state===`verifying`?(g(),n(!0)):(r.state===`failed`||r.state===`cancelled`)&&(g(),d(!1),p(r.error??e(`modelNeeded.failed`)));else{if(++a.current<LA)return;g(),d(!1),p(e(`modelNeeded.failed`))}}).catch(e=>{s.current===c?++o.current<RA||(g(),d(!1),p(e instanceof Error?e.message:String(e))):g()})},IA)):zA.get(u)===f&&qt(u).catch(e=>console.warn(`[ModelNeededDialog] could not cancel the download`,e))},[t,n,g,e]);if(t?.off)return(0,Qx.createPortal)(P(`div`,{className:`model-needed-overlay`,children:V(`div`,{ref:r,className:`model-needed`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`modelNeeded.off.${t.off}.title`),children:[P(`h2`,{className:`model-needed-title`,children:e(`modelNeeded.off.${t.off}.title`)}),P(`p`,{className:`model-needed-from`,children:e(`modelNeeded.off.${t.off}.body`)}),V(`div`,{className:`model-needed-actions`,children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:_,children:e(`modelNeeded.notNow`)}),P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>n(!0),children:e(`modelNeeded.off.send`)})]})]})}),document.body);if(!t?.model)return null;let{model:y,job:b,disk_free_gb:x}=t,S=y.size_gb!=null&&x!=null&&y.size_gb>x,C=S||m;return(0,Qx.createPortal)(P(`div`,{className:`model-needed-overlay`,children:V(`div`,{ref:r,className:`model-needed`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`modelNeeded.dialog`),children:[P(`h2`,{className:`model-needed-title`,children:e(`modelNeeded.title.${b}`)}),V(`p`,{className:`model-needed-line`,children:[P(`bdi`,{children:y.name}),y.size_gb!=null&&V(D.Fragment,{children:[`, `,P(`bdi`,{dir:`ltr`,children:$(y.size_gb)})]}),x!=null&&V(D.Fragment,{children:[` · `,e(`modelNeeded.free`),` `,P(`bdi`,{dir:`ltr`,children:$(x)})]})]}),y.source&&V(`p`,{className:`model-needed-from`,children:[e(`setup.contents.from`),` `,P(`bdi`,{dir:`ltr`,children:y.source})]}),P(`p`,{className:`model-needed-from`,children:e(`modelNeeded.waits`)}),u&&(c==null?V(`p`,{role:`status`,children:[P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,e(`modelNeeded.starting`)]}):P(`progress`,{className:`setup-progress`,max:100,value:c,"aria-label":e(`modelNeeded.dialog`)})),S&&!u&&P(`p`,{className:`setup-error`,role:`alert`,children:e(`modelNeeded.lowDisk`,{need:$(y.size_gb??0),free:$(x??0),freeUp:$((y.size_gb??0)-(x??0))})}),f&&P(`p`,{className:`setup-error`,role:`alert`,children:f}),V(`div`,{className:`model-needed-actions`,children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:_,children:e(`modelNeeded.notNow`)}),P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void v(C),disabled:u,children:e(C?`setup.confirm.downloadAnyway`:f?`setup.tryAgain`:`modelNeeded.download`)})]})]})}),document.body)}function VA(e){let t=e?.reason;return t===`needs_key`||t===`bad_key`}function HA({provider:e,limit:t}){let n=T(),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null);if((0,J.useEffect)(()=>{i(null),o(null),We(e).then(i).catch(e=>o(e instanceof Error?e.message:String(e)))},[e]),a)return P(`p`,{className:`settings-error`,role:`alert`,children:n(`settings.price.loadFailed`,{reason:a})});if(!r)return V(`p`,{className:`settings-hint`,children:[P(K,{size:13,className:`spin`}),` `,n(`settings.price.loading`)]});if(r.models.length===0)return V(`p`,{className:`settings-hint cloud-prices-note`,children:[n(`settings.price.unknownSentence`),` `,P(`bdi`,{children:r.note})]});let s=t?r.models.slice(0,t):r.models;return V(`div`,{className:`cloud-prices`,"aria-label":n(`settings.model.prices`),children:[P(`ul`,{className:`cloud-prices-list`,children:s.map(e=>V(`li`,{children:[V(`span`,{className:`cloud-prices-name`,children:[P(`bdi`,{children:e.name}),e.note&&V(`span`,{className:`cloud-prices-note`,children:[` · `,P(`bdi`,{children:e.note})]})]}),P(`span`,{className:`cloud-prices-price`,children:XT(e.price,n)})]},e.model))}),V(`span`,{className:`settings-hint`,children:[P(`bdi`,{children:r.source}),`. `,n(`settings.price.payProvider`)]})]})}function UA(){return zc(Dx)}function WA(e,t=150){let n=UA(),[r,i]=(0,J.useState)(e),a=(0,J.useRef)(e);return(0,J.useEffect)(()=>{if(n||typeof requestAnimationFrame!=`function`){a.current=e,i(e);return}let r=a.current,o=performance.now(),s=0,c=n=>{let l=Math.min(1,(n-o)/t),u=1-(1-l)**3,d=r+(e-r)*u;a.current=d,i(d),l<1&&(s=requestAnimationFrame(c))};return s=requestAnimationFrame(c),()=>cancelAnimationFrame(s)},[e,t,n]),r}function GA(e,t){let[n,r]=(0,J.useState)(e);return(0,J.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function KA(){let[e,t]=(0,J.useState)(()=>typeof document>`u`||document.visibilityState!==`hidden`);return(0,J.useEffect)(()=>{let e=()=>t(document.visibilityState!==`hidden`);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}var qA=180;function JA({open:e,children:t}){let[n,r]=(0,J.useState)(e),[i,a]=(0,J.useState)(e),o=(0,J.useRef)(t);return e&&(o.current=t),(0,J.useEffect)(()=>{if(e){r(!0);let e=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(e)}a(!1);let t=setTimeout(()=>r(!1),qA);return()=>clearTimeout(t)},[e]),n?P(`div`,{className:`reveal${i?` is-open`:``}`,"aria-hidden":!e||void 0,children:P(`div`,{className:`reveal-inner`,children:e?t:o.current})}):null}var YA=e=>e?.catalog??[],XA=e=>e.roles.includes(`vision`),ZA=e=>e.roles.includes(`embedding`),QA=e=>e.recipe===`flm`,$A=e=>e.fits===!1&&(e.fit_code===`npu`||e.fit_code===`backend`),ej=e=>e.support===null,tj=e=>e?.feature_tier!==`compact`;function nj(e,t){let n=e.find(e=>e.id===t.defaultChat);return n&&QA(n)||t.vision===`none`?null:t.vision?t.vision:n?.reads_images?n.id:e.find(e=>XA(e)&&e.gaia_model)?.id??null}function rj(e,t){let n=nj(t,e),r=new Set(e.ticked),i=new Set(e.unticked);for(let a of t)XA(a)&&a.id!==e.defaultChat&&(a.id===n?(r.add(a.id),i.delete(a.id)):a.downloaded||(r.delete(a.id),i.add(a.id)));return{...e,ticked:r,unticked:i}}function ij(e,t,n){let r=new Set(e.ticked),i=t.find(t=>t.id===e.defaultChat);i&&!i.downloaded&&r.delete(i.id);let a=t.find(e=>e.id===n);if(a?.downloaded||r.add(n),!tj(a))for(let e of t)e.roles.includes(`image_creation`)&&r.delete(e.id);return rj({...e,ticked:r,defaultChat:n,chatChosen:!0,vision:null},t)}function aj(e,t,n){return rj({...e,vision:n},t)}function oj(e,t){if(t.vision===`none`)return null;let n=nj(e,t),r=e.find(e=>e.id===t.defaultChat);return r&&QA(r)||n===(r?.reads_images?r.id:e.find(e=>XA(e)&&e.gaia_model)?.id)?null:n}function sj(e){return e.filter(e=>e.gaia_model&&(e.planned||e.recommended||e.downloaded||e.partial))}function cj(e){let t=new Set(sj(e).map(e=>e.id));return e.filter(e=>e.gaia_model&&!t.has(e.id))}function lj(e){return e.filter(e=>!e.gaia_model&&e.downloaded)}function uj(e){let t=YA(e),n=new Set(t.filter(e=>e.selected||e.gaia_model&&e.downloaded&&!e.skipped).map(e=>e.id)),r=!t.find(t=>t.id===e.chat_model.id)?.reads_images&&t.some(e=>XA(e)&&e.gaia_model&&e.skipped);return rj({ticked:n,defaultChat:e.chat_model.id,unticked:new Set,chatChosen:e.chat_model.user_set,vision:e.vision_model??(r?`none`:null)},t)}function dj(e,t){return e.filter(e=>e.chat_choice&&(t.has(e.id)||e.downloaded))}function fj(e,t,n,r){let i=new Set(e.ticked),a=new Set(e.unticked);r?(i.add(n),a.delete(n)):(i.delete(n),a.add(n));let o=dj(t,i),s=e.defaultChat;if(!s||!o.some(e=>e.id===s)){let e=t.find(e=>e.id===n);s=r&&e?.chat_choice?n:(o.find(e=>e.recommended)??o[0])?.id??null}return{...e,ticked:i,defaultChat:s,unticked:a}}function pj(e,t,n){let r=t.find(e=>e.id===n)?.downloaded;return{...e,defaultChat:n,chatChosen:!0,ticked:r?e.ticked:new Set([...e.ticked,n])}}function mj(e){let t=YA(e),n=new Set(t.filter(e=>e.recommended||e.gaia_model&&e.downloaded).map(e=>e.id)),r=dj(t,n);return rj({ticked:n,defaultChat:e.recommended_model&&r.some(t=>t.id===e.recommended_model)?e.recommended_model:(r.find(e=>e.recommended)??r[0])?.id??null,unticked:new Set,chatChosen:!1,vision:null},t)}function hj(e,t){return e.filter(e=>t.ticked.has(e.id)&&!e.downloaded).sort((e,t)=>(t.size_gb??0)-(e.size_gb??0))}function gj(e,t){let n=hj(YA(e),t).map(e=>e.size_gb),r=n.every(e=>e!=null)?Sj(n.reduce((e,t)=>e+t,0)):null,i=e.disk?.free_gb??null;return{downloadGb:r,freeGb:i,afterGb:r!=null&&i!=null?Sj(i-r):null}}function _j(e,t){let{downloadGb:n,freeGb:r}=gj(e,t);return n==null||r==null||n<=r?null:{needGb:n,freeGb:r,freeUpGb:Sj(n-r),drop:hj(YA(e),t).find(e=>e.size_gb!=null&&n-e.size_gb<=r)??null}}function vj(e,t){return e.filter(e=>e.fits===!1&&(t.ticked.has(e.id)||e.id===t.defaultChat))}function yj(e,t){let n=[];for(let r of YA(e)){if(!r.planned){r.skipped&&t.ticked.has(r.id)&&n.push({id:r.id,skipped:!1});continue}if(r.id===e.chat_model.id){r.skipped&&n.push({id:r.id,skipped:!1});continue}let i=t.ticked.has(r.id);!i&&!r.skipped&&n.push({id:r.id,skipped:!0}),i&&r.skipped&&n.push({id:r.id,skipped:!1})}return n}function bj(e,t){return YA(e).filter(e=>t.ticked.has(e.id)&&!e.planned&&!e.downloaded).map(e=>e.id)}function xj(e,t){let n=(e.models??[]).filter(e=>e.state!==`skipped`);if(!t?.catalog||n.length===0)return e.overall;let r=0,i=0;for(let e of n){let n=t.catalog.find(t=>t.id===e.id),a=n?.downloaded?0:n?.size_gb==null?e.bytes_total:Math.min(e.bytes_total||1/0,n.size_gb*1e9),o=Math.max(0,e.bytes_total-a);i+=a,r+=e.state===`ready`||e.state===`verifying`?a:Math.min(a,Math.max(0,e.bytes_done-o))}return{bytes_done:r,bytes_total:i,speed_bps:e.overall?.speed_bps??0,eta_s:null,percent:i>0?Math.floor(r*100/i):100,failed:n.filter(e=>e.state===`failed`).length}}function Sj(e){return Math.round(e*10)/10}var Cj=6;function wj(e,t){let n=[];return e.chat_choice&&!ZA(e)&&n.push(t(`setup.models.purpose.chat`)),XA(e)&&n.push(t(`setup.models.purpose.vision`)),ZA(e)&&n.push(t(`setup.models.purpose.documents`)),n}function Tj(e,t){return ZA(e)?t(`setup.models.line.documents`):XA(e)?t(`setup.models.line.vision`):t(`setup.models.line.chat`)}function Ej(e,t){return e.downloaded?t(`setup.models.status.onPc`):e.size_gb==null?t(`setup.models.status.sizeUnknown`):e.partial?t(`setup.models.status.partial`,{size:$(e.size_gb)}):t(`setup.models.status.download`,{size:$(e.size_gb)})}function Dj(e,t){return e.fits!==!0||e.need_gb==null||e.capacity_gb==null?null:t(`setup.models.fit.ok`,{need:jS(e.need_gb),have:jS(e.capacity_gb)})}function Oj(e,t){return e.fit_code===`npu`?t(`setup.models.warn.npu`):e.fit_code===`backend`?t(`setup.models.warn.backend`):e.need_gb!=null&&e.capacity_gb!=null?t(`setup.models.warn.tooBig`,{need:jS(e.need_gb),have:jS(e.capacity_gb)}):t(`setup.models.warn.tooBigNoNumbers`)}function kj(e,t,n){return!XA(e)&&!ZA(e)?null:n===`settings`?e.downloaded?t(`settings.models.warn.kept`,{name:e.name}):t(XA(e)?`settings.models.warn.vision`:`settings.models.warn.documents`,{name:e.name}):t(XA(e)?`setup.models.warn.vision`:`setup.models.warn.documents`,{name:e.name})}function Aj({entry:e,ticked:t,onToggle:n,disabled:r,progress:i,actions:a,place:o}){let s=T(),c=(0,J.useId)(),l=e.fits===!1,u=t?null:kj(e,s,o),d=i?.state===`downloading`&&i.bytes_total>0,f=l?Oj(e,s):u,p=[`${c}-status`,`${c}-note`,f?`${c}-warn`:null].filter(Boolean).join(` `);return V(`li`,{className:`mc-row${t?` is-ticked`:``}${f?` has-warning`:``}`,children:[V(`div`,{className:`mc-row-top`,children:[V(`label`,{className:`mc-row-main`,children:[P(`input`,{type:`checkbox`,className:`mc-input`,checked:t,disabled:r,onChange:e=>n(e.target.checked),"aria-describedby":p}),P(`span`,{className:`mc-box`,"aria-hidden":`true`,children:P(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,children:P(`path`,{className:`mc-tick`,d:`M3.5 8.5l3 3 6-7`})})}),V(`span`,{className:`mc-text`,children:[V(`span`,{className:`mc-name-line`,children:[P(`bdi`,{className:`mc-name`,title:e.id,children:e.name}),V(`span`,{className:`mc-chips`,children:[wj(e,s).map(e=>P(`span`,{className:`mc-chip`,children:e},e)),QA(e)&&P(`span`,{className:`mc-chip is-npu`,children:s(`setup.models.npu`)})]})]}),V(`span`,{className:`mc-status`,id:`${c}-status`,children:[d?s(`setup.models.status.downloading`,{done:MS(i.bytes_done),total:MS(i.bytes_total)}):Ej(e,s),e.recommended&&P(`span`,{className:`mc-pill`,children:s(`setup.models.recommended`)}),e.fits===null&&V(`span`,{className:`mc-chip is-unknown`,children:[P(kr,{size:11,"aria-hidden":`true`}),` `,s(`setup.models.fitUnknown`)]})]}),P(`span`,{className:`mc-note`,id:`${c}-note`,children:s.compose(t=>[Tj(e,t),Dj(e,t),e.fits===null?t(`setup.models.fit.unknown`):null].filter(Boolean).join(` `))})]})]}),a&&P(`span`,{className:`mc-actions`,children:a})]}),d&&P(`progress`,{className:`mc-mini-progress`,max:i.bytes_total,value:i.bytes_done,"aria-label":s(`setup.progress.rowLabel`,{name:e.name,state:s(`setup.state.downloading`)})}),P(JA,{open:!!f,children:V(`p`,{className:`mc-warn${l?` is-big`:``}`,role:`note`,id:`${c}-warn`,children:[P(q,{size:13,"aria-hidden":`true`}),P(`span`,{children:f})]})})]})}function jj({plan:e,selection:t}){let n=T(),{downloadGb:r,freeGb:i,afterGb:a}=gj(e,t),o=_j(e,t),s=WA(r??0),c=WA(a??0),l=Mj(e.disk?.path??null),u=r!=null&&i?Math.min(1,r/i):0,d=GA(r==null?n(`setup.summary.spokenUnknown`):a==null?n(`setup.summary.spokenNoDisk`,{download:$(r)}):n(`setup.summary.spoken`,{download:$(r),after:$(Math.max(0,a))}),600);return V(`div`,{className:`mc-summary${o?` is-warn`:``}`,role:`group`,"aria-label":n(`setup.summary.label`),children:[V(`div`,{className:`mc-summary-stats`,children:[V(`span`,{className:`mc-stat`,children:[P(`span`,{className:`mc-stat-label`,children:n(`setup.summary.download`)}),P(`bdi`,{className:`mc-stat-value`,children:r==null?n(`setup.summary.sizeUnknown`):$(Nj(s))})]}),V(`span`,{className:`mc-stat`,children:[V(`span`,{className:`mc-stat-label`,children:[P(Fi,{size:12,"aria-hidden":`true`}),` `,l?n(`setup.summary.freeOn`,{drive:l}):n(`setup.summary.free`)]}),P(`bdi`,{className:`mc-stat-value`,children:i==null?n(`setup.summary.freeUnknown`):$(i)})]}),a!=null&&!o&&V(`span`,{className:`mc-stat`,children:[P(`span`,{className:`mc-stat-label`,children:n(`setup.summary.after`)}),P(`bdi`,{className:`mc-stat-value`,children:$(Math.max(0,Nj(c)))})]})]}),i!=null&&P(`div`,{className:`mc-disk`,"aria-hidden":`true`,children:P(`span`,{className:`mc-disk-fill`,style:{inlineSize:`${(u*100).toFixed(1)}%`}})}),P(JA,{open:!!o,children:o&&V(`p`,{className:`mc-disk-warn`,role:`note`,children:[P(q,{size:13,"aria-hidden":`true`}),P(`span`,{children:o.drop?n(`setup.summary.shortDrop`,{need:$(o.needGb),free:$(o.freeGb),drive:l??n(`setup.summary.theDrive`),freeUp:$(o.freeUpGb),name:o.drop.name,saves:$(o.drop.size_gb??0)}):n(`setup.summary.short`,{need:$(o.needGb),free:$(o.freeGb),drive:l??n(`setup.summary.theDrive`),freeUp:$(o.freeUpGb)})})]})}),P(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:d})]})}function Mj(e){if(!e)return null;let t=/^([A-Za-z]:)[\\/]/.exec(e);return t?t[1]:e}function Nj(e){return Math.round(e*10)/10}function Pj({plan:e,selection:t,onToggle:n,onDefaultChat:r,labelledBy:i,cloud:a,disabled:o,progress:s,rowActions:c,place:l=`setup`}){let u=T(),d=YA(e),[f,p]=(0,J.useState)(``),m=(0,J.useId)(),h=a?d.filter(ZA):sj(d),g=a?[]:cj(d),_=a?[]:lj(d),v=(0,J.useMemo)(()=>{let e=f.trim().toLowerCase();return e?_.filter(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)):_},[_,f]),y=dj(d,t.ticked),b=e=>P(Aj,{entry:e,ticked:t.ticked.has(e.id),onToggle:t=>n(e.id,t),disabled:o,progress:s?.[e.id],actions:c?.(e),place:l},e.id);return V(`div`,{className:`mc`,children:[P(`ul`,{className:`mc-list`,role:`group`,"aria-labelledby":i,children:h.map(b)}),a?P(`p`,{className:`setup-hint`,children:u(`setup.models.cloudNote`)}):P(`p`,{className:`mc-foot`,children:u(`setup.models.neverDeletes`)}),g.length>0&&V(`details`,{className:`mc-more`,children:[P(`summary`,{children:u(`setup.models.more`,{n:String(g.length)})}),P(`ul`,{className:`mc-list`,role:`group`,"aria-label":u(`setup.models.moreLabel`),children:g.map(b)})]}),_.length>0&&V(`details`,{className:`mc-more`,children:[P(`summary`,{children:u(`setup.models.installed`,{n:String(_.length)})}),_.length>Cj&&P(`input`,{className:`settings-input mc-search`,type:`search`,value:f,onChange:e=>p(e.target.value),placeholder:u(`setup.models.search`),"aria-label":u(`setup.models.search`)}),P(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-label":u(`setup.models.installedLabel`),children:v.map(e=>P(`li`,{className:`mc-row is-installed${t.defaultChat===e.id?` is-ticked`:``}`,children:V(`label`,{className:`mc-row-main`,children:[P(`input`,{type:`radio`,name:`${m}-installed`,className:`mc-radio`,checked:t.defaultChat===e.id,disabled:o,onChange:()=>r(e.id)}),V(`span`,{className:`mc-text`,children:[V(`span`,{className:`mc-name-line`,children:[P(`bdi`,{className:`mc-name`,title:e.id,children:e.name}),V(`span`,{className:`mc-chips`,children:[P(`span`,{className:`mc-chip`,children:u(`setup.models.purpose.chat`)}),QA(e)&&P(`span`,{className:`mc-chip is-npu`,children:u(`setup.models.npu`)})]})]}),V(`span`,{className:`mc-status`,children:[u(`setup.models.status.onPc`),` · `,u(`setup.models.useAsDefault`)]})]})]})},e.id))})]}),!a&&V(`div`,{className:`mc-default`,children:[P(`label`,{htmlFor:m,className:`mc-default-label`,children:u(`setup.models.defaultChat`)}),V(`select`,{id:m,className:`settings-input mc-select`,value:t.defaultChat??``,disabled:o||y.length===0,onChange:e=>r(e.target.value),children:[y.length===0&&P(`option`,{value:``,children:u.bare(`setup.models.noChat`)}),y.map(e=>V(`option`,{value:e.id,children:[e.name,QA(e)?` (${u(`setup.models.npu`)})`:``]},e.id))]})]})]})}function Fj(){let e=T();return V(`div`,{className:`mc`,"aria-busy":`true`,children:[V(`p`,{className:`setup-hint`,role:`status`,children:[P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,e(`setup.models.loading`)]}),P(`ul`,{className:`mc-list`,"aria-hidden":`true`,children:[0,1,2].map(e=>P(`li`,{className:`mc-row is-skeleton`,children:P(`span`,{className:`mc-skeleton`})},e))})]})}function Ij({entry:e}){let t=T();return e.support===`verified`?P(`span`,{className:`mc-chip is-verified`,children:t(`setup.label.verified`)}):e.support===`untested`?P(`span`,{className:`mc-chip is-untested`,children:t(`setup.label.untested`)}):null}function Lj({name:e,entry:t,checked:n,recommended:r,disabled:i,onPick:a,children:o}){let s=T();return P(`li`,{className:`mc-row${n?` is-ticked`:``}`,children:V(`label`,{className:`mc-row-main`,children:[P(`input`,{type:`radio`,className:`mc-radio`,name:e,checked:n,disabled:i||$A(t),onChange:a}),V(`span`,{className:`mc-text`,children:[V(`span`,{className:`mc-name-line`,children:[P(`span`,{className:`mc-name`,title:t.id,children:P(`bdi`,{children:t.name})}),V(`span`,{className:`mc-chips`,children:[r&&P(`span`,{className:`mc-pill`,children:s(`setup.models.recommended`)}),P(Ij,{entry:t}),QA(t)&&P(`bdi`,{className:`mc-chip is-npu`,children:s(`setup.models.npu`)})]})]}),P(`span`,{className:`mc-status`,children:Ej(t,s)}),t.fits===!1&&V(`span`,{className:`mc-warn is-big`,role:`note`,children:[P(q,{size:13,"aria-hidden":`true`}),` `,Oj(t,s)]}),o]})]})})}function Rj({label:e,note:t,size:n,checked:r,disabled:i,warning:a,chips:o,onChange:s}){return P(`li`,{className:`mc-row${r?` is-ticked`:``}${i?` is-off`:``}`,children:V(`label`,{className:`mc-row-main`,children:[P(`input`,{type:`checkbox`,className:`mc-input`,checked:r,disabled:i,onChange:e=>s(e.target.checked)}),P(`span`,{className:`mc-box`,"aria-hidden":`true`,children:P(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,children:P(`path`,{className:`mc-tick`,d:`M3.5 8.5l3 3 6-7`})})}),V(`span`,{className:`mc-text`,children:[V(`span`,{className:`mc-name-line`,children:[P(`span`,{className:`mc-name`,children:P(`bdi`,{children:e})}),P(`span`,{className:`mc-chips`,children:o})]}),P(`span`,{className:`mc-status`,children:P(`bdi`,{dir:`ltr`,children:n})}),P(`span`,{className:`mc-note`,children:t}),a&&V(`span`,{className:`mc-warn`,role:`note`,children:[P(q,{size:13,"aria-hidden":`true`}),` `,a]})]})]})})}function zj({plan:e,selection:t,onSelection:n,disabled:r}){let i=T(),a=(0,J.useId)(),o=YA(e),[s,c]=(0,J.useState)(!1),l=o.find(e=>e.id===t.defaultChat),u=!!l&&QA(l),d=o.filter(e=>e.chat_choice&&!ZA(e)&&(e.gaia_model||e.downloaded)&&QA(e)===u),f=d.filter(e=>e.support===`verified`),p=d.filter(e=>e.support!==`verified`),m=nj(o,t),h=!!l?.reads_images,g=o.filter(e=>XA(e)&&e.id!==l?.id),_=o.find(ZA),v=e=>o.find(t=>ej(t)&&t.roles.includes(e)),y=e=>e.downloaded?i(`setup.models.status.onPc`):e.size_gb==null?i(`setup.contents.sizeOnDownload`):$(e.size_gb),b=(e,r)=>n(fj(t,o,e,r)),x=e=>n(ij(t,o,e)),S=e=>n(aj(t,o,e)),C=v(`speech`),w=v(`voice`),E=v(`image_creation`),O=tj(l),k=l?.support===`untested`;return V(`div`,{className:`mc`,children:[V(`section`,{className:`mc-job`,"aria-labelledby":`${a}-chat`,children:[P(`h3`,{className:`mc-job-title`,id:`${a}-chat`,children:i(`setup.job.chat`)}),P(`p`,{className:`setup-hint`,children:i(`setup.job.verifiedNote`)}),P(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-labelledby":`${a}-chat`,children:f.map(n=>P(Lj,{name:`${a}-chat-model`,entry:n,checked:n.id===t.defaultChat,recommended:n.id===e.recommended_model,disabled:r,onPick:()=>x(n.id)},n.id))}),p.length>0&&V(D.Fragment,{children:[P(`p`,{className:`setup-hint`,children:i(`setup.job.untestedNote`)}),P(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-labelledby":`${a}-chat`,children:p.map(e=>P(Lj,{name:`${a}-chat-model`,entry:e,checked:e.id===t.defaultChat,recommended:!1,disabled:r,onPick:()=>x(e.id)},e.id))})]}),k&&V(`p`,{className:`mc-warn`,role:`note`,children:[P(q,{size:13,"aria-hidden":`true`}),` `,i(`setup.job.untestedPicked`)]})]}),V(`section`,{className:`mc-job`,"aria-labelledby":`${a}-vision`,children:[P(`h3`,{className:`mc-job-title`,id:`${a}-vision`,children:i(`setup.job.vision`)}),u?P(`p`,{className:`setup-hint`,role:`note`,children:i(`setup.job.visionOffNpu`,{name:l?.name??``})}):h?V(`div`,{className:`setup-card`,children:[V(`p`,{className:`mc-job-line`,children:[P(`bdi`,{children:i(`setup.job.visionBuiltIn`,{name:l?.name??``})}),P(`span`,{className:`setup-ok`,children:i(`setup.job.nothingMore`)})]}),P(`button`,{type:`button`,className:`link-btn`,"aria-expanded":s,onClick:()=>c(e=>!e),children:i(s?`setup.job.hideVision`:`setup.job.otherVision`)})]}):P(`p`,{className:`setup-hint`,children:i(`setup.job.visionNeeded`,{name:l?.name??``})}),!u&&(!h||s)&&V(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-labelledby":`${a}-vision`,children:[g.map(e=>P(Lj,{name:`${a}-vision-model`,entry:e,checked:m===e.id,recommended:!h&&e.gaia_model&&e.support===`verified`,disabled:r,onPick:()=>S(e.id)},e.id)),P(`li`,{className:`mc-row${m===null?` is-ticked`:``}`,children:V(`label`,{className:`mc-row-main`,children:[P(`input`,{type:`radio`,className:`mc-radio`,name:`${a}-vision-model`,checked:h?m===l?.id:m===null,disabled:r,onChange:()=>S(h?null:`none`)}),V(`span`,{className:`mc-text`,children:[P(`span`,{className:`mc-name`,children:i(h?`setup.job.useChatForVision`:`setup.job.skipVision`)}),m===null&&!h&&V(`span`,{className:`mc-warn`,role:`note`,children:[P(q,{size:13,"aria-hidden":`true`}),` `,i(`setup.job.skipVisionNote`)]})]})]})})]})]}),_&&V(`section`,{className:`mc-job`,"aria-labelledby":`${a}-docs`,children:[P(`h3`,{className:`mc-job-title`,id:`${a}-docs`,children:i(`setup.job.documents`)}),P(`ul`,{className:`mc-list`,children:P(Rj,{label:_.name,note:i(`setup.models.line.documents`),size:y(_),checked:t.ticked.has(_.id),disabled:r,warning:t.ticked.has(_.id)?null:i(`setup.job.documentsOff`),chips:V(D.Fragment,{children:[P(`span`,{className:`mc-pill`,children:i(`setup.models.recommended`)}),P(Ij,{entry:_})]}),onChange:e=>b(_.id,e)})})]}),V(`section`,{className:`mc-job`,"aria-labelledby":`${a}-extras`,children:[P(`h3`,{className:`mc-job-title`,id:`${a}-extras`,children:i(`setup.job.extras`)}),P(`p`,{className:`setup-hint`,children:i(`setup.job.extrasNote`)}),V(`ul`,{className:`mc-list`,children:[C&&P(Rj,{label:i(`setup.job.speech`),note:i(`setup.job.speechNote`),size:y(C),checked:t.ticked.has(C.id),disabled:r,onChange:e=>b(C.id,e)}),w&&P(Rj,{label:i(`setup.job.voice`),note:i(`setup.job.voiceNote`),size:y(w),checked:t.ticked.has(w.id),disabled:r,onChange:e=>b(w.id,e)}),E&&P(Rj,{label:i(`setup.job.images`),note:i(`setup.job.imagesNote`),size:y(E),checked:t.ticked.has(E.id),disabled:r||!O,warning:O?null:i(`setup.job.imagesBlocked`,{name:l?.name??``}),onChange:e=>b(E.id,e)})]})]}),P(Bj,{plan:e,selection:t})]})}function Bj({plan:e,selection:t}){let n=T(),r=YA(e),i=e=>r.find(t=>t.id===e)?.name??e??n(`setup.get.off`),a=e=>r.find(n=>ej(n)&&n.roles.includes(e)&&t.ticked.has(n.id)),o=r.find(e=>ZA(e)&&t.ticked.has(e.id)),s=r.find(e=>e.id===t.defaultChat),c=nj(r,t),l=[a(`speech`)&&n(`setup.job.speech`),a(`voice`)&&n(`setup.job.voice`)].filter(Boolean).join(`, `);return V(`section`,{className:`setup-card`,"aria-label":n(`setup.get.title`),children:[P(`h3`,{className:`mc-job-title`,children:n(`setup.get.title`)}),V(`dl`,{className:`setup-summary-list`,children:[V(`div`,{children:[P(`dt`,{children:n(`setup.job.chat`)}),P(`dd`,{children:P(`bdi`,{children:i(t.defaultChat)})})]}),V(`div`,{children:[P(`dt`,{children:n(`setup.job.vision`)}),P(`dd`,{children:P(`bdi`,{children:s&&QA(s)?n(`setup.get.offNpu`):c?i(c):n(`setup.get.off`)})})]}),V(`div`,{children:[P(`dt`,{children:n(`setup.job.documents`)}),P(`dd`,{children:P(`bdi`,{children:o?o.name:n(`setup.get.off`)})})]}),V(`div`,{children:[P(`dt`,{children:n(`setup.get.voice`)}),P(`dd`,{children:l||n(`setup.get.off`)})]}),V(`div`,{children:[P(`dt`,{children:n(`setup.job.images`)}),P(`dd`,{children:tj(s)?a(`image_creation`)?n(`setup.get.on`):n(`setup.get.off`):n(`setup.get.notAvailable`)})]})]})]})}var Vj=(0,J.createContext)(void 0),Hj=Vj.Provider;function Uj({children:e}){let t=(0,J.useContext)(Vj);return t===void 0?P(`div`,{className:`setup-row setup-nav`,children:e}):t===null?null:(0,Qx.createPortal)(P(`div`,{className:`setup-footer-row`,children:e}),t)}function Wj({title:e,children:t,confirmLabel:n,cancelLabel:r,onConfirm:i,onCancel:a,danger:o,busy:s}){let c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useId)(),d=(0,J.useId)();return aS(c,!0),(0,J.useEffect)(()=>{let e=document.activeElement;return l.current?.focus(),()=>e?.focus?.()},[]),Io(!0,a,!s),(0,Qx.createPortal)(P(`div`,{className:`confirm-overlay`,children:V(`div`,{ref:c,className:`confirm-sheet`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":u,"aria-describedby":t?d:void 0,children:[P(`h2`,{id:u,className:`confirm-title`,children:e}),t&&P(`div`,{id:d,className:`confirm-body`,children:t}),V(`div`,{className:`confirm-actions`,children:[P(`button`,{ref:l,type:`button`,className:`btn-secondary`,onClick:a,disabled:s,children:r}),P(`button`,{type:`button`,className:o?`btn-danger`:`btn-primary`,onClick:i,disabled:s,children:n})]})]})}),document.body)}function Gj(e){return e===`windows`?`Windows`:e===`linux`?`Linux`:e}function Kj(e){let t=/^Run:\s*(.+)$/.exec(e)??/^(sudo .+)$/.exec(e);return t?t[1].trim():null}function qj(e,t){return e.setting&&Math.abs(e.setting.current_gb-t)<.05&&e.gpu_gb!=null?e.gpu_gb:e.presets?.find(e=>Math.abs(e.setting_gb-t)<.05)?.gpu_gb??null}function Jj(e,t,n=!1){return t==null?e(n?`gpu.appliedAny`:`gpu.pending.restartAny`):e(n?`gpu.applied`:`gpu.pending.restart`,{gb:$(t)})}function Yj(e){e.focus({preventScroll:!0});for(let t=e.parentElement;t;t=t.parentElement){let n=getComputedStyle(t).overflowY;if(n!==`auto`&&n!==`scroll`)continue;let r=e.getBoundingClientRect().top-t.getBoundingClientRect().top;(r<0||r>t.clientHeight-40)&&(t.scrollTop+=r-16);return}}function Xj(e){return e instanceof Error?e.message:String(e)}function Zj({status:e,targetGpuGb:t}){let n=T(),r=e=>Math.round(e*10),i=r(e.total_gb??0),a=r(e.gpu_gb??0),o=t!=null&&r(t)>a?r(t):null,s=o==null?0:o-a,c=Math.max(0,i-a-s),l=e=>$(e/10),u=e=>i>0?Math.min(100,e/i*100):0,d=e.pending?.state===`took_effect`;return V(`div`,{className:`gpu-split`,children:[V(`div`,{className:`gpu-bar${d?` is-new`:``}`,role:`img`,"aria-label":o==null?n(`gpu.split.aria`,{cpu:l(c),gpu:l(a)}):n(`gpu.split.ariaTarget`,{cpu:l(c),gpu:l(o),now:l(a)}),children:[P(`span`,{className:`gpu-seg is-gpu`,style:{inlineSize:`${u(a)}%`}}),P(`span`,{className:`gpu-seg is-target`,style:{inlineSize:`${u(s)}%`}}),P(`span`,{className:`gpu-seg is-cpu`}),o!=null&&P(`span`,{className:`gpu-marker`,style:{insetInlineStart:`${u(o)}%`}})]}),V(`div`,{className:`gpu-legend`,"aria-hidden":`true`,children:[P(`span`,{className:`gpu-key is-gpu`,children:P(`bdi`,{children:n(`gpu.split.gpu`,{gb:l(a)})})}),o!=null&&P(`span`,{className:`gpu-key is-target`,children:P(`bdi`,{children:n(`gpu.split.added`,{gb:l(s)})})}),P(`span`,{className:`gpu-key is-cpu`,children:P(`bdi`,{children:n(`gpu.split.cpu`,{gb:l(c)})})})]})]})}function Qj({presets:e,value:t,onChange:n,recommended:r,max:i,disabled:a}){let o=T(),s=(0,J.useRef)([]),c=Math.max(0,e.findIndex(e=>e.setting_gb===t));return P(`div`,{className:`gpu-presets`,role:`radiogroup`,"aria-label":o(`gpu.presets.label`),onKeyDown:t=>{let r=t.key===`ArrowRight`||t.key===`ArrowDown`?1:t.key===`ArrowLeft`||t.key===`ArrowUp`?-1:0;if(!r)return;t.preventDefault();let i=getComputedStyle(t.currentTarget).direction===`rtl`,a=(t.key===`ArrowRight`||t.key===`ArrowLeft`)&&i?-r:r,o=(c+a+e.length)%e.length;n(e[o].setting_gb),s.current[o]?.focus()},children:e.map((e,l)=>V(`button`,{ref:e=>{s.current[l]=e},type:`button`,role:`radio`,"aria-checked":e.setting_gb===t,tabIndex:l===c?0:-1,className:`gpu-preset${e.setting_gb===t?` is-active`:``}`,disabled:a,onClick:()=>n(e.setting_gb),children:[P(`bdi`,{children:o(`gpu.presets.gpu`,{gb:$(e.gpu_gb)})}),e.setting_gb===r&&V(D.Fragment,{children:[` `,P(`span`,{className:`gpu-tag is-recommended`,children:o(`gpu.presets.recommended`)})]}),e.setting_gb===i&&V(D.Fragment,{children:[` `,P(`span`,{className:`gpu-tag is-max`,children:o(`gpu.presets.max`)})]})]},e.setting_gb))})}function $j({status:e,onStatus:t,mode:n,names:r,onSkip:i,onContinue:a,onBack:o,headingId:s}){let c=T(),l=(0,J.useCallback)(()=>{let e=s?document.getElementById(s):null;e&&Yj(e)},[s]);(0,J.useEffect)(()=>{n===`setup`&&l()},[n,l]);let u=(0,J.useId)(),d=e.presets??[],[f,p]=(0,J.useState)(e.recommended_setting_gb??d[0]?.setting_gb??null),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(void 0),[b,x]=(0,J.useState)(null),[S,C]=(0,J.useState)(null),[w,E]=(0,J.useState)(null),[O,k]=(0,J.useState)(null),A=d.find(e=>e.setting_gb===f)??null,j=e.recommended_setting_gb??null,M=d.length>0&&d[d.length-1].setting_gb===e.setting?.max_gb?d[d.length-1].setting_gb:null,N=A&&e.total_gb!=null?Math.max(0,e.total_gb-A.gpu_gb):null,F=j==null?(e.models??[]).find(e=>e.default&&e.fits_now):void 0,I=(A?.unlocks??[]).slice(0,2).map(e=>r[e]??e),L=e.pending??null,ee=e.method===`apply`,R=e.guided_value!==null,z=(0,J.useCallback)(async()=>{h(!0),_(null),C(`steps`),E(null);try{let e=await Xe(f??void 0);y(e.guided_value),_(e.guided_value===null?[]:e.guided_steps??[])}catch(e){y(void 0),_([]),E({kind:`error`,message:Xj(e)})}finally{C(null)}},[f]),B=async()=>{if(f!=null){x(null),C(`apply`),E(null);try{t(await He(f)),E({kind:`applied`})}catch(e){let t=e instanceof vn&&e.httpStatus===403;E(t?{kind:`denied`}:{kind:`error`,message:Xj(e)}),t&&l()}finally{C(null)}}},te=async()=>{x(null),C(`revert`),E(null);try{t(await un()),E({kind:`applied`})}catch(e){E(e instanceof vn&&e.httpStatus===403?{kind:`denied`}:{kind:`error`,message:Xj(e)})}finally{C(null)}},ne=async()=>{if(f!=null){C(`done`),E(null);try{t(await xe(f)),h(!1)}catch(e){E({kind:`error`,message:Xj(e)})}finally{C(null)}}},re=async()=>{C(`keep`),E(null);try{t(await Ge())}catch(e){E({kind:`error`,message:Xj(e)})}finally{C(null)}},ie=async e=>{try{await navigator.clipboard.writeText(e),k(e)}catch(e){E({kind:`error`,message:c(`gpu.copyFailed`,{reason:Xj(e)})})}},ae=L?.state===`restart_required`;return V(`div`,{className:`gpu`,children:[P(`p`,{className:`setup-hint`,children:c(`gpu.body`,{total:$(e.total_gb??0),gpu:$(e.gpu_gb??0)})}),P(Zj,{status:e,targetGpuGb:!ae&&!m?A?.gpu_gb??null:null}),L?.state===`took_effect`&&V(`div`,{className:`gpu-notice is-ok`,role:`status`,children:[P(pr,{size:14,"aria-hidden":`true`}),P(`span`,{children:c(`gpu.pending.tookEffect`,{gb:$(e.gpu_gb??0)})}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void re(),disabled:S!==null,children:c(`gpu.ok`)})]}),ae&&V(`div`,{className:`gpu-notice`,role:`status`,children:[P(Vi,{size:14,"aria-hidden":`true`}),P(`span`,{children:c.compose(t=>[Jj(t,qj(e,L.setting_gb),w?.kind===`applied`),t(`gpu.pending.restartHow`),n===`setup`?t(`gpu.pending.downloadsFirst`):null].filter(Boolean).join(` `))}),L.source===`guided`&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void re(),disabled:S!==null,children:c(`gpu.keep`,{gb:$(e.gpu_gb??0)})})]}),L?.state===`not_applied`&&V(`div`,{className:`gpu-notice is-warn`,role:`status`,children:[P(q,{size:14,"aria-hidden":`true`}),P(`span`,{children:c(`gpu.pending.notApplied`,{gb:$(e.gpu_gb??0)})}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void re(),disabled:S!==null,children:c(`gpu.keep`,{gb:$(e.gpu_gb??0)})})]}),!ae&&!m&&d.length>0&&V(D.Fragment,{children:[F&&V(`p`,{className:`gpu-unlock is-keep`,children:[P(pr,{size:13,"aria-hidden":`true`}),` `,c(`gpu.keepRecommended`,{model:r[F.id]??F.id})]}),P(Qj,{presets:d,value:f,onChange:p,recommended:j,max:M,disabled:S!==null}),A&&P(`p`,{className:`gpu-unlock`,children:I.length>0?c(I.length>1?`gpu.unlock.two`:`gpu.unlock.one`,{gb:$(A.gpu_gb),a:I[0],b:I[1]??``}):c(`gpu.unlock.none`,{gb:$(A.gpu_gb)})}),A&&A.setting_gb===M&&N!=null&&V(`p`,{className:`gpu-unlock is-warn`,role:`note`,children:[P(q,{size:13,"aria-hidden":`true`}),` `,c(`gpu.maxWarn`,{cpu:$(N),os:Gj(e.os)})]}),P(`p`,{className:`setup-hint`,children:c.compose(t=>`${t(`gpu.reserve`,{gb:$(e.reserve_gb??16),os:Gj(e.os)})} ${t(`gpu.needs`)}`)}),!ee&&e.method_reason&&P(`p`,{className:`setup-hint`,children:P(`bdi`,{dir:`ltr`,children:e.method_reason})})]}),!ae&&!m&&d.length===0&&P(`p`,{className:`setup-hint`,children:c(`gpu.noPresets`)}),m&&V(`div`,{className:`gpu-guided`,children:[A&&P(`p`,{className:`setup-hint`,id:u,children:c(`gpu.guided.lede`,{gb:$(A.gpu_gb)})}),g===null?V(`p`,{className:`setup-hint`,role:`status`,children:[P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,c(`gpu.guided.loading`)]}):v===null?P(`p`,{className:`setup-hint`,children:c(`gpu.noPresets`)}):P(`ol`,{className:`gpu-steps`,"aria-labelledby":u,children:g.map(e=>{let t=Kj(e);return V(`li`,{children:[P(`span`,{children:e}),t&&V(`button`,{type:`button`,className:`btn-secondary gpu-copy`,onClick:()=>void ie(t),"aria-label":c(`gpu.copyAria`,{what:t}),children:[P(O===t?pr:zr,{size:12,"aria-hidden":`true`}),c(O===t?`gpu.copied`:`gpu.copy`)]})]},e)})}),V(Uj,{children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>h(!1),disabled:S!==null,children:c(`gpu.guided.back`)}),!ee&&v!==null&&V(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void ne(),disabled:S!==null||f==null,children:[S===`done`&&P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,c(`gpu.guided.done`)]})]})]}),S===`apply`||S===`revert`?V(`p`,{className:`setup-hint`,role:`status`,children:[P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,c(`gpu.waiting`)]}):null,w?.kind===`denied`&&V(`div`,{className:`gpu-notice is-warn`,role:`alert`,children:[P(q,{size:14,"aria-hidden":`true`}),P(`span`,{children:c(`gpu.denied`)})]}),w?.kind===`error`&&P(`p`,{className:`setup-error`,role:`alert`,children:w.message}),!m&&(()=>{let t=!ae&&ee&&d.length>0&&P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>x(`apply`),disabled:S!==null||f==null,children:w?.kind===`denied`||L?.state===`not_applied`?c(`gpu.tryAgain`):c(`gpu.apply`)}),r=!ae&&d.length>0&&R&&P(`button`,{type:`button`,className:ee?`btn-secondary`:`btn-primary`,onClick:()=>void z(),disabled:S!==null,children:c(`gpu.showMe`)});return n===`setup`?V(Uj,{children:[o&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:o,children:c(`setup.back`)}),ae?a&&P(`button`,{type:`button`,className:`btn-primary`,onClick:a,autoFocus:!0,children:c(`setup.continue`)}):V(D.Fragment,{children:[i&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:i,disabled:S!==null,children:c(`gpu.skip`)}),ee?V(D.Fragment,{children:[r,t]}):r]})]}):V(`div`,{className:`setup-row gpu-actions`,children:[t,r,e.revert?.available&&V(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>x(`revert`),disabled:S!==null,children:[P(Ia,{size:13,"aria-hidden":`true`}),` `,c(`gpu.undo`)]})]})})(),b===`apply`&&f!=null&&V(Wj,{title:A?c(`gpu.consent.title`,{gb:$(A.gpu_gb)}):c(`gpu.consent.titleAny`),confirmLabel:c(`setup.continue`),cancelLabel:c(`setup.cancel`),onConfirm:()=>void B(),onCancel:()=>x(null),children:[P(`p`,{children:A?c(`gpu.consent.body`,{name:e.setting?.name??``,gb:$(A.gpu_gb)}):c(`gpu.consent.bodyAny`,{name:e.setting?.name??``})}),P(`p`,{className:`confirm-note`,children:c(`gpu.consent.saved`,{gb:$(e.gpu_gb??0)})})]}),b===`revert`&&P(Wj,{title:c(`gpu.revert.title`),confirmLabel:c(`setup.continue`),cancelLabel:c(`setup.cancel`),onConfirm:()=>void te(),onCancel:()=>x(null),children:P(`p`,{children:c(`gpu.revert.body`)})})]})}function eM({plan:e,planError:t,onRetryPlan:n,onUseRecommended:r,selection:i,onSelection:a,cloud:o,keepTrying:s,onKeepTrying:c,onBack:l,onContinue:u,busy:d,error:f}){let p=T(),m=(0,J.useRef)(null),[h,g]=(0,J.useState)(!1),_=!!e&&!!i&&!!e.catalog,v=(0,J.useRef)(null);if(_&&v.current===null&&(v.current=!o&&hj(YA(e),i).length===0&&!!i.defaultChat&&YA(e).some(e=>e.downloaded)),(0,J.useEffect)(()=>{_&&m.current?.querySelector(`input:not([disabled])`)?.focus()},[_,h]),t&&!_)return V(`div`,{className:`setup-models-error`,children:[P(`p`,{className:`setup-error`,role:`alert`,children:p(`setup.models.listFailed`,{reason:t})}),V(`div`,{className:`setup-row`,children:[P(`button`,{type:`button`,className:`btn-primary`,onClick:n,children:p(`setup.tryAgain`)}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:r,children:p(`setup.models.useRecommended`)})]}),P(`p`,{className:`setup-hint`,children:p(`setup.models.useRecommendedNote`)})]});if(!_)return P(Fj,{});let y=YA(e),b=hj(y,i),x=!o&&!i.defaultChat,S=_j(e,i),C=o?[]:y.filter(e=>e.fits===!1&&i.ticked.has(e.id)),w=!h&&!!v.current&&b.length===0,E=p(S?`setup.continueAnyway`:`setup.continue`);return w?V(`div`,{className:`setup-present`,role:`status`,children:[V(`p`,{children:[P(pr,{size:14,"aria-hidden":`true`}),` `,p(`setup.models.allPresent`)]}),P(`button`,{type:`button`,className:`link-btn`,onClick:()=>g(!0),children:p(`setup.models.change`)}),V(Uj,{children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:l,disabled:d,children:p(`setup.back`)}),V(`button`,{type:`button`,className:`btn-primary`,onClick:()=>u(!1),disabled:d,children:[d&&P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,p(`setup.finish`)]})]}),f&&P(`p`,{className:`setup-error`,role:`alert`,children:f})]}):V(`div`,{className:`setup-models`,ref:m,children:[P(`p`,{className:`setup-hint`,children:p(`setup.job.lede`)}),P(zj,{plan:e,selection:i,onSelection:a,disabled:d}),!o&&P(`button`,{type:`button`,className:`link-btn setup-reset`,onClick:()=>a(mj(e)),disabled:d,children:p(`setup.models.resetRecommended`)}),V(`div`,{className:`setup-models-footer`,children:[P(jj,{plan:e,selection:i}),V(`label`,{className:`setup-keep-trying`,children:[P(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),disabled:d}),P(`span`,{children:p(`setup.keepTrying`)})]}),P(JA,{open:x,children:P(`p`,{className:`setup-error`,id:`setup-no-chat`,children:p(`setup.models.noChatReason`)})}),C.length>0&&P(`span`,{className:`visually-hidden`,children:C.map(e=>Oj(e,p)).join(` `)}),f&&P(`p`,{className:`setup-error`,role:`alert`,children:f}),V(Uj,{children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:l,disabled:d,children:p(`setup.back`)}),V(`button`,{type:`button`,className:`btn-primary`,onClick:()=>u(!!S),disabled:d||x,"aria-describedby":x?`setup-no-chat`:void 0,children:[d&&P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,E]})]})]})]})}function tM({plan:e,chatModel:t,gpu:n}){let r=T();if(!e?.catalog)return null;let i=e.catalog,a=e=>e?i.find(t=>t.id===e)?.name??e:null,o=nj(i,{ticked:new Set,unticked:new Set,chatChosen:!1,defaultChat:t,vision:e.vision_model??null}),s=i.find(e=>e.id===o)??i.find(e=>XA(e)&&e.gaia_model),c=i.find(e=>ZA(e)&&e.downloaded),l=i.filter(e=>e.gaia_model&&e.planned&&e.skipped),u=n?.pending,d=i.find(e=>e.id===t);return V(`dl`,{className:`setup-summary-list`,children:[t&&V(`div`,{children:[P(`dt`,{children:r(`setup.ready.chat`)}),V(`dd`,{children:[P(`bdi`,{children:a(t)}),d?.recipe===`flm`?` (${r(`setup.models.npu`)})`:``]})]}),V(`div`,{children:[P(`dt`,{children:r(`setup.ready.vision`)}),P(`dd`,{children:s?.downloaded?P(`bdi`,{children:s.name}):r(`setup.ready.visionOff`,{name:s?.name??`Gemma-4-E4B-it`})})]}),c&&V(`div`,{children:[P(`dt`,{children:r(`setup.ready.documents`)}),P(`dd`,{children:P(`bdi`,{children:c.name})})]}),l.length>0&&V(`div`,{children:[P(`dt`,{children:r(`setup.ready.notInstalled`)}),P(`dd`,{children:l.map(e=>e.name).join(`, `)})]}),u?.state===`restart_required`&&V(`div`,{className:`is-warn`,children:[P(`dt`,{children:r(`setup.ready.gpu`)}),V(`dd`,{children:[P(q,{size:13,"aria-hidden":`true`}),` `,Jj(r,n?qj(n,u.setting_gb):null)]})]}),u?.state===`took_effect`&&V(`div`,{children:[P(`dt`,{children:r(`setup.ready.gpu`)}),P(`dd`,{children:n?.gpu_gb==null?r(`setup.ready.gpuChanged`):r(`setup.ready.gpuNow`,{gb:$(n.gpu_gb)})})]})]})}function nM(e){if(e.skill===`document-brief`){let t=/^(\d+) /.exec(e.note)?.[1];return t?{n:Number(t)}:void 0}if(e.skill===`coding`){let t=/^In (.+)$/.exec(e.note)?.[1];return t?{folder:t}:void 0}}function rM(e,t,n,r){let i=`${n}.one`,a=`${n}.other`,o=N(i)&&N(a)&&typeof r?.n==`number`?r.n===1?i:a:n;return!N(o)||c[o].includes(`{`)&&!r?t:z(o,r)===t?e(o,r):t}function iM(e,t){return{title:rM(t,e.title,`card.${e.skill}.title`),note:rM(t,e.note,`card.${e.skill}.note`,nM(e))}}function aM({text:e}){let t=o(e);return t.length===1?P(D.Fragment,{children:e}):P(D.Fragment,{children:t.map((e,t)=>P(`span`,{className:`start-card-part`,children:e},t))})}function oM({cards:e,onPick:t,disabled:n}){let r=T();return e.length===0?null:P(`ul`,{className:`start-cards`,"aria-label":r(`newChat.cardsLabel`),children:e.map(e=>{let{title:i,note:a}=iM(e,r);return P(`li`,{children:V(`button`,{type:`button`,className:`start-card`,onClick:()=>t(e),disabled:n,title:e.needs_input?`${e.prompt}…`:e.prompt,children:[V(`span`,{className:`start-card-title`,children:[i,P(qn,{size:13,"aria-hidden":`true`})]}),P(`span`,{className:`start-card-note`,children:P(aM,{text:a})})]})},e.skill)})})}function sM(){let[e,t]=(0,J.useState)(null),[n,r]=(0,J.useState)([]),i=(0,J.useCallback)(()=>{Promise.resolve(wn()).then(e=>{t(e?.providers?.find(e=>e.id===`amd`)?.network??null),r(e?.providers??[])}).catch(e=>{console.warn(`[useGatewayNetwork] could not check the AMD gateway`,e),t(null)})},[]);return(0,J.useEffect)(i,[i]),{network:e,providers:n,recheck:i}}function cM(e,t,n){return t===`active`?n(`setup.contents.working`):t===`done`?n(`setup.contents.ready`):t===`failed`?n(`setup.contents.failed`):e.installed?n(`setup.contents.alreadyHere`):n(`setup.contents.waiting`)}function lM(e,t){return e==null?t(`setup.contents.sizeOnDownload`):$(e)}function uM({state:e}){return e===`done`?P(pr,{size:13,"aria-hidden":`true`}):e===`active`?P(K,{size:13,className:`spin`,"aria-hidden":`true`}):P(e===`failed`?So:jr,{size:13,"aria-hidden":`true`})}function dM({id:e,error:t,transient:n,onRetry:r,disabled:i}){let a=T(),o=a(`setup.component.${e}`);return V(`div`,{className:`setup-content-failure`,role:`alert`,children:[P(`p`,{children:a(n?`setup.contents.failedNetwork`:`setup.contents.failedOther`,{name:o})}),t&&V(`details`,{className:`dl-details`,children:[P(`summary`,{children:a(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:t})]}),r&&P(`button`,{type:`button`,className:`btn-primary`,onClick:r,disabled:i,"aria-label":a(`setup.contents.retryNamed`,{name:o}),children:a(`setup.progress.retry`)})]})}function fM({plan:e,run:t,models:n=[],onRetry:r,retryDisabled:i}){let a=T();return V(`ul`,{className:`setup-contents`,children:[(e.components??[]).map(e=>{let n=t?.components?.[e.id],o=t!=null&&t.state!==`running`&&t.state!==`verifying`,s=n===`active`&&o?void 0:n;return V(`li`,{className:`setup-content is-${s??(e.installed?`done`:`waiting`)}`,children:[P(`span`,{className:`setup-content-icon`,children:P(uM,{state:s??(e.installed?`done`:void 0)})}),V(`span`,{className:`setup-content-main`,children:[P(`span`,{className:`setup-content-name`,children:a(`setup.component.${e.id}`)}),P(`span`,{className:`setup-content-note`,children:a(`setup.component.${e.id}Note`)}),V(`span`,{className:`setup-content-from`,children:[a(`setup.contents.from`),` `,P(`bdi`,{dir:`ltr`,children:e.source})]})]}),V(`span`,{className:`setup-content-side`,children:[P(`bdi`,{dir:`ltr`,children:lM(e.size_gb,a)}),P(`span`,{children:cM(e,s,a)})]}),s===`failed`&&o&&!t?.problem&&P(dM,{id:e.id,error:t?.error,transient:t?.component_kinds?.[e.id]===`transient`,onRetry:r,disabled:i})]},e.id)}),n.map(e=>V(`li`,{className:`setup-content is-waiting`,children:[P(`span`,{className:`setup-content-icon`,children:P(uM,{state:void 0})}),V(`span`,{className:`setup-content-main`,children:[P(`span`,{className:`setup-content-name`,children:P(`bdi`,{children:e.name})}),P(`span`,{className:`setup-content-note`,children:e.roles.map(e=>a(`setup.purpose.${e}`)).join(` · `)}),e.source&&V(`span`,{className:`setup-content-from`,children:[a(`setup.contents.from`),` `,P(`bdi`,{dir:`ltr`,children:e.source})]})]}),P(`span`,{className:`setup-content-side`,children:P(`bdi`,{dir:`ltr`,children:lM(e.size_gb,a)})})]},e.id))]})}function pM({lines:e,className:t,id:n}){let r=(0,J.useRef)(null),i=(0,J.useRef)(!0),a=e.join(`
78
+ `);return(0,J.useEffect)(()=>{let e=r.current;e&&i.current&&(e.scrollTop=e.scrollHeight)},[a]),P(`pre`,{ref:r,id:n,className:t,dir:`ltr`,tabIndex:0,onScroll:e=>{let t=e.currentTarget;i.current=t.scrollHeight-t.scrollTop-t.clientHeight<8},children:a})}var mM=1e9,hM={downloading:0,verifying:1,failed:2,ready:3,unchecked:3,cancelled:4,queued:5,skipped:6};function gM(e){return e.roles.includes(`embedding`)?0:e.roles.includes(`chat`)?1:2}function _M(e){return[...e].filter(e=>e.state!==`skipped`).sort((e,t)=>hM[e.state]-hM[t.state]||gM(e)-gM(t))}var vM=/^\s*(Downloading:|Downloaded\b|\[[=\-\s>#]*\])/;function yM(e){return e.some(e=>e.trim()&&!vM.test(e))}var bM={queued:`setup.state.queued`,downloading:`setup.state.downloading`,verifying:`setup.state.verifying`,ready:`setup.state.ready`,failed:`setup.state.failed`,skipped:`setup.state.skipped`,cancelled:`setup.state.cancelled`,unchecked:`setup.state.unchecked`};function xM(e){return e?e.state===`running`||e.state===`verifying`||!!e.models?.some(e=>e.state===`downloading`||e.state===`queued`||e.state===`verifying`):!1}function SM(e,t,n,r){switch(e.error_kind){case`network`:return r(`setup.fail.network`,{name:t});case`disk_full`:{let i=Math.max(0,e.bytes_total-e.bytes_done)/1e9,a=n==null?i:Math.max(.1,i-n);return r(`setup.fail.diskFull`,{name:t,done:MS(e.bytes_done),need:$(a)})}case`verify`:return r(`setup.fail.verify`,{name:t});case`memory`:return r(`setup.fail.testMemory`,{name:t});case`stuck`:return r(`setup.fail.testStuck`,{name:t});case`answer`:return r(`setup.fail.testAnswer`,{name:t});case`window`:return r(`setup.fail.testWindow`,{name:t});case`path_too_long`:return r(`setup.fail.pathTooLong`,{name:t});default:return r(`setup.fail.lemonade`,{name:t})}}function CM({model:e,name:t,estimate:n,now:r,freeGb:i,onRetry:a,onResume:o,onSkip:s,onRestart:c,busy:l,retryLater:u,checking:d,checkingFor:f}){let p=T(),m=(0,J.useId)(),h=(0,J.useId)(),[g,_]=(0,J.useState)(!1),v=e.log??[],y=e.bytes_total>0?Math.min(100,e.bytes_done/e.bytes_total*100):e.state===`ready`?100:0,b=p(bM[e.state]),x=e.retrying_until?Math.max(0,Math.round(e.retrying_until-r/1e3)):0,S=e.state===`downloading`&&!x?n?.stalledFor??0:0,C=e.state===`verifying`&&d||e.state===`downloading`&&!x&&S<15,w;if(e.state===`downloading`){let t=PS(p.locale,e.bytes_total>0?`${MS(e.bytes_done)} / ${MS(e.bytes_total)}`:MS(e.bytes_done));if(x>0)w=p(`setup.progress.retrying`,{n:String(x)});else if(S>=60)w=p(`setup.progress.stuck`);else if(S>=15)w=p(`setup.progress.stalled`,{n:`15`});else if(n?.speed&&n.eta!=null){let{speed:e,eta:r}=n;w=p.compose(n=>`${t} · ${PS(p.locale,NS(e))} · ${FS(r,n)}`)}else w=p.compose(e=>`${t} · ${e(`setup.progress.estimating`)}`)}else w=e.state===`verifying`?d?f>=10?p(`setup.progress.checkingFor`,{n:String(f)}):p(`setup.progress.checkingLoad`):p(`setup.progress.waitingCheck`):e.state===`ready`?e.bytes_total?MS(e.bytes_total):``:e.state===`unchecked`?p(`setup.progress.unchecked`):e.state===`cancelled`?e.bytes_done>0?p(`setup.progress.keptPartial`,{done:MS(e.bytes_done)}):``:e.state===`queued`&&e.bytes_total?MS(e.bytes_total):``;let E=e.state===`downloading`?p.compose(t=>[t(`setup.progress.percent`,{n:String(Math.floor(y))}),e.bytes_total?t(`setup.progress.of`,{done:MS(e.bytes_done),total:MS(e.bytes_total)}):null,n?.eta==null?null:IS(n.eta,t)].filter(Boolean).join(`, `)):b;return V(`li`,{className:`dl-row is-${e.state}${C?` is-live`:``}${S>=15?` is-stalled`:``}`,children:[V(`div`,{className:`dl-row-head`,children:[P(`span`,{className:`dl-icon`,"aria-hidden":`true`,children:e.state===`ready`||e.state===`unchecked`?P(pr,{size:14}):e.state===`failed`?P(Cr,{size:14}):e.state===`cancelled`?P(Sa,{size:13}):P(`span`,{className:`dl-dot`})}),P(`span`,{className:`dl-name`,children:P(`bdi`,{title:e.id,children:t})}),P(`span`,{className:`dl-state`,children:b}),e.state===`downloading`&&V(`bdi`,{className:`dl-pct`,children:[Math.floor(y),`%`]}),e.state!==`failed`&&yM(v)&&P(`button`,{type:`button`,className:`dl-log-toggle`,onClick:()=>_(e=>!e),"aria-expanded":g,"aria-controls":h,"aria-label":p(`setup.progress.logFor`,{name:t}),title:p(`setup.progress.logFor`,{name:t}),children:P(yr,{size:14,className:g?`is-open`:``,"aria-hidden":`true`})})]}),P(`div`,{className:`dl-track`,role:`progressbar`,"aria-label":p(`setup.progress.rowLabel`,{name:t,state:b}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":C&&e.state===`verifying`?void 0:Math.floor(y),"aria-valuetext":E,children:P(`span`,{className:`dl-fill`,style:{inlineSize:`${e.state===`verifying`?100:y}%`}})}),w&&P(`p`,{className:`dl-detail`,children:P(`bdi`,{children:w})}),g&&e.state!==`failed`&&yM(v)&&P(pM,{lines:v,id:h,className:`dl-log`}),e.state===`failed`&&V(`div`,{className:`dl-fail`,children:[P(`p`,{className:`dl-error`,id:m,children:SM(e,t,i,p)}),(v.length>0||e.error)&&V(`details`,{className:`dl-details`,children:[P(`summary`,{children:p(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:v.length>0?v.join(`
79
+ `):e.error})]}),u?P(`p`,{className:`dl-detail`,children:p(`setup.progress.retryLater`)}):V(`div`,{className:`setup-row`,children:[a&&V(`button`,{type:`button`,className:`btn-primary`,disabled:l,onClick:()=>a(e.id,e.error_kind),"aria-describedby":m,children:[P(Ra,{size:13,"aria-hidden":`true`}),` `,p(`setup.progress.retry`)]}),s&&P(`button`,{type:`button`,className:`btn-secondary`,disabled:l,onClick:()=>s(e.id),children:p(`setup.progress.skipModel`)})]})]}),e.state===`cancelled`&&o&&P(`div`,{className:`setup-row`,children:P(`button`,{type:`button`,className:`btn-secondary`,disabled:l,onClick:()=>o(e.id),children:p(`setup.progress.resume`)})}),S>=60&&c&&P(`div`,{className:`setup-row`,children:V(`button`,{type:`button`,className:`btn-secondary`,disabled:l,onClick:c,children:[P(Ra,{size:13,"aria-hidden":`true`}),` `,p(`setup.progress.retry`)]})})]})}function wM({status:e,names:t,freeGb:n=null,onCancel:r,onRetry:i,onResume:a,onResumeAll:o,onSkip:s,onRestart:c,busy:l=!1,retryLater:u=!1,labelledBy:d}){let f=T(),p=KA(),m=(0,J.useMemo)(()=>_M(e.models??[]),[e.models]),h=(0,J.useRef)(new Map),g=(0,J.useRef)(new Map),_=(0,J.useRef)(new RS),v=(0,J.useRef)(!1),[y,b]=(0,J.useState)(()=>Date.now()),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),E=i&&((e,t)=>{let n=m.find(t=>t.id===e);t===`verify`&&n?w(n):i(e,t)}),[D,O]=(0,J.useState)(``),[k,A]=(0,J.useState)(``),j=(0,J.useRef)(null),M=e.state===`verifying`||e.state!==`running`&&m.some(e=>e.state===`verifying`),N=(0,J.useRef)(new Map);(0,J.useEffect)(()=>{if(!p||!(m.some(e=>e.retrying_until)||M))return;let e=setInterval(()=>b(Date.now()),1e3);return()=>clearInterval(e)},[m,p,M]);let F=e.overall,{estimates:I,overallEstimate:L}=(0,J.useMemo)(()=>{let e=Date.now(),t={};for(let n of m){if(n.state!==`downloading`){h.current.delete(n.id);continue}let r=h.current.get(n.id),i=n.downloaded_before_gb??null;(!r||g.current.get(n.id)!==i)&&(r=new RS,h.current.set(n.id,r),g.current.set(n.id,i)),t[n.id]=r.update(n.bytes_done,n.bytes_total,e)}let n=m.some(e=>e.state===`downloading`);n&&!v.current&&(_.current=new RS),v.current=n;let r=m.filter(e=>e.state===`downloading`||e.state===`queued`).reduce((e,t)=>e+Math.max(0,t.bytes_total-t.bytes_done),0);return{estimates:t,overallEstimate:n&&F?_.current.update(F.bytes_done,F.bytes_done+r,e):void 0}},[m,F]);(0,J.useEffect)(()=>{let e=new Map(m.map(e=>[e.id,e.state])),n=Math.floor((F?.percent??0)/25),r=j.current;if(j.current={states:e,quarter:n},!r)return;let i=[];for(let e of m){if(r.states.get(e.id)===e.state)continue;let n=t[e.id]??e.id;e.state===`failed`?A(f(`setup.progress.announceFailed`,{name:n})):i.push(f(`setup.progress.announceState`,{name:n,state:f(bM[e.state])}))}n>r.quarter&&n>0&&n<4&&i.push(f(`setup.progress.announceOverall`,{n:String(n*25)})),i.length&&O(i.join(`. `))},[m,F?.percent,t,f]);let ee=e=>{if(!M)return N.current.delete(e),0;let t=Date.now(),n=N.current.get(e)??t;return N.current.set(e,n),Math.floor((t-n)/1e3)},R=xM(e),z=m.filter(e=>e.state===`cancelled`),B=F?.failed??m.filter(e=>e.state===`failed`).length,te=F?.percent??0,ne=()=>{(F?.bytes_done??0)>mM?S(!0):r?.()},re=f.compose(e=>[e(`setup.progress.overallPct`,{n:String(te)}),F&&F.bytes_total>0?e(`setup.progress.of`,{done:MS(F.bytes_done),total:MS(F.bytes_total)}):null,R&&L?.speed?PS(f.locale,NS(L.speed)):null,R?L?.eta==null?e(`setup.progress.estimating`):e(`setup.progress.left`,{eta:FS(L.eta,e)}):null,B>0?e(`setup.progress.failedCount`,{n:String(B)}):null].filter(Boolean).join(` · `));return V(`section`,{className:`dl${p?``:` is-paused`}`,"aria-labelledby":d,children:[V(`div`,{className:`dl-overall`,children:[P(`p`,{className:`dl-overall-line`,children:P(`bdi`,{children:re})}),P(`div`,{className:`dl-track is-overall${m.some(e=>e.state===`downloading`)?` is-live`:``}`,role:`progressbar`,"aria-label":f(`setup.progress.overallLabel`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":te,"aria-valuetext":f(`setup.progress.percent`,{n:String(te)}),children:P(`span`,{className:`dl-fill`,style:{inlineSize:`${te}%`}})})]}),P(`ul`,{className:`dl-list`,children:m.map(e=>P(CM,{model:e,name:t[e.id]??e.id,estimate:I[e.id],now:y,freeGb:n,onRetry:E,onResume:R?void 0:a,onSkip:s,onRestart:c,busy:l,retryLater:u,checking:M,checkingFor:ee(e.id)},e.id))}),R&&P(`p`,{className:`setup-hint dl-controls`,children:f(`setup.progress.keepsGoing`)}),(R&&r||!R&&z.length>0&&o)&&V(Uj,{children:[R&&r&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:ne,disabled:l,children:f(`setup.progress.cancel`)}),!R&&z.length>0&&o&&P(`button`,{type:`button`,className:`btn-primary`,onClick:o,disabled:l,children:f(`setup.progress.resumeAll`)})]}),P(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:D}),P(`span`,{className:`visually-hidden`,role:`alert`,children:k}),x&&P(Wj,{title:f(`setup.progress.cancelTitle`),confirmLabel:f(`setup.progress.cancelConfirm`),cancelLabel:f(`setup.progress.cancelKeep`),onConfirm:()=>{S(!1),r?.()},onCancel:()=>S(!1),children:P(`p`,{children:f(`setup.progress.cancelBody`)})}),C&&P(Wj,{title:f(`setup.redownload.title`,{name:t[C.id]??C.id}),confirmLabel:f(`setup.redownload.confirm`),cancelLabel:f(`setup.redownload.keep`),onConfirm:()=>{let e=C;w(null),i?.(e.id,`verify`)},onCancel:()=>w(null),children:P(`p`,{children:f(`setup.redownload.body`,{name:t[C.id]??C.id,size:MS(C.bytes_total)})})})]})}var TM=[`check`,`download`,`test`],EM={root:`setup-report`,button:`btn-secondary setup-report-button`,hint:`setup-hint`,error:`setup-error`};function DM({run:e,before:t={}}){let n=T(),[r,i]=(0,J.useState)(()=>new Set),a=e=>i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),o=n=>[...t[n]??[],...e?.logs?.[n]??[]],s=TM.filter(e=>o(e).length>0);return V(`section`,{className:`setup-logs`,"aria-label":n(`setup.logs.title`),children:[s.map(e=>{let t=o(e),i=r.has(e);return V(`div`,{className:`setup-log`,children:[V(`button`,{type:`button`,className:`setup-log-toggle`,onClick:()=>a(e),"aria-expanded":i,children:[P(yr,{size:13,className:i?`is-open`:``,"aria-hidden":`true`}),` `,n(`setup.logs.${e}`)]}),i&&P(pM,{lines:t,className:`setup-log-pre`})]},e)}),P(tC,{classes:EM,note:n(`setup.logs.reportNote`)})]})}function OM(){let e=T(),t=k(e=>e.locale),n=k(e=>e.setLocale);return V(`label`,{className:`setup-language`,children:[P(Gi,{size:14,"aria-hidden":`true`}),P(`span`,{className:`visually-hidden`,children:e(`settings.language`)}),P(`select`,{value:t,onChange:e=>n(e.target.value),children:b.map(({meta:e})=>P(`option`,{value:e.code,lang:e.code,dir:e.dir,children:M(e)},e.code))})]})}var kM={driver:[`setup.npu.problem.driver`,`setup.npu.fix.driver`],device:[`setup.npu.problem.device`,`setup.npu.fix.device`],firmware:[`setup.npu.problem.firmware`,`setup.npu.fix.firmware`],access:[`setup.npu.problem.access`,`setup.npu.fix.access`],memlock:[`setup.npu.problem.memlock`,`setup.npu.fix.memlock`],runtime:[`setup.npu.problem.runtime`,`setup.npu.fix.runtime`]},AM={cancelled:`setup.npu.fixError.cancelled`,timeout:`setup.npu.fixError.timeout`,not_authorized:`setup.npu.fixError.notAuthorized`,no_pkexec:`setup.npu.fixError.noPkexec`};function jM({problem:e}){let t=T(),n=kM[e.code];if(!n)return V(`li`,{children:[P(`strong`,{children:e.title}),` `,e.fix]});let r=e.params,i=n[1];e.code===`access`&&r.group&&(i=`setup.npu.fix.accessGroup`);let a=n[0];return e.code===`memlock`&&r.fix===`restart`&&(a=`setup.npu.problem.memlockStill`,i=`setup.npu.fix.memlockRestart`),e.code===`memlock`&&r.fix===`stuck`&&(a=`setup.npu.problem.memlockStuck`,i=`setup.npu.fix.memlockStuck`),V(`li`,{children:[P(`strong`,{children:t(a,{device:r.device??``,limit:r.limit??``,version:r.version??``,detail:r.detail??``})}),` `,t(i,{group:r.group??``})]})}function MM({problems:e,disabled:t,onRecheck:n,id:r=`setup-npu-problems`}){let i=T(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),l=e.some(e=>e.code===`memlock`&&e.params.fix===`apply`),u=async(e,t)=>{o(!0),c(null);try{await e(),n?.()}catch(e){let n=e instanceof vn?e.body?.code:void 0,r=n&&n in AM?AM[n]:t;c(i(r))}finally{o(!1)}};return V(`div`,{className:`setup-npu-problems`,id:r,role:`note`,children:[P(`p`,{children:i(`setup.npu.notReady`)}),P(`ul`,{children:e.map(e=>P(jM,{problem:e},e.code))}),P(`p`,{className:`setup-hint`,children:i(`setup.npu.meanwhile`)}),s&&P(`p`,{className:`setup-npu-error`,role:`alert`,children:s}),V(`div`,{className:`setup-npu-actions`,children:[l&&P(`button`,{type:`button`,className:`btn-primary`,disabled:t||a,onClick:()=>void u(Ne,`setup.npu.fixError.failed`),children:i(`setup.npu.fixMemlock`)}),n&&P(`button`,{type:`button`,className:`btn-secondary`,disabled:t||a,onClick:()=>void u(lt,`setup.npu.recheckFailed`),children:i(`setup.npu.recheck`)})]})]})}async function NM(){let e=await be();e.reachable&&(e.available_backends??[]).some(e=>e.name===`vulkan`)&&(e.preferred_backend??e.default_backend)!==`vulkan`&&await Pe(`vulkan`)}function PM({plan:e,selection:t,onSelection:n,disabled:r=!1,onRecheck:i}){let a=T(),o=YA(e),s=e.npu?.present&&!e.npu.ready?e.npu.problems:[],c=s.length?void 0:o.find(e=>QA(e)&&e.gaia_model&&e.chat_choice&&e.fits!==!1)??o.find(e=>QA(e)&&e.chat_choice&&e.downloaded&&!$A(e)),l=!s.length&&!c&&o.some(e=>QA(e)&&e.fit_code===`npu`),u=!!o.find(e=>e.id===t.defaultChat&&QA(e)),d=mj(e).defaultChat,f=d&&!o.find(e=>e.id===d&&QA(e))?d:o.find(e=>e.chat_choice&&e.gaia_model&&e.support===`verified`&&!QA(e))?.id,p=e=>{e===`npu`&&c&&!u&&n(ij(t,o,c.id)),e===`gpu`&&u&&f&&n(ij(t,o,f))},m=[{id:`gpu`,label:a(`setup.backend.gpu`)},...c?[{id:`npu`,label:a(`setup.backend.npu`)}]:[],...s.length?[{id:`npu`,label:a(`setup.backend.npu`),unavailable:!0}]:[]],h=u?`npu`:`gpu`;return V(`section`,{className:`setup-backend`,"aria-labelledby":`setup-backend-title`,children:[P(`h3`,{className:`mc-job-title`,id:`setup-backend-title`,children:a(`setup.backend.title`)}),P(`div`,{className:`segmented`,role:`radiogroup`,"aria-labelledby":`setup-backend-title`,children:m.map(e=>P(`button`,{type:`button`,role:`radio`,"aria-checked":h===e.id,"aria-describedby":e.unavailable?`setup-npu-problems`:void 0,className:h===e.id?`is-active`:``,disabled:r||e.unavailable,onClick:()=>p(e.id),children:P(`bdi`,{children:e.label})},e.id))}),s.length>0?P(MM,{problems:s,disabled:r,onRecheck:i}):P(`p`,{className:`setup-hint`,children:a(c?`setup.backend.hint`:l?`setup.backend.hintNpuUnusable`:`setup.backend.hintNoNpu`)})]})}var FM=({children:e})=>P(`bdi`,{dir:`ltr`,children:e});function IM({label:e,children:t}){return V(`div`,{className:`found-row`,children:[P(`dt`,{children:e}),P(`dd`,{children:t})]})}function LM(e){return e.family?`${e.name} (${e.family})`:e.name}var RM=[[`llamacpp`,`llama.cpp`],[`flm`,`FastFlowLM`],[`whispercpp`,`whisper.cpp`],[`kokoro`,`Kokoro`],[`sd-cpp`,`stable-diffusion.cpp`]],zM=new Set([`llamacpp`,`flm`]);function BM(e){let t=[];for(let[n,r]of RM){let i=(e.backends??[]).find(e=>e.recipe===n&&e.default);i&&i.state!==`unsupported`&&t.push({name:r,b:i})}return t}function VM(e,t){return e?e.kind===`release_candidate`&&e.rc?`${e.version.replace(/rc\d+$/,``)} RC ${e.rc}`:e.kind===`source`&&e.commit?`${e.version} (${e.commit})`:e.version:t??null}var HM={release:`release`,release_candidate:`release candidate`,local:`local build`,source:`from source`};function UM(e,t){let n=e.system,r=e=>(n?.devices??[]).filter(t=>t.available&&e(t.kind)),i=r(e=>e.endsWith(`gpu`)),a=r(e=>e.endsWith(`npu`)),o=BM(e);return{sys:n,cpu:r(e=>e===`cpu`)[0],gpus:i,npus:a,runsOn:i[0]?.name??t?.gpu_name??null,npu:a[0]??null,runtimes:o,gaia:VM(n?.gaia_build,n?.gaia_version),build:n?.gaia_build?.kind??null,software:[VM(n?.gaia_build,n?.gaia_version)?`GAIA ${VM(n?.gaia_build,n?.gaia_version)}`:null,n?.lemonade_version?`Lemonade ${n.lemonade_version}`:null,...o.filter(({b:e})=>zM.has(e.recipe)&&GM(e)).map(({name:e,b:t})=>`${e} ${t.version??t.backend}`)].filter(e=>!!e),totalMemory:AS(n?.physical_memory,t?.ram_gb),freeGb:e.disk?.free_gb??t?.disk_free_gb??null,modelsPath:e.disk?.path??null,gaiaHome:n?.gaia_home??null}}var WM={installed:`installed`,update_required:`installed, updates on first use`},GM=e=>e.state===`installed`||e.state===`update_required`,KM={chat:`setup.job.chat`,vision:`setup.job.vision`,embedding:`setup.job.documents`,speech:`setup.job.speech`,voice:`setup.job.voice`,image_creation:`setup.job.images`};function qM(e,t){let n=UM(e,t),r=e.lemonade.mode===`external`?`the user's own`:`GAIA's own`;return[`GAIA: ${n.gaia??`unknown`}${n.build?`, ${HM[n.build]}`:``} (agent ${n.sys?.agent_version??`not installed yet`})`,`Model server: ${r} Lemonade ${n.sys?.lemonade_version??`(version not reported)`}${e.lemonade.url?` at ${e.lemonade.url}`:``}`,...n.runtimes.map(({name:e,b:t})=>`${e}: ${t.backend}${t.version?` ${t.version}`:``} (${WM[t.state??``]??`not installed`})`),`OS: ${n.sys?.os??t?.os??`unknown`}`,`Processor: ${n.cpu?.name??n.sys?.processor??`unknown`}${n.cpu?.cores?` (${n.cpu.cores} cores, ${n.cpu.threads??n.cpu.cores} threads)`:``}`,`Graphics: ${n.gpus.map(LM).join(`; `)||t?.gpu_name||`none found`}`,`NPU: ${n.npus.map(LM).join(`; `)||`none found`}`,`Memory: ${n.totalMemory??`unknown`}${e.capacity_gb==null?``:`, ${$(e.capacity_gb)} for models${e.memory_source?` (${e.memory_source})`:``}`}`,`Models folder: ${n.modelsPath??`unknown`}${n.freeGb==null?``:` (${$(n.freeGb)} free)`}`,`GAIA data and logs: ${n.gaiaHome??`unknown`}`].join(`
80
+ `)}function JM({plan:e,hardware:t,onChangeMemory:n}){let r=T(),i=UM(e,t),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(null),d=async e=>{u(null);try{await En(e,!1)}catch(e){u(r(`setup.found.openFailed`,{error:e instanceof Error?e.message:String(e)}))}},f=P(`span`,{className:`found-muted`,children:r(`setup.found.unknown`)}),p=[...t?.blockers??[],...(t?.warnings??[]).filter(e=>t?.lemonade_running||!/\bNPU\b/.test(e))],m=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let h=e=>{c(e),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>c(null),2e3)};return V(`section`,{className:`setup-card found`,"aria-label":r(`setup.found.title`),children:[V(`div`,{className:`found-head`,children:[P(`h3`,{className:`mc-job-title`,children:r(`setup.found.title`)}),P(`button`,{type:`button`,className:`found-copy`,onClick:()=>{navigator.clipboard.writeText(qM(e,t)).then(()=>h(`done`),e=>{console.warn(`[DetectedSummary] could not copy the details`,e),h(`failed`)})},"aria-label":r(`setup.found.copy`),title:r(`setup.found.copy`),children:P(s===`done`?pr:zr,{size:14,"aria-hidden":`true`})}),s&&P(`span`,{className:`found-copied`,role:`status`,children:r(s===`done`?`setup.found.copied`:`setup.found.copyFailed`)})]}),V(`dl`,{className:`found-glance`,children:[V(IM,{label:r(`setup.found.runsOn`),children:[i.runsOn?P(FM,{children:i.runsOn}):f,i.npu&&P(`span`,{className:`found-chip`,children:P(FM,{children:`NPU`})})]}),V(IM,{label:r(`setup.found.memory`),children:[e.capacity_gb!=null&&i.totalMemory?r(`setup.found.memoryOf`,{size:$(e.capacity_gb),total:i.totalMemory}):e.capacity_gb==null?i.totalMemory?P(FM,{children:i.totalMemory}):f:P(FM,{children:$(e.capacity_gb)}),n&&P(`button`,{type:`button`,className:`link-btn found-link`,onClick:n,children:r(`setup.found.changeMemory`)})]}),P(IM,{label:r(`setup.found.space`),children:i.freeGb==null?f:P(FM,{children:$(i.freeGb)})}),V(IM,{label:r(`setup.found.software`),children:[i.software.length?P(FM,{children:i.software.join(` · `)}):f,i.build&&i.build!==`release`&&P(`span`,{className:`found-chip`,children:r(`setup.found.build.${i.build}`)})]})]}),V(`div`,{className:`found-paths`,children:[[[`setup.found.modelsFolder`,i.modelsPath],[`setup.found.gaiaFolder`,i.gaiaHome]].map(([e,t])=>t&&V(`button`,{type:`button`,className:`link-btn found-open`,onClick:()=>void d(t),title:t,children:[P(yi,{size:13,"aria-hidden":`true`}),` `,r(e)]},e)),l&&P(`p`,{className:`setup-error`,role:`alert`,children:l})]}),p.length>0&&V(`details`,{className:`dl-details found-warnings`,children:[V(`summary`,{children:[P(Cr,{size:13,"aria-hidden":`true`}),` `,r(`setup.found.noticed`)]}),P(`ul`,{children:p.map(e=>P(`li`,{children:P(FM,{children:e})},e))})]}),V(`button`,{type:`button`,className:`setup-log-toggle found-more`,onClick:()=>o(e=>!e),"aria-expanded":a,children:[P(yr,{size:13,className:a?`is-open`:``,"aria-hidden":`true`}),` `,r(`setup.found.details`)]}),a&&V(`div`,{className:`found-details`,children:[P(`h4`,{className:`found-group`,children:r(`setup.found.software`)}),V(`dl`,{className:`found-list`,children:[V(IM,{label:P(FM,{children:`GAIA`}),children:[i.gaia?P(FM,{children:i.gaia}):f,i.build&&i.build!==`release`&&P(`span`,{className:`found-chip`,children:r(`setup.found.build.${i.build}`)})]}),P(IM,{label:r(`setup.found.agent`),children:i.sys?.agent_version?P(FM,{children:i.sys.agent_version}):P(`span`,{className:`found-muted`,children:r(`setup.found.agentLater`)})}),V(IM,{label:r(`setup.found.server`),children:[e.lemonade.mode===`external`?r(`setup.found.serverYours`):r(`setup.found.serverOwn`),i.sys?.lemonade_version&&V(D.Fragment,{children:[` `,P(FM,{children:i.sys.lemonade_version})]}),e.lemonade.url&&P(`span`,{className:`found-sub`,children:P(FM,{children:e.lemonade.url})})]})]}),P(`h4`,{className:`found-group`,children:r(`setup.found.runtime`)}),i.runtimes.length?P(`div`,{className:`found-table-wrap`,children:V(`table`,{className:`found-table`,children:[P(`thead`,{className:`visually-hidden`,children:V(`tr`,{children:[P(`th`,{scope:`col`,children:r(`setup.found.col.runtime`)}),P(`th`,{scope:`col`,children:r(`setup.found.col.device`)}),P(`th`,{scope:`col`,children:r(`setup.found.col.version`)}),P(`th`,{scope:`col`,children:r(`setup.found.col.state`)})]})}),P(`tbody`,{children:i.runtimes.map(({name:e,b:t})=>V(`tr`,{children:[P(`th`,{scope:`row`,children:P(FM,{children:e})}),P(`td`,{children:P(FM,{children:t.backend})}),P(`td`,{children:P(FM,{children:t.version??``})}),P(`td`,{className:GM(t)?`is-installed`:void 0,children:r(GM(t)?`setup.pc.backend.installed`:`setup.pc.backend.available`)})]},t.recipe))})]})}):P(`p`,{className:`found-muted`,children:r(`setup.found.unknown`)}),P(`h4`,{className:`found-group`,children:r(`setup.found.models`)}),(e.catalog??[]).length?P(`div`,{className:`found-table-wrap`,children:V(`table`,{className:`found-table`,children:[P(`thead`,{className:`visually-hidden`,children:V(`tr`,{children:[P(`th`,{scope:`col`,children:r(`setup.found.col.model`)}),P(`th`,{scope:`col`,children:r(`setup.found.col.job`)}),P(`th`,{scope:`col`,children:r(`setup.found.col.tested`)}),P(`th`,{scope:`col`,children:r(`setup.found.col.size`)}),P(`th`,{scope:`col`,children:r(`setup.found.col.state`)})]})}),P(`tbody`,{children:(e.catalog??[]).map(e=>V(`tr`,{children:[P(`th`,{scope:`row`,title:e.id,children:P(`bdi`,{children:e.name})}),P(`td`,{children:e.roles.map(e=>r(KM[e])).join(` · `)}),V(`td`,{children:[e.support===`verified`&&P(`span`,{className:`mc-chip is-verified`,children:r(`setup.label.verified`)}),e.support===`untested`&&P(`span`,{className:`mc-chip is-untested`,children:r(`setup.label.untested`)})]}),P(`td`,{children:P(FM,{children:e.full_size_gb??e.size_gb?$(e.full_size_gb??e.size_gb):``})}),P(`td`,{className:e.downloaded?`is-installed`:void 0,children:r(e.downloaded?`setup.models.status.onPc`:`setup.found.notDownloaded`)})]},e.id))})]})}):P(`p`,{className:`found-muted`,children:r(`setup.found.unknown`)}),P(`h4`,{className:`found-group`,children:r(`setup.found.hardware`)}),V(`dl`,{className:`found-list`,children:[P(IM,{label:r(`setup.found.os`),children:i.sys?.os??t?.os?P(FM,{children:i.sys?.os??t?.os}):f}),V(IM,{label:r(`setup.found.cpu`),children:[i.cpu||i.sys?.processor?P(FM,{children:i.cpu?.name??i.sys?.processor}):f,i.cpu?.cores?P(`span`,{className:`found-sub`,children:r(`setup.found.cores`,{cores:String(i.cpu.cores),threads:String(i.cpu.threads??i.cpu.cores)})}):null]}),P(IM,{label:r(`setup.found.gpu`),children:i.gpus.length?P(FM,{children:i.gpus.map(LM).join(`; `)}):P(`span`,{className:`found-muted`,children:r(`setup.found.none`)})}),P(IM,{label:r(`setup.found.npu`),children:i.npus.length?P(FM,{children:i.npus.map(LM).join(`; `)}):P(`span`,{className:`found-muted`,children:r(`setup.found.none`)})})]})]})]})}function YM({state:e}){return e===`done`?P(pr,{size:13,"aria-hidden":`true`}):e===`active`?P(K,{size:13,className:`spin`,"aria-hidden":`true`}):P(e===`failed`?So:e===`question`?kr:jr,{size:13,"aria-hidden":`true`})}function XM({hardware:e,hardwareError:t,plan:n,serverRun:r,awaitingChoice:i=!1}){let a=T(),[o,s]=(0,J.useState)(!1),c=!!n?.lemonade.reachable,l=r?.state===`failed`||r?.state===`cancelled`,u=a(n?.lemonade.mode===`external`?`setup.found.serverYours`:`setup.found.serverOwn`),d=n?.system?.lemonade_version?a(`setup.checks.serverFound`,{version:n.system.lemonade_version,whose:u}):u,f=e?`done`:t?`failed`:`active`,p=[e?.gpu_name,e?.npu_detected?a(`setup.checks.npu`):null].filter(Boolean).join(` · `),m=t?null:n?.capacity_gb==null?c?AS(n?.system?.physical_memory,e?.ram_gb):null:$(n.capacity_gb),h=t?`failed`:m?`done`:l?`failed`:i?`waiting`:`active`,g=[{id:`device`,label:a(`setup.checks.device`),value:t?`${a(`setup.system.unread`)} ${t}`:p||null,state:f},{id:`memory`,label:a(`setup.found.memory`),value:m,state:h},{id:`disk`,label:a(`setup.checks.disk`),value:e?.disk_free_gb==null?null:a(`setup.checks.diskValue`,{size:PS(a.locale,`${Math.round(e.disk_free_gb)} GB`)}),state:f},{id:`server`,label:a(`setup.checks.server`),value:c?d:i?a(`setup.checks.serverChoose`):null,state:c?`done`:l?`failed`:i?`question`:e?`active`:`waiting`},{id:`models`,label:a(`setup.checks.backends`),value:c&&n?.catalog?a(`setup.checks.backendsValue`,{models:String(n.catalog.length),downloaded:String(n.catalog.filter(e=>e.downloaded).length)}):null,state:c&&n?.catalog?`done`:c?`active`:`waiting`}],_=g.filter(e=>e.state===`done`).length,v=Math.round(_/g.length*100),y=P(`ul`,{className:`setup-rows`,id:`setup-check-rows`,children:g.map(e=>V(`li`,{className:`setup-result is-${e.state}`,children:[P(YM,{state:e.state}),P(`span`,{className:`setup-result-label`,children:e.label}),e.value&&P(`bdi`,{className:`setup-result-value`,children:e.value})]},e.id))});return _===g.length?V(`section`,{className:`setup-card setup-checks-done`,"aria-label":a(`setup.check.title`),children:[P(`p`,{className:`setup-result is-done`,role:`status`,children:V(`button`,{type:`button`,className:`setup-checks-toggle`,"aria-expanded":o,"aria-controls":`setup-check-rows`,onClick:()=>s(e=>!e),children:[P(pr,{size:13,"aria-hidden":`true`}),P(`span`,{className:`setup-result-label`,children:a(`setup.checks.allPassed`,{n:String(g.length)})}),P(yr,{size:13,className:o?`is-open`:``,"aria-hidden":`true`})]})}),o&&y]}):V(`section`,{className:`setup-card`,"aria-label":a(`setup.check.title`),children:[V(`div`,{className:`setup-bar-head`,children:[P(`span`,{children:a(`setup.checks.count`,{done:String(_),total:String(g.length)})}),V(`bdi`,{dir:`ltr`,children:[v,`%`]})]}),P(`progress`,{className:`setup-progress`,max:100,value:v,"aria-label":a(`setup.check.title`)}),y]})}function ZM({steps:e}){let t=T();return V(`nav`,{className:`setup-rail`,"aria-label":t(`setup.rail.label`),children:[P(`p`,{className:`setup-rail-title`,children:t(`setup.title`)}),P(`ol`,{className:`setup-rail-list`,children:e.map((e,t)=>{let n=e.status===`done`?P(pr,{size:13,"aria-hidden":`true`}):e.status===`active`?P(K,{size:13,className:`spin`,"aria-hidden":`true`}):e.status===`failed`?P(Cr,{size:13,"aria-hidden":`true`}):t+1,r=V(D.Fragment,{children:[P(`span`,{className:`setup-rail-num`,children:n}),P(`span`,{children:e.label})]}),i=`setup-rail-step is-${e.status}${e.shown?` is-shown`:``}`,a=e.shown?`step`:void 0;return P(`li`,{children:e.onOpen?P(`button`,{type:`button`,className:i,onClick:e.onOpen,children:r}):P(`span`,{className:i,"aria-current":a,children:r})},e.id)})})]})}var QM={memory:`setup.test.why.memory`,broken:`setup.test.why.broken`,stuck:`setup.test.why.stuck`,missing:`setup.test.why.missing`,agent:`setup.test.why.agent`,answer:`setup.test.why.answer`,window:`setup.test.why.window`};function $M(e,t){return t(`setup.test.job.${e}`)}function eN({state:e}){return e===`passed`?P(pr,{size:13,"aria-hidden":`true`}):e===`running`?P(K,{size:13,className:`spin`,"aria-hidden":`true`}):P(e===`failed`?So:e===`skipped`?ua:jr,{size:13,"aria-hidden":`true`})}function tN(e,t){return e.state===`running`?t(`setup.test.running`):e.state===`failed`?t(`setup.test.failed`):e.state===`skipped`?t(`setup.test.skipped`):e.seconds==null?t(`setup.test.passed`):t(`setup.test.passedIn`,{seconds:String(Math.round(e.seconds))})}function nN({run:e,expected:t,names:n,catalog:r,onRetry:i,onChooseAnother:a,onCancel:o,onDownloadAgain:s,busy:c}){let l=T(),u=e.tests??[],d=new Set(u.map(e=>e.job)),f=t.filter(e=>!d.has(e)),p=u.filter(e=>e.state!==`running`).length,m=Math.max(u.length+f.length,1),h=Math.round(p/m*100),g=u.filter(e=>e.state===`failed`).filter(e=>!r.find(t=>t.id===e.subject)?.roles.some(e=>[`speech`,`voice`,`image_creation`].includes(e))),_=e.state===`failed`||e.state===`cancelled`,v=s?[...new Set(g.filter(e=>e.kind===`broken`&&e.subject).map(e=>e.subject))]:[],[y,b]=(0,J.useState)(null),x=r.find(e=>e.id===y)?.full_size_gb,S=_&&e.components?.agent===`failed`,C=g.some(e=>e.subject&&e.kind!==`missing`);return V(D.Fragment,{children:[V(`section`,{className:`setup-card`,"aria-label":l(`setup.test.title`),children:[V(`div`,{className:`setup-bar-head`,children:[P(`span`,{children:l(`setup.test.count`,{done:String(p),total:String(m)})}),V(`bdi`,{dir:`ltr`,children:[h,`%`]})]}),P(`progress`,{className:`setup-progress`,max:100,value:h,"aria-label":l(`setup.test.title`)}),V(`ul`,{className:`setup-rows`,children:[u.map(e=>V(`li`,{className:`setup-result is-${e.state}`,children:[P(eN,{state:e.state}),V(`span`,{className:`setup-result-label`,children:[$M(e.job,l),e.subject&&V(`bdi`,{className:`setup-result-model`,children:[` `,n[e.subject]??e.subject]})]}),P(`span`,{className:`setup-result-value`,children:tN(e,l)}),e.error&&V(`div`,{className:`setup-result-error`,children:[P(`p`,{children:l(e.kind===`broken`&&!s?`setup.test.why.brokenYours`:QM[e.kind??``]??`setup.test.why.other`)}),V(`details`,{className:`dl-details`,children:[P(`summary`,{children:l(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:e.error})]})]})]},`${e.job}:${e.subject??``}`)),f.map(e=>e===`agent`&&S?V(`li`,{className:`setup-result is-failed`,children:[P(eN,{state:`failed`}),P(`span`,{className:`setup-result-label`,children:$M(e,l)}),P(`span`,{className:`setup-result-value`,children:l(`setup.test.failed`)}),P(`div`,{className:`setup-result-error`,children:P(`p`,{children:l(`setup.test.why.hub`)})})]},e):V(`li`,{className:`setup-result is-waiting`,children:[P(eN,{state:`waiting`}),P(`span`,{className:`setup-result-label`,children:$M(e,l)}),P(`span`,{className:`setup-result-value`,children:l(`setup.test.waiting`)})]},e))]})]}),e.state===`verifying`&&o&&P(Uj,{children:P(`button`,{type:`button`,className:`btn-secondary`,onClick:o,disabled:c,children:l(`setup.progress.cancel`)})}),_&&V(`div`,{className:`setup-failure`,role:`alert`,children:[P(`p`,{children:e.state===`cancelled`?l(`setup.test.cancelled`):g.some(e=>e.kind===`memory`)?l(`setup.test.failedMemory`):l(`setup.test.failedHelp`)}),V(Uj,{children:[C&&a&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:a,disabled:c,children:l(`setup.test.chooseAnother`)}),P(`button`,{type:`button`,className:v.length?`btn-secondary`:`btn-primary`,onClick:i,disabled:c,children:l(`setup.test.tryAgain`)}),v.map(e=>P(`button`,{type:`button`,className:`btn-primary setup-wrap-btn`,onClick:()=>b(e),disabled:c,children:v.length===1?l(`setup.test.downloadItAgain`):l(`setup.test.downloadAgain`,{name:n[e]??e})},e))]})]}),y&&P(Wj,{title:l(`setup.redownload.title`,{name:n[y]??y}),confirmLabel:l(`setup.redownload.confirm`),cancelLabel:l(`setup.redownload.keep`),onConfirm:()=>{let e=y;b(null),s?.(e)},onCancel:()=>b(null),children:P(`p`,{children:l(`setup.redownload.body`,{name:n[y]??y,size:x==null?``:$(x)})})})]})}var rN=`https://app.fireworks.ai/settings/users/api-keys`,iN=`https://amd-gaia.ai/docs/guides/llm-gateway`,aN=[{id:`local`,title:`setup.where.local`,note:`setup.where.localNote`},{id:`fireworks`,title:`Fireworks AI`,note:`setup.where.fireworksNote`},{id:`amd`,title:`AMD LLM Gateway`,note:`setup.where.amdNote`}];function oN(e,t){return N(e.title)?t(e.title):e.title}var sN=1e3,cN=`gaia-setup-choice`;function lN(){try{let e=localStorage.getItem(cN);return e===`local`||e===`fireworks`||e===`amd`?e:null}catch(e){return console.warn(`[SetupScreen] could not read the saved provider choice`,e),null}}function uN(e){try{localStorage.setItem(cN,e)}catch(e){console.warn(`[SetupScreen] could not save the provider choice; a reload will ask again`,e)}}var dN=[`ok`,`needs_key`,`too_old`];function fN({onChosen:e,onNothingToOffer:t,onFound:n,canInstallOwn:r=!0}){let i=T(),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)([]),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),E=(0,J.useRef)(!0),O=(0,J.useCallback)(async()=>{c(null);try{let e=await ce();if(!e.offer){t?.();return}f(!0);let{found:r,unchecked:i=[]}=await et();if(!E.current)return;u(r?[]:i),r&&dN.includes(r.status)?(o({target:e,found:r}),n?.(r),g(r.status===`needs_key`),r.status===`too_old`&&t?.()):i.length===0&&t?.()}catch(e){E.current&&c(e instanceof Error?e.message:String(e))}finally{E.current&&f(!1)}},[t,n]);(0,J.useEffect)(()=>(E.current=!0,O(),()=>{E.current=!1}),[O]);let k=(0,J.useCallback)(async t=>{if(a){b(t),S(null);try{await Ee(t===`external`?{mode:t,base_url:a.found.url,api_key:p.trim()||void 0}:{mode:t}),m(``),w(t),e(t)}catch(e){VA(e)&&g(!0),S(e instanceof Error?e.message:String(e))}finally{b(null)}}},[a,p,e]);if(s||l.length>0)return V(D.Fragment,{children:[P(`p`,{className:`setup-hint`,children:s?i(`setup.offer.checkFailed`):i(`setup.offer.noAnswer`,{url:l.join(`, `)})}),s&&V(`details`,{className:`dl-details`,children:[P(`summary`,{children:i(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:s})]}),V(Uj,{children:[V(`button`,{type:`button`,className:`btn-secondary`,disabled:d,onClick:()=>void O(),children:[d&&P(K,{size:13,className:`spin`}),` `,i(`setup.offer.checkAgain`)]}),t&&r&&P(`button`,{type:`button`,className:`btn-primary`,disabled:d,onClick:t,children:i(`setup.offer.useOwn`)})]})]});if(!a)return d?V(`p`,{className:`setup-hint`,role:`status`,children:[P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,i(`setup.offer.looking`)]}):null;let{target:A,found:j}=a;return C?P(`p`,{className:`setup-hint`,role:`status`,children:C===`external`?i(`setup.offer.usingYours`,{url:j.url}):i(`setup.offer.usingOwn`)}):j.status===`too_old`?V(`p`,{className:`setup-hint`,role:`status`,children:[i(`setup.offer.tooOld`),` `,V(`bdi`,{dir:`ltr`,className:`setup-choice-note`,children:[`Lemonade `,j.version??``,` · `,j.url]})]}):V(`form`,{id:`setup-lemonade-form`,className:`setup-lemonade`,"aria-label":i(`setup.offer.label`),onSubmit:e=>{e.preventDefault(),k(`external`)},children:[P(`span`,{className:`setup-choice-title`,children:i(`setup.offer.title`)}),P(`span`,{className:`setup-choice-note`,children:V(`bdi`,{dir:`ltr`,children:[`Lemonade`,j.version?` ${j.version}`:``,` · `,j.url]})}),V(`button`,{type:`button`,className:`setup-log-toggle setup-offer-more`,onClick:()=>v(e=>!e),"aria-expanded":_,"aria-controls":`setup-offer-detail`,children:[P(yr,{size:13,className:_?`is-open`:``,"aria-hidden":`true`}),` `,i(`setup.offer.whatGaiaDoes`)]}),_&&P(`p`,{className:`setup-choice-note`,id:`setup-offer-detail`,children:i(`setup.offer.whatGaiaDoesText`)}),h&&P(`input`,{className:`settings-input`,type:`password`,autoComplete:`off`,value:p,onChange:e=>m(e.target.value),placeholder:i(`setup.offer.keyPlaceholder`),"aria-label":i(`setup.offer.keyLabel`)}),x&&(h?P(`p`,{className:`setup-error`,role:`alert`,children:i(`setup.offer.keyRejected`)}):P(mN,{text:x})),V(Uj,{children:[V(`button`,{type:`submit`,form:`setup-lemonade-form`,className:`btn-secondary`,disabled:!!y||h&&!p.trim(),children:[y===`external`&&P(K,{size:13,className:`spin`}),` `,i(`setup.offer.useMine`)]}),V(`button`,{type:`button`,className:`btn-primary`,disabled:!!y,onClick:()=>void k(`gaia`),children:[y===`gaia`&&P(K,{size:13,className:`spin`}),` `,i(`setup.offer.useOwn`)]})]})]})}function pN({problem:e,onRetry:t,onUseGaia:n}){let r=T(),i=e.kind===`server_too_old`&&e.use_gaia;return V(D.Fragment,{children:[e.start&&V(`details`,{className:`dl-details`,children:[P(`summary`,{children:r(`setup.server.howToStart`)}),P(`pre`,{dir:`ltr`,children:e.start})]}),V(Uj,{children:[P(`button`,{type:`button`,className:i?`btn-secondary`:`btn-primary`,onClick:t,children:r(`setup.tryAgain`)}),e.use_gaia&&P(`button`,{type:`button`,className:i?`btn-primary`:`btn-secondary`,onClick:n,children:r(`setup.server.useGaia`)})]}),e.use_gaia&&P(`p`,{className:`setup-hint`,children:r(`setup.server.useGaiaNote`)}),e.use_gaia&&e.env_url&&P(`p`,{className:`setup-hint`,children:r(`setup.server.envIgnoredNote`,{url:e.env_url})})]})}function mN({text:e}){let t=T();return V(`div`,{className:`setup-error`,role:`alert`,children:[P(`p`,{children:t(`setup.failedLead`)}),V(`details`,{className:`dl-details`,children:[P(`summary`,{children:t(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:e})]})]})}function hN({run:e}){let t=T();return e.problem?V(`div`,{className:`setup-error`,role:`alert`,children:[P(`p`,{children:t(e.problem.kind===`server_too_old`?`setup.server.tooOld`:`setup.server.unreachable`)}),V(`details`,{className:`dl-details`,children:[P(`summary`,{children:t(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:e.problem.message})]})]}):V(`div`,{className:`setup-error`,role:`alert`,children:[P(`p`,{children:t(e.components?.server===`failed`?`setup.server.ownFailed`:`setup.stopped`)}),e.error&&V(`details`,{className:`dl-details`,children:[P(`summary`,{children:t(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:e.error})]})]})}var gN=[`check`,`plan`,`key`,`models`,`gpu`,`download`,`test`,`ready`];function _N(e){return e instanceof Error?e.message:String(e)}function vN({onReady:e,onClose:t}){let n=T(),r=cs(e=>e.refresh),i=cs(e=>e.select),[a,o]=(0,J.useState)(`local`),[s,c]=(0,J.useState)(`check`),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(`models`),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(()=>new Set([`check`])),y=(0,J.useRef)(`check`),[b,x]=(0,J.useState)(null),[S,C]=(0,J.useState)(null),[w,E]=(0,J.useState)(null),[O,k]=(0,J.useState)(null),[A,j]=(0,J.useState)(null),[M,N]=(0,J.useState)(``),[F,I]=(0,J.useState)({busy:!1,error:null,done:!1}),[L,ee]=(0,J.useState)(null),[R,z]=(0,J.useState)(null),[B,te]=(0,J.useState)(null),[ne,re]=(0,J.useState)(null),[ie,ae]=(0,J.useState)(null),[oe,H]=(0,J.useState)(null),[U,se]=(0,J.useState)(!1),[W,G]=(0,J.useState)(null),[ue,de]=(0,J.useState)(!1),[fe,pe]=(0,J.useState)(!1),[me,he]=(0,J.useState)(null),[ge,_e]=(0,J.useState)(!1),[ye,be]=(0,J.useState)(null),[xe,Se]=(0,J.useState)([]),[we,Te]=(0,J.useState)([]),[Ee,De]=(0,J.useState)([]),[ke,Ae]=(0,J.useState)(!1),[Me,Ne]=(0,J.useState)(!1),Pe=(0,J.useRef)({gaiaLemonade:!1,options:{}}),Fe=(0,J.useRef)(null),Le=(0,J.useRef)(!1),Re=(0,J.useRef)(!1),[ze,Be]=(0,J.useState)(!1),[Ve,He]=(0,J.useState)(!1),Ue=(0,J.useCallback)(()=>He(!0),[]),[We,Ge]=(0,J.useState)(null),[Ke,qe]=(0,J.useState)(null),Je=(0,J.useRef)(!0);(0,J.useEffect)(()=>(Je.current=!0,()=>{Je.current=!1}),[]);let{network:Ye,providers:Ze,recheck:Qe}=sM(),$e=Ze.find(e=>e.id===a&&e.key_source===`environment`&&e.key_hint),et=e=>e===`amd`&&Ye?.reachable===!1,tt=a!==`local`,nt=w?.server_only?w:null,it=w&&!w.server_only?w:null,at=w?.state===`running`||w?.state===`verifying`,st=it?.state===`ready`,ct=xM(w),lt=!(it?.models??[]).some(e=>e.state===`downloading`||e.state===`queued`)&&((it?.tests?.length??0)>0||it?.state===`verifying`),ut=(0,J.useCallback)(()=>{C(null),le().then(x).catch(e=>C(_N(e)))},[]),dt=(0,J.useRef)(0),pt=(0,J.useCallback)(async()=>{let e=++dt.current;z(null);try{let t=await ot();return e===dt.current?(ee(t),t):null}catch(t){return e===dt.current&&z(_N(t)),null}},[]),mt=(0,J.useCallback)(async()=>{try{let e=await Xe();Je.current&&H(e??null)}catch(e){console.warn(`[SetupScreen] GPU memory could not be read; the step stays hidden`,e)}},[]),gt=t!=null;(0,J.useEffect)(()=>{ce().then(e=>Ae(e.source===`config`)).catch(e=>console.warn(`[SetupScreen] could not read which Lemonade GAIA uses`,e)),ut(),pt(),Ce().then(e=>{(e.state!==`idle`||e.models?.length)&&(gt&&e.state!==`running`&&e.state!==`verifying`||(E(e),e.server_only||c(`download`),e.skip_chat_model&&o(lN()===`amd`?`amd`:`fireworks`)))}).catch(e=>j(_N(e))).finally(()=>Be(!0))},[ut,pt,gt]),(0,J.useEffect)(()=>{L?.catalog&&L.lemonade.reachable&&(te(e=>e??uj(L)),mt(),!w&&L.catalog.some(e=>e.partial&&e.selected)&&_e(!0))},[L,mt,w]);let _t=(0,J.useCallback)(()=>{Fe.current&&clearInterval(Fe.current),Fe.current=null},[]),vt=(w?.models??[]).filter(e=>e.state===`failed`&&e.error_kind===`disk_full`).length;(0,J.useEffect)(()=>{vt>0&&pt()},[vt,pt]);let yt=(0,J.useCallback)(async()=>{try{let e=await Ce();if(k(null),e.state===`idle`&&!e.models?.length){E(null),c(`plan`),Ne(!0),pt();return}E(e)}catch(e){k(_N(e))}},[pt,n]);(0,J.useEffect)(()=>(!ct&&!O||(Fe.current=setInterval(()=>{yt()},sN)),_t),[ct,O,yt,_t]),(0,J.useEffect)(()=>{nt&&nt.state===`ready`&&(ut(),pt())},[nt,nt?.state,ut,pt]),(0,J.useEffect)(()=>{st&&(ut(),pt().then(e=>{e&&ae(e)}),mt())},[st,ut,pt,mt]);let bt=(0,J.useRef)(!1),xt=(0,J.useCallback)(async(e=!1,t={})=>{if(bt.current)return!1;bt.current=!0,j(null),he(null),_e(!1),Ne(!1);try{uN(a),Pe.current={gaiaLemonade:e,options:t};let n=await ft(tt,e,t);E(n),g(null);let r=t.extraModels??[];return r.length&&De(e=>e.filter(e=>!r.includes(e))),t.serverOnly||c(`download`),e&&Ae(!1),!0}catch(e){let t=Oe(e);if(t)return G({kind:`server`,detail:t,then:`run`}),!1;if(e instanceof vn&&e.httpStatus===409){let e=await Ce().catch(()=>null);if(e&&(e.state===`running`||e.state===`verifying`))return E(e),g(null),e.server_only||c(`download`),!0}return j(_N(e)),!1}finally{bt.current=!1}},[a,tt]);(0,J.useEffect)(()=>{s===`check`&&ze&&Ve&&L&&!L.lemonade.reachable&&!w&&!Le.current&&(Le.current=!0,xt(!1,{serverOnly:!0}))},[s,ze,Ve,L,w,xt]);let St=!!(B&&L?.catalog&&L.lemonade.reachable&&(b||S)),Ct=(0,J.useCallback)(()=>{let{gaiaLemonade:e,options:t}=Pe.current;xt(e,t)},[xt]),wt=(0,J.useCallback)((e,t=L)=>{re(t);let n=t&&B&&!tt?bj(t,B):[];return xt(!1,{acknowledgeLowDisk:e,keepTrying:U,extraModels:n})},[L,B,tt,U,xt]),[Tt,Et]=(0,J.useState)(!1),Dt=(0,J.useRef)(!1),Ot=(0,J.useCallback)(async(e,t=ue)=>{if(!L||!B||Dt.current)return;he(null),Et(e);let r=YA(L),i=tt?[]:vj(r,B).filter(e=>!e.downloaded||e.id===B.defaultChat),a=i.find($A);if(a){let e=a.id===B.defaultChat?`setup.models.cantRun.chat`:`setup.models.cantRun.other`;he(n(e,{name:a.name,why:Oj(a,n)}))}else if(!tt&&!t&&i.length>0&&i.every(e=>e.need_gb!=null))G({kind:`no_fit`,models:i});else{pe(!0),Dt.current=!0;try{let n=L;if(!tt&&B.defaultChat&&B.defaultChat!==n.chat_model.id)try{n=await Wt(B.defaultChat,t)}catch(e){let t=Oe(e);if(t){G({kind:`server`,detail:t,then:`chat`});return}throw e}if(!tt){await NM();let e=oj(r,B);e!==(n.vision_model??null)&&(n=await Ie(e));for(let e of yj(n,B))n=await ht(e.id,e.skipped)}ee(n),await wt(e,n)}catch(e){he(_N(e))}finally{Dt.current=!1,pe(!1)}}},[L,B,tt,ue,wt,n]),kt=(0,J.useCallback)(e=>{he(null),s===`download`?g(e===y.current?null:e):(g(null),c(e===`test`||e===`ready`?`download`:e))},[s]),At=(0,J.useCallback)(()=>{h??o(`local`),kt(`plan`)},[kt,h]),jt=(0,J.useCallback)(()=>{at&&h!=null||(o(`local`),u(!0),kt(`models`))},[kt,at,h]),Mt=(0,J.useCallback)(()=>{at&&h!=null||(u(!1),o(lN()===`amd`?`amd`:`fireworks`),kt(`key`))},[kt,at,h]),Nt=!!oe?.applies,Pt=(0,J.useCallback)(()=>{kt((h??s)===`gpu`?d:`plan`)},[d,kt,h,s]),Ft=(0,J.useCallback)(e=>{f(e),kt(`gpu`)},[kt]),It=(0,J.useRef)({prev:null,next:null});(0,J.useEffect)(()=>{let e=e=>{if(!e.altKey||W||(e.target instanceof Element?e.target:null)?.closest(`input, textarea, select, [contenteditable="true"]`))return;let t=e.key===`ArrowLeft`?It.current.prev:e.key===`ArrowRight`?It.current.next:null;t&&(e.preventDefault(),kt(t))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[kt,W]);let Lt=(0,J.useCallback)(async()=>{try{await qt(),await yt()}catch(e){he(_N(e))}},[yt]),zt=(0,J.useCallback)(async(e,t)=>{he(null),pe(!0);try{t===`verify`&&await je(e),t===`disk_full`&&pt();try{E(await ve(e,{keepTrying:U}))}catch(t){let n=Oe(t);if(!n)throw t;G({kind:`server`,detail:n,then:`retry`,id:e})}}catch(e){he(_N(e))}finally{pe(!1)}},[U,pt]),Bt=(0,J.useCallback)(async e=>{he(null),pe(!0);try{L?.catalog?.find(t=>t.id===e)?.planned&&ee(await ht(e,!0)),E(t=>t&&{...t,models:t.models?.map(t=>t.id===e?{...t,state:`skipped`}:t)});let{options:t}=Pe.current;Pe.current.options={...t,extraModels:t.extraModels?.filter(t=>t!==e)},te(t=>t&&t.ticked.has(e)?fj(t,YA(L),e,!1):t)}catch(e){he(_N(e))}finally{pe(!1)}},[L]),Vt=(0,J.useCallback)(async()=>{await Lt(),Ct()},[Lt,Ct]),Ht=(0,J.useCallback)(async()=>{if(!at){I({busy:!0,error:null,done:!1});try{await Rt(a,{api_key:!ke&&M||void 0},e=>I({busy:!0,error:null,done:!1,waiting:e}),()=>!Je.current);let{models:e}=await Zt(a),t=e.find(e=>e.rank===1)??e[0];if(!t)throw Error(n(`setup.key.noModels`));await i(t.id),be(t.id),N(``),I({busy:!1,error:null,done:!0}),wt(!1)}catch(e){I({busy:!1,error:_N(e),done:!1})}}},[a,M,i,ke,wt,n,at]),Ut=(0,J.useCallback)(e=>{uN(e),o(e),I({busy:!1,error:null,done:!1})},[]);(0,J.useEffect)(()=>{if(!st||we.length===0||Re.current)return;let e=we;Re.current=!0,xt(!1,{keepTrying:U,extraModels:e}).then(t=>{Re.current=!1,Te(t=>t.filter(t=>!e.includes(t))),t||De(t=>[...t,...e.filter(e=>!t.includes(e))])})},[st,we,U,xt]);let Gt=st&&we.length===0,Kt=tt?ye:it?.chat_model??(L&&!L.decided_after_server?L.chat_model.id:null),Jt=(0,J.useCallback)(async t=>{he(null);try{!tt&&Kt&&await i(Kt),await r()}catch(e){he(_N(e));return}e(t)},[Kt,tt,e,r,i]);(0,J.useEffect)(()=>{Gt&&rt().then(e=>Se(e.cards)).catch(e=>console.warn(`[SetupScreen] no first tasks to offer`,e))},[Gt]);let Yt=(0,J.useMemo)(()=>{let e={};for(let t of L?.catalog??[])e[t.id]=t.name;return e},[L]),Xt=w?.state===`failed`||w?.state===`cancelled`,Qt=it&&(it.state===`failed`||it.state===`cancelled`)&&(it.models??[]).length>0&&(it.models??[]).every(e=>e.state===`ready`||e.state===`skipped`||e.state===`verifying`||e.state===`unchecked`)&&!ct,$t=!!it&&Xt&&!it.problem&&Object.values(it.components??{}).includes(`failed`),en=YA(L),tn=B?hj(en,B):[],nn=L&&B?_j(L,B):null,rn=en.find(e=>e.id===B?.defaultChat),an=!!b&&!b.compatible&&b.blockers.length>0,on=Gt?`ready`:s===`download`&&lt?`test`:s;y.current=on;let sn=h??on;(0,J.useEffect)(()=>{v(e=>e.has(sn)?e:new Set(e).add(sn))},[sn]);let cn=(0,J.useRef)(!0);(0,J.useEffect)(()=>{if(cn.current){cn.current=!1;return}let e=document.querySelector(`.setup-inner`);e&&(e.scrollTop=0),document.getElementById(`setup-title`)?.focus({preventScroll:!0})},[sn]);let ln=[{id:`check`,label:n(`setup.check.title`),key:`setup.check.title`},{id:`plan`,label:n(`setup.plan.step`),key:`setup.plan.step`},{id:`download`,label:n(`setup.download.step`),key:`setup.download.step`},{id:`test`,label:n(`setup.test.step`),key:`setup.test.step`},{id:`ready`,label:n(`setup.ready.step`),key:`setup.ready.step`}],un=e=>e===`models`||e===`key`?`plan`:e===`gpu`?d===`check`?`check`:`plan`:e,dn=tt?`key`:l?`models`:`plan`,fn=ln.findIndex(e=>e.id===un(on)),pn=e=>e===`download`||e===`test`||e===`ready`,mn=[];if(b){let e=[L?.system?.physical_memory?`${AS(L.system.physical_memory,null)} installed`:null,b.ram_gb==null?null:`${b.ram_gb} GB the OS can use`].filter(Boolean).join(`, `),t=b.disk_free_gb==null?null:`${Math.round(b.disk_free_gb)} GB free on disk`;mn.push(`This PC: ${[b.gpu_name,b.npu_detected?`NPU`:null].filter(Boolean).join(`, `)||`no GPU reported`}`+[e,t].filter(Boolean).map(e=>`; ${e}`).join(``))}else S&&mn.push(`Couldn't read this PC: ${S}`);We&&(mn.push(`Found your Lemonade${We.version?` ${We.version}`:``} at ${We.url}`),mn.push(Ke===`external`?`You chose your own Lemonade`:Ke===`gaia`?`You chose GAIA's own Lemonade`:`Waiting for you to choose which Lemonade GAIA uses`)),L&&(!We||Ke)?mn.push(L.lemonade.reachable?`Model server answering at ${L.lemonade.url??`its address`}`:`No model server answering yet`):R&&mn.push(`Couldn't read the model list: ${R}`);let hn=(e,t)=>t<=fn||_.has(e)&&!pn(e),gn=ln.map((e,t)=>({id:e.id,label:e.label,status:t<fn?`done`:t>fn?`pending`:on===`ready`?`done`:Xt&&(on===`download`||on===`test`||on===`check`)?`failed`:at&&(on===`download`||on===`test`)?`active`:`current`,shown:e.id===un(sn),onOpen:e.id!==un(sn)&&hn(e.id,t)?()=>kt(e.id===`plan`?dn:e.id):void 0})),_n=ln.findIndex(e=>e.id===un(sn)),yn=sn===`gpu`&&d===`check`?.5:gN.indexOf(sn),bn=(0,J.useRef)(yn),xn=(0,J.useRef)(`forward`);bn.current!==yn&&(xn.current=yn>bn.current?`forward`:`back`,bn.current=yn);let Sn=sn===`gpu`?d:sn===`models`||sn===`key`?`plan`:_n>0?ln[_n-1].id===`plan`?dn:ln[_n-1].id:null,Cn=(sn!==`gpu`&&_n>=0&&_n<ln.length-1&&hn(ln[_n+1].id,_n+1)?ln[_n+1].id:null)??(h==null?sn===`check`&&St?`plan`:sn===`gpu`?d:null:null);It.current={prev:Sn,next:Cn};let wn=sn===`gpu`||sn===`models`||sn===`key`,Tn=h!=null&&at,En=[`server`];tt||En.push(`chat`),!tt&&B&&nj(en,B)&&En.push(`vision`),B&&en.some(e=>ZA(e)&&B.ticked.has(e.id))&&En.push(`embedding`);for(let e of en)B&&ej(e)&&B.ticked.has(e.id)&&!e.downloaded&&En.push(e.roles[0]);En.push(`agent`);let Dn=B&&!tt?en.filter(e=>ej(e)&&!B.ticked.has(e.id)&&!e.downloaded&&(tj(rn)||!e.roles.includes(`image_creation`))):[],On=en.find(e=>e.fit_code===`memory`&&e.chat_choice&&e.support===`verified`);return V(`main`,{className:`setup`,"aria-labelledby":`setup-title`,children:[P(ZM,{steps:gn}),P(Hj,{value:p,children:V(`div`,{className:`setup-pane`,children:[V(`div`,{className:`setup-inner`,children:[_n>=0&&V(`nav`,{className:`setup-topnav`,"aria-label":n(`setup.nav.label`),children:[P(`button`,{type:`button`,className:`setup-arrow`,onClick:()=>Sn&&kt(Sn),disabled:!Sn,"aria-label":n(`setup.nav.prev`),children:P(_r,{size:16,"aria-hidden":`true`})}),P(`button`,{type:`button`,className:`setup-arrow`,onClick:()=>Cn&&kt(Cn),disabled:!Cn,"aria-label":n(`setup.nav.next`),children:P(yr,{size:16,"aria-hidden":`true`})}),P(`span`,{children:P(`bdi`,{children:n(`setup.nav.stepOf`,{n:String(_n+1),total:String(ln.length)})})}),h!=null&&h!==on&&P(`button`,{type:`button`,className:`link-btn`,onClick:()=>g(null),children:n.compose(e=>e(`setup.nav.toLive`,{step:e(ln.find(e=>e.id===on)?.key??`setup.download.step`)}))}),P(OM,{})]}),ge&&s!==`download`&&V(`div`,{className:`setup-banner`,role:`status`,children:[P(Vi,{size:14,"aria-hidden":`true`}),P(`span`,{children:n(`setup.resume.banner`)})]}),Me&&s!==`download`&&P(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.interrupted`)}),V(`div`,{className:`setup-stage is-${xn.current}`,children:[sn===`check`&&V(D.Fragment,{children:[P(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(St?`setup.check.headingDone`:`setup.check.heading`)}),P(`p`,{className:`setup-lede`,children:n(St?`setup.check.ledeDone`:`setup.check.lede`)}),P(XM,{hardware:b,hardwareError:S,plan:L,serverRun:nt,awaitingChoice:!!We&&!Ve}),St&&L&&P(JM,{plan:L,hardware:b,onChangeMemory:Nt&&h==null?()=>Ft(`check`):void 0}),St&&h==null&&!(We&&!Ve)&&P(Uj,{children:P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>kt(`plan`),children:n(`setup.continue`)})}),nt&&Xt&&V(D.Fragment,{children:[P(hN,{run:nt}),nt.problem?P(pN,{problem:nt.problem,onRetry:()=>void xt(!1,{serverOnly:!0}),onUseGaia:()=>void xt(!0,{serverOnly:!0})}):P(Uj,{children:P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void xt(!!nt.gaia_lemonade,{serverOnly:!0}),children:n(`setup.tryAgain`)})})]}),R&&!L&&V(D.Fragment,{children:[P(mN,{text:R}),V(Uj,{children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void xt(!1,{keepTrying:U}),children:n(`setup.models.useRecommended`)}),P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void pt(),children:n(`setup.tryAgain`)})]}),P(`p`,{className:`setup-hint`,children:n(`setup.models.useRecommendedNote`)})]}),A&&P(mN,{text:A}),A&&!nt&&L&&!L.lemonade.reachable&&P(Uj,{children:P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void xt(!1,{serverOnly:!0}),children:n(`setup.tryAgain`)})}),ze&&L&&(!L.lemonade.reachable&&!nt||St&&h==null&&L.lemonade.mode!==`external`)&&P(fN,{onNothingToOffer:Ue,canInstallOwn:!L.lemonade.reachable&&!nt,onFound:Ge,onChosen:e=>{Ae(e===`external`),qe(e),He(!0),ut(),pt()}})]}),sn===`plan`&&L&&B&&V(D.Fragment,{children:[P(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.plan.title`)}),P(`p`,{className:`setup-lede`,children:n(`setup.plan.lede`)}),V(`section`,{className:`setup-hero`,"aria-label":n(`setup.plan.label`),children:[P(`p`,{className:`setup-eyebrow`,children:B.chatChosen?n(`setup.plan.yours`):n(`setup.plan.recommended`)}),P(`p`,{className:`setup-hero-title`,children:P(`bdi`,{children:n(`setup.plan.run`,{name:rn?.name??``})})}),V(`dl`,{className:`setup-facts`,children:[V(`div`,{children:[P(`dt`,{children:n(`setup.summary.download`)}),P(`dd`,{children:P(`bdi`,{dir:`ltr`,children:$(gj(L,B).downloadGb??0)})})]}),V(`div`,{children:[P(`dt`,{children:n(`setup.plan.runsOn`)}),P(`dd`,{children:P(`bdi`,{children:rn&&QA(rn)?n(`setup.checks.npu`):b?.gpu_name??n(`setup.plan.cpu`)})})]}),V(`div`,{children:[P(`dt`,{children:n(`setup.plan.diskAfter`)}),P(`dd`,{children:P(`bdi`,{dir:`ltr`,children:gj(L,B).afterGb==null?`—`:$(Math.max(0,gj(L,B).afterGb))})})]})]}),V(`ul`,{className:`setup-reasons`,children:[!B.chatChosen&&P(`li`,{children:n(`setup.plan.why.evaluated`)}),rn?.need_gb!=null&&rn.capacity_gb!=null&&rn.fits&&P(`li`,{children:n(`setup.plan.why.fits`,{need:jS(rn.need_gb),have:jS(rn.capacity_gb)})}),P(`li`,{children:n(`setup.plan.why.private`)}),rn&&QA(rn)&&P(`li`,{children:n(`setup.plan.why.noImagesNpu`)}),On&&On.id!==rn?.id&&On.need_gb!=null&&On.capacity_gb!=null&&P(`li`,{children:n(`setup.plan.why.bigger`,{name:On.name,need:jS(On.need_gb),have:jS(On.capacity_gb)})})]}),P(Uj,{children:V(`button`,{type:`button`,className:`btn-primary`,onClick:()=>nn?G({kind:`low_disk`}):void Ot(!1),disabled:fe||an||Tn,children:[fe&&P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,tn.length?n(`setup.plan.start`):n(`setup.plan.startNoDownload`)]})}),V(`div`,{className:`setup-row`,children:[P(`button`,{type:`button`,className:`link-btn`,onClick:jt,disabled:Tn,children:n(`setup.plan.customize`)}),P(`button`,{type:`button`,className:`link-btn`,onClick:Mt,disabled:Tn,children:n(`setup.plan.cloud`)}),t&&P(`button`,{type:`button`,className:`link-btn`,onClick:t,children:n(`setup.backToGaia`)})]}),an&&V(`div`,{className:`setup-error`,role:`alert`,children:[P(`p`,{children:n(`setup.blocked`)}),V(`details`,{className:`dl-details`,children:[P(`summary`,{children:n(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:b?.blockers.join(`
81
+ `)})]})]}),nn&&P(`p`,{className:`setup-error`,role:`alert`,children:n(`setup.summary.short`,{need:$(nn.needGb),free:$(nn.freeGb),drive:n(`setup.summary.theDrive`),freeUp:$(nn.freeUpGb)})}),(me??A)&&P(mN,{text:me??A})]}),V(`details`,{className:`setup-disclosure`,children:[P(`summary`,{children:n(`setup.plan.whatDownloads`)}),P(fM,{plan:L,models:tn})]})]}),sn===`gpu`&&oe&&V(D.Fragment,{children:[P(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.gpu.title`)}),P(`p`,{className:`setup-lede`,children:n(`setup.gpu.lede`)}),P($j,{status:oe,onStatus:H,mode:`setup`,headingId:`setup-title`,names:Yt,onBack:Pt,onSkip:()=>kt(d),onContinue:()=>kt(d)})]}),sn===`models`&&V(D.Fragment,{children:[P(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.models.title`)}),L&&B&&P(PM,{plan:L,selection:B,onSelection:te,disabled:fe||Tn,onRecheck:()=>void pt()}),Nt&&oe?.total_gb!=null&&oe.gpu_gb!=null&&V(`p`,{className:`setup-hint setup-gpu-option`,children:[n(`setup.models.gpu`,{gpu:$(oe.gpu_gb),total:$(oe.total_gb)}),` `,P(`button`,{type:`button`,className:`link-btn`,onClick:()=>Ft(`models`),disabled:fe||Tn,children:n(`setup.found.changeMemory`)})]}),P(eM,{plan:L,planError:R,onRetryPlan:()=>void pt(),onUseRecommended:()=>void xt(!1,{keepTrying:U}),selection:B,onSelection:te,cloud:!1,keepTrying:U,onKeepTrying:se,onBack:Pt,onContinue:e=>void Ot(e),busy:fe||Tn,error:me??A})]}),sn===`key`&&V(`form`,{id:`setup-key-form`,onSubmit:e=>{e.preventDefault(),Ht()},className:`setup-form`,children:[P(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.key.title`)}),P(`div`,{className:`setup-choices`,role:`radiogroup`,"aria-label":n(`setup.key.provider`),children:aN.filter(e=>e.id!==`local`).map(e=>V(`button`,{type:`button`,role:`radio`,"aria-checked":a===e.id,className:`setup-choice${a===e.id?` is-active`:``}${et(e.id)?` is-disabled`:``}`,onClick:()=>Ut(e.id),disabled:F.busy||et(e.id),children:[P(Fr,{size:16,"aria-hidden":`true`}),V(`span`,{children:[P(`span`,{className:`setup-choice-title`,children:P(`bdi`,{children:oN(e,n)})}),P(`span`,{className:`setup-choice-note`,children:et(e.id)?n(`setup.key.gatewayOff`):n(e.note)})]})]},e.id))}),Ye?.reachable===!1&&P(`button`,{type:`button`,className:`link-btn setup-start`,onClick:Qe,children:n(`setup.key.checkAgain`)}),a===`fireworks`&&!ke&&V(`section`,{className:`setup-card`,children:[P(`h3`,{className:`mc-job-title`,children:n(`setup.key.getOne`)}),V(`ol`,{className:`setup-key-steps`,children:[P(`li`,{children:P(`a`,{href:rN,target:`_blank`,rel:`noreferrer`,children:n(`setup.key.step1`)})}),P(`li`,{children:n(`setup.key.step2`)}),P(`li`,{children:n(`setup.key.step3`)})]})]}),a===`amd`&&!ke&&P(`section`,{className:`setup-card`,children:P(`p`,{className:`setup-hint`,children:P(`a`,{href:iN,target:`_blank`,rel:`noreferrer`,children:n(`setup.key.gatewayHelp`)})})}),P(HA,{provider:a,limit:3}),P(`p`,{className:`setup-hint`,children:n(ke?`setup.key.usersServer`:`setup.key.where`)}),P(`div`,{className:`setup-row`,children:!ke&&P(`input`,{className:`settings-input`,type:`password`,autoComplete:`off`,value:M,onChange:e=>N(e.target.value),placeholder:n(`setup.key.placeholder`),"aria-label":n(`setup.key.label`)})}),$e&&!ke&&!M&&P(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.key.foundEnv`,{name:$e.name,hint:$e.key_hint??``})}),F.busy&&!F.waiting&&P(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.key.testing`)}),F.busy&&F.waiting&&P(`p`,{className:`setup-hint`,role:`status`,children:F.waiting}),F.error&&P(`p`,{className:`setup-error`,role:`alert`,children:F.error}),V(Uj,{children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:At,disabled:F.busy,children:n(`setup.back`)}),V(`button`,{type:`submit`,form:`setup-key-form`,className:`btn-primary`,disabled:F.busy||et(a)||Tn,children:[F.busy&&P(K,{size:13,className:`spin`}),` `,n(`setup.key.connect`)]})]})]}),sn===`download`&&!it&&V(D.Fragment,{children:[P(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.download.title`)}),P(`p`,{className:`setup-lede`,children:n(`setup.download.lede`)}),V(`p`,{className:`setup-hint`,role:`status`,children:[P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,n(`setup.download.starting`)]})]}),sn===`download`&&it&&V(D.Fragment,{children:[P(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.download.title`)}),P(`p`,{className:`setup-lede`,children:n(`setup.download.lede`)}),L&&P(`section`,{className:`setup-card`,"aria-label":n(`setup.contents.title`),children:P(fM,{plan:L,run:it,onRetry:Ct,retryDisabled:fe})}),(it.models?.length??0)>0?P(`div`,{className:O?`is-stale`:void 0,children:P(wM,{status:{...it,overall:xj(it,ne??L)},names:Yt,freeGb:L?.disk?.free_gb??null,onCancel:()=>void Lt(),onRetry:(e,t)=>void zt(e,t),onResume:e=>void zt(e,null),onResumeAll:Ct,onSkip:e=>void Bt(e),onRestart:()=>void Vt(),busy:fe||!!O,retryLater:at,labelledBy:`setup-title`})}):at?V(`p`,{className:`setup-hint`,role:`status`,children:[P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,n(`setup.download.working`)]}):null,Dn.length>0&&V(`section`,{className:`setup-card`,"aria-label":n(`setup.optional.title`),children:[P(`h3`,{className:`mc-job-title`,children:n(`setup.optional.title`)}),P(`p`,{className:`setup-hint`,children:n(`setup.optional.lede`)}),P(`ul`,{className:`setup-rows`,children:Dn.map(e=>{let t=we.includes(e.id);return V(`li`,{className:`setup-result is-waiting`,children:[P(`span`,{className:`setup-result-label`,children:n(`setup.purpose.${e.roles[0]}`)}),V(`span`,{className:`setup-result-value`,children:[P(`bdi`,{dir:`ltr`,children:e.size_gb==null?n(`setup.contents.sizeOnDownload`):$(e.size_gb)}),P(`button`,{type:`button`,className:`btn-secondary`,"aria-pressed":t,onClick:()=>Te(n=>t?n.filter(t=>t!==e.id):[...n,e.id]),children:n(t?`setup.optional.added`:`setup.optional.add`)})]})]},e.id)})})]}),O&&V(D.Fragment,{children:[P(`p`,{className:`setup-error`,role:`alert`,children:n(`setup.lostContact`,{error:O})}),P(Uj,{children:P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void yt(),children:n(`setup.reconnect`)})})]}),Xt&&Qt&&!$t&&it.state===`failed`&&!it.model_failed&&(it.problem?P(pN,{problem:it.problem,onRetry:Ct,onUseGaia:()=>void xt(!0,Pe.current.options)}):V(`div`,{className:`setup-error`,role:`alert`,children:[P(`p`,{children:n(`setup.download.stoppedBeforeCheck`)}),it.error&&V(`details`,{className:`dl-details`,children:[P(`summary`,{children:n(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:it.error})]})]})),Xt&&Qt&&!$t&&V(D.Fragment,{children:[P(`p`,{className:`setup-hint`,children:n(`setup.download.finishNote`)}),P(Uj,{children:P(`button`,{type:`button`,className:`btn-primary`,onClick:Ct,disabled:fe,children:n(`setup.finish`)})})]}),Xt&&!Qt&&!$t&&!(it.models??[]).some(e=>e.state===`failed`||e.state===`cancelled`)&&V(D.Fragment,{children:[P(hN,{run:it}),it.problem?P(pN,{problem:it.problem,onRetry:Ct,onUseGaia:()=>void xt(!0,Pe.current.options)}):P(Uj,{children:P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void xt(!!it.gaia_lemonade,Pe.current.options),children:n(`setup.tryAgain`)})})]}),(me||A)&&P(mN,{text:me??A})]}),sn===`test`&&it&&V(D.Fragment,{children:[P(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.test.title`)}),P(`p`,{className:`setup-lede`,children:n(`setup.test.lede`)}),P(nN,{run:it,expected:En,names:Yt,catalog:en,onRetry:Ct,onChooseAnother:tt?void 0:jt,onCancel:()=>void Lt(),onDownloadAgain:L?.lemonade.mode===`external`?void 0:e=>void zt(e,`verify`),busy:fe}),Xt&&it.error&&!(it.tests??[]).some(e=>e.error===it.error)&&V(`details`,{className:`dl-details`,children:[P(`summary`,{children:n(`setup.progress.details`)}),P(`pre`,{dir:`ltr`,children:it.error})]}),(me||A)&&P(mN,{text:me??A})]}),sn===`ready`&&V(D.Fragment,{children:[P(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.ready.heading`)}),V(`div`,{className:`setup-done`,role:`status`,children:[P(`div`,{className:`setup-done-head`,children:Kt&&P(`p`,{children:n(tt?`setup.ready.answersCloud`:`setup.ready.answersLocal`,{model:tt?vs(Kt):Yt[Kt]??ie?.catalog?.find(e=>e.id===Kt)?.name??vs(Kt)})})}),P(Uj,{children:P(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Jt(),autoFocus:!0,children:n(`setup.ready.start`)})}),!tt&&ie&&P(tM,{plan:ie,chatModel:Kt,gpu:oe}),A&&P(mN,{text:A}),(it?.tests??[]).filter(e=>e.state===`failed`).map(e=>P(`p`,{className:`setup-failed-extra`,role:`alert`,children:n(`setup.ready.extraFailed`,{job:n(`setup.test.job.${e.job}`)})},`${e.job}:${e.subject??``}`)),Ee.length>0&&!W&&P(`p`,{className:`setup-failed-extra`,role:`alert`,children:n(`setup.ready.extraNotFetched`,{names:Ee.map(e=>Yt[e]??e).join(`, `)})}),xe.length>0&&V(D.Fragment,{children:[P(`p`,{className:`setup-hint`,children:n(`setup.ready.tasks`)}),P(oM,{cards:xe,onPick:e=>void Jt(e)})]})]})]})]},sn),t&&!at&&sn!==`plan`&&sn!==`ready`&&P(`div`,{className:`setup-row`,children:P(`button`,{type:`button`,className:`link-btn setup-close`,onClick:t,children:n(`setup.backToGaia`)})}),Tn&&(wn||sn===`plan`)&&P(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.nav.runGoing`)}),P(DM,{run:w,before:{check:mn}})]}),P(`div`,{className:`setup-footer`,ref:m})]})}),W?.kind===`no_fit`&&P(Wj,{title:W.models.length===1?n(`setup.confirm.noFitOne`,{name:W.models[0].name}):n(`setup.confirm.noFitMany`),confirmLabel:n(`setup.confirm.downloadAnyway`),cancelLabel:n(`setup.confirm.pickSmaller`),onConfirm:()=>{G(null),de(!0),Ot(Tt,!0)},onCancel:()=>G(null),children:W.models.map(e=>V(`p`,{children:[P(`bdi`,{children:e.name}),`: `,Oj(e,n)]},e.id))}),W?.kind===`low_disk`&&nn&&P(Wj,{title:n(`setup.confirm.lowDiskTitle`),confirmLabel:n(`setup.confirm.downloadAnyway`),cancelLabel:n(`setup.confirm.changeModels`),onConfirm:()=>{G(null),Ot(!0)},onCancel:()=>{G(null),jt()},children:P(`p`,{children:n(`setup.summary.short`,{need:$(nn.needGb),free:$(nn.freeGb),drive:n(`setup.summary.theDrive`),freeUp:$(nn.freeUpGb)})})}),W?.kind===`server`&&P(Wj,{title:W.detail.code===`low_disk`?n(`setup.confirm.lowDiskTitle`):n(`setup.confirm.noFitServerTitle`),confirmLabel:W.detail.code===`low_disk`?n(`setup.confirm.downloadAnyway`):n(`setup.confirm.useAnyway`),cancelLabel:n(`setup.confirm.changeModels`),onConfirm:()=>{let e=W;if(G(null),e.then===`chat`)de(!0),Ot(Tt,!0);else if(e.then===`retry`)ve(e.id,{keepTrying:U,acknowledgeLowDisk:!0}).then(E).catch(e=>he(_N(e)));else{let{gaiaLemonade:e,options:t}=Pe.current;xt(e,{...t,acknowledgeLowDisk:!0})}},onCancel:()=>{let e=W;G(null),e.then!==`retry`&&!st&&jt()},children:P(`p`,{children:W.detail.message})})]})}function yN(e,t,n){let r=(0,J.useRef)(n);(0,J.useEffect)(()=>{r.current=n});let i=(0,J.useRef)(!1),a=(0,J.useRef)(null);if(t&&!i.current){let e=document.activeElement;a.current=e instanceof HTMLElement?e:null}(0,J.useEffect)(()=>{if(!t)return;i.current=!0;let n=a.current,o=e.current;if(o&&!o.contains(document.activeElement)){let e=r.current?.()??iS(o)[0];e?e.focus():(o.hasAttribute(`tabindex`)||o.setAttribute(`tabindex`,`-1`),o.focus())}return()=>{i.current=!1;let e=document.activeElement;(!e||e===document.body||o?.contains(e))&&n?.isConnected&&n.focus()}},[e,t])}function bN({title:e,titleId:t,count:n,hint:r,defaultOpen:i=!1,forceOpen:a=!1,children:o}){let[s,c]=(0,J.useState)(i);return V(`details`,{className:`settings-disclosure`,open:s||a,onToggle:e=>{a||c(e.currentTarget.open)},children:[V(`summary`,{onClick:e=>{a&&e.preventDefault()},children:[P(hr,{size:15,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),V(`span`,{className:`settings-disclosure-text`,children:[P(`span`,{className:`settings-disclosure-title`,id:t,tabIndex:t?-1:void 0,children:e}),r&&P(`span`,{className:`settings-disclosure-hint`,children:r})]}),n!=null&&P(`bdi`,{dir:`ltr`,className:`settings-disclosure-count`,children:n})]}),P(`div`,{className:`settings-disclosure-body`,children:o})]})}var xN=g(Tc()?`settings.desktop.menuBar`:`settings.desktop.tray`),SN=[{key:`minimizeToTray`,label:`settings.desktop.keepRunning`,hint:`settings.desktop.keepRunningHint`},{key:`startOnLogin`,label:`settings.desktop.startOnLogin`,hint:`settings.desktop.startOnLoginHint`},{key:`startMinimized`,label:`settings.desktop.startMinimized`,hint:`settings.desktop.startMinimizedHint`}],CN=new Set([`startMinimized`]),wN={minimizeToTray:`settings.desktop.keepRunningNoTray`};function TN(e){return e?.reason===`no-host`?`settings.desktop.noTray`:e?.reason===`check-failed`?`settings.desktop.noTrayCheckFailed`:null}function EN(){let e=T(),t=window.gaiaAPI?.tray,[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null);(0,J.useEffect)(()=>{t&&t.getConfig().then(e=>{r(e.tray),a(e.host)}).catch(t=>s(e(`settings.desktop.readFailed`,{reason:t instanceof Error?t.message:String(t)})))},[t,e]);let u=(0,J.useCallback)(async e=>{if(t&&n&&c===null){l(e),s(null);try{let i=await t.setConfig({tray:{[e]:!n[e]}});r(i.tray),a(i.host)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(null)}}},[t,n,c]);if(!t)return null;let d=TN(i);return P(bN,{title:e(`settings.desktop.title`),children:V(`div`,{className:`settings-field`,role:`group`,"aria-labelledby":`desktop-app-label`,children:[P(`span`,{className:`settings-label`,id:`desktop-app-label`,children:e(`settings.desktop.title`)}),SN.map(({key:t,label:r,hint:i})=>{let a=CN.has(t)?d:null,o=d&&wN[t]||i;return V(`div`,{children:[V(`label`,{className:`setting-row`,children:[P(`span`,{children:e(r,{tray:xN})}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,role:`switch`,checked:!a&&!!n?.[t],"aria-describedby":`desktop-${t}-hint`,onChange:()=>void u(t),disabled:!!a||!n||c!==null&&c!==t,"aria-busy":c===t,"aria-label":e(r,{tray:xN})}),P(`span`,{className:`toggle-track`})]})]}),P(`p`,{className:`settings-hint`,id:`desktop-${t}-hint`,children:a?e(a):e(o,{tray:xN})})]},t)}),o&&P(`p`,{className:`settings-error`,role:`alert`,children:o})]})})}function DN(){return window.gaiaUpdater}var ON={status:`idle`,version:null,progress:0,releaseNotes:null,error:null,currentVersion:null,pinnedVersion:null,autoUpdate:!1,includePrereleases:!1};function kN(){let[e,t]=(0,J.useState)({...ON});return(0,J.useEffect)(()=>{let e=DN();if(!e)return;let n=!0;e.getStatus().then(e=>{n&&e&&t(e)}).catch(()=>{});let r=e.onStatusChange(e=>{n&&e&&t(e)});return()=>{n=!1;try{r()}catch{}}},[]),e}var AN=`gaia-update-error:`;function jN(e,t){let n=`update.err.${e}`;return N(n)?g(n,t??{}):null}function MN(e){let t=e instanceof Error?e.message:String(e),n=t.indexOf(AN);if(n<0)return t.replace(/^Error invoking remote method '[^']+': (?:Error: )?/,``);let r;try{r=JSON.parse(t.slice(n+18))}catch{return t.slice(0,n)+t.slice(n+18)}let i=jN(r.code,r.params)??r.message??r.code,a=r.note&&jN(r.note.code,r.note.params);return a?g(`update.err.withNote`,{error:i,note:a}):i}function NN(e,t){let n=MN(e);return typeof n==`object`?t(n.ref,n.params):String(n)}function PN(){return window.gaiaUpdater}function FN({onClose:e}){let t=T(),[n,r]=(0,J.useState)({kind:`loading`}),i=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=PN();e?e.listReleases().then(e=>{r(Array.isArray(e)?{kind:`list`,releases:e}:{kind:`error`,message:e.error})}).catch(()=>{r({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`})}):r({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`})},[]),Io(!0,e),aS(i,!0),(0,J.useEffect)(()=>{let e=i.current;e&&e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)?.focus()},[]),(0,J.useEffect)(()=>{let e=i.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 a(e,t){e.isCurrent||r({kind:`confirm`,release:e,releases:t})}async function o(n){r({kind:`installing`});let i=PN();if(!i)r({kind:`error`,message:t(`update.picker.noBridge`)});else try{await i.installVersion(n.tag),e()}catch(e){r({kind:`error`,message:t(`update.picker.failed`,{reason:MN(e)})})}}function s(e){if(!e)return``;try{return new Date(e).toLocaleDateString(te(t),{year:`numeric`,month:`short`,day:`numeric`})}catch{return e}}return P(`div`,{className:`version-picker-overlay`,onClick:t=>{t.target===t.currentTarget&&e()},children:V(`div`,{className:`version-picker-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`update.picker.title`),ref:i,children:[V(`div`,{className:`version-picker-header`,children:[P(`h3`,{children:t(`update.picker.title`)}),P(`button`,{className:`version-picker-close`,onClick:e,"aria-label":t(`update.picker.close`),type:`button`,children:`×`})]}),V(`div`,{className:`version-picker-body`,children:[n.kind===`loading`&&V(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[P(`span`,{className:`version-picker-spinner`}),t(`update.picker.loading`)]}),n.kind===`error`&&V(`div`,{className:`version-picker-error`,children:[P(`p`,{children:n.message}),P(`p`,{children:P(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:t(`update.picker.browse`)})})]}),n.kind===`list`&&P(`ul`,{className:`version-picker-list`,role:`listbox`,"aria-label":t(`update.picker.listAria`),children:n.releases.map(e=>P(`li`,{children:V(`button`,{type:`button`,className:`version-picker-row`,"data-version":e.version,"aria-label":e.isCurrent?t(`update.picker.rowInstalled`,{version:e.version}):e.isPinned?t(`update.picker.rowPinned`,{version:e.version}):e.version,"aria-disabled":e.isCurrent?`true`:`false`,onClick:()=>a(e,n.releases),disabled:e.isCurrent,children:[P(`span`,{className:`vp-version`,children:e.version}),P(`span`,{className:`vp-date`,children:s(e.date)}),e.isCurrent&&P(`span`,{className:`vp-badge vp-badge-current`,children:t(`update.picker.installed`)}),e.isPinned&&!e.isCurrent&&P(`span`,{className:`vp-badge vp-badge-pinned`,children:t(`update.picker.pinned`)}),!e.isCurrent&&P(`span`,{className:`vp-arrow`,"aria-hidden":`true`,children:`›`})]})},e.tag))}),n.kind===`list`&&V(`p`,{className:`version-picker-more`,children:[t(`update.picker.recent`,{n:n.releases.length}),` `,P(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:t(`update.picker.browseAll`)})]}),n.kind===`confirm`&&V(`div`,{className:`version-picker-confirm`,children:[P(`p`,{children:t(`update.picker.confirm`,{version:n.release.version})}),P(`p`,{className:`vp-confirm-note`,children:t(`update.picker.confirmNote`,{version:n.release.version})}),V(`div`,{className:`vp-confirm-actions`,children:[P(`button`,{type:`button`,className:`vp-btn-cancel`,onClick:()=>r({kind:`list`,releases:n.releases}),children:t(`update.picker.back`)}),P(`button`,{type:`button`,className:`vp-btn-confirm`,onClick:()=>o(n.release),children:t(`update.picker.install`)})]})]}),n.kind===`installing`&&V(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[P(`span`,{className:`version-picker-spinner`}),t(`update.picker.starting`)]})]})]})})}var IN=`https://github.com/amd/gaia/releases`;function LN(e){return/^\d+\.\d+\.\d+-/.test(e??``)}function RN(e,t){let n=e.version??``;switch(e.status){case`checking`:return t(`update.status.checking`);case`available`:return t(`update.status.available`,{version:n});case`downloading`:return e.preparing?t(`update.status.preparing`,{version:n}):t(`update.status.downloading`,{version:n,pct:e.progress});case`downloaded`:return t(`update.status.downloaded`,{version:n});case`error`:return t(`update.status.error`,{reason:e.error??t(`update.status.unknownError`)});case`no-channel`:return e.error??t(`update.status.noChannel`);case`disabled`:return t(`update.status.disabled`);default:return t(`update.status.upToDate`)}}function zN(){let e=kN(),t=T(),n=DN(),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1);if(!n)return null;async function l(e,r){if(n){i(!0),o(null);try{await r(n)}catch(n){d.system.error(`${e} failed`,n),o(t(`update.settings.failed`,{action:g(e),reason:MN(n)}))}finally{i(!1)}}}let u=e.status===`disabled`,f=r||e.status===`checking`||e.status===`downloading`,p=`${t(`update.settings.running`,{version:e.currentVersion??t(`update.settings.unknownVersion`)})} ${RN(e,t)}`,m=[`available`,`downloaded`,`error`].includes(e.status)||!!e.pinnedVersion||!!e.installFailed||!!e.configError||!!a;return P(bN,{title:t(`update.settings.title`),titleId:`updates-label`,hint:p,forceOpen:m,children:V(`div`,{className:`settings-field`,role:`group`,"aria-labelledby":`updates-label`,children:[P(`p`,{className:`visually-hidden`,role:`status`,children:p}),V(`label`,{className:`setting-row`,children:[P(`span`,{children:t(`update.settings.auto`)}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,role:`switch`,checked:e.autoUpdate,"aria-describedby":`updates-auto-hint`,"aria-label":t(`update.settings.auto`),"aria-busy":r,disabled:u,onChange:()=>{r||l(`update.action.saveAuto`,t=>t.setAutoUpdate(!e.autoUpdate))}}),P(`span`,{className:`toggle-track`})]})]}),P(`p`,{className:`settings-hint`,id:`updates-auto-hint`,children:t(`update.settings.autoHint`)}),V(`label`,{className:`setting-row`,children:[P(`span`,{children:t(`update.settings.rc`)}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,role:`switch`,checked:!!e.includePrereleases,"aria-describedby":`updates-rc-hint`,"aria-label":t(`update.settings.rc`),"aria-busy":r,disabled:u,onChange:()=>{r||l(`update.action.saveRc`,t=>t.setIncludePrereleases(!e.includePrereleases))}}),P(`span`,{className:`toggle-track`})]})]}),V(`p`,{className:`settings-hint`,id:`updates-rc-hint`,children:[t(`update.settings.rcHint`),LN(e.currentVersion)&&` ${t(`update.settings.rcHintRunning`)}`]}),e.pinnedVersion&&V(`p`,{className:`settings-hint`,children:[t(`update.settings.pinned`,{version:e.pinnedVersion}),` `,P(`button`,{type:`button`,className:`btn-secondary`,disabled:r,onClick:()=>void l(`update.action.resume`,e=>e.resumeUpdates()),children:t(`update.settings.unpin`)})]}),V(`div`,{className:`setting-actions`,children:[e.status===`available`&&!e.pinnedVersion&&P(`button`,{type:`button`,className:`btn-primary`,disabled:r,onClick:()=>void l(`update.action.download`,e=>e.downloadUpdate()),children:t(`update.settings.updateTo`,{version:e.version??``})}),e.status===`downloaded`&&P(`button`,{type:`button`,className:`btn-primary`,disabled:r,onClick:()=>void l(`update.action.restart`,e=>e.restart()),children:t(`update.settings.restart`)}),P(`button`,{type:`button`,className:`btn-secondary`,disabled:f||u,onClick:()=>void l(`update.action.check`,e=>e.check()),children:t(`update.settings.check`)}),P(`button`,{type:`button`,className:`btn-secondary`,disabled:f||u,onClick:()=>c(!0),children:t(`update.settings.pick`)}),e.previousVersion&&P(`button`,{type:`button`,className:`btn-secondary`,"aria-describedby":`updates-back-hint`,disabled:f||u,onClick:()=>void l(`update.action.goBack`,e=>e.revertUpdate()),children:t(`update.settings.goBack`,{version:e.previousVersion})})]}),e.previousVersion&&P(`p`,{className:`settings-hint`,id:`updates-back-hint`,children:t(`update.settings.goBackHint`)}),e.installFailed&&P(`p`,{className:`settings-error`,role:`alert`,children:t(`update.settings.installFailed`,{...e.installFailed,url:IN})}),e.lastCheckError&&P(`p`,{className:`settings-hint`,children:t(`update.settings.lastCheckError`,{reason:e.lastCheckError})}),e.configError&&P(`p`,{className:`settings-error`,role:`alert`,children:e.configError}),a&&P(`p`,{className:`settings-error`,role:`alert`,children:a}),s&&P(FN,{onClose:()=>c(!1)})]})})}var BN=[{value:`light`,label:`settings.theme.light`},{value:`dark`,label:`settings.theme.dark`},{value:`system`,label:`settings.theme.system`}],VN={default:`palette.default`,stone:`palette.stone`,marble:`palette.marble`,glacier:`palette.glacier`,forest:`palette.forest`,sage:`palette.sage`,basalt:`palette.basalt`,gold:`palette.gold`,dusk:`palette.dusk`,custom:`settings.colors.custom`},HN=[[`Enter`,`settings.shortcut.send`],[`Shift+Enter`,`settings.shortcut.newLine`],[`Esc`,`settings.shortcut.stop`],[`Mod+Shift+O`,`settings.shortcut.newChat`],[`Mod+K`,`settings.shortcut.search`],[`Mod+B`,`settings.shortcut.sidebar`],[`Mod+,`,`settings.shortcut.settings`]];function UN(){let e=T(),t=k(e=>e.locale),n=k(e=>e.setLocale),r=k(e=>e.themePreference),i=k(e=>e.setThemePreference),a=k(e=>e.palette),o=k(e=>e.setPalette),s=k(e=>e.customColors),c=k(e=>e.setCustomColors),l=GO(e=>e.visible),u=GO(e=>e.setVisible),d=e=>t=>c({...s,[e]:t.target.value.toUpperCase()});return V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:e(`settings.section.general`)}),V(`div`,{className:`settings-field`,children:[P(`label`,{className:`settings-label`,htmlFor:`ui-language`,children:e(`settings.language`)}),P(`select`,{id:`ui-language`,className:`settings-input`,value:t,onChange:e=>n(e.target.value),children:b.map(({meta:e})=>P(`option`,{value:e.code,lang:e.code,dir:e.dir,children:M(e)},e.code))}),P(`span`,{className:`settings-hint`,children:e(`settings.languageHint`)})]}),V(`div`,{className:`settings-field`,children:[P(`span`,{className:`settings-label`,id:`appearance-label`,children:e(`settings.appearance`)}),P(`div`,{className:`segmented`,role:`radiogroup`,"aria-labelledby":`appearance-label`,children:BN.map(t=>P(`button`,{type:`button`,role:`radio`,"aria-checked":r===t.value,className:r===t.value?`is-active`:``,onClick:()=>i(t.value),children:e(t.label)},t.value))})]}),V(`div`,{className:`settings-field`,children:[V(`label`,{className:`setting-row`,children:[P(`span`,{children:e(`resources.settings`)}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),"aria-label":e(`resources.settings`),"aria-describedby":`resources-hint`}),P(`span`,{className:`toggle-track`})]})]}),P(`span`,{className:`settings-hint`,id:`resources-hint`,children:e(`resources.settingsHint`)})]}),V(bN,{title:e(`settings.colors`),titleId:`palette-label`,defaultOpen:a===`custom`,children:[V(`div`,{className:`palette-grid`,role:`radiogroup`,"aria-labelledby":`palette-label`,children:[oe.map(t=>V(`button`,{type:`button`,role:`radio`,"aria-checked":a===t.id,className:`palette-tile${a===t.id?` is-active`:``}`,onClick:()=>o(t.id),children:[P(`span`,{className:`palette-swatch`,"aria-hidden":`true`,children:t.swatch.map(e=>P(`i`,{style:{background:e}},e))}),e(VN[t.id])]},t.id)),V(`button`,{type:`button`,role:`radio`,"aria-checked":a===`custom`,className:`palette-tile${a===`custom`?` is-active`:``}`,onClick:()=>o(`custom`),children:[V(`span`,{className:`palette-swatch`,"aria-hidden":`true`,children:[P(`i`,{style:{background:s.base}}),P(`i`,{style:{background:s.accent}})]}),e(`settings.colors.custom`)]})]}),a===`custom`&&V(`div`,{className:`palette-custom`,children:[V(`label`,{className:`palette-color`,htmlFor:`custom-accent`,children:[P(`input`,{id:`custom-accent`,type:`color`,value:s.accent,onChange:d(`accent`)}),V(`span`,{children:[e(`settings.colors.accent`),P(`small`,{children:e(`settings.colors.accentHint`)})]})]}),V(`label`,{className:`palette-color`,htmlFor:`custom-base`,children:[P(`input`,{id:`custom-base`,type:`color`,value:s.base,onChange:d(`base`)}),V(`span`,{children:[e(`settings.colors.base`),P(`small`,{children:e(`settings.colors.baseHint`)})]})]}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>c(v),children:e(`settings.colors.reset`)}),P(`p`,{className:`settings-hint`,children:e(`settings.colors.hint`)})]})]}),P(EN,{}),P(zN,{}),P(bN,{title:e(`settings.shortcuts`),children:P(`dl`,{className:`shortcut-list`,children:HN.map(([t,n])=>V(`div`,{className:`shortcut-row`,children:[P(`dt`,{children:P(`kbd`,{children:kc(t)})}),P(`dd`,{children:e(n)})]},t))})})]})}function WN(e){return/not reachable|not answering|model server at|ConnectionPool|NewConnectionError|Connection refused|Max retries/i.test(e)}function GN(e){return/gaia init/i.test(e??``)}function KN(e){return!!e&&!e.lemonade_running&&(GN(e.start_command)||GN(e.start_instruction))}function qN({className:e=`btn-secondary`}){let t=T();return P(`button`,{type:`button`,className:e,onClick:()=>window.dispatchEvent(new CustomEvent(`gaia:set-up-local`)),children:t(`settings.errors.setUpLocal`)})}function JN({message:e,onRetry:t}){let n=T(),r=k(e=>KN(e.systemStatus));return WN(e)?V(`div`,{className:`settings-notice`,role:`alert`,children:[P(`strong`,{children:n(r?`settings.errors.notInstalledTitle`:`settings.errors.serverDownTitle`)}),P(`p`,{children:n(r?`settings.errors.notInstalled`:`settings.errors.serverDown`)}),r&&P(qN,{className:`btn-primary`}),t&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:t,children:n(`settings.key.checkAgain`)}),V(`details`,{className:`settings-more`,children:[V(`summary`,{children:[P(hr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,n(`settings.errors.details`)]}),P(`bdi`,{dir:`ltr`,className:`settings-notice-raw`,children:e})]})]}):P(`p`,{className:`settings-error`,role:`alert`,children:e})}function YN({onAdded:e}){let t=T(),[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),f=(0,J.useRef)(``),p=(0,J.useCallback)(async e=>{let t=n.trim();f.current=t,l(`check`),d(null);try{let n=await sn(t,e);if(f.current!==t)return;s(n),a(n.file??e)}catch(e){if(f.current!==t)return;s(null),d(e instanceof Error?e.message:String(e))}finally{l(null)}},[n]),m=(0,J.useCallback)(async()=>{l(`add`),d(null);try{let{report:o}=await xt(n.trim(),i);r(``),a(``),s(null),e(o.display_name??o.model_id??t(`settings.custom.theModel`))}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(null)}},[e,i,n,t]);return V(`form`,{className:`settings-field custom-model-add`,onSubmit:e=>{e.preventDefault(),p(``)},children:[P(`label`,{className:`visually-hidden`,htmlFor:`custom-model-url`,children:t(`settings.custom.title`)}),P(`span`,{className:`settings-hint`,children:t(`settings.custom.hint`)}),V(`div`,{className:`settings-row`,children:[P(`input`,{id:`custom-model-url`,className:`settings-input`,type:`url`,inputMode:`url`,dir:`ltr`,spellCheck:!1,autoComplete:`off`,value:n,readOnly:c!==null,onChange:e=>{r(e.target.value),s(null),a(``),f.current=``},placeholder:`https://huggingface.co/unsloth/Qwen3-4B-Instruct-2507-GGUF`}),V(`button`,{type:`submit`,className:`btn-secondary`,disabled:c!==null||!n.trim(),children:[c===`check`?P(K,{size:13,className:`spin`}):null,` `,t(`settings.custom.check`)]})]}),o&&(()=>{let e=P(`ul`,{className:`custom-model-checks`,"aria-label":t(`settings.custom.checks`),children:o.checks.map(e=>V(`li`,{className:e.ok?`is-ok`:`is-failed`,children:[e.ok?P(pr,{size:13,"aria-label":t(`settings.custom.passed`)}):P(So,{size:13,"aria-label":t(`settings.custom.failed`)}),V(`bdi`,{children:[P(`strong`,{children:e.label}),` — `,e.detail]})]},e.id))});return o.ok?V(`details`,{className:`custom-model-checks-summary`,children:[V(`summary`,{children:[P(pr,{size:13,"aria-hidden":`true`}),` `,t(`settings.custom.allPassed`,{n:o.checks.length})]}),e]}):e})(),o&&o.warnings.length>0&&P(`ul`,{className:`custom-model-checks`,"aria-label":t(`settings.custom.warnings`),children:o.warnings.map(e=>V(`li`,{className:`is-warning`,children:[P(q,{size:13,"aria-label":t(`settings.custom.warning`)}),` `,P(`bdi`,{children:e})]},e))}),o&&o.variants.length>1&&V(`div`,{className:`settings-row`,children:[P(`label`,{className:`settings-hint`,htmlFor:`custom-model-quant`,children:t(`settings.custom.quantization`)}),P(`select`,{id:`custom-model-quant`,className:`settings-input`,value:i,onChange:e=>void p(e.target.value),disabled:c!==null,children:o.variants.map(e=>V(`option`,{value:e.file,children:[e.quant,` · `,e.size_gb,` GB`,e.fits?``:` · ${t.bare(`settings.custom.tooLarge`)}`]},e.file))})]}),o?.ok&&V(`div`,{className:`settings-row`,children:[V(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void m(),disabled:c!==null,children:[c===`add`?P(K,{size:13,className:`spin`}):null,` `,t(`settings.custom.add`,{name:o.display_name??``})]}),P(`span`,{className:`settings-hint`,children:t(`settings.model.sizeDownload`,{size:`${o.size_gb} GB`})})]}),u&&P(JN,{message:u})]})}function XN(e){return e instanceof Error?e.message:String(e)}function ZN(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}function QN({downloadsSlot:e}){let t=T(),[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(null),b=Ls(e=>e.status),x=Ls(e=>e.started),S=(0,J.useMemo)(()=>Ps(b,x),[b,x]),C=Ls(e=>e.error),w=Ls(e=>e.refresh),E=Ls(e=>e.enqueue),O=Ls(e=>e.cancel),k=(0,J.useCallback)(async(e=!1)=>{a(null);try{let t=await ot();r(t),s(n=>e||!n?uj(t):n)}catch(e){a(XN(e))}},[]);(0,J.useEffect)(()=>{k(!0),w(),(async()=>{try{_(await Xe()??null)}catch(e){y(XN(e))}})()},[k,w]);let A=(S?.models??[]).filter(e=>e.state===`ready`).map(e=>e.id).join(`,`),j=(0,J.useRef)(A);(0,J.useEffect)(()=>{A!==j.current&&(j.current=A,k(!0))},[A,k]);let M=(0,J.useMemo)(()=>{let e={};for(let t of S?.models??[])e[t.id]=t;return e},[S]),N=(0,J.useMemo)(()=>{let e={};for(let t of n?.catalog??[])e[t.id]=t.name;return e},[n]),F=(0,J.useMemo)(()=>n?uj(n):null,[n]),I=YA(n),L=n&&o?hj(I,o).filter(e=>M[e.id]?.state!==`downloading`):[],ee=L.reduce((e,t)=>e+(t.size_gb??0),0),R=!!n&&!!o&&!!F&&(!ZN(o.ticked,F.ticked)||o.defaultChat!==F.defaultChat||L.length>0),z=(0,J.useCallback)(async(e,i)=>{if(!n||!o)return;if(p(null),!e){let e=vj(I,o).filter(e=>!e.downloaded||e.id===o.defaultChat);if(e.length>0&&e.every(e=>e.need_gb!=null)){l({kind:`no_fit`,models:e});return}}let a=_j(n,o);if(a&&!i)l({kind:`low_disk`,message:a.drop?t(`setup.summary.shortDrop`,{need:$(a.needGb),free:$(a.freeGb),drive:Mj(n.disk?.path??null)??t(`setup.summary.theDrive`),freeUp:$(a.freeUpGb),name:a.drop.name,saves:$(a.drop.size_gb??0)}):t(`setup.summary.short`,{need:$(a.needGb),free:$(a.freeGb),drive:Mj(n.disk?.path??null)??t(`setup.summary.theDrive`),freeUp:$(a.freeUpGb)})});else{d(!0);try{let i=n;if(o.defaultChat&&o.defaultChat!==i.chat_model.id)try{i=await Wt(o.defaultChat,e||m)}catch(e){let t=Oe(e);if(t){l({kind:`server`,detail:t});return}throw e}for(let e of yj(i,o))i=await ht(e.id,e.skipped);let a=hj(YA(i),o).map(e=>e.id).filter(e=>M[e]?.state!==`downloading`);r(i),s({...o,defaultChat:i.chat_model.id}),cs.getState().refresh(),a.length&&await E(a,{acknowledgeLowDisk:!0}),p({ok:!0,text:t(`settings.models.applied`)})}catch(e){p({ok:!1,text:XN(e)})}finally{d(!1)}}},[n,o,I,m,M,E,t]),B=(0,J.useCallback)(async e=>{l(null),d(!0),p(null);try{let n=await je(e.id);Uo(),r(n),s(uj(n)),p({ok:!0,text:t(`settings.models.removed`,{name:e.name,size:$(n.freed_gb)})})}catch(e){p({ok:!1,text:XN(e)})}finally{d(!1)}},[t]),te=(0,J.useCallback)((e,t)=>{(async()=>{try{t===`verify`&&await je(e),await E([e])}catch(e){p({ok:!1,text:XN(e)})}})()},[E]),ne=!!S&&(S.models?.length??0)>0&&(xM(S)||S.models.some(e=>e.state!==`skipped`))&&S&&V(`section`,{className:`settings-field models-pane-section`,"aria-labelledby":`settings-downloads-title`,children:[P(`span`,{className:`settings-label`,id:`settings-downloads-title`,children:t(`settings.models.downloads`)}),P(wM,{status:S,names:N,freeGb:n?.disk?.free_gb??null,onCancel:()=>void O(),onRetry:te,onResume:e=>void E([e]),onResumeAll:()=>void E((S.models??[]).filter(e=>e.state===`cancelled`).map(e=>e.id))}),C&&P(`p`,{className:`settings-error`,role:`alert`,children:C})]});return V(D.Fragment,{children:[P(bN,{title:t(`settings.models.manage`),hint:t(`settings.models.manageHint`),forceOpen:!!i||f?.ok===!1,children:V(`section`,{className:`settings-field models-pane-section`,"aria-labelledby":`settings-models-title`,children:[P(`span`,{className:`visually-hidden`,id:`settings-models-title`,children:t(`settings.models.title`)}),P(`p`,{className:`settings-hint`,children:t(`settings.models.lede`)}),i&&P(JN,{message:i}),n&&!n.lemonade.reachable&&P(`p`,{className:`settings-hint`,children:t(`settings.models.unavailable`)}),!n&&!i&&V(`p`,{className:`settings-hint`,children:[P(K,{size:13,className:`spin`,"aria-hidden":`true`}),` `,t(`setup.models.loading`)]}),n&&n.lemonade.reachable&&o&&V(D.Fragment,{children:[P(Pj,{plan:n,selection:o,onToggle:(e,t)=>s(fj(o,I,e,t)),onDefaultChat:e=>s(pj(o,I,e)),labelledBy:`settings-models-title`,place:`settings`,disabled:u,progress:M,rowActions:e=>e.downloaded&&e.id!==o.defaultChat?P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>l({kind:`remove`,entry:e}),disabled:u||M[e.id]?.state===`downloading`,"aria-label":t(`settings.models.removeAria`,{name:e.name}),children:t(`settings.models.remove`)}):null}),P(jj,{plan:n,selection:o}),P(`div`,{className:`models-apply`,children:V(`button`,{type:`button`,className:`btn-primary`,disabled:!R||u,onClick:()=>void z(!1,!1),children:[u&&P(K,{size:13,className:`spin`,"aria-hidden":`true`}),u?t(`settings.models.applying`):L.length>0?t(`settings.models.applyDownload`,{size:$(Math.round(ee*10)/10)}):t(`settings.models.apply`)]})})]}),f?.ok&&P(`p`,{className:`settings-ok`,role:`status`,children:f.text}),f&&!f.ok&&P(JN,{message:f.text})]})}),(g?.applies||v&&!WN(v))&&P(bN,{title:t(`gpu.settingsTitle`),titleId:`settings-gpu-title`,defaultOpen:!!g?.pending||!!v,children:V(`section`,{className:`settings-field models-pane-section`,"aria-labelledby":`settings-gpu-title`,children:[v&&P(`p`,{className:`settings-error`,role:`alert`,children:v}),g?.applies&&P($j,{status:g,onStatus:_,mode:`settings`,names:N,headingId:`settings-gpu-title`})]})}),e?(0,Qx.createPortal)(ne,e):e===void 0&&ne,c?.kind===`remove`&&P(Wj,{title:t(`settings.models.removeTitle`,{name:c.entry.name}),confirmLabel:t(`settings.models.removeConfirm`),cancelLabel:t(`settings.models.keep`),danger:!0,onConfirm:()=>void B(c.entry),onCancel:()=>l(null),children:P(`p`,{children:XA(c.entry)?t(`settings.models.removeVision`,{size:$(c.entry.full_size_gb??0)}):t(`settings.models.removeBody`,{size:$(c.entry.full_size_gb??0)})})}),c?.kind===`no_fit`&&P(Wj,{title:c.models.length===1?t(`setup.confirm.noFitOne`,{name:c.models[0].name}):t(`setup.confirm.noFitMany`),confirmLabel:t(`setup.confirm.downloadAnyway`),cancelLabel:t(`setup.confirm.pickSmaller`),onConfirm:()=>{l(null),h(!0),z(!0,!1)},onCancel:()=>l(null),children:c.models.map(e=>V(`p`,{children:[P(`bdi`,{children:e.name}),`: `,Oj(e,t)]},e.id))}),c?.kind===`low_disk`&&P(Wj,{title:t(`setup.confirm.lowDiskTitle`),confirmLabel:t(`setup.confirm.downloadAnyway`),cancelLabel:t(`setup.confirm.changeModels`),onConfirm:()=>{l(null),z(!0,!0)},onCancel:()=>l(null),children:P(`p`,{children:c.message})}),c?.kind===`server`&&P(Wj,{title:t(`setup.confirm.noFitServerTitle`),confirmLabel:t(`setup.confirm.useAnyway`),cancelLabel:t(`setup.confirm.changeModels`),onConfirm:()=>{l(null),h(!0),z(!0,!1)},onCancel:()=>l(null),children:P(`p`,{children:c.detail.message})})]})}var $N=`auto`;function eP({model:e}){let t=T(),[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null);(0,J.useEffect)(()=>{r(null),a(null),l(null),_e(e).then(r).catch(e=>a(e instanceof Error?e.message:String(e)))},[e]);let u=(0,J.useCallback)(async n=>{s(!0),a(null),l(null);try{let i=await Ke(e,n===$N?null:Number(n));r(i);let a={name:i.display_name,size:i.chosen?Cs(i.chosen):g(`settings.ctx.automaticSize`)},o=i.reload?.reason;i.reload?.started?l(t(`settings.ctx.reloading`,a)):l(o===`already_loaded`?t(`settings.ctx.alreadyLoaded`,a):o===`warm_up`?t(`settings.ctx.warmUp`,a):o===`busy`?t(`settings.ctx.busy`,a):o===`not_gaias_server`?t(`settings.ctx.ownServer`,a):t(o===`restarting`?`settings.ctx.restarting`:`settings.ctx.nextLoad`))}catch(e){a(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e,t]);if(i&&!n)return WN(i)?P(`p`,{className:`settings-hint`,children:t(`settings.ctx.serverDown`)}):P(`p`,{className:`settings-error`,role:`alert`,children:i});if(!n)return V(`p`,{className:`settings-hint`,children:[P(K,{size:13,className:`spin`}),` `,t(`settings.ctx.checking`)]});let d=n.chosen==null?$N:String(n.chosen),f=n.chosen!=null&&n.loaded_ctx!=null&&n.loaded_ctx!==n.chosen;return V(D.Fragment,{children:[V(`div`,{className:`model-in-use-field`,children:[P(`label`,{className:`settings-label`,htmlFor:`ctx-size`,children:t(`settings.ctx.label`)}),V(`select`,{id:`ctx-size`,className:`settings-input`,value:d,onChange:e=>void u(e.target.value),disabled:o||n.options.length===0,children:[P(`option`,{value:$N,children:n.automatic?t.bare(`settings.ctx.automaticAt`,{size:Cs(n.automatic)}):t.bare(`settings.ctx.automatic`)}),n.options.map(e=>P(`option`,{value:String(e),children:t.bare(`settings.ctx.tokens`,{size:Cs(e)})},e))]})]}),n.note&&P(`span`,{className:`settings-hint`,children:P(`bdi`,{children:n.note})}),!n.note&&!!n.max_fit&&V(`details`,{className:`settings-more`,children:[V(`summary`,{children:[P(hr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,t(`settings.ctx.about`)]}),P(`span`,{className:`settings-hint`,children:t(`settings.ctx.explain`,{size:Cs(n.max_fit),name:n.display_name,memory:n.memory_source})})]}),f&&P(`span`,{className:`settings-hint`,children:t(`settings.ctx.loadedAt`,{size:Cs(n.loaded_ctx)})}),o&&V(`span`,{className:`settings-hint`,children:[P(K,{size:13,className:`spin`}),` `,t(`settings.ctx.applying`)]}),c&&P(`p`,{className:`settings-ok`,role:`status`,children:c}),i&&P(`p`,{className:`settings-error`,role:`alert`,children:i})]})}function tP({row:e,providerName:t,choices:n,labels:r,disabled:i,onSwitch:a}){let o=T(),s=cs(e=>e.active),c=s?.model??null,l=!!s?.remote,u=n.some(e=>us(c,e.id)),d=s?.downloaded??e?.downloaded,f=l?null:e?.state===`loaded`?o(`settings.model.loaded`):d===!0?o(`settings.model.downloaded`):d===!1?o(`settings.model.notDownloaded`):null,p=e?.placement?.device;return V(`section`,{className:`settings-card model-in-use`,"aria-label":o(`settings.model.inUseTitle`),children:[P(`span`,{className:`model-in-use-label`,children:o(`settings.model.inUseTitle`)}),c?P(`bdi`,{className:`model-in-use-name`,title:c,children:e?.display_name||s?.display_name||ds(c)}):P(`span`,{className:`settings-hint`,children:o(`settings.model.noneInUse`)}),s?.config_error&&P(`p`,{className:`settings-error`,role:`alert`,children:P(`bdi`,{children:s.config_error})}),c&&!l&&e?.available===!1&&P(`p`,{className:`settings-error`,role:`alert`,children:o(`settings.model.inUseCantRun`)}),c&&V(`span`,{className:`model-chips`,children:[l&&P(`span`,{className:`model-badge is-device`,children:o(`settings.model.cloud`)}),l&&t&&P(`bdi`,{className:`model-badge is-ready`,children:t}),p&&P(`span`,{className:`model-badge is-device`,children:p.toUpperCase()}),f&&P(`span`,{className:`model-badge ${e?.state===`loaded`?`is-loaded`:`is-ready`}`,children:f}),e?.fits===!0&&P(`span`,{className:`model-badge is-fit`,children:o(`settings.model.fits`)}),!!e?.size_gb&&V(`bdi`,{dir:`ltr`,className:`model-badge is-size`,children:[e.size_gb,` GB`]}),l&&!!e?.context_length&&P(`span`,{className:`model-badge is-ready`,children:o(`settings.model.contextChip`,{size:Cs(e.context_length)})})]}),(n.length>1||n.length===1&&!u)&&V(`div`,{className:`model-in-use-field`,children:[P(`label`,{className:`settings-label`,htmlFor:`model-switch`,children:o(`settings.model.switch`)}),V(`select`,{id:`model-switch`,className:`settings-input`,value:u?n.find(e=>us(c,e.id))?.id:``,onChange:e=>a(e.target.value),disabled:i,children:[!u&&P(`option`,{value:``,disabled:!0,children:o.bare(`settings.model.switchPlaceholder`)}),n.map(e=>P(`option`,{value:e.id,children:r[e.id]},e.id))]})]}),c&&!l&&s?.downloaded!==!1&&P(eP,{model:c})]})}function nP({model:e,label:t,current:n,remote:r,busy:i,confirmingRemove:a,onUse:o,onDownload:s,onAskRemove:c,onKeep:l,onRemove:u,onNpuRecheck:d}){let f=T(),p=Ts(e)?e.download_progress:null,m=e.placement?.label,h=f.compose(t=>[m&&(e.placement?.source===`expected`?t(`settings.model.expected`,{label:m}):m),e.size_gb?t(e.downloaded?`settings.model.sizeOnDisk`:`settings.model.sizeDownload`,{size:`${e.size_gb} GB`}):null,e.tokens_per_second?t(`settings.model.speed`,{speed:`${Math.round(e.tokens_per_second)} tok/s`}):null,!e.placement&&e.context_length?t(`settings.model.contextTokens`,{size:e.context_length.toLocaleString()}):null].filter(Boolean).join(` · `)),g=!!(e.display_name||h||e.evidence||e.custom&&e.source_url);return V(`li`,{className:`model-row${n?` is-current`:``}`,children:[V(`div`,{className:`model-row-text`,children:[P(`bdi`,{className:`model-row-name`,title:e.id,children:t}),V(`div`,{className:`model-chips`,children:[e.placement?.device&&P(`span`,{className:`model-badge is-device`,children:e.placement.device.toUpperCase()}),e.rank&&V(`span`,{className:`model-badge is-rank`,children:[V(`bdi`,{dir:`ltr`,children:[`#`,e.rank]}),` `,e.note]}),e.state===`loaded`&&P(`span`,{className:`model-badge is-loaded`,children:f(`settings.model.loaded`)}),e.fits===!0&&e.available!==!1&&P(`span`,{className:`model-badge is-fit`,children:f(`settings.model.fits`)}),e.custom&&P(`span`,{className:`model-badge is-custom`,children:f(`settings.model.custom`)}),!!e.size_gb&&V(`bdi`,{dir:`ltr`,className:`model-badge is-size`,children:[e.size_gb,` GB`]}),g&&V(`details`,{className:`settings-more`,children:[V(`summary`,{children:[P(hr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,f(`settings.model.details`)]}),e.display_name&&P(`span`,{className:`model-row-meta`,children:P(`bdi`,{children:e.id})}),h&&P(`span`,{className:`model-row-meta`,children:h}),e.evidence&&P(`span`,{className:`model-row-meta`,children:f(`settings.model.measured`,{evidence:e.evidence})}),e.custom&&e.source_url&&P(`span`,{className:`model-row-meta`,children:f(`settings.model.from`,{url:e.source_url})})]})]}),r&&P(`span`,{className:`model-row-meta${e.price?``:` is-unknown-price`}`,children:XT(e.price,f)}),e.placement?.warning&&P(`span`,{className:`model-row-meta is-warning`,role:`alert`,children:P(`bdi`,{children:e.placement.warning})}),e.npu_problems?.length?P(MM,{problems:e.npu_problems,disabled:i!==null,onRecheck:d,id:`npu-problems-${e.id}`}):e.unavailable_reason&&P(`span`,{className:`model-row-meta`,children:f(`settings.model.cantRun`,{reason:e.unavailable_reason})}),p&&P(`progress`,{max:100,value:p.percent,"aria-label":f(`settings.model.downloadingAria`,{name:t})})]}),V(`div`,{className:`model-row-actions`,children:[e.custom&&!n&&!p&&(a?V(D.Fragment,{children:[V(`button`,{type:`button`,className:`btn-danger`,onClick:u,disabled:i!==null,children:[i===`rm:${e.id}`?P(K,{size:13,className:`spin`}):null,e.downloaded?f(`settings.model.removeDownload`):f(`settings.models.remove`)]}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:l,disabled:i!==null,children:f(`settings.models.keep`)})]}):P(`button`,{type:`button`,className:`btn-secondary`,onClick:c,disabled:i!==null,"aria-label":f(`settings.models.removeAria`,{name:t}),children:f(`settings.models.remove`)})),n&&e.available===!1?P(`span`,{className:`model-row-current is-blocked`,children:f(`settings.model.inUseBlocked`)}):n?V(`span`,{className:`model-row-current`,children:[P(pr,{size:13,"aria-hidden":`true`}),` `,f(`settings.model.inUse`)]}):e.available===!1?null:p?V(`span`,{className:`model-row-current`,children:[P(K,{size:13,className:`spin`}),` `,p.message?P(`bdi`,{children:p.message}):V(`bdi`,{dir:`ltr`,children:[Math.round(p.percent),`%`]})]}):e.downloaded?V(`button`,{type:`button`,className:`btn-secondary`,onClick:o,disabled:i!==null,"aria-label":f(`settings.model.useAria`,{name:t}),children:[i===e.id?P(K,{size:13,className:`spin`}):null,` `,f(`settings.model.use`)]}):V(`button`,{type:`button`,className:`btn-secondary`,onClick:s,disabled:i!==null,"aria-label":f(`settings.model.downloadAria`,{name:t}),children:[i===`dl:${e.id}`?P(K,{size:13,className:`spin`}):null,` `,f(`settings.model.download`)]})]})]})}function rP(){let e=T(),[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(!1),l=(0,J.useCallback)(async e=>{c(!0),i(null);try{let t=await e();n(t),o(t.limit_usd==null?``:String(t.limit_usd))}catch(e){i(e instanceof Error?e.message:String(e))}finally{c(!1)}},[]);if((0,J.useEffect)(()=>{l(H)},[l]),!t)return r?P(`p`,{className:`settings-error`,role:`alert`,children:r}):V(`p`,{className:`settings-hint`,children:[P(K,{size:13,className:`spin`}),` `,e(`settings.spend.loading`)]});let u=t.limit_usd,d=a.trim()===``?null:Number(a),f=d===null||Number.isFinite(d)&&d>0,p=d!==u;return V(`section`,{className:`settings-field spending`,"aria-label":e(`settings.spend.aria`),children:[P(`span`,{className:`settings-label`,children:e(`settings.spend.title`)}),V(`p`,{className:`spending-total`,children:[P(`bdi`,{dir:`ltr`,children:P(`strong`,{children:ZT(t.total_usd)})}),u!=null&&V(D.Fragment,{children:[` `,e(`settings.spend.ofLimit`,{limit:ZT(u)})]}),V(`span`,{className:`settings-hint`,children:[` · `,e.plural(`settings.spend.turns`,t.turns)]})]}),t.unpriced_turns>0&&P(`p`,{className:`settings-hint`,children:e.plural(`settings.spend.unpriced`,t.unpriced_turns)}),t.unreported_turns>0&&P(`p`,{className:`settings-hint`,children:e.plural(`settings.spend.unreported`,t.unreported_turns)}),t.state===`near`&&V(`p`,{className:`spending-warning`,role:`status`,children:[P(q,{size:13,"aria-hidden":`true`}),` `,e(`settings.spend.near`)]}),t.state===`reached`&&V(`div`,{className:`spending-warning`,role:`alert`,children:[V(`p`,{children:[P(q,{size:13,"aria-hidden":`true`}),` `,e(`settings.spend.reached`)]}),P(`button`,{type:`button`,className:`btn-secondary`,disabled:s,onClick:()=>void l(hn),children:e(`settings.spend.allow`)})]}),t.state===`allowed_over`&&P(`p`,{className:`settings-hint`,children:e(`settings.spend.allowed`)}),V(`form`,{className:`settings-row`,onSubmit:e=>{e.preventDefault(),f&&p&&l(()=>Ze(d))},children:[P(`label`,{className:`spending-limit-label`,htmlFor:`spend-limit`,children:e(`settings.spend.limit`)}),P(`input`,{id:`spend-limit`,className:`settings-input`,type:`number`,min:`0.01`,step:`0.01`,inputMode:`decimal`,placeholder:e.bare(`settings.spend.noLimit`),value:a,onChange:e=>o(e.target.value),"aria-invalid":!f}),V(`button`,{type:`submit`,className:`btn-secondary`,disabled:s||!f||!p,children:[s?P(K,{size:13,className:`spin`}):null,` `,e(`settings.advanced.save`)]}),u!=null&&P(`button`,{type:`button`,className:`btn-secondary`,disabled:s,onClick:()=>void l(()=>Ze(null)),children:e(`settings.spend.removeLimit`)})]}),P(`span`,{className:`settings-hint`,children:e(`settings.spend.how`)}),r&&P(`p`,{className:`settings-error`,role:`alert`,children:r})]})}var iP=2e3;function aP(e,t){return e.key_source===`environment`?t(`settings.key.setIn`,{name:e.env_var??``}):`••••••••••••••••••••${e.key_hint?` ${e.key_hint}`:``}`}function oP(){let e=T(),t=cs(e=>e.active),n=cs(e=>e.select),r=cs(e=>e.refresh),i=cs(e=>e.rememberNames),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=k(e=>e.settingsProvider),[u,d]=(0,J.useState)(l??t?.provider??`local`),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(``),[v,y]=(0,J.useState)(!1),[b,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(!1),[w,E]=(0,J.useState)(!1),[O,A]=(0,J.useState)({base_url:``,auth_header_name:``,auth_header_prefix:``}),[j,M]=(0,J.useState)(null),[N,F]=(0,J.useState)(null),[I,L]=(0,J.useState)(null),[ee,R]=(0,J.useState)(null),[z,B]=(0,J.useState)(!1),[te,ne]=(0,J.useState)(null),[re,ie]=(0,J.useState)(null),ae=(0,J.useRef)(u);ae.current=u;let oe=(0,J.useRef)(!0);(0,J.useEffect)(()=>(oe.current=!0,()=>{oe.current=!1}),[]);let H=a?.find(e=>e.id===u)??null,U=e=>e?.network?.reachable===!1,se=!!H&&(!H.remote||!!H.models_discovered),W=(0,J.useCallback)(async()=>{c(null);try{let e=await wn();o(e.providers),e.lemonade_error&&c(e.lemonade_error)}catch(e){c(e instanceof Error?e.message:String(e))}},[]),G=(0,J.useCallback)(async(e,t=!1)=>{t||(p(null),h(null));try{let t=await Zt(e);i(t.models),p(t.models),F(t.memory_gb?`${t.memory_gb} GB (${t.memory_source})`:t.capacity_error??null)}catch(e){h(e instanceof Error?e.message:String(e))}},[i]);(0,J.useEffect)(()=>{W()},[W]);let ce=!!a?.some(e=>e.key_state===`waiting_for_os_permission`);(0,J.useEffect)(()=>{if(!ce)return;let e=setInterval(()=>{W()},iP);return()=>clearInterval(e)},[ce,W]);let le=t?.provider;(0,J.useEffect)(()=>{le&&!l&&d(le)},[le,l]),(0,J.useEffect)(()=>{x(``),C(!1),E(!1),L(null),_(``),y(!1),B(!1)},[u]),(0,J.useEffect)(()=>{se?G(u):p(null)},[u,se,G]);let ue=(0,J.useCallback)(async()=>{if(H){M(`connect`),L(null);try{let t=u===`amd`?{api_key:b||void 0,...Object.fromEntries(Object.entries(O).filter(([,e])=>e!==``))}:{api_key:b||void 0},n=()=>!oe.current||ae.current!==u,r=await Rt(u,t,e=>{n()||L({ok:!0,text:e})},n);if(n())return;x(``),C(!1),L({ok:!0,text:r.remember_error?e(`settings.key.sessionOnly`,{reason:r.remember_error}):r.known_models?e(`settings.key.knownModels`,{name:H.name}):r.remembered?e(`settings.key.kept`):e(`settings.key.connectedDone`)}),await W()}catch(e){oe.current&&ae.current===u&&L({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{oe.current&&M(null)}}},[O,u,b,W,H,e]),de=(0,J.useCallback)(async()=>{M(`forget`),E(!1),L(null);try{await Kt(u),L({ok:!0,text:e(`settings.key.cleared`)}),await W(),await r()}catch(e){L({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{M(null)}},[u,W,r,e]),pe=(0,J.useCallback)(async t=>{M(t),L(null);try{await n(t),L({ok:!0,text:e(`settings.model.switched`,{name:ds(t)})}),await G(u,!0)}catch(e){L({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{M(null)}},[u,G,n,e]),me=(0,J.useCallback)(async e=>{M(`dl:${e}`),L(null),B(!1);try{await fe(e),await G(`local`,!0)}catch(e){L({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{M(null)}},[G]),he=(0,J.useCallback)(async t=>{M(`rm:${t}`),L(null);try{let n=await tt(t);R(null);let i=n.cleared.includes(`last_model`)?`settings.model.removedLast`:n.cleared.includes(`default_model`)?`settings.model.removedDefault`:`settings.model.removed`;L({ok:!0,text:e(i,{name:n.display_name})}),await G(`local`,!0),await r()}catch(e){L({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{M(null)}},[G,r,e]),ge=(0,J.useCallback)(async t=>{L({ok:!0,text:e(`settings.model.added`,{name:t})}),B(!0),await G(`local`,!0)},[G,e]),_e=!!f?.some(Ts);(0,J.useEffect)(()=>{if(_e)return()=>{r()}},[_e,r]),(0,J.useEffect)(()=>{if(u!==`local`||!_e)return;let e=setInterval(()=>{G(`local`,!0)},iP);return()=>clearInterval(e)},[_e,u,G]);let ve=t?.model,ye=f?.find(e=>us(ve,e.id));(0,J.useEffect)(()=>{ye&&ne(ye)},[ye]);let be=(0,J.useMemo)(()=>{let e=g.trim().toLowerCase();return(f??[]).filter(t=>!e||t.id.toLowerCase().includes(e)||(t.display_name??``).toLowerCase().includes(e))},[f,g]),xe=be.filter(e=>e.available!==!1),Se=u===`fireworks`&&!v&&!g.trim()&&xe.some(e=>e.rank!==null),Ce=e=>e.rank!==null||e.id===t?.model,we=Se?xe.filter(Ce):xe,Te=Se?xe.filter(e=>!Ce(e)):[],Ee=be.filter(e=>e.available===!1),De=ys(f??[]),Oe=!!g.trim(),ke=e=>us(t?.model,e.id),Ae=H?.id===`local`,je=we.filter(e=>e.downloaded).sort((e,t)=>Number(ke(t))-Number(ke(e))),Me=we.filter(e=>!e.downloaded),Ne=(f??[]).filter(e=>e.available!==!1&&e.downloaded),Pe=Ne.filter(Ce),Fe=u===`fireworks`&&Pe.some(e=>e.rank!==null)?Pe:Ne,Ie=e=>P(nP,{model:e,label:De[e.id],current:ke(e),remote:!!H?.remote,busy:j,confirmingRemove:ee===e.id,onUse:()=>void pe(e.id),onDownload:()=>void me(e.id),onAskRemove:()=>R(e.id),onKeep:()=>R(null),onRemove:()=>void he(e.id),onNpuRecheck:()=>void G(u,!0)},e.id);return V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:e(`settings.section.model`)}),P(tP,{row:ye??(us(te?.id,t?.model)?te:null),providerName:a?.find(e=>e.id===t?.provider)?.name??null,choices:se?Fe:[],labels:De,disabled:j!==null,onSwitch:e=>void pe(e)}),P(`div`,{className:`provider-tabs`,role:`radiogroup`,"aria-label":e(`settings.model.whereRuns`),children:(a??[{id:`local`,name:`Local`,remote:!1}]).map(t=>V(`button`,{type:`button`,role:`radio`,"aria-checked":u===t.id,className:`provider-tab${u===t.id?` is-active`:``}${U(t)?` is-disabled`:``}`,onClick:()=>d(t.id),disabled:U(t)&&u!==t.id,title:U(t)?t.network?.detail??void 0:void 0,children:[t.remote?P(Fr,{size:14,"aria-hidden":`true`}):P(Ur,{size:14,"aria-hidden":`true`}),P(`span`,{children:t.name}),t.remote&&t.models_discovered&&P(`span`,{className:`provider-tab-dot`,"aria-label":e(`settings.key.connectedDot`)})]},t.id))}),s&&P(JN,{message:s,onRetry:()=>{W(),G(u)}}),H&&V(`section`,{className:`settings-card`,"aria-label":H.name,children:[H.remote&&P(`p`,{className:`settings-note`,children:P(`bdi`,{children:H.privacy_notice})}),V(`details`,{className:`settings-more`,children:[V(`summary`,{children:[P(hr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,e(`settings.model.howItWorks`)]}),P(`p`,{className:`settings-hint`,children:e(`settings.model.lede`)}),Ae&&P(`p`,{className:`settings-hint`,children:P(`bdi`,{children:H.privacy_notice})}),Ae&&P(`p`,{className:`settings-hint`,children:e(`settings.model.devices`)}),Ae&&N&&P(`p`,{className:`settings-hint`,children:e(`settings.model.memory`,{memory:N})})]}),H.remote&&!se&&V(`div`,{className:`settings-field`,children:[P(`span`,{className:`settings-label`,children:e(`settings.model.prices`)}),P(HA,{provider:H.id})]}),U(H)&&V(`div`,{className:`settings-field`,children:[P(`p`,{className:`settings-error`,role:`alert`,children:H.network?.detail}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void W(),children:e(`settings.key.checkAgain`)})]}),H.remote&&!U(H)&&V(`form`,{className:`settings-field`,onSubmit:e=>{e.preventDefault(),ue()},children:[V(`div`,{className:`settings-row settings-row-between`,children:[P(`span`,{className:`settings-label`,children:e(`settings.key.title`)}),H.key_source&&P(`span`,{className:`settings-key-status ${se?`settings-ok`:`settings-error`}`,children:e(se?`settings.key.connected`:`settings.key.notConnected`)})]}),!H.key_source&&P(`span`,{className:`settings-hint`,children:H.key_state===`waiting_for_os_permission`?H.key_message??e(`settings.key.waitingOs`):e(`settings.key.none`)}),H.id===`amd`&&(!H.key_source||S)&&V(`div`,{className:`settings-grid`,children:[P(`input`,{className:`settings-input`,placeholder:e(`settings.key.gatewayPlaceholder`),value:O.base_url,onChange:e=>A({...O,base_url:e.target.value}),"aria-label":e(`settings.key.gatewayUrl`)}),P(`input`,{className:`settings-input`,placeholder:e(`settings.key.headerPlaceholder`),value:O.auth_header_name,onChange:e=>A({...O,auth_header_name:e.target.value}),"aria-label":e(`settings.key.headerName`)})]}),H.key_source&&!S?V(`div`,{className:`settings-row`,children:[P(`input`,{className:`settings-input settings-key-masked`,readOnly:!0,value:aP(H,e),"aria-label":e(`settings.key.savedAria`,{name:H.name})}),!se&&V(`button`,{type:`submit`,className:`btn-primary`,disabled:j!==null,children:[j===`connect`?P(K,{size:13,className:`spin`}):null,e(`settings.key.reconnect`)]}),(H.key_source!==`environment`||H.key_from_gaia_env)&&(w?V(D.Fragment,{children:[P(`span`,{className:`settings-hint`,children:e(`settings.key.removeAsk`)}),P(`button`,{type:`button`,className:`btn-danger`,onClick:()=>void de(),disabled:j!==null,children:e(`settings.models.remove`)}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>E(!1),children:e(`settings.models.keep`)})]}):V(D.Fragment,{children:[P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>C(!0),disabled:j!==null,children:e(`settings.key.replace`)}),H.key_source!==`environment`&&P(`button`,{type:`button`,className:`btn-secondary settings-key-remove`,onClick:()=>E(!0),disabled:j!==null,"aria-label":e(`settings.key.remove`),title:e(`settings.key.remove`),children:P(co,{size:14,"aria-hidden":`true`})})]}))]}):V(`div`,{className:`settings-row`,children:[P(`input`,{className:`settings-input`,type:`password`,autoComplete:`off`,spellCheck:!1,autoFocus:S,value:b,onChange:e=>x(e.target.value),placeholder:e(S?`settings.key.pasteNew`:`settings.key.paste`),"aria-label":e(`settings.key.fieldAria`,{name:H.name})}),V(`button`,{type:`submit`,className:`btn-primary`,disabled:j!==null||!b,children:[j===`connect`?P(K,{size:13,className:`spin`}):null,e(S?`settings.key.save`:`settings.key.connect`)]}),S&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{x(``),C(!1)},disabled:j!==null,children:e(`settings.key.cancel`)})]}),H.key_source&&!se&&!H.error&&!S&&P(`p`,{className:`settings-hint`,children:e(`settings.key.notConnectedHint`,{name:H.name})}),H.error&&P(`p`,{className:`settings-error`,role:`alert`,children:H.error})]}),I?.ok&&P(`p`,{className:`settings-ok`,role:`status`,children:I.text}),I&&!I.ok&&P(JN,{message:I.text}),H.known_models&&P(`p`,{className:`settings-hint`,role:`status`,children:e(`settings.key.knownList`,{name:H.name})}),Ae&&P(`div`,{className:`models-downloads-slot`,ref:ie}),se&&V(`div`,{className:`settings-field`,children:[P(`span`,{className:`settings-label`,children:e(`settings.model.models`)}),(f?.length??0)>6&&P(`input`,{className:`settings-input`,type:`search`,value:g,onChange:e=>_(e.target.value),placeholder:e(`settings.model.search`),"aria-label":e(`settings.model.search`)}),m&&!(s&&WN(m))&&P(JN,{message:m}),!f&&!m&&V(`p`,{className:`settings-hint`,children:[P(K,{size:13,className:`spin`}),` `,e(`settings.loading`)]}),f&&be.length===0&&!m&&P(`p`,{className:`settings-hint`,children:e(Oe||!Ae?`settings.model.noMatch`:`settings.model.noModels`)}),Ae?V(D.Fragment,{children:[je.length>0&&P(bN,{title:e(`settings.model.groupDownloaded`),count:je.length,defaultOpen:!0,forceOpen:Oe,children:P(`ul`,{className:`model-list`,children:je.map(Ie)})}),Me.length>0&&P(bN,{title:e(`settings.model.groupAvailable`),count:Me.length,defaultOpen:je.length===0,forceOpen:Oe||z||Me.some(Ts),children:P(`ul`,{className:`model-list`,children:Me.map(Ie)})})]}):P(`ul`,{className:`model-list`,children:we.map(Ie)}),Se&&Te.length>0&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>y(!0),children:e(`settings.model.showAll`)}),u===`fireworks`&&v&&!Oe&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>y(!1),children:e(`settings.model.showRecommended`)}),Ee.length>0&&P(bN,{title:e(`settings.model.groupUnavailable`),count:Ee.length,forceOpen:Oe,children:P(`ul`,{className:`model-list`,children:Ee.map(Ie)})})]}),Ae&&se&&P(bN,{title:e(`settings.custom.title`),children:P(YN,{onAdded:e=>void ge(e)})}),Ae&&se&&P(QN,{downloadsSlot:re}),H.remote&&P(rP,{})]})]})}function sP(){let e=T(),t=k(e=>e.sessions),[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),u=(0,J.useCallback)(async()=>{l(null);try{let e=await an();r(e.sessions),a(e.default_mode),k.getState().setDefaultPermissionMode(e.default_mode)}catch(e){l(e instanceof Error?e.message:String(e))}},[]);(0,J.useEffect)(()=>{u()},[u]);let d=(0,J.useCallback)(async e=>{l(null);try{await e(),await u()}catch(e){l(e instanceof Error?e.message:String(e))}},[u]),f=(0,J.useCallback)(async e=>{s(!1),await d(()=>kt(e))},[d]),p=()=>{i===`full_access`?f(`ask`):s(e=>!e)},m=e=>t.find(t=>t.id===e)?.title??e;return V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:e(`settings.section.permissions`)}),P(`p`,{className:`settings-pane-lede`,children:e(`settings.permissions.lede`)}),V(`details`,{className:`settings-more`,children:[V(`summary`,{children:[P(hr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,e(`settings.model.howItWorks`)]}),P(`p`,{className:`settings-hint`,children:e(`settings.permissions.perChat`)})]}),V(`section`,{className:`settings-card`,"aria-label":e(`settings.permissions.newChats`),children:[V(`label`,{className:`setting-row`,children:[P(`span`,{className:`settings-label`,children:e(`settings.permissions.fullAccess`)}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,checked:i===`full_access`,onChange:p,disabled:i===null,"aria-label":e(`settings.permissions.fullAccess`)}),P(`span`,{className:`toggle-track`})]})]}),P(`p`,{className:`settings-hint`,children:e(i===`full_access`?`settings.permissions.on`:`settings.permissions.off`)}),o&&V(`div`,{className:`settings-warning`,role:`alert`,children:[P(`p`,{children:e(`settings.permissions.warning`)}),V(`div`,{className:`settings-row`,children:[P(`button`,{type:`button`,className:`btn-danger`,onClick:()=>void f(`full_access`),children:e(`settings.permissions.turnOn`)}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>s(!1),children:e(`settings.key.cancel`)})]})]})]}),c&&P(`p`,{className:`settings-error`,role:`alert`,children:c}),n&&n.length===0&&P(`p`,{className:`settings-hint`,children:e(`settings.permissions.none`)}),!!n?.length&&P(bN,{title:e(`settings.permissions.chats`),count:n.length,defaultOpen:!0,children:n.map(t=>V(`section`,{className:`settings-field permission-chat`,"aria-label":m(t.session_id),children:[V(`div`,{className:`settings-row settings-row-between`,children:[P(`bdi`,{className:`settings-label`,children:m(t.session_id)}),t.mode===`full_access`&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>d(async()=>{let e=(await Pt(t.session_id,`ask`)).mode;_E(t.session_id,e)}),children:e(`settings.permissions.turnOff`)})]}),t.grants.length>0&&P(`ul`,{className:`grant-list`,children:t.grants.map(n=>V(`li`,{className:`grant-row`,children:[P(`code`,{children:n.label}),P(`button`,{type:`button`,className:`link-btn`,onClick:()=>d(()=>Xt(t.session_id,n.key)),"aria-label":e(`settings.permissions.revokeAria`,{name:n.label}),children:e(`settings.permissions.revoke`)})]},n.key))}),t.grants.length>1&&P(`button`,{type:`button`,className:`link-btn`,onClick:()=>d(()=>Xt(t.session_id)),children:e(`settings.permissions.revokeAll`)})]},t.session_id))})]})}var cP={path:`~/.gaia/skills`},lP=[{source:`agent-bundled`,title:`settings.skills.bundled`,note:`settings.skills.bundledNote`},{source:`user`,title:`settings.skills.yours`,note:`settings.skills.yoursNote`,empty:`settings.skills.yoursEmpty`,params:cP},{source:`claude-project`,title:`settings.skills.project`,note:`settings.skills.projectNote`,params:{path:`.claude/skills`}},{source:`claude-import`,title:`settings.skills.import`,note:`settings.skills.importNote`}];function uP({onUseSkill:e}){let t=T(),[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)({}),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(``);(0,J.useEffect)(()=>{let e=!1;return cn().then(t=>{e||(r(t.skills),a(t.invalid))}).catch(t=>{e||s(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[]);let u=c.trim().toLowerCase(),d=(n??[]).filter(e=>!u||e.name.toLowerCase().includes(u)||e.description.toLowerCase().includes(u)),f=n?.every(e=>lP.some(t=>t.source===e.source))??!1,p=n=>V(`li`,{className:`skill-row`,children:[V(`div`,{className:`skill-row-text`,children:[V(`span`,{className:`skill-row-name`,children:[n.name,n.version&&V(`span`,{className:`skill-row-meta`,children:[` v`,n.version]}),n.always_on&&V(`span`,{className:`skill-row-meta`,children:[` · `,t(`settings.skills.alwaysOn`)]})]}),P(`span`,{className:`skill-row-desc`,children:P(`bdi`,{children:n.description})})]}),!n.always_on&&P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>e(n.name),"aria-label":t(`settings.skills.useAria`,{name:n.name}),children:t(`settings.model.use`)})]},n.name);return V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:t(`settings.section.skills`)}),P(`p`,{className:`settings-pane-lede`,children:t(`settings.skills.lede`)}),V(`details`,{className:`settings-more`,children:[V(`summary`,{children:[P(hr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,t(`settings.model.howItWorks`)]}),P(`p`,{className:`settings-hint`,children:t(`settings.skills.how`,cP)})]}),o&&P(`p`,{className:`settings-error`,role:`alert`,children:o}),!n&&!o&&V(`p`,{className:`settings-hint`,children:[P(K,{size:13,className:`spin`}),` `,t(`settings.loading`)]}),n&&n.length>6&&P(`input`,{className:`settings-input`,type:`search`,value:c,onChange:e=>l(e.target.value),placeholder:t(`settings.skills.search`),"aria-label":t(`settings.skills.search`)}),n&&n.length===0&&P(`p`,{className:`settings-hint`,children:t(`settings.skills.none`)}),f?lP.map(e=>{let r=d.filter(t=>t.source===e.source),i=(n??[]).filter(t=>t.source===e.source).length;return r.length===0&&(u||!e.empty)?null:P(bN,{title:t(e.title),count:i,hint:t(e.note,e.params),defaultOpen:e.source===`user`,forceOpen:!!u,children:P(`section`,{"aria-label":t(e.title),children:r.length===0?P(`p`,{className:`settings-hint`,children:e.empty&&t(e.empty,e.params)}):P(`ul`,{className:`skill-list`,children:r.map(p)})})},e.source)}):P(`ul`,{className:`skill-list`,children:d.map(p)}),Object.keys(i).length>0&&V(`div`,{className:`settings-card`,role:`alert`,children:[P(`span`,{className:`settings-label`,children:t(`settings.skills.skipped`)}),P(`ul`,{className:`grant-list`,children:Object.entries(i).map(([e,t])=>V(`li`,{children:[P(`bdi`,{dir:`ltr`,children:P(`code`,{children:e})}),` — `,P(`bdi`,{children:t})]},e))})]})]})}function dP(){let e=T(),t=k(e=>e.setShowMemoryDashboard),n=k(e=>e.closeSettings),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1);(0,J.useEffect)(()=>{dA().then(i).catch(e=>o(e instanceof Error?e.message:String(e)))},[]);let l=(0,J.useCallback)(async()=>{if(r){c(!0),o(null);try{i(await fA({memory_enabled:!r.memory_enabled}))}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}}},[r]);return V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:e(`settings.section.memory`)}),P(`p`,{className:`settings-pane-lede`,children:e(`settings.memory.lede`)}),V(`section`,{className:`settings-card`,"aria-label":e(`settings.section.memory`),children:[V(`label`,{className:`setting-row`,children:[P(`span`,{children:e(`settings.memory.remember`)}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,checked:!!r?.memory_enabled,onChange:()=>void l(),disabled:!r||s,"aria-label":e(`settings.memory.remember`)}),P(`span`,{className:`toggle-track`})]})]}),a&&P(`p`,{className:`settings-error`,role:`alert`,children:a}),V(`div`,{className:`settings-row settings-row-between`,children:[P(`span`,{className:`settings-hint`,children:e(`settings.memory.dashboardHint`)}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{n(),t(!0)},children:e(`settings.memory.dashboard`)})]})]})]})}function fP(e,t,n){if(!/^\d+$/.test(e.trim()))return!1;let r=Number(e);return r>=t&&r<=n}function pP(e){return e<1048576?`${Math.ceil(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function mP(){let e=T(),[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1);(0,J.useEffect)(()=>{mn().then(e=>{n(e),i(String(e.retention_days)),o(String(e.max_mb))},t=>c({ok:!1,text:e(`settings.undo.readFailed`,{reason:t instanceof Error?t.message:String(t)})}))},[e]);let[d,f]=(0,J.useState)({days:!1,mb:!1}),p=!fP(r,1,365)||d.days,m=!fP(a,10,1e5)||d.mb,h=t!==null&&(r!==String(t.retention_days)||a!==String(t.max_mb)),g=async()=>{if(!(p||m)){u(!0),c(null);try{let t=await dn(Number(r),Number(a));n(t),c({ok:!0,text:e(`settings.undo.saved`)})}catch(t){let n=t instanceof vn&&t.httpStatus===422?t.fields:[],r=n.includes(`retention_days`),i=n.includes(`max_mb`);r||i?(f({days:r,mb:i}),c({ok:!1,text:e(`settings.undo.fix`)})):c({ok:!1,text:t instanceof Error?t.message:String(t)})}finally{u(!1)}}};return V(`div`,{className:`settings-field`,"aria-label":e(`settings.privacy.undo`),children:[P(`span`,{className:`settings-label`,children:e(`settings.privacy.undo`)}),P(`p`,{className:`settings-hint`,children:e(`settings.undo.hint`)}),t&&V(D.Fragment,{children:[V(`div`,{className:`setting-row`,children:[P(`label`,{htmlFor:`undo-days`,children:e(`settings.undo.days`)}),P(`input`,{id:`undo-days`,type:`number`,className:`model-input undo-history-input`,min:1,max:365,value:r,"aria-invalid":p,"aria-describedby":p?`undo-days-error`:void 0,onChange:e=>{i(e.target.value),f(e=>({...e,days:!1}))}})]}),p&&P(`p`,{id:`undo-days-error`,className:`settings-error`,children:e(`settings.undo.daysError`)}),V(`div`,{className:`setting-row`,children:[P(`label`,{htmlFor:`undo-mb`,children:e(`settings.undo.mb`)}),P(`input`,{id:`undo-mb`,type:`number`,className:`model-input undo-history-input`,min:10,max:1e5,value:a,"aria-invalid":m,"aria-describedby":m?`undo-mb-error`:void 0,onChange:e=>{o(e.target.value),f(e=>({...e,mb:!1}))}})]}),m&&P(`p`,{id:`undo-mb-error`,className:`settings-error`,children:e(`settings.undo.mbError`)}),V(`div`,{className:`setting-row setting-row-path`,children:[P(`span`,{children:e(`settings.undo.inUse`)}),V(`span`,{children:[e.plural(`settings.undo.used`,t.turns,{size:pP(t.used_bytes)}),` `,P(`bdi`,{dir:`ltr`,children:P(`code`,{className:`setting-path`,children:t.path})})]})]}),P(`button`,{type:`button`,className:`btn-model-save`,onClick:()=>void g(),disabled:!h||l||p||m,children:e(l?`settings.models.applying`:`settings.advanced.save`)})]}),s&&P(`p`,{className:s.ok?`settings-ok`:`settings-error`,role:s.ok?`status`:`alert`,children:s.text})]})}var hP={root:`settings-report`,button:`btn-secondary`,hint:`settings-hint`,error:`settings-error`};function gP(){let e=T(),t=k(e=>e.sessions),n=k(e=>e.removeSession),r=hs(),i=k(e=>e.systemStatus?.data_dir),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),l=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]);let u=(0,J.useCallback)(async()=>{if(!a){o(!0),l.current=setTimeout(()=>o(!1),4e3);return}o(!1);let r=[];for(let e of t)try{await de(e.id),n(e.id)}catch(t){r.push(`${e.title}: ${t instanceof Error?t.message:t}`)}c(r.length?{ok:!1,text:e(`settings.privacy.deleteFailed`,{n:r.length,reason:r.join(`; `)})}:{ok:!0,text:e(`settings.privacy.deleted`)})},[a,n,t,e]);return V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:e(`settings.section.privacy`)}),V(`section`,{className:`settings-card`,"aria-label":e(`settings.privacy.whereTitle`),children:[P(`p`,{className:`settings-note`,children:e(`settings.privacy.stays`)}),P(`p`,{className:r?.remote?`settings-note`:`settings-hint`,children:r?.remote?e(`settings.privacy.remote`,{name:r.label}):e(r?`settings.privacy.local`:`settings.privacy.unknown`)}),i&&V(`div`,{className:`setting-row setting-row-path`,children:[P(`span`,{children:e(`settings.privacy.dataFolder`)}),P(`bdi`,{dir:`ltr`,className:`setting-path`,children:i})]})]}),V(`section`,{className:`settings-card`,"aria-label":e(`settings.privacy.reportTitle`),children:[P(`p`,{className:`settings-note`,children:e(`settings.privacy.reportNote`)}),P(tC,{classes:hP})]}),P(bN,{title:e(`settings.privacy.undo`),children:P(mP,{})}),V(`section`,{className:`settings-card`,"aria-label":e(`settings.privacy.deleteTitle`),children:[P(`p`,{className:`danger-warning`,children:t.length===0?e(`settings.privacy.nothingToDelete`):e(`settings.privacy.deleteWarning`)}),P(`button`,{type:`button`,className:`btn-danger`,onClick:()=>void u(),disabled:t.length===0,children:e(a?`settings.privacy.deleteConfirm`:`settings.privacy.delete`)})]}),s&&P(`p`,{className:s.ok?`settings-ok`:`settings-error`,role:s.ok?`status`:`alert`,children:s.text})]})}var _P=[{id:`needs_approval`,label:`settings.alerts.approval`},{id:`question`,label:`settings.alerts.question`},{id:`finished`,label:`settings.alerts.finished`}],vP=[{value:`banner`,label:`settings.alerts.banner`},{value:`badge`,label:`settings.alerts.badge`},{value:`off`,label:`settings.alerts.off`}],yP=[0,10,20,30,50];function bP(){return typeof Notification>`u`?`unsupported`:Notification.permission}function xP(){let e=T(),t=lc(),n=!!window.gaiaAPI,[r,i]=(0,J.useState)(bP),a=Object.values(t.modes).includes(`banner`);return V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:e(`settings.section.notifications`)}),P(`p`,{className:`settings-pane-lede`,children:e(`settings.alerts.lede`)}),V(`section`,{className:`settings-card`,"aria-label":e(`settings.alerts.when`),children:[_P.map(n=>V(`div`,{className:`setting-row`,children:[P(`span`,{id:`alert-${n.id}`,children:e(n.label)}),P(`div`,{className:`segmented`,role:`radiogroup`,"aria-labelledby":`alert-${n.id}`,children:vP.map(r=>P(`button`,{type:`button`,role:`radio`,"aria-checked":t.modes[n.id]===r.value,className:t.modes[n.id]===r.value?`is-active`:``,onClick:()=>t.setMode(n.id,r.value),children:e(r.label)},r.value))})]},n.id)),!n&&a&&r!==`granted`&&(r==="default"?P(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{Notification.requestPermission().then(i).catch(e=>{console.error(`[alerts] Notification permission request failed`,e),i(bP())})},children:e(`settings.alerts.allow`)}):P(`p`,{className:`settings-error`,role:`alert`,children:e(r===`unsupported`?`settings.alerts.unsupported`:`settings.alerts.blocked`)})),V(`label`,{className:`setting-row`,children:[P(`span`,{children:e(`settings.alerts.sound`)}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,checked:t.sound,onChange:()=>t.update({sound:!t.sound}),"aria-label":e(`settings.alerts.sound`)}),P(`span`,{className:`toggle-track`})]})]}),n&&V(`label`,{className:`setting-row`,children:[P(`span`,{children:e(`settings.alerts.flash`)}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,checked:t.flash,onChange:()=>t.update({flash:!t.flash}),"aria-label":e(`settings.alerts.flash`)}),P(`span`,{className:`toggle-track`})]})]})]}),V(`section`,{className:`settings-card`,"aria-labelledby":`keep-awake-title`,children:[P(`h3`,{className:`settings-label`,id:`keep-awake-title`,children:e(`settings.alerts.keepAwakeTitle`)}),n?V(D.Fragment,{children:[V(`label`,{className:`setting-row`,children:[P(`span`,{children:e(`settings.alerts.keepAwake`)}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,checked:t.keepAwake,onChange:()=>t.update({keepAwake:!t.keepAwake}),"aria-label":e(`settings.alerts.keepAwake`)}),P(`span`,{className:`toggle-track`})]})]}),V(`div`,{className:`setting-row`,children:[P(`label`,{htmlFor:`battery-floor`,children:e(`settings.alerts.battery`)}),P(`select`,{id:`battery-floor`,className:`settings-input settings-select-compact`,value:t.batteryFloor,disabled:!t.keepAwake,onChange:e=>t.update({batteryFloor:Number(e.target.value)}),children:yP.map(t=>P(`option`,{value:t,children:t===0?e.bare(`settings.alerts.never`):`${t}%`},t))})]}),P(`p`,{className:`settings-hint`,children:e(`settings.alerts.screen`)})]}):P(`p`,{className:`settings-hint`,children:e(`settings.alerts.desktopOnly`)})]})]})}var SP=[50,75,100,125,150,175,200],CP=[{accent:`american`,gender:`female`},{accent:`american`,gender:`male`},{accent:`british`,gender:`female`},{accent:`british`,gender:`male`}],wP=`settings:preview`,TP=`Hello, I'm GAIA. This is how I'll read my replies to you.`;function EP(e){return e instanceof vn?e.detail||e.message:String(e)}function DP(){let e=T(),t=wS(e=>e.settings),n=wS(e=>e.setSettings),r=wS(e=>e.read),i=wS(e=>e.stop),a=wS(e=>e.messageId===wP),o=wS(e=>e.messageId===wP&&e.status===`loading`),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1);(0,J.useEffect)(()=>{dS().then(n).catch(e=>c(EP(e)))},[n]);let p=e=>{f(!0),u(null),wS.getState().messageId===wP&&i(),fS(e).then(n).catch(e=>u(EP(e))).finally(()=>f(!1))};return s?V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:e(`settings.section.voice`)}),P(`p`,{className:`settings-error`,role:`alert`,children:e(`readAloud.settings.loadFailed`,{reason:s})})]}):t?V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:e(`settings.section.voice`)}),P(`p`,{className:`settings-pane-lede`,children:e(`readAloud.settings.lede`)}),V(`div`,{className:`settings-field`,children:[P(`label`,{className:`settings-label`,htmlFor:`read-aloud-voice`,children:e(`readAloud.settings.voice`)}),V(`div`,{className:`read-aloud-voice-row`,children:[P(`select`,{id:`read-aloud-voice`,className:`settings-input`,value:t.voice,disabled:d,onChange:e=>p({voice:e.target.value}),children:CP.map(n=>P(`optgroup`,{label:e(`readAloud.group.${n.accent}.${n.gender}`),children:t.voices.filter(e=>e.accent===n.accent&&e.gender===n.gender).map(e=>P(`option`,{value:e.id,lang:`en`,children:e.name},e.id))},`${n.accent}-${n.gender}`))}),V(`button`,{type:`button`,className:`btn-secondary`,"aria-pressed":a,disabled:d,onClick:()=>a?i():void r(wP,TP),children:[o?P(K,{size:13,className:`spin`}):P(a?io:go,{size:13}),e(a?`readAloud.stop`:`readAloud.settings.preview`)]})]}),P(`span`,{className:`settings-hint`,children:e(`readAloud.settings.englishOnly`)}),P(DS,{messageId:wP})]}),V(`div`,{className:`settings-field`,children:[P(`label`,{className:`settings-label`,htmlFor:`read-aloud-speed`,children:e(`readAloud.settings.speed`)}),P(`select`,{id:`read-aloud-speed`,className:`settings-input`,value:t.speed,disabled:d,onChange:e=>p({speed:Number(e.target.value)}),children:(SP.includes(t.speed)?SP:[...SP,t.speed].sort((e,t)=>e-t)).map(t=>P(`option`,{value:t,children:t===100?e.bare(`readAloud.settings.normalSpeed`):`⁦${(t/100).toLocaleString(e.locale)}×⁩`},t))})]}),V(`label`,{className:`setting-row`,children:[P(`span`,{children:e(`readAloud.settings.auto`)}),V(`span`,{className:`toggle-switch`,children:[P(`input`,{type:`checkbox`,checked:t.auto,disabled:d,onChange:()=>p({auto:!t.auto}),"aria-label":e(`readAloud.settings.auto`)}),P(`span`,{className:`toggle-track`})]})]}),P(`p`,{className:`settings-hint`,children:e(`readAloud.settings.shared`)}),l&&P(`p`,{className:`settings-error`,role:`alert`,children:e(`readAloud.settings.saveFailed`,{reason:l})})]}):V(`p`,{className:`settings-hint`,children:[P(K,{size:13,className:`spin`}),` `,e(`settings.loading`)]})}function OP(){let e=T(),t=k(e=>e.openSettings),n=k(e=>e.closeSettings),r=k(e=>e.runSetupAgain),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1);(0,J.useEffect)(()=>{ot().then(a).catch(e=>l(e instanceof Error?e.message:String(e))),le().then(s).catch(e=>l(e instanceof Error?e.message:String(e)))},[]);let f=i?.catalog?.find(e=>e.id===i.chat_model.id),p=(i?.catalog??[]).filter(e=>e.downloaded),m=p.reduce((e,t)=>e+(t.full_size_gb??0),0),h=[o?.gpu_name,o?.npu_detected?e(`setup.checks.npu`):null].filter(Boolean).join(` · `),g=[{title:e(`settings.setup.where`),rows:[{label:e(`settings.setup.chatRuns`),value:f?.name??null,section:`model`},{label:e(`settings.setup.cloudKeys`),value:null,section:`model`}]},{title:e(`setup.pc.step`),rows:[{label:e(`settings.setup.detected`),value:[h,o?.ram_gb==null?null:`${o.ram_gb} GB`].filter(Boolean).join(` · `)||null,section:`advanced`},{label:e(`settings.setup.server`),value:i?.lemonade.mode===`external`?e(`settings.setup.serverYours`):e(`settings.setup.serverOwn`),section:`advanced`},{label:e(`setup.gpu.title`),value:null,section:`model`}]},{title:e(`setup.models.step`),rows:[{label:e(`settings.setup.models`),value:i?.catalog?e(`settings.setup.modelsValue`,{n:String(p.length),size:$(m)}):null,section:`model`},{label:e(`settings.setup.context`),value:null,section:`model`}]},{title:e(`settings.setup.after`),rows:[{label:e(`settings.section.connectors`),value:null,section:`connectors`},{label:e(`settings.section.memory`),value:null,section:`memory`},{label:e(`settings.language`),value:null,section:`general`},{label:e(`settings.setup.signIn`),value:null,section:`general`}]}];return V(`div`,{className:`settings-pane`,children:[P(`h2`,{className:`settings-pane-title`,children:e(`settings.section.setup`)}),P(`p`,{className:`settings-hint`,children:e(`settings.setup.lede`)}),V(`div`,{className:`settings-setup-status`,children:[V(`span`,{children:[P(`strong`,{children:e(`settings.setup.ready`)}),f&&V(`span`,{className:`settings-hint`,children:[` `,P(`bdi`,{children:e(`settings.setup.running`,{name:f.name})})]})]}),P(`button`,{type:`button`,className:`btn-secondary`,"data-testid":`setup-run-again`,onClick:()=>d(!0),children:e(`settings.setup.runAgain`)})]}),c&&P(`p`,{className:`setup-error`,role:`alert`,children:c}),g.map(e=>V(`section`,{className:`settings-setup-group`,"aria-label":e.title,children:[P(`h3`,{className:`settings-label`,children:e.title}),e.rows.map(e=>V(`button`,{type:`button`,className:`settings-setup-row`,onClick:()=>t(e.section),children:[V(`span`,{children:[P(`span`,{className:`settings-setup-row-label`,children:e.label}),e.value&&P(`bdi`,{className:`settings-hint settings-setup-row-value`,children:e.value})]}),P(yr,{size:14,className:`settings-setup-chevron`,"aria-hidden":`true`})]},e.label))]},e.title)),u&&P(Wj,{title:e(`settings.setup.confirmTitle`),confirmLabel:e(`settings.setup.confirmYes`),cancelLabel:e(`setup.again.notNow`),onConfirm:()=>{d(!1),n(),r(!0)},onCancel:()=>d(!1),children:P(`p`,{children:e(`settings.setup.confirmBody`)})})]})}var kP=`modulepreload`,AP=function(e,t){return new URL(e,t).href},jP={},MP=function(e){return e.pathname.endsWith(`.css`)},NP=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},PP=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,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?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=AP(t,n);let r=s(t),i=MP(r);return NP(jP,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:kP,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}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)})},FP=(0,J.lazy)(()=>PP(()=>import(`./ConnectorsPane-Byq5_CvM.js`).then(e=>({default:e.ConnectorsPane})),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),IP=(0,J.lazy)(()=>PP(()=>import(`./AdvancedSettings-D8P_x4lg.js`).then(e=>({default:e.AdvancedSettings})),__vite__mapDeps([5,1,2,3]),import.meta.url)),LP=[`general`,`setup`,`model`,`permissions`,`skills`,`connectors`,`memory`,`notifications`,`voice`,`privacy`,`advanced`];function RP({onUseSkill:e}){let t=T(),n=k(e=>e.settingsSection),r=k(e=>e.openSettings),i=k(e=>e.closeSettings),a=(0,J.useRef)(null),o=n!==null;if(Io(o,i),aS(a,o),yN(a,o,()=>a.current?.querySelector(`.settings-nav-item.is-active`)),!n)return null;let s=(()=>{switch(n){case`general`:return P(UN,{});case`setup`:return P(OP,{});case`model`:return P(oP,{});case`permissions`:return P(sP,{});case`skills`:return P(uP,{onUseSkill:t=>{i(),e(t)}});case`connectors`:return P(FP,{});case`memory`:return P(dP,{});case`notifications`:return P(xP,{});case`voice`:return P(DP,{});case`privacy`:return P(gP,{});case`advanced`:return P(IP,{})}})();return P(`div`,{className:`settings-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&i()},children:V(`div`,{ref:a,className:`settings-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`settings.title`),children:[V(`nav`,{className:`settings-nav`,"aria-label":t(`settings.sections`),children:[P(`h1`,{className:`settings-nav-title`,children:t(`settings.title`)}),LP.map(e=>P(`button`,{type:`button`,"data-section":e,className:`settings-nav-item${n===e?` is-active`:``}`,"aria-current":n===e?`page`:void 0,onClick:t=>{t.currentTarget.focus(),r(e)},children:t(`settings.section.${e}`)},e))]}),V(`div`,{className:`settings-body`,children:[P(`button`,{type:`button`,className:`settings-close`,onClick:i,"aria-label":t(`settings.close`),children:P(So,{size:18})}),P(`div`,{className:`settings-scroll`,children:P(J.Suspense,{fallback:V(`p`,{className:`settings-hint`,children:[P(K,{size:13,className:`spin`}),` `,t(`settings.loading`)]}),children:s})})]})]})})}var zP=p((e,t)=>({lifecycle:null,restartError:null,apply:n=>{n.apiBase&&B(n.apiBase),e({lifecycle:n,restartError:n.status===`running`?null:t().restartError})},restart:async()=>{let n=window.gaiaAPI?.backend;if(!n)throw Error(`Restart GAIA needs the desktop app.`);e({restartError:null});try{t().apply(await n.restart())}catch(t){d.system.error(`Restart GAIA failed`,t),e({restartError:t instanceof Error?t.message:String(t)})}}}));function BP(e){let t=window.gaiaAPI?.backend;if(!t)return()=>{};let n=t=>{let n=zP.getState().lifecycle?.status;zP.getState().apply(t),t.status===`running`&&n&&n!==`running`&&e()},r=t.onState(n);return t.getState().then(n).catch(e=>d.system.error(`Could not read the backend state from the desktop app`,e)),r}function VP(e,t){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),f=(0,J.useCallback)(()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(clearTimeout(l.current),null),u.current&&=(clearInterval(u.current),null)},[]);(0,J.useEffect)(()=>f,[f]);let p=(0,J.useCallback)((e,t)=>{u.current&&clearInterval(u.current),u.current=setInterval(async()=>{try{let n=await Nt();t===`load`?n.model_loaded?.toLowerCase()===e.toLowerCase()&&(r(!1),c.current&&=(clearTimeout(c.current),null),u.current&&=(clearInterval(u.current),null)):(n.model_downloaded===!0||n.model_loaded?.toLowerCase()===e.toLowerCase())&&(a(!1),l.current&&=(clearTimeout(l.current),null),u.current&&=(clearInterval(u.current),null))}catch{}},Lc)},[]),m=e??`Gemma-4-E4B-it-GGUF`;return(0,J.useEffect)(()=>s(null),[m]),{isLoadingModel:n,isDownloadingModel:i,downloadError:o,loadModel:(0,J.useCallback)(async(e,t)=>{let n=e??m,i=t??32768;r(!0);try{if(!await zt(n,i)){r(!1);return}d.system.info(`Load model triggered: ${n} (ctx=${i})`),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>r(!1),Fc),p(n,`load`)}catch(e){d.system.error(`Failed to trigger model load`,e),r(!1)}},[m,t,p]),downloadModel:(0,J.useCallback)(async(e=!1,t,n=!1)=>{let r=t??m;a(!0),s(null);try{await fe(r,e,n),d.system.info(`Download model triggered: ${r} (force=${e})`),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>a(!1),Ic),p(r,`download`)}catch(e){d.system.error(`Failed to trigger model download`,e),s(e instanceof Error?e.message:String(e)),a(!1)}},[m,p])}}function HP({onRetry:e,label:t,busyLabel:n=`Checking…`}){let[r,i]=(0,J.useState)(!1);return P(`button`,{className:`connection-banner__retry`,onClick:()=>{i(!0),Promise.resolve(e()).finally(()=>i(!1))},disabled:r,children:r?n:t})}function UP(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function WP({lifecycle:e}){let t=T(),n=zP(e=>e.restart),r=zP(e=>e.restartError),i=e.status===`restarting`,[a,o]=(0,J.useState)(()=>Date.now());if((0,J.useEffect)(()=>{if(!i)return;o(Date.now());let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[i]),i){let n=e.since?Math.max(0,Math.floor((a-e.since)/1e3)):0;return V(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[P(`div`,{className:`connection-banner__icon`,children:P(K,{size:16,className:`connection-banner__spinner`})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[t(`banner.restarting`),` `,P(`bdi`,{dir:`ltr`,className:`connection-banner__timer`,children:UP(n)}),` `,P(`span`,{className:`connection-banner__hint`,children:t(`banner.restartingHint`)})]})]})}return V(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[P(`div`,{className:`connection-banner__icon`,children:P(q,{size:16})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[t(`banner.restartStopped`),` `,P(`span`,{className:`connection-banner__hint`,children:r?t(`banner.restartFailed`,{error:r}):t(`banner.restartStoppedHint`)})]}),P(HP,{onRetry:n,label:t(`banner.restartButton`),busyLabel:t(`banner.restartingShort`)})]})}function GP({onRetry:e,backendSlow:t=!1,backendError:n=null}){let r=T(),{backendConnected:i,systemStatus:a,currentSessionId:o,messages:s}=k(),c=zP(e=>e.lifecycle),[l,u]=(0,J.useState)(!1),d=!!o&&s.length>0,f=a?.default_model_name??`Gemma-4-E4B-it-GGUF`,{isDownloadingModel:p,downloadError:m,downloadModel:h}=VP(f),g=cs(e=>e.pickLoad),_=cs(e=>e.retryPickLoad),v=cs(e=>e.dismissPickLoad);ls();let y=(0,J.useRef)(a?.lemonade_running),b=(0,J.useRef)(a?.model_downloaded),x=(0,J.useRef)(a?.context_size_sufficient),S=(0,J.useRef)(a?.expected_model_loaded);if((0,J.useEffect)(()=>{if(d)return;let e=a?.lemonade_running,t=a?.model_downloaded,n=a?.context_size_sufficient,r=a?.expected_model_loaded,i=!1;y.current!==e&&(y.current=e,e===!1&&(i=!0)),b.current!==t&&(b.current=t,t===!1&&(i=!0)),x.current!==n&&(x.current=n,n===!1&&(i=!0)),S.current!==r&&(S.current=r,r===!1&&(i=!0)),i&&u(!1)},[a,d]),c&&c.status!==`running`)return P(WP,{lifecycle:c});let C=a?.download_progress??null,w=C?.model_name||f;if(p||C?.state===`downloading`||C?.state===`starting`||C?.state===`error`){let e=C?.total_bytes?`${(C.total_bytes/1e9).toFixed(1)} GB`:`large download`,t=C?.state===`error`;return V(`div`,{className:`connection-banner ${t?`connection-banner--error`:`connection-banner--warning`}`,role:t?`alert`:`status`,children:[P(`div`,{className:`connection-banner__icon`,children:P(t?q:qr,{size:16})}),P(`div`,{className:`connection-banner__text`,dir:`auto`,children:t?V(D.Fragment,{children:[`Download of `,P(`strong`,{children:w}),` failed.`,` `,(m??C?.message)&&P(`span`,{className:`connection-banner__hint`,children:m??C?.message})]}):V(D.Fragment,{children:[`Downloading `,P(`strong`,{children:w}),` (`,e,`).`,C?.state===`downloading`&&C.file&&V(D.Fragment,{children:[` `,V(`span`,{className:`connection-banner__hint`,children:[`File `,C.file_index,` / `,C.total_files,`: `,P(`code`,{children:C.file})]})]})]})}),t?P(`button`,{className:`connection-banner__retry`,onClick:()=>h(!1,w,!a?.model_loaded),children:`Retry`}):P(`span`,{className:`connection-banner__loading connection-banner__progress`,children:C&&C.state===`downloading`&&C.total_bytes>0?V(D.Fragment,{children:[P(`span`,{className:`connection-banner__progress-bar`,role:`progressbar`,"aria-valuenow":C.percent,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Download progress`,children:P(`span`,{className:`connection-banner__progress-fill`,style:{width:`${C.percent}%`}})}),V(`span`,{className:`connection-banner__progress-label`,children:[C.percent,`% ·`,` `,(C.downloaded_bytes/1e9).toFixed(2),` /`,` `,(C.total_bytes/1e9).toFixed(2),` GB`]})]}):V(D.Fragment,{children:[P(K,{size:13,className:`connection-banner__spinner`}),C?.state===`starting`?C.message??`Starting download…`:`Downloading…`]})}),t&&P(`button`,{className:`connection-banner__dismiss`,onClick:()=>u(!0),"aria-label":`Dismiss`,children:P(So,{size:14})})]})}if(g){let e=ds(g.model);return g.error?V(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[P(`div`,{className:`connection-banner__icon`,children:P(q,{size:16})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(`banner.pickLoad.failed`,{model:e}),` `,P(`span`,{className:`connection-banner__hint`,dir:`auto`,children:g.error.key?r(g.error.key,{reason:g.error.reason}):g.error.reason})]}),P(HP,{onRetry:_,label:r(`banner.pickLoad.retry`)}),P(`button`,{className:`connection-banner__dismiss`,onClick:v,"aria-label":r(`banner.dismiss`),children:P(So,{size:14})})]}):V(`div`,{className:`connection-banner connection-banner--init`,role:`status`,children:[P(`div`,{className:`connection-banner__icon`,children:P(K,{size:16,className:`connection-banner__spinner`})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(`banner.pickLoad.loading`,{model:e}),` `,P(`bdi`,{dir:`ltr`,children:r(`banner.pickLoad.seconds`,{s:g.seconds})}),` `,P(`span`,{className:`connection-banner__hint`,children:r(`banner.pickLoad.canType`)})]})]})}if(Bw(a)&&!t&&!n){let e=a?.init_tasks?.find(e=>e.status===`running`)?.name||`Preparing AI system`;return V(`div`,{className:`connection-banner connection-banner--init`,role:`status`,children:[P(`div`,{className:`connection-banner__icon`,children:P(K,{size:16,className:`connection-banner__spinner`})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[e,V(`span`,{className:`thinking-dots`,children:[P(`span`,{children:`.`}),P(`span`,{children:`.`}),P(`span`,{children:`.`})]})]})]})}if(l||d)return null;if(!i)return V(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[P(`div`,{className:`connection-banner__icon`,children:P(vo,{size:16})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(`banner.unreachable`),` `,P(`span`,{className:`connection-banner__hint`,children:r(`banner.unreachableHint`)})]}),e&&P(HP,{onRetry:e,label:`Retry`})]});if(n)return V(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[P(`div`,{className:`connection-banner__icon`,children:P(q,{size:16})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`GAIA's backend answered with an error (`,n,`).`,` `,P(`span`,{className:`connection-banner__hint`,children:`It may be overloaded. GAIA keeps checking; if it lasts, restart GAIA.`})]}),e&&P(HP,{onRetry:e,label:`Check again`})]});if(t)return V(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[P(`div`,{className:`connection-banner__icon`,children:P(q,{size:16})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`GAIA is slow to answer.`,` `,P(`span`,{className:`connection-banner__hint`,children:`It may be busy with another chat or app. GAIA keeps checking.`})]}),e&&P(HP,{onRetry:e,label:`Check again`})]});if(a?.config_error)return V(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[P(`div`,{className:`connection-banner__icon`,children:P(q,{size:16})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`GAIA settings could not be loaded.`,` `,P(`span`,{className:`connection-banner__hint`,children:a.config_error})]}),e&&P(HP,{onRetry:e,label:`Check again`})]});if(a&&!a.lemonade_running){let t=Vw(a)===`unresponsive`,n=KN(a);return V(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[P(`div`,{className:`connection-banner__icon`,children:P(q,{size:16})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[t?`The model server is not answering (${a.lemonade_error}). It may be busy with another app or loading a model.`:r(`banner.serverStopped`),` `,n?P(`span`,{className:`connection-banner__hint`,children:r(`banner.finishSetup`)}):a.start_command?V(`span`,{className:`connection-banner__hint`,children:[t?`If it stays this way, restart it: `:`To start it by hand, run `,P(`code`,{children:a.start_command})]}):a.start_instruction&&P(`span`,{className:`connection-banner__hint`,children:a.start_instruction})]}),n&&P(qN,{className:`connection-banner__retry`}),e&&P(HP,{onRetry:e,label:r(`settings.key.checkAgain`)}),P(`button`,{className:`connection-banner__dismiss`,onClick:()=>u(!0),"aria-label":`Dismiss`,children:P(So,{size:14})})]})}if(a&&a.lemonade_running&&a.model_loaded&&a.context_size_sufficient===!1){let t=a.model_context_size??0;return V(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[P(`div`,{className:`connection-banner__icon`,children:P(qi,{size:16})}),V(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`LLM context window is too small (`,t.toLocaleString(),` tokens;`,` `,Nc.toLocaleString(),` required).`,` `,P(`span`,{className:`connection-banner__hint`,children:`Reload it with a larger context in Settings → Advanced.`})]}),e&&P(HP,{onRetry:e,label:`Check again`}),P(`button`,{className:`connection-banner__dismiss`,onClick:()=>u(!0),"aria-label":`Dismiss`,children:P(So,{size:14})})]})}return null}function KP(){let e=kN(),t=T(),[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(null),o=(0,J.useCallback)(e=>{let n=DN();n&&(a(null),n[e]().catch(n=>{d.system.error(`Update ${e} failed`,n),a(NN(n,t))}))},[t]);if(n)return null;let s=e.installFailed?t(`update.chip.installFailedDetail`,e.installFailed):null,c=e.status===`downloading`||e.status===`downloaded`;if(e.startFailed&&e.previousVersion&&!c)return V(`div`,{className:`update-chip update-chip--error`,role:`status`,children:[P(q,{size:13,className:`update-chip__icon`}),P(`span`,{className:`update-chip__label`,title:i??void 0,children:t(i?`update.chip.updateFailed`:`update.chip.startFailed`)}),P(`button`,{type:`button`,className:`update-chip__action`,onClick:()=>o(`revertUpdate`),children:t(`update.chip.goBack`,{version:e.previousVersion})}),P(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismissError`),children:P(So,{size:11})})]});let l=e.status===`available`||e.status===`downloaded`;if(s&&!l)return V(`div`,{className:`update-chip update-chip--error`,role:`status`,title:s??void 0,children:[P(q,{size:13,className:`update-chip__icon`}),P(`span`,{className:`update-chip__label`,children:t(`update.chip.installFailed`)}),P(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismissError`),children:P(So,{size:11})})]});if(e.status===`idle`||e.status===`checking`||e.status===`disabled`||e.status===`no-channel`)return null;if(e.status===`downloading`){let n=Math.max(0,Math.min(100,e.progress));return V(`div`,{className:`update-chip update-chip--downloading`,role:`status`,"aria-live":`polite`,title:t(`update.chip.downloadingTitle`,{version:e.version??``}),children:[P(qr,{size:13,className:`update-chip__icon`}),P(`span`,{className:`update-chip__label`,children:e.preparing?t(`update.chip.preparing`):t(`update.chip.downloading`,{pct:n})})]})}return e.status===`available`?V(`div`,{className:`update-chip update-chip--available`,role:`status`,title:i||s||e.releaseNotes||t(`update.chip.availableTitle`),children:[P(qr,{size:13,className:`update-chip__icon`}),P(`span`,{className:`update-chip__label`,children:i?t(`update.chip.updateFailed`):s?t(`update.chip.installFailed`):t(`update.chip.available`,{version:e.version??``})}),!e.pinnedVersion&&P(`button`,{type:`button`,className:`update-chip__action`,onClick:()=>o(`downloadUpdate`),children:t(`update.chip.updateNow`)}),P(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismiss`),children:P(So,{size:11})})]}):e.status===`downloaded`?V(`div`,{className:`update-chip update-chip--ready`,role:`status`,"aria-live":`polite`,children:[P(Pa,{size:13,className:`update-chip__icon`}),P(`button`,{type:`button`,className:`update-chip__action`,onClick:()=>o(`restart`),title:i||s||t(`update.chip.restartTitle`),children:t(i?`update.chip.restartFailed`:s?`update.chip.installFailedRetry`:`update.chip.ready`)})]}):e.status===`error`?V(`div`,{className:`update-chip update-chip--error`,role:`status`,title:e.error||t(`update.chip.checkFailed`),children:[P(q,{size:13,className:`update-chip__icon`}),P(`span`,{className:`update-chip__label`,children:t(`update.chip.checkFailed`)}),P(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismissError`),children:P(So,{size:11})})]}):null}var qP={permission_request:{icon:P(Wa,{size:16}),colorClass:`notif-type-permission`},policy_alert:{icon:P(Wa,{size:16}),colorClass:`notif-type-policy`},security_alert:{icon:P(q,{size:16}),colorClass:`notif-type-security`},status_change:{icon:P(Tr,{size:16}),colorClass:`notif-type-status`},info:{icon:P(Vi,{size:16}),colorClass:`notif-type-info`},error:{icon:P(Cr,{size:16}),colorClass:`notif-type-error`}};function JP(e,t){let n=Date.now()-e,r=Math.floor(n/1e3);if(r<60)return t(`time.justNow`);let i=Math.floor(r/60);if(i<60)return t(`time.minutesAgo`,{n:i});let a=Math.floor(i/60);if(a<24)return t(`time.hoursAgo`,{n:a});let o=Math.floor(a/24);return o<7?t(`time.daysAgo`,{n:o}):new Date(e).toLocaleDateString(te(t),{month:`short`,day:`numeric`})}function YP({onClose:e}){let t=T(),n=Qs(ko(ec)),r=Qs($s),i=Qs(e=>e.markRead),a=Qs(e=>e.markAllRead),o=Qs(e=>e.clearAll),s=Qs(e=>e.dismiss),c=Qs(e=>e.respondToPermission),l=Qs(e=>e.typeFilter),u=Qs(e=>e.setTypeFilter),d=(0,J.useCallback)(e=>{i(e)},[i]),f=(0,J.useCallback)(e=>{c(e.id,`allow`).catch(e=>console.error(`[NotificationCenter] allow failed:`,e))},[c]),p=(0,J.useCallback)(e=>{c(e.id,`deny`).catch(e=>console.error(`[NotificationCenter] deny failed:`,e))},[c]);Io(!0,e);let m=[{key:null,label:t(`notifications.filter.all`)},{key:`permission_request`,label:t(`notifications.filter.permissions`)},{key:`policy_alert`,label:t(`notifications.filter.policy`)},{key:`error`,label:t(`notifications.filter.errors`)},{key:`security_alert`,label:t(`notifications.filter.security`)},{key:`status_change`,label:t(`notifications.filter.status`)},{key:`info`,label:t(`notifications.filter.info`)}];return V(`div`,{className:`notification-center`,role:`dialog`,"aria-label":t(`notifications.dialogAria`),children:[V(`div`,{className:`notification-center-header`,children:[V(`div`,{className:`notification-center-title-row`,children:[P(`h2`,{className:`notification-center-title`,children:t(`notifications.title`)}),r>0&&P(`span`,{className:`notification-center-badge`,children:r})]}),P(`button`,{className:`btn-icon notification-center-close`,onClick:e,"aria-label":t(`notifications.close`),children:P(So,{size:18})})]}),P(`div`,{className:`notification-filter-bar`,role:`tablist`,"aria-label":t(`notifications.filterAria`),children:m.map(e=>P(`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`))}),P(`div`,{className:`notification-list`,children:n.length===0?V(`div`,{className:`notification-empty`,children:[P($n,{size:40,strokeWidth:1.2}),P(`span`,{children:t(`notifications.empty`)})]}):n.map(e=>{let n=qP[e.type],r=e.type===`permission_request`&&e.tool?Ks(e,t,ny):null;return V(`div`,{className:`notification-item ${e.read?``:`unread`} ${n.colorClass}`,id:e.type===`policy_alert`&&e.receiptId?`policy-receipt-${encodeURIComponent(e.receiptId)}`:void 0,onClick:()=>d(e.id),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&d(e.id)},children:[!e.read&&P(`span`,{className:`notification-unread-dot`}),P(`span`,{className:`notification-icon`,children:n.icon}),V(`div`,{className:`notification-content`,children:[V(`div`,{className:`notification-content-header`,children:[P(`span`,{className:`notification-agent`,dir:`auto`,children:e.agentName}),P(`span`,{className:`notification-time`,children:JP(e.timestamp,t)})]}),r?V(D.Fragment,{children:[P(`span`,{className:`notification-title`,children:P(ay,{text:r.heading})}),P(`span`,{className:`notification-message`,children:P(ay,{text:r.question})})]}):V(D.Fragment,{children:[e.title&&P(`span`,{className:`notification-title`,children:e.title}),P(`span`,{className:`notification-message`,children:e.message})]}),e.type===`permission_request`&&e.tool&&e.tool!==`allow_path_access`&&V(`span`,{className:`notification-tool`,children:[t(`activity.policy.tool`),`: `,P(`code`,{dir:`ltr`,children:e.tool})]}),e.type===`policy_alert`&&V(`div`,{className:`notification-policy-details`,children:[e.tool&&V(`span`,{className:`notification-tool`,children:[t(`activity.policy.tool`),`: `,P(`code`,{dir:`ltr`,children:e.tool})]}),e.reason&&V(`span`,{className:`notification-policy-reason`,children:[t(`notifications.reason`),`: `,e.reason]}),e.ruleIds&&e.ruleIds.length>0&&V(`span`,{className:`notification-tool`,children:[t(`activity.policy.rules`),`: `,P(`code`,{dir:`ltr`,children:e.ruleIds.join(`, `)})]}),e.policyVersion&&V(`span`,{className:`notification-tool`,children:[t(`activity.policy.policy`),`: `,P(`code`,{dir:`ltr`,children:e.policyVersion})]}),V(`span`,{className:`notification-tool`,children:[t(`activity.policy.receipt`),`:`,` `,e.receiptId?P(`code`,{dir:`ltr`,children:e.receiptId}):P(`em`,{children:t(`activity.policy.receiptUnavailable`)})]})]}),e.type===`permission_request`&&!e.response&&V(`div`,{className:`notification-actions`,children:[V(`button`,{className:`notification-action-btn notification-action-allow`,onClick:t=>{t.stopPropagation(),f(e)},children:[P(pr,{size:14}),t(`notifications.approve`)]}),V(`button`,{className:`notification-action-btn notification-action-deny`,onClick:t=>{t.stopPropagation(),p(e)},children:[P(So,{size:14}),t(`notifications.deny`)]})]}),e.type===`permission_request`&&e.response&&P(`span`,{className:`notification-response-badge ${e.response===`allow`?`response-allow`:`response-deny`}`,children:e.response===`allow`?t(`notifications.approved`):t(`notifications.denied`)})]}),P(`button`,{className:`notification-dismiss`,onClick:t=>{t.stopPropagation(),s(e.id)},"aria-label":t(`notifications.dismiss`),children:P(So,{size:14})})]},e.id)})}),n.length>0&&V(`div`,{className:`notification-center-footer`,children:[V(`button`,{className:`notification-footer-btn`,onClick:a,disabled:r===0,children:[P(pr,{size:14}),t(`notifications.markAllRead`)]}),V(`button`,{className:`notification-footer-btn notification-footer-clear`,onClick:o,children:[P(co,{size:14}),t(`notifications.clear`)]})]})]})}var XP=1500,ZP=e=>new Promise(t=>setTimeout(t,e));async function QP({onProgress:e,isCancelled:t=()=>!1,pollMs:n=XP}={}){try{await on(ok)}catch(e){if(e?.httpStatus!==409)throw e;let t=await Ut(ok).catch(()=>null);if(!t||t.status===`completed`||t.status===`failed`)throw e}for(;!t();){let t=await Ut(ok);if(e?.(t),t.status===`completed`)return;if(t.status===`failed`)throw Error(t.error||`The GAIA agent could not be installed.`);await ZP(n)}}function $P({onInstalled:e,noBuild:t=!1}){let n=T(),[r,i]=(0,J.useState)({kind:`idle`}),a=(0,J.useRef)(!1);(0,J.useEffect)(()=>()=>{a.current=!0},[]);let o=(0,J.useCallback)(async()=>{i({kind:`installing`,percent:0});try{if(await QP({isCancelled:()=>a.current,onProgress:e=>{a.current||i({kind:`installing`,percent:e.percent??0})}}),a.current)return;await e(),a.current||i({kind:`idle`})}catch(e){a.current||i({kind:`failed`,error:e instanceof Error?e.message:String(e)})}},[e]);return t?P(`div`,{className:`app-notice is-warning`,role:`status`,children:P(`span`,{children:n(`agentNotice.noBuild`)})}):V(`div`,{className:`app-notice is-warning`,role:`status`,children:[r.kind===`installing`?P(`span`,{children:n(`agentNotice.installing`,{percent:Math.round(r.percent)})}):r.kind===`failed`?P(`span`,{children:n(`agentNotice.failed`,{error:r.error})}):P(`span`,{children:n(`agentNotice.missing`)}),r.kind!==`installing`&&P(`button`,{type:`button`,className:`link-btn`,onClick:()=>void o(),children:r.kind===`failed`?n(`agentNotice.retry`):n(`agentNotice.install`)})]})}function eF(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}function tF(e,t){let{addNotification:n}=Qs.getState();for(let r of t)r.error_count<=(e[r.id]??0)||!r.last_error||n({id:`schedule-error-${r.id}-${r.error_count}`,type:`error`,agentId:`scheduler`,agentName:`GAIA`,title:`Scheduled task "${r.name}" failed`,message:r.last_error,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,...r.session_id?{sessionId:r.session_id}:{}})}var nF=p((e,t)=>({schedules:[],loading:!1,error:null,actionError:null,selectedSchedule:null,results:[],resultsLoading:!1,errorCounts:null,loadSchedules:async()=>{t().schedules.length===0&&!t().error&&e({loading:!0}),e({error:null});try{let n=(await At()).schedules||[],r=t().errorCounts;r&&tF(r,n),e({schedules:n,loading:!1,errorCounts:Object.fromEntries(n.map(e=>[e.id,e.error_count]))})}catch(t){d.api.error(`Failed to load schedules`,t),e({error:`Failed to load schedules`,loading:!1})}},createSchedule:async(t,n,r)=>{try{let i=await yt(t,n,r);e(e=>({schedules:[...e.schedules,i],actionError:null}))}catch(e){throw d.api.error(`Failed to create schedule`,e),e}},updateScheduleStatus:async(t,n)=>{try{let r=await ut(t,n);e(e=>({schedules:e.schedules.map(e=>e.name===t?r:e),actionError:null}))}catch(n){d.api.error(`Failed to update schedule "${t}"`,n),e({actionError:eF(n,`Failed to update schedule`)})}},runScheduleNow:async t=>{try{let n=await Jt(t);e(e=>({schedules:e.schedules.map(e=>e.name===t?n:e),actionError:null}))}catch(n){d.api.error(`Failed to run schedule "${t}" now`,n),e({actionError:eF(n,`Could not run the schedule now`)})}},deleteSchedule:async t=>{try{await Qe(t),e(e=>({schedules:e.schedules.filter(e=>e.name!==t),selectedSchedule:e.selectedSchedule===t?null:e.selectedSchedule,actionError:null}))}catch(n){d.api.error(`Failed to delete schedule "${t}"`,n),e({actionError:eF(n,`Failed to delete schedule`)})}},selectSchedule:n=>{e({selectedSchedule:n,results:[],resultsLoading:!1}),n&&t().loadResults(n)},loadResults:async n=>{e({resultsLoading:!0});try{let r=await De(n);if(t().selectedSchedule!==n)return;e({results:r.results||[],resultsLoading:!1})}catch(r){if(d.api.error(`Failed to load results for "${n}"`,r),t().selectedSchedule!==n)return;e({results:[],resultsLoading:!1})}},dismissActionError:()=>e({actionError:null})})),rF=new Set([`loading_model`,`downloading_model`,`model_retry`,`waiting`]),iF=5;function aF(e,t){return{id:e,title:t.get(e)?.title??`Untitled chat`}}function oF(e){let t=new Map(e.sessions.map(e=>[e.id,e])),n=e.isStreaming&&e.currentSessionId!==null,r=[...e.runningSessionIds];n&&!r.includes(e.currentSessionId)&&r.push(e.currentSessionId);let i=new Set(r),a=new Set(e.notifications.filter(e=>e.type===`permission_request`&&!e.response&&!e.dismissed&&e.sessionId&&i.has(e.sessionId)).map(e=>e.sessionId)),o=[...a].map(e=>({...aF(e,t),reason:`approval`}));n&&e.awaitingUser&&!a.has(e.currentSessionId)&&o.push({...aF(e.currentSessionId,t),reason:`answer`});for(let[n,r]of Object.entries(e.awaitingBySession))o.some(e=>e.id===n)||o.push({...aF(n,t),reason:r===`question`?`answer`:`approval`});let s=n&&!e.awaitingUser&&e.livePhase&&rF.has(e.livePhase)?e.liveStatus:null,c=e.systemStatus,l=null;if(c?.default_model_is_cloud&&c.default_model_name)l={name:c.default_model_name,where:`cloud`};else if(c?.model_loaded){let e=c.model_labels?.includes(`cloud`),t=c.model_device&&c.model_device!==`none`?c.model_device:null;l={name:c.model_loaded,where:e?`cloud`:t}}let u=[...e.sessions].sort((e,t)=>t.updated_at.localeCompare(e.updated_at)).slice(0,iF).map(e=>aF(e.id,t));return{backendConnected:e.backendConnected,modelServerRunning:c&&!c.default_model_is_cloud?c.lemonade_running:null,model:l,waitingOnModel:s||null,running:r.map(e=>aF(e,t)),needsYou:o,recent:u}}function sF(e){let t=(0,J.useRef)(e);t.current=e,(0,J.useEffect)(()=>{let e=window.gaiaAPI?.tray;if(!e)return;let n=``,r=null,i=()=>{let t=k.getState(),i={backendConnected:t.backendConnected,systemStatus:t.systemStatus,sessions:t.sessions,runningSessionIds:t.runningSessionIds,awaitingBySession:t.awaitingBySession,currentSessionId:t.currentSessionId,isStreaming:t.isStreaming,awaitingUser:t.awaitingUser,liveStatus:t.liveStatus,livePhase:t.livePhase,notifications:Qs.getState().notifications},a=r;if(r=i,a&&Object.keys(i).every(e=>i[e]===a[e]))return;let o=oF(i),s=JSON.stringify(o);s!==n&&(n=s,e.setActivity(o).catch(e=>{n=``,d.system.error(`The tray could not take the app state`,e)}))};i();let a=k.subscribe(i),o=Qs.subscribe(i),s=e.onCommand(e=>{switch(e.type){case`open-chat`:t.current.openChat(e.sessionId);break;case`new-chat`:t.current.newChat();break;case`open-settings`:k.getState().openSettings(e.section);break;case`refresh-status`:t.current.refreshStatus();break;default:d.system.error(`Unknown tray command`,e)}});return()=>{a(),o(),s()}},[])}function cF(){(0,J.useEffect)(()=>{let e=window.gaiaAPI;if(!e)return;let t=Qs.getState().addNotification,n=[e.notification.onNotification(t),e.notification.onPermissionRequest(t),e.tray.onNavigate(e=>{let t=typeof e==`string`&&e.startsWith(`session:`)?e.slice(8):null;if(!t)return;let n=k.getState();n.currentSessionId!==t&&n.setMessages([]),n.setCurrentSession(t)})];return()=>n.forEach(e=>e())},[])}function lF(e,t,n){let r=window.gaiaAPI;if(r){r.notification.show({title:t,body:n,sessionId:e}).then(e=>{e||d.system.warn(`This OS has no desktop notifications; the badge still counts it.`)}).catch(e=>d.system.error(`Could not show the desktop notification`,e));return}if(typeof Notification>`u`){d.system.warn(`This browser has no notifications; the alert was not shown.`);return}if(Notification.permission!==`granted`){d.system.warn(`Browser notifications are ${Notification.permission}; allow them in Settings → Notifications.`);return}let i=new Notification(t,{body:n,tag:`gaia-${e}`});i.onclick=()=>{window.focus(),k.getState().setCurrentSession(e)}}function uF(){let[e,t]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let e=navigator;if(!e.getBattery)return;let n=null,r=()=>{n&&t({charging:n.charging,level:n.level})};return e.getBattery().then(e=>{n=e,r(),e.addEventListener(`levelchange`,r),e.addEventListener(`chargingchange`,r)}).catch(e=>d.system.warn(`Battery level unavailable; keep-awake ignores the battery policy.`,e)),()=>{n?.removeEventListener(`levelchange`,r),n?.removeEventListener(`chargingchange`,r)}},[]),e}function dF(){cF();let e=k(e=>e.runningSessionIds),t=k(e=>e.awaitingBySession),n=k(e=>e.sessions),r=k(e=>e.currentSessionId),i=Qs(ko(nc)),a=lc(),o=uF(),s=(0,J.useRef)(null),c=gc(e,t,i),l=JSON.stringify(c);(0,J.useEffect)(()=>{let e=JSON.parse(l),t=s.current;if(s.current=e,t===null)return;let{sessions:n,currentSessionId:r}=k.getState(),i=document.hasFocus(),o=!1;for(let{sessionId:s,event:c}of _c(t,e)){let e=n.find(e=>e.id===s);if(e?.kind===`eval`||e?.kind===`scheduled`)continue;let t=a.modes[c];if(!(t===`off`||bc(s,r,i))&&(o=!0,t===`banner`)){if(c!==`finished`){let{title:t,body:n}=yc(c,e);lF(s,t,n)}else mt(s).then(e=>{k.getState().updateSessionInList(s,e);let{title:t,body:n}=yc(c,e);lF(s,t,n)}).catch(t=>{d.system.error(`Could not read how chat ${s} ended`,t);let{title:n,body:r}=yc(c,{...e,last_run_status:null});lF(s,n,r)})}}if(o){if(a.sound)try{Cc()}catch(e){d.system.warn(`Alert sound not played`,e)}a.flash&&!i&&window.gaiaAPI&&window.gaiaAPI.notification.flash().catch(e=>d.system.error(`Could not flash the taskbar button`,e))}},[l,a.modes,a.sound,a.flash]);let u=xc(n,c,a.modes,r);(0,J.useEffect)(()=>{window.gaiaAPI?.notification.setAttentionCount(u).catch(e=>d.system.error(`Could not update the taskbar badge`,e))},[u]);let f=a.keepAwake&&e.length>0&&Sc(o,a.batteryFloor);(0,J.useEffect)(()=>{window.gaiaAPI?.power.setKeepAwake(f).catch(e=>d.system.error(`Could not change keep-awake`,e))},[f])}function fF(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 pF(e){return e.replace(/-/g,``).slice(0,7)}function mF(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 hF(e,t,n){return!e||t&&(e===t||e===pF(t))?null:n.some(t=>t.id===e)?e:mF(n,e)}function gF(e){return new URLSearchParams(e.search).get(`session`)||e.hash.replace(/^#/,``)||null}var _F=`gaia:last-session`;function vF(e){try{e?localStorage.setItem(_F,e):localStorage.removeItem(_F)}catch(e){d.ui.warn(`Could not save the open chat for the next launch`,e)}}function yF(){try{return localStorage.getItem(_F)}catch(e){return d.ui.warn(`Could not read the chat open at last launch`,e),null}}var bF=1e3,xF=3e4;function SF(e,{initialMs:t=bF,maxMs:n=xF,onError:r}={}){let i=t,a=0,o=null,s=!1,c=!1,l=!1,u=()=>{l||c||s||(o&&=(clearTimeout(o),null),s=!0,a+=1,e().then(()=>{c=!0}).catch(e=>{l||(r?.(e,a),o=setTimeout(()=>{o=null,u()},i),i=Math.min(i*2,n))}).finally(()=>{s=!1}))};return u(),{kick:()=>{o&&u()},stop:()=>{l=!0,o&&clearTimeout(o),o=null},done:()=>c}}function CF(e,t,n){return e&&!t&&!n}var wF=(0,J.lazy)(()=>PP(()=>import(`./MemoryDashboard-D2A5sTz6.js`).then(e=>({default:e.MemoryDashboard})),__vite__mapDeps([6,1,2,7,8]),import.meta.url)),TF=(0,J.lazy)(()=>PP(()=>import(`./ScheduleManager-Bye5OV6N.js`).then(e=>({default:e.ScheduleManager})),__vite__mapDeps([9,1,2,7,3,10]),import.meta.url)),EF=(0,J.lazy)(()=>PP(()=>import(`./DocumentLibrary-B8SHRZpL.js`).then(e=>({default:e.DocumentLibrary})),__vite__mapDeps([11,1,2,3,12]),import.meta.url)),DF=(0,J.lazy)(()=>PP(()=>import(`./FileBrowser-OU9tD0Ek.js`).then(e=>({default:e.FileBrowser})),__vite__mapDeps([13,1,2,3,14]),import.meta.url)),OF=(0,J.lazy)(()=>PP(()=>import(`./MobileAccessModal-BgeK3LK3.js`).then(e=>({default:e.MobileAccessModal})),__vite__mapDeps([15,1,2,3,16]),import.meta.url)),kF=3,AF=3e5,jF=6e3,MF=6e4,NF=e=>e instanceof TypeError,PF=e=>new Promise(t=>setTimeout(t,e)),FF=3e5,IF=class extends Error{};async function LF(){let e=Date.now()+FF;for(;;){let t=await Ce();if(t.state===`ready`)return;if(t.state===`failed`||t.state===`cancelled`)throw new IF(t.error||I().bare(`setup.upgrading.stopped`));if(Date.now()>=e)throw Error(I().bare(`setup.upgrading.slow`));await PF(bF)}}function RF(){return P(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})}var zF=e=>e===1||e%10==0;function BF(){let e=T(),t=k(e=>e.currentSessionId),n=k(e=>e.setSessions),r=k(e=>e.setCurrentSession),i=k(e=>e.addSession),a=k(e=>e.setMessages),o=k(e=>e.showDocLibrary),s=k(e=>e.showFileBrowser),c=k(e=>e.showMemoryDashboard),l=k(e=>e.showSchedules),u=k(e=>e.sidebarOpen),f=k(e=>e.sidebarCollapsed),p=k(e=>e.setSidebarOpen),h=k(e=>e.setSystemStatus),g=k(e=>e.setBackendConnected),_=k(e=>e.setAgents),v=k(e=>e.agents),y=k(e=>e.setPendingPrompt),b=k(e=>e.setDefaultPermissionMode),x=k(e=>e.openSettings),S=k(e=>e.settingsSection),C=k(e=>e.syncSystemTheme),w=cs(e=>e.restoreNotice),E=cs(e=>e.dismissRestoreNotice),D=Qs(e=>e.showPanel),O=k(e=>e.systemStatus?.initialized===!0),A=(0,J.useRef)(!1),j=Qs(e=>e.setShowPanel);(0,J.useEffect)(()=>{if(!w?.ok)return;let e=setTimeout(E,jF);return()=>clearTimeout(e)},[w,E]);let[M,N]=(0,J.useState)({state:`checking`}),F=k(e=>e.setupAgain),I=k(e=>e.runSetupAgain),ee=(0,J.useRef)(M);ee.current=M;let[R,z]=(0,J.useState)(!1),B=(0,J.useRef)(R);B.current=R;let[te,ne]=(0,J.useState)(!1),[re,ie]=(0,J.useState)(!1),ae=te||R&&!sk(v),oe=(0,J.useRef)(ae);oe.current=ae;let[H,se]=(0,J.useState)(null),[W,ce]=(0,J.useState)(``),[le,de]=(0,J.useState)(0),[fe,pe]=(0,J.useState)(!1),[me,he]=(0,J.useState)(!1),[ge,_e]=(0,J.useState)(null),[ve,ye]=(0,J.useState)(null),be=(0,J.useRef)(async()=>{}),xe=(0,J.useRef)(async()=>{}),Se=(0,J.useCallback)(async(e=!1,t=!1)=>{e||N({state:`checking`});let n=0;try{for(;;){await cs.getState().refresh();let e=!!cs.getState().active?.remote,r;try{r=await G(e)}catch(e){if(!t||!NF(e)||n>=MF)throw e;await PF(bF),n+=bF;continue}if(!r.ready&&r.stage===`upgrade`){N({state:`upgrading`});let t=await Ce();(!t.upgrade_embedded||t.state!==`running`&&t.state!==`verifying`)&&await ft(e,!1,{upgradeEmbedded:!0}),await LF(),r=await G(e)}n>0&&await Promise.all([be.current(),xe.current()]),ie(!!r.no_agent_build),N(r.ready?{state:`ready`}:{state:`needed`,check:r});return}}catch(e){let t=e instanceof Error?e.message:String(e);if(e instanceof IF){d.system.warn(`Updating the local model server failed`,e),N({state:`unknown`,error:t,upgradeFailed:!0});return}d.system.warn(`Setup check could not be answered`,e),N({state:`unknown`,error:t})}},[]),we=(0,J.useRef)(0),Te=(0,J.useCallback)(async()=>{let e=++we.current,t=(await _n()).agents||[];e===we.current&&(_(t),z(!0),sk(t)&&ne(!1))},[_]),Ee=(0,J.useCallback)(()=>{let e=B.current;z(!1),Te().catch(t=>{d.api.warn(`Agent list unavailable after setup`,t),e&&z(!0)})},[Te]);(0,J.useEffect)(()=>{let e=()=>{oe.current&&Te().catch(e=>d.api.warn(`Agent list unavailable`,e))};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Te]);let De=(0,J.useCallback)(async()=>{b((await an()).default_mode)},[b]),Oe=(0,J.useRef)([]);(0,J.useEffect)(()=>{m(`0.26.0rc1`),Se(!1,!0);let e=[SF(Te,{onError:(e,t)=>{zF(t)&&d.api.warn(`Agent list unavailable (attempt ${t}); retrying`,e)}}),SF(De,{onError:(e,t)=>{zF(t)&&d.api.warn(`Default permission mode unavailable (attempt ${t}); retrying`,e)}})];return Oe.current=e,()=>e.forEach(e=>e.stop())},[Se,Te,De]);let ke=(0,J.useCallback)(()=>{Oe.current.forEach(e=>e.kick()),cs.getState().retryNow(),xe.current();let e=ee.current;e.state===`unknown`&&!e.upgradeFailed&&Se(!0)},[Se]),Ae=(0,J.useRef)(ke);Ae.current=ke;let je=(0,J.useRef)(0),Me=(0,J.useRef)(0),Ne=(0,J.useRef)(null),Pe=(0,J.useRef)(!1),[Fe,Ie]=(0,J.useState)(!1),[Le,Re]=(0,J.useState)(null),ze=(0,J.useCallback)(e=>{if(e.kind===`unreachable`){d.system.warn(`System status check failed`,e.error),Pe.current=!0,Me.current=0,Ne.current=null,Ie(!1),Re(null),g(!1),h(null);return}if(e.kind===`error`){d.system.warn(`System status answered HTTP ${e.httpStatus}`,e.message),Pe.current&&Ae.current(),Pe.current=!1,Me.current=0,Ne.current=null,Ie(!1),Re(`HTTP ${e.httpStatus}: ${e.message}`),g(!0);return}if(e.kind===`slow`){if(Me.current+=1,Ne.current??=Date.now(),Re(null),d.system.warn(`System status did not answer in time (${Me.current} in a row)`),Date.now()-Ne.current>=AF){Ie(!1),g(!1),h(null);return}g(!0),(Pe.current||Me.current>=kF)&&Ie(!0);return}let{status:t}=e;Pe.current&&Ae.current(),Pe.current=!1,Me.current=0,Ne.current=null,Ie(!1),Re(null),g(!0),je.current=t.lemonade_running?0:je.current+1;let n=k.getState().systemStatus;t.lemonade_running||je.current>=kF||!n?.lemonade_running?h(t):h({...n,download_progress:t.download_progress})},[g,h]),Be=(0,J.useRef)(ze);Be.current=ze;let[Ve]=(0,J.useState)(()=>Ww(e=>Be.current(e))),He=Ve.check;be.current=He,(0,J.useEffect)(()=>hk(Ve.start),[Ve]),(0,J.useEffect)(()=>BP(()=>{He()}),[He]);let Ue=(0,J.useRef)(``);(0,J.useEffect)(()=>{let e=e=>Ft().then(t=>{let r=t.sessions||[];if(!e&&r.length===0&&k.getState().sessions.length>0)return;let i=r.map(e=>`${e.id}|${e.updated_at}|${e.title}|${e.inference_remote}|${e.inference_provider}|${e.inference_description}|${e.effective_model}|${e.unread}|${e.pinned}|${e.last_run_status}|${e.kind}`).join(`
82
+ `);if(i===Ue.current)return;Ue.current=i,n(r);let a=cs.getState().active?.model;a&&r.some(e=>e.effective_model&&e.effective_model!==a)&&cs.getState().refresh()}).catch(t=>{e&&d.system.error(`Could not load chats`,t)});xe.current=()=>e(!1),e(!0);let t=setInterval(()=>void e(!1),5e3);return()=>clearInterval(t)},[n]),(0,J.useEffect)(()=>rT(),[]),(0,J.useEffect)(()=>{let e=()=>{nF.getState().loadSchedules()};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]),(0,J.useEffect)(()=>xT(),[]),dF();let We=(0,J.useRef)(!1),Ge=(0,J.useRef)(!1);(0,J.useEffect)(()=>{let e=()=>{let e=gF(window.location),{currentSessionId:t,sessions:n}=k.getState(),i=hF(e,t,n);return i&&(r(i),a([])),i},t=()=>{if(We.current||(We.current=!0,e()||k.getState().currentSessionId))return;if(window.location.hash){window.history.replaceState(null,``,window.location.pathname+window.location.search);return}if(Ge.current||Mt(`new-chat`))return;let{sessions:t}=k.getState(),n=hF(yF(),null,t);n&&(r(n),a([]))},n=k.subscribe(e=>{e.sessions.length>0&&t()});return k.getState().sessions.length>0&&t(),window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),()=>{n(),window.removeEventListener(`hashchange`,e),window.removeEventListener(`popstate`,e)}},[r,a]),(0,J.useEffect)(()=>{let e=null,t=2e3,n=!1,i=null,o=()=>{n||(e=new EventSource(`${L()}/sessions/events`),e.onopen=()=>{t=2e3},e.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch(e){d.api.warn(`Malformed session event`,e);return}t.type===`set_active_session`&&t.session_id&&t.session_id!==k.getState().currentSessionId&&(r(t.session_id),a([]))},e.onerror=()=>{e?.close(),e=null,!n&&(i=setTimeout(o,t),t=Math.min(t*2,3e4))})};return o(),()=>{n=!0,i&&clearTimeout(i),e?.close()}},[r,a]),(0,J.useEffect)(()=>{if(We.current&&vF(t),t){let e=pF(t);window.location.hash!==`#${e}`&&window.history.replaceState(null,``,`#${e}`)}else We.current&&window.location.hash&&window.history.replaceState(null,``,window.location.pathname+window.location.search)},[t]);let Ke=(0,J.useCallback)(async e=>{if(se(null),!await Go(`chat`))return ce(e),!1;let t=k.getState(),n;try{n=await Tn({title:`New Task`,agent_type:ok,document_ids:t.draftDocumentIds,private:t.draftPrivate,folders:t.draftFolder?[t.draftFolder]:[]})}catch(e){throw ck(e)?(ne(!0),Error(`The GAIA agent isn't installed. Install it from the notice above, then send again.`)):e}oe.current&&(ne(!1),Te().catch(e=>d.api.warn(`Agent list unavailable`,e))),t.defaultPermissionModeKnown||(await De().catch(e=>d.api.warn(`Default permission mode unavailable; using the chip's mode`,e)),t=k.getState()),t.clearDraftDocuments(),t.setDraftPrivate(!1),t.setDraftFolder(null);let o=null;try{await Pt(n.id,t.draftPermissionMode)}catch(e){o=e}return U(_t),o&&!n.private&&bn(qe(n.id),e),i(n),r(n.id),a([]),ce(``),o?(se(`The chat was created, but its permission mode could not be set, so your message was not sent${n.private?``:` — it is in the chat's box`}: ${o instanceof Error?o.message:o}`),!1):(t.resetDraftPermissionMode(),y({sessionId:n.id,text:e}),!0)},[i,r,a,y,Te,De]),Je=(0,J.useCallback)(()=>{let e=k.getState(),t=e.currentSessionId;t&&jc(t,e)&&Mc(t),e.setShowMemoryDashboard(!1),e.setShowSchedules(!1),Ge.current=!0,r(null),a([]),de(e=>e+1)},[r,a]);sF({openChat:(0,J.useCallback)(e=>{let t=k.getState();t.closeSettings(),e!==t.currentSessionId&&(Mc(t.currentSessionId),a([])),r(e)},[r,a]),newChat:(0,J.useCallback)(()=>{k.getState().closeSettings(),Je()},[Je]),refreshStatus:()=>void He()});let Ye=(0,J.useCallback)(e=>{Je(),Ke(`Load the \`${e}\` skill, then tell me briefly what it lets you do.`).catch(e=>se(e instanceof Error?e.message:String(e)))},[Je,Ke]),Xe=(0,J.useCallback)(e=>{N({state:`ready`}),Ee(),He(),e&&(e.needs_input?ce(e.prompt):Ke(e.prompt).catch(e=>se(e instanceof Error?e.message:String(e))))},[He,Ke,Ee]),Ze=(0,J.useCallback)(()=>{N({state:`ready`}),He()},[He]);(0,J.useEffect)(()=>{let e=()=>{k.getState().closeSettings(),N({state:`addingLocal`})};return window.addEventListener(`gaia:set-up-local`,e),()=>window.removeEventListener(`gaia:set-up-local`,e)},[]),(0,J.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&(e.shiftKey&&e.key.toLowerCase()===`o`?(e.preventDefault(),Je()):!e.shiftKey&&e.key.toLowerCase()===`k`?(e.preventDefault(),window.dispatchEvent(new CustomEvent(`gaia:focus-search`))):!e.shiftKey&&e.key.toLowerCase()===`b`?(e.preventDefault(),k.getState().toggleSidebarCollapsed()):!e.shiftKey&&e.key===`,`&&(e.preventDefault(),x()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Je,x]),(0,J.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 768px)`);if(!e)return;let t=()=>p(!e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[p]),(0,J.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(prefers-color-scheme: light)`);return e.addEventListener(`change`,C),()=>e.removeEventListener(`change`,C)},[C]),(0,J.useEffect)(()=>{xn().then(e=>he(e.active===!0)).catch(e=>d.system.debug(`Mobile access unavailable`,e))},[]);let Qe=(0,J.useCallback)(async()=>{if(pe(!0),_e(null),me)ye(null);else try{let e=await Nn(),t=e.reason===`ngrok_not_installed`;if(ye(t?e.installCommands??[]:null),t)return;e.error?_e(e.error):he(!0)}catch(e){ye(null),_e(e instanceof Error?e.message:`Could not start mobile access`)}},[me]),$e=(0,J.useCallback)(async()=>{try{await ue(),he(!1),pe(!1)}catch(e){_e(e instanceof Error?e.message:`Could not stop mobile access`)}},[]);jD(e=>{e?Qe():$e()}),(0,J.useEffect)(()=>{kD(me)},[me]);let et=typeof window<`u`&&window.innerWidth<=768,tt=CF(M.state===`checking`,O,A.current);if(!tt&&M.state!==`needed`&&(A.current=!0),tt)return P(`div`,{className:`app`,children:V(`main`,{className:`startup`,role:`status`,"aria-label":`Starting GAIA`,children:[P(`div`,{className:`loading-spinner`,"aria-hidden":`true`}),P(`p`,{className:`startup-text`,children:`Starting GAIA…`})]})});if(M.state===`upgrading`)return P(`div`,{className:`app`,children:V(`main`,{className:`startup`,role:`status`,"aria-live":`polite`,"aria-label":e(`setup.upgrading.notice`),children:[P(`div`,{className:`loading-spinner`,"aria-hidden":`true`}),P(`p`,{className:`startup-text`,children:e(`setup.upgrading.notice`)})]})});if(M.state===`needed`||M.state===`addingLocal`||F){let e=F?()=>I(!1):M.state===`addingLocal`?Ze:void 0;return V(`div`,{className:`app`,children:[P(vN,{onReady:e=>{I(!1),Xe(e)},onClose:e}),P(BA,{}),P(KP,{})]})}let nt=c?P(J.Suspense,{fallback:P(RF,{}),children:P(wF,{})}):t?P(Dk,{sessionId:t},t):P(FA,{onSend:Ke,initialText:W,focusRequest:le},W);return V(`div`,{className:`app`,children:[!u&&P(`button`,{className:`sidebar-toggle`,onClick:()=>p(!0),"aria-label":`Open sidebar`,children:P(oa,{size:18})}),P(`div`,{className:`sidebar-overlay ${u?`visible`:``}`,onClick:()=>p(!1),"aria-hidden":`true`}),P(ol,{onNewChat:Je,onMobileAccess:et?void 0:()=>void Qe(),tunnelActive:me}),V(`div`,{className:`main-content`,children:[M.state===`ready`&&P(GP,{onRetry:He,backendSlow:Fe,backendError:Le}),M.state===`unknown`&&(M.upgradeFailed?V(`div`,{className:`app-notice is-warning`,role:`status`,children:[P(`span`,{children:e(`setup.upgrading.failed`,{error:M.error})}),P(`button`,{type:`button`,className:`link-btn`,onClick:()=>void Se(),children:e(`setup.upgrading.retry`)})]}):V(`div`,{className:`app-notice is-warning`,role:`status`,children:[P(`span`,{children:e(`setup.unknown.failed`,{error:M.error})}),P(`button`,{type:`button`,className:`link-btn`,onClick:()=>void Se(),children:e(`setup.unknown.retry`)})]})),(!u||f)&&P(Rs,{placement:`main`}),ae&&P($P,{onInstalled:Te,noBuild:re}),w&&V(`div`,{className:`app-notice${w.ok?``:` is-warning`}`,role:`status`,children:[P(`span`,{children:w.message}),!w.ok&&P(`button`,{type:`button`,className:`link-btn`,onClick:()=>{E(),x(`model`)},children:`Pick a model`}),P(`button`,{type:`button`,className:`app-notice-close`,onClick:E,"aria-label":`Dismiss`,children:P(So,{size:14})})]}),nt]}),l&&P(J.Suspense,{fallback:null,children:P(TF,{})}),o&&P(J.Suspense,{fallback:null,children:P(EF,{})}),s&&P(J.Suspense,{fallback:null,children:P(DF,{onStartChat:Ke})}),D&&P(`div`,{className:`notification-center-popover`,children:P(YP,{onClose:()=>j(!1)})}),fe&&P(J.Suspense,{fallback:null,children:P(OF,{isOpen:fe,onClose:()=>pe(!1),onStop:()=>void $e(),error:ge,setupCommands:ve,onRetry:()=>void Qe()})}),S&&P(RP,{onUseSkill:Ye}),P(BA,{}),P(KP,{}),H&&P(`div`,{className:`toast`,role:`alert`,children:H})]})}var VF=`agent-refresh`,HF={"pre-checks":`engine.stage.preChecks`,"ensure-uv":`engine.stage.ensureUv`,"create-venv":`engine.stage.createVenv`,"install-package":`engine.stage.installPackage`,verify:`engine.stage.verify`,[VF]:`engine.stage.agentRefresh`,start:`engine.stage.start`},UF={disk:`engine.hint.disk`,network:`engine.hint.network`,tls:`engine.hint.tls`,locked:`engine.hint.locked`,daemon:`engine.hint.daemon`};function WF(e,t){if(!e)return t(`engine.stage.neutral`);let n=HF[e];return n?t(n):(console.warn(`[EngineInstallScreen] install stage "${e}" has no label`),t(`engine.stage.neutral`))}function GF(e,t){return e.reason?t(UF[e.reason]):t(e.stage===VF?`engine.hint.agent`:`engine.hint.other`)}function KF(e){return e.reason===`locked`&&e.lockedBy?.length?e.lockedBy:null}function qF(e,t){let n=e.name??String(e.pid),r=e.folder;return e.isGaia?r?t(`engine.locked.gaia`,{name:n,folder:r}):t(`engine.locked.gaiaNoFolder`,{name:n}):r?t(`engine.locked.other`,{name:n,folder:r}):t(`engine.locked.otherNoFolder`,{name:n})}function JF({status:e}){let t=T(),n=WF(e.stage,t);return V(`div`,{className:`engine-progress`,role:`status`,children:[V(`div`,{className:`engine-progress-head`,children:[P(`span`,{children:n}),e.percent!==null&&V(`bdi`,{dir:`ltr`,children:[e.percent,`%`]})]}),P(`progress`,{className:`engine-bar`,"aria-label":n,max:100,value:e.percent??void 0})]})}function YF({error:e,busy:t,notice:n,onRetry:r,onCloseLockers:i,onContinue:a,onRevert:o,onOpenLog:s}){let c=T(),l=KF(e),u=l!==null&&l.every(e=>e.isGaia),d=(l?.length??0)>1;return V(`div`,{className:`engine-failure`,children:[V(`div`,{role:`alert`,children:[l?V(D.Fragment,{children:[l.map(e=>P(`p`,{className:`engine-hint`,children:qF(e,c)},e.pid)),!u&&P(`p`,{className:`engine-hint`,children:c(d?`engine.locked.closeThenMany`:`engine.locked.closeThen`)})]}):P(`p`,{className:`engine-hint`,children:GF(e,c)}),P(`p`,{className:`engine-error`,children:P(`bdi`,{dir:`ltr`,children:e.message})})]}),u&&P(`button`,{type:`button`,className:`btn-primary engine-retry`,disabled:t,onClick:i,autoFocus:!0,children:c(d?`engine.locked.closeMany`:`engine.locked.close`)}),P(`button`,{type:`button`,className:`${u?`btn-secondary`:`btn-primary`} engine-retry`,disabled:t,onClick:r,autoFocus:!u,children:c(`engine.tryAgain`)}),e.stage===VF&&P(`button`,{type:`button`,className:`btn-secondary engine-retry`,disabled:t,onClick:a,children:c(`engine.continueWithout`)}),e.previousVersion&&P(`button`,{type:`button`,className:`btn-secondary engine-retry`,disabled:t,onClick:o,children:c(`update.chip.goBack`,{version:e.previousVersion})}),n&&P(`p`,{className:`engine-error`,role:`alert`,children:P(`bdi`,{dir:`ltr`,children:n})}),V(`details`,{className:`engine-details`,children:[P(`summary`,{children:c(`engine.details`)}),P(`pre`,{className:`engine-log`,dir:`ltr`,children:e.logTail.join(`
83
+ `)}),P(`button`,{type:`button`,className:`btn-secondary`,onClick:s,children:c(`engine.openLog`)})]})]})}function XF(){let e=T(),[t,n]=(0,J.useState)({phase:`running`,stage:null,percent:null,message:``,error:null}),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),s=(0,J.useCallback)(e=>{console.error(`[EngineInstallScreen] the desktop app did not answer`,e),o(e instanceof Error?e.message:String(e))},[]);(0,J.useEffect)(()=>{let e=window.gaiaInstall,t=e.onProgress(n);return e.status().then(n).catch(s),t},[s]);let c=(0,J.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.retry().catch(s).finally(()=>i(!1))},[s]),l=(0,J.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.closeLockingPrograms().catch(s).finally(()=>i(!1))},[s]),u=(0,J.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.continueWithoutAgentUpdate().catch(s).finally(()=>i(!1))},[s]),d=(0,J.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.revert().then(e=>{e||i(!1)}).catch(e=>{s(e),i(!1)})},[s]),f=(0,J.useCallback)(()=>{o(null),window.gaiaInstall.openLogFile().then(e=>{e.ok||o(e.message)}).catch(s)},[s]),{error:p}=t,m=t.phase===`failed`&&p,h=e(m?p.stage===VF?`engine.failed.agentTitle`:`engine.failed.title`:`engine.title`);return P(`div`,{className:`app`,children:P(`main`,{className:`engine`,children:V(`div`,{className:`engine-inner`,children:[P(`h1`,{className:`engine-title`,children:h}),m?P(YF,{error:p,busy:r,notice:a,onRetry:c,onCloseLockers:l,onContinue:u,onRevert:d,onOpenLog:f}):V(D.Fragment,{children:[P(`p`,{className:`engine-lede`,children:e(`engine.lede`)}),P(JF,{status:t}),a&&P(`p`,{className:`engine-error`,role:`alert`,children:P(`bdi`,{dir:`ltr`,children:a})})]})]})})})}function ZF(){return!!window.gaiaInstall&&new URLSearchParams(window.location.search).get(`engine`)===`install`}async function QF(e){if(!e.isProduction||e.protocol!==`https:`&&e.protocol!==`http:`||!e.serviceWorker)return!1;try{return await e.serviceWorker.register(`./sw.js`,{scope:`./`}),!0}catch(e){return console.error(`[pwa] Service worker registration failed, so the UI is not cached for an installed app:`,e),!1}}Vs(),u();var $F=localStorage.getItem(`gaia-chat-theme`);S(x($F===`light`||$F===`dark`?$F:`system`));var eI=k.getState();i(eI.palette,eI.customColors,eI.theme),s(eI.locale),C(),l(),Co.createRoot(document.getElementById(`root`)).render(P(J.StrictMode,{children:ZF()?P(XF,{}):P(BF,{})})),window.addEventListener(`load`,()=>{QF({isProduction:!0,protocol:window.location.protocol,serviceWorker:`serviceWorker`in navigator?navigator.serviceWorker:void 0})});export{Ec as $,Zk as A,Gr as At,iA as B,_r as Bt,qk as C,yi as Ct,hA as D,Zr as Dt,Yk as E,ti as Et,gA as F,Dr as Ft,fA as G,mA as H,pr as Ht,sA as I,Tr as It,kT as J,FT as K,cA as L,Cr as Lt,Uk as M,zr as Mt,Xk as N,Nr as Nt,Gk as O,Yr as Ot,eA as P,jr as Pt,Nc as Q,rA as R,xr as Rt,Jk as S,Ti as St,tA as T,hi as Tt,yA as U,rr as Ut,oA as V,hr as Vt,Qk as W,Yn as Wt,aS as X,jT as Y,Pc as Z,uA as _,fa as _t,JN as a,mo as at,Kk as b,Zi as bt,KN as c,co as ct,VA as d,Ba as dt,ds as et,EA as f,Ra as ft,lA as g,Sa as gt,pA as h,Ea as ht,PP as i,bo as it,dA as j,Ur as jt,Wk as k,qr as kt,bN as l,eo as lt,bA as m,Ma as mt,nF as n,Io as nt,qN as o,fo as ot,vA as p,Pa as pt,LT as q,VP as r,So as rt,GN as s,q as st,fF as t,Go as tt,yN as u,Qa as ut,nA as v,K as vt,$k as w,_i as wt,xA as x,Fi as xt,_A as y,ta as yt,aA as z,yr as zt};