@amd-gaia/agent-ui 0.27.0-rc.8 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/gaia-ui.cjs +57 -3
- package/dist/assets/AdvancedSettings-R8_C2uBe.js +1 -0
- package/dist/assets/AutomationsSettings-B3zbjgZt.js +1 -0
- package/dist/assets/ConnectorsPane-BxG6qzLb.css +1 -0
- package/dist/assets/ConnectorsPane-BzcyOZRr.js +1 -0
- package/dist/assets/{DocumentLibrary-fEMoY7lH.css → DocumentLibrary-Ctwq2m2t.css} +1 -1
- package/dist/assets/DocumentLibrary-o3Fy8URO.js +5 -0
- package/dist/assets/FileBrowser-DxS29ShT.css +1 -0
- package/dist/assets/FileBrowser-_6Dx8AKt.js +4 -0
- package/dist/assets/MemoryDashboard-Bfy9g6TS.css +1 -0
- package/dist/assets/MemoryDashboard-ao_en1zm.js +1 -0
- package/dist/assets/MessagingSettings-DJq0F5BO.js +1 -0
- package/dist/assets/{MobileAccessModal-BrZMaERi.css → MobileAccessModal-DSFjH6di.css} +1 -1
- package/dist/assets/MobileAccessModal-ld0MPTgk.js +2 -0
- package/dist/assets/ScheduleManager-CEBoBLPV.css +1 -0
- package/dist/assets/ScheduleManager-px6Ly00O.js +1 -0
- package/dist/assets/folderIndexResult-BIoxqF5I.js +1 -0
- package/dist/assets/index-DXyVxzzC.css +1 -0
- package/dist/assets/index-Qh2EUbOw.js +226 -0
- package/dist/assets/useFocusTrap-Cy_PGcml.js +6 -0
- package/dist/index.html +3 -3
- package/dist/sw.js +1 -1
- package/main-safety-net.cjs +26 -2
- package/main.cjs +196 -58
- package/package.json +2 -2
- package/services/backend-crash-dialog.cjs +19 -5
- package/services/backend-health-monitor.cjs +86 -0
- package/services/backend-installer.cjs +1 -0
- package/services/backend-supervisor.cjs +35 -9
- package/services/browser-pane/dev-servers.cjs +44 -1
- package/services/browser-pane/listen-addresses.cjs +140 -0
- package/services/context-menu.cjs +79 -0
- package/services/link-policy.cjs +78 -7
- package/services/port-manager.cjs +2 -3
- package/services/process-tree.cjs +84 -14
- package/services/quit-guard.cjs +8 -4
- package/services/ui-token.cjs +156 -0
- package/dist/assets/AdvancedSettings-DPIu61Ug.js +0 -1
- package/dist/assets/AutomationsSettings-B-JefRcu.js +0 -1
- package/dist/assets/ConnectorsPane-BGI8nBUb.css +0 -1
- package/dist/assets/ConnectorsPane-DR1BXwSE.js +0 -1
- package/dist/assets/DocumentLibrary-je0OG0yL.js +0 -5
- package/dist/assets/FileBrowser-1goNp4CP.css +0 -1
- package/dist/assets/FileBrowser-CsVRdbcE.js +0 -4
- package/dist/assets/MemoryDashboard-CeioRY3q.js +0 -1
- package/dist/assets/MemoryDashboard-RpfLag-v.css +0 -1
- package/dist/assets/MessagingSettings-naPht5_K.js +0 -1
- package/dist/assets/MobileAccessModal-Bi6c7ior.js +0 -2
- package/dist/assets/ScheduleManager-BZzEH2-W.css +0 -1
- package/dist/assets/ScheduleManager-Dod2vW7s.js +0 -1
- package/dist/assets/index-B5hpAuDg.css +0 -1
- package/dist/assets/index-BLw-Jjdx.js +0 -222
- package/dist/assets/useFocusTrap-ChaVFhZD.js +0 -6
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ConnectorsPane-DR1BXwSE.js","./rolldown-runtime-XKyaHtl9.js","./useFocusTrap-ChaVFhZD.js","./ConnectorsPane-BGI8nBUb.css","./MessagingSettings-naPht5_K.js","./AutomationsSettings-B-JefRcu.js","./AdvancedSettings-DPIu61Ug.js","./MemoryDashboard-CeioRY3q.js","./MemoryDashboard-RpfLag-v.css","./ScheduleManager-Dod2vW7s.js","./ScheduleManager-BZzEH2-W.css","./DocumentLibrary-je0OG0yL.js","./DocumentLibrary-fEMoY7lH.css","./FileBrowser-CsVRdbcE.js","./FileBrowser-1goNp4CP.css","./MobileAccessModal-Bi6c7ior.js","./MobileAccessModal-BrZMaERi.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{$ as r,$n as i,$r as a,A as o,An as s,Ar as c,At as l,B as u,Br as d,C as f,Ct as p,D as m,Dn as h,Dt as g,E as _,En as v,Et as y,F as b,Fn as x,Fr as S,Ft as C,G as w,Gn as T,Gr as E,Gt as D,Hn as O,Hr as ee,Ht as te,I as ne,In as re,Ir as k,It as ie,J as ae,Jn as A,Jr as oe,Jt as se,K as ce,Kn as le,Kr as ue,Kt as de,L as fe,Ln as pe,Lr as me,Lt as j,M as he,Mn as M,Mt as ge,N as _e,Nn as ve,O as ye,On as be,Ot as xe,P as Se,Pn as Ce,Pr as we,Pt as Te,Q as Ee,Qn as De,Qr as Oe,Qt as ke,R as Ae,Rn as je,Rr as Me,Rt as Ne,S as Pe,Sn as Fe,St as Ie,T as Le,Tn as Re,Tt as ze,U as Be,Un as Ve,Ur as He,Ut as Ue,V as We,Vn as Ge,Vr as Ke,Vt as qe,W as Je,Wn as Ye,Wr as Xe,Wt as Ze,X as Qe,Xn as $e,Xr as et,Xt as tt,Y as nt,Yn as rt,Yr as it,Yt as at,Z as ot,Zn as st,Zr as ct,Zt as lt,_ as ut,_n as dt,_r as ft,_t as pt,a as mt,ai as ht,an as gt,ar as _t,at as vt,b as N,bn as yt,bt,c as P,ci as F,cn as xt,cr as St,ct as Ct,d as wt,di as Tt,dn as Et,dr as Dt,dt as Ot,ei as kt,en as At,er as jt,et as Mt,f as Nt,fi as Pt,fn as Ft,fr as It,g as Lt,gi as Rt,h as zt,hi as I,hn as Bt,hr as Vt,ht as Ht,i as Ut,ii as Wt,in as Gt,ir as Kt,it as qt,j as Jt,jn as Yt,jt as Xt,k as Zt,kn as Qt,kt as $t,l as L,li as en,ln as tn,lr as nn,lt as rn,m as an,mi as on,mn as sn,mr as cn,mt as ln,n as un,ni as dn,nn as fn,nr as pn,o as mn,oi as hn,on as gn,or as _n,ot as vn,p as yn,pi as bn,pn as xn,pr as Sn,pt as Cn,q as wn,qn as Tn,qr as En,qt as Dn,r as On,ri as kn,rn as An,rr as jn,rt as Mn,s as R,si as Nn,sn as Pn,sr as Fn,st as In,t as Ln,ti as Rn,tn as zn,tr as Bn,tt as Vn,u as z,ui as Hn,un as Un,ur as Wn,ut as Gn,v as Kn,vn as qn,vt as Jn,w as Yn,wn as Xn,wt as Zn,x as Qn,xn as $n,xt as er,y as tr,yn as nr,yt as rr,z as ir,zn as ar,zr as or,zt as sr}from"./useFocusTrap-ChaVFhZD.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 cr=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&&ne(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&&ne(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 ee=new MessageChannel,te=ee.port2;ee.port1.onmessage=D,O=function(){te.postMessage(null)}}else O=function(){_(D,0)};function ne(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,ne(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}}}})),lr=n(((e,t)=>{t.exports=cr()})),ur=n((e=>{var t=Rt();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`})),dr=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=ur()})),fr=n((e=>{var t=lr(),n=Rt(),r=dr();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 f(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)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(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 m(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 h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(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)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(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 v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(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 C(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 w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),ee=Symbol.for(`react.strict_mode`),te=Symbol.for(`react.profiler`),ne=Symbol.for(`react.consumer`),re=Symbol.for(`react.context`),k=Symbol.for(`react.forward_ref`),ie=Symbol.for(`react.suspense`),ae=Symbol.for(`react.suspense_list`),A=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.legacy_hidden`),le=Symbol.for(`react.memo_cache_sentinel`),ue=Symbol.for(`react.view_transition`),de=Symbol.for(`react.recoverable`),fe=Symbol.iterator;function pe(e){return typeof e!=`object`||!e?null:(e=fe&&e[fe]||e[`@@iterator`],typeof e==`function`?e:null)}var me=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===me?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case te:return`Profiler`;case ee:return`StrictMode`;case ie:return`Suspense`;case ae:return`SuspenseList`;case se:return`Activity`;case ue:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case re:return e.displayName||`Context`;case ne:return(e._context.displayName||`Context`)+`.Consumer`;case k:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case A:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var he=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_e={pending:!1,data:null,method:null,action:null},ve=[],ye=-1;function be(e){return{current:e}}function xe(e){0>ye||(e.current=ve[ye],ve[ye]=null,ye--)}function Se(e,t){ye++,ve[ye]=e.current,e.current=t}var Ce=be(null),we=be(null),Te=be(null),Ee=be(null);function De(e,t){switch(Se(Te,t),Se(we,e),Se(Ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?xp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=xp(t),e=Sp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}xe(Ce),Se(Ce,e)}function Oe(){xe(Ce),xe(we),xe(Te)}function ke(e){var t=e.memoizedState;t!==null&&(vh._currentValue=t.memoizedState,Se(Ee,e)),t=Ce.current;var n=Sp(t,e.type);t!==n&&(Se(we,e),Se(Ce,n))}function Ae(e){we.current===e&&(xe(Ce),xe(we)),Ee.current===e&&(xe(Ee),vh._currentValue=_e)}var je,Me;function Ne(e){if(je===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);je=t&&t[1]||``,Me=-1<e.stack.indexOf(`
|
|
3
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
-
`+je+e+Me}var Pe=!1;function Fe(e,t){if(!e||Pe)return``;Pe=!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{Pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ne(n):``}function Ie(e,t){switch(e.tag){case 26:case 27:case 5:return Ne(e.type);case 16:return Ne(`Lazy`);case 13:return e.child!==t&&t!==null?Ne(`Suspense Fallback`):Ne(`Suspense`);case 19:return Ne(`SuspenseList`);case 0:case 15:return Fe(e.type,!1);case 11:return Fe(e.type.render,!1);case 1:return Fe(e.type,!0);case 31:return Ne(`Activity`);case 30:return Ne(`ViewTransition`);default:return``}}function Le(e){try{var t=``,n=null;do t+=Ie(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
-
Error generating stack: `+e.message+`
|
|
9
|
-
`+e.stack}}var Re=Object.prototype.hasOwnProperty,ze=t.unstable_scheduleCallback,Be=t.unstable_cancelCallback,Ve=t.unstable_shouldYield,He=t.unstable_requestPaint,Ue=t.unstable_now,We=t.unstable_getCurrentPriorityLevel,Ge=t.unstable_ImmediatePriority,Ke=t.unstable_UserBlockingPriority,qe=t.unstable_NormalPriority,Je=t.unstable_LowPriority,Ye=t.unstable_IdlePriority,Xe=t.log,Ze=t.unstable_setDisableYieldValue,Qe=null,$e=null;function et(e){if(typeof Xe==`function`&&Ze(e),$e&&typeof $e.setStrictMode==`function`)try{$e.setStrictMode(Qe,e)}catch{}}var tt=Math.clz32?Math.clz32:it,nt=Math.log,rt=Math.LN2;function it(e){return e>>>=0,e===0?32:31-(nt(e)/rt|0)|0}var at=256,ot=262144,st=4194304;function ct(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 lt(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=ct(n))):i=ct(o):i=ct(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ct(n))):i=ct(o)):i=ct(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 ut(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function dt(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-tt(n),i=1<<r;t|=e[r],n&=~i}return t}function ft(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 pt(){var e=st;return st<<=1,!(st&62914560)&&(st=4194304),e}function mt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ht(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gt(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-tt(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&&_t(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function _t(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-tt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function vt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-tt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function N(e,t){var n=t&-t;return n=n&42?1:yt(n),(n&(e.suspendedLanes|t))===0?n:0}function yt(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 bt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function P(){var e=ge.p;return e===0?(e=window.event,e===void 0?32:Ph(e.type)):e}function F(e,t){var n=ge.p;try{return ge.p=e,t()}finally{ge.p=n}}var xt=Math.random().toString(36).slice(2),St=`__reactFiber$`+xt,Ct=`__reactProps$`+xt,wt=`__reactContainer$`+xt,Tt=`__reactEvents$`+xt,Et=`__reactListeners$`+xt,Dt=`__reactHandles$`+xt,Ot=`__reactResources$`+xt,kt=`__reactMarker$`+xt,At=`__reactLoad$`+xt;function jt(e){delete e[St],delete e[Ct],delete e[Et],delete e[Dt]}function Mt(e){var t;if(t=e[St])return t;for(var n=e.parentNode;n;){if(t=n[wt]||n[St]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Cm(e);e!==null;){if(n=e[St])return n;e=Cm(e)}return t}e=n,n=e.parentNode}return null}function Nt(e){if(e=e[St]||e[wt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Pt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Ft(e){var t=e[Ot];return t||=e[Ot]={hoistableStyles:new Map,hoistableScripts:new Map},t}function It(e){e[kt]=!0}function Lt(e){e[At]=void 0}var zt=new Set,I={};function Bt(e,t){Vt(e,t),Vt(e+`Capture`,t)}function Vt(e,t){for(I[e]=t,e=0;e<t.length;e++)zt.add(t[e])}var Ht=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]*$`),Ut={},Wt={};function Gt(e){return Re.call(Wt,e)?!0:Re.call(Ut,e)?!1:Ht.test(e)?Wt[e]=!0:(Ut[e]=!0,!1)}var Kt=!1;function qt(){var e=Kt;return Kt=!1,e}function Jt(e,t,n){if(Gt(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 Yt(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 Xt(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 Zt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Qt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function $t(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 L(e){if(!e._valueTracker){var t=Qt(e)?`checked`:`value`;e._valueTracker=$t(e,t,``+e[t])}}function en(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Qt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var tn=/[\n"\\]/g;function nn(e){return e.replace(tn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function rn(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=``+Zt(t)):e.value!==``+Zt(t)&&(e.value=``+Zt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):on(e,Zt(n)):o===`number`&&e.value==t?on(e,Zt(e.value)):on(e,Zt(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=``+Zt(s):e.removeAttribute(`name`)}function an(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)){L(e);return}n=n==null?``:``+Zt(n),t=t==null?n:``+Zt(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),L(e)}function on(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function sn(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=``+Zt(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 cn(e,t,n){t!=null&&(t=``+Zt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Zt(n)}function ln(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(he(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Zt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),L(e)}function un(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var dn=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 fn(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||dn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function pn(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]=``,Kt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(fn(e,a,r),Kt=!0)}else for(var o in t)t.hasOwnProperty(o)&&fn(e,o,t[o])}function mn(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 hn=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`]]),gn=/^[\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 _n(e){return gn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function vn(){}var yn=null;function bn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xn=null,Sn=null;function Cn(e){var t=Nt(e);if(t&&(e=t.stateNode)){var n=e[Ct]||null;a:switch(e=t.stateNode,t.type){case`input`:if(rn(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="`+nn(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[Ct]||null;if(!a)throw Error(i(90));rn(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&&en(r)}break a;case`textarea`:cn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&sn(e,!!n.multiple,t,!1)}}}var wn=!1;function Tn(e,t,n){if(wn)return e(t,n);wn=!0;try{return e(t)}finally{if(wn=!1,(xn!==null||Sn!==null)&&(Jd(),xn&&(t=xn,e=Sn,Sn=xn=null,Cn(t),e)))for(t=0;t<e.length;t++)Cn(e[t])}}function En(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Ct]||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 Dn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,On=!1;if(Dn)try{var kn={};Object.defineProperty(kn,"passive",{get:function(){On=!0}}),window.addEventListener(`test`,kn,kn),window.removeEventListener(`test`,kn,kn)}catch{On=!1}var An=null,jn=null,Mn=null;function R(){if(Mn)return Mn;var e,t=jn,n=t.length,r,i=`value`in An?An.value:An.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 Mn=i.slice(e,1<r?1-r:void 0)}function Nn(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 Pn(){return!0}function Fn(){return!1}function In(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)?Pn:Fn,this.isPropagationStopped=Fn,this}return w(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=Pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Pn)},persist:function(){},isPersistent:Pn}),t}var Ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Rn=In(Ln),zn=w({},Ln,{view:0,detail:0}),Bn=In(zn),Vn,z,Hn,Un=w({},zn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:er,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!==Hn&&(Hn&&e.type===`mousemove`?(Vn=e.screenX-Hn.screenX,z=e.screenY-Hn.screenY):z=Vn=0,Hn=e),Vn)},movementY:function(e){return`movementY`in e?e.movementY:z}}),Wn=In(Un),Gn=In(w({},Un,{dataTransfer:0})),Kn=In(w({},zn,{relatedTarget:0})),qn=In(w({},Ln,{animationName:0,elapsedTime:0,pseudoElement:0})),Jn=In(w({},Ln,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Yn=In(w({},Ln,{data:0})),Xn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Zn={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`},Qn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function $n(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Qn[e])?!!t[e]:!1}function er(){return $n}var tr=In(w({},zn,{key:function(e){if(e.key){var t=Xn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Nn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Zn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:er,charCode:function(e){return e.type===`keypress`?Nn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Nn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),nr=In(w({},Un,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),rr=In(w({},Ln,{submitter:0})),ir=In(w({},zn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:er})),ar=In(w({},Ln,{propertyName:0,elapsedTime:0,pseudoElement:0})),or=In(w({},Un,{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})),sr=In(w({},Ln,{newState:0,oldState:0,source:0})),cr=[9,13,27,32],ur=Dn&&`CompositionEvent`in window,fr=null;Dn&&`documentMode`in document&&(fr=document.documentMode);var pr=Dn&&`TextEvent`in window&&!fr,mr=Dn&&(!ur||fr&&8<fr&&11>=fr),hr=` `,gr=!1;function _r(e,t){switch(e){case`keyup`:return cr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function vr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var yr=!1;function br(e,t){switch(e){case`compositionend`:return vr(t);case`keypress`:return t.which===32?(gr=!0,hr):null;case`textInput`:return e=t.data,e===hr&&gr?null:e;default:return null}}function xr(e,t){if(yr)return e===`compositionend`||!ur&&_r(e,t)?(e=R(),Mn=jn=An=null,yr=!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 mr&&t.locale!==`ko`?null:t.data;default:return null}}var Sr={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 Cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Sr[e.type]:t===`textarea`}function wr(e,t,n,r){xn?Sn?Sn.push(r):Sn=[r]:xn=r,t=ip(t,`onChange`),0<t.length&&(n=new Rn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Tr=null,Er=null;function Dr(e){Xf(e,0)}function Or(e){if(en(Pt(e)))return e}function kr(e,t){if(e===`change`)return t}var Ar=!1;if(Dn){var jr;if(Dn){var Mr=`oninput`in document;if(!Mr){var Nr=document.createElement(`div`);Nr.setAttribute(`oninput`,`return;`),Mr=typeof Nr.oninput==`function`}jr=Mr}else jr=!1;Ar=jr&&(!document.documentMode||9<document.documentMode)}function Pr(){Tr&&(Tr.detachEvent(`onpropertychange`,Fr),Er=Tr=null)}function Fr(e){if(e.propertyName===`value`&&Or(Er)){var t=[];wr(t,Er,e,bn(e)),Tn(Dr,t)}}function Ir(e,t,n){e===`focusin`?(Pr(),Tr=t,Er=n,Tr.attachEvent(`onpropertychange`,Fr)):e===`focusout`&&Pr()}function Lr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Or(Er)}function Rr(e,t){if(e===`click`)return Or(t)}function zr(e,t){if(e===`input`||e===`change`)return Or(t)}function Br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Vr=typeof Object.is==`function`?Object.is:Br;function Hr(e,t){if(Vr(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(!Re.call(t,i)||!Vr(e[i],t[i]))return!1}return!0}function Ur(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 Wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gr(e,t){var n=Wr(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=Wr(n)}}function Kr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ur(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=Ur(e.document)}return t}function Jr(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 Yr=Dn&&`documentMode`in document&&11>=document.documentMode,Xr=null,Zr=null,Qr=null,$r=!1;function ei(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$r||Xr==null||Xr!==Ur(r)||(r=Xr,`selectionStart`in r&&Jr(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}),Qr&&Hr(Qr,r)||(Qr=r,r=ip(Zr,`onSelect`),0<r.length&&(t=new Rn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Xr)))}function ti(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ni={animationend:ti(`Animation`,`AnimationEnd`),animationiteration:ti(`Animation`,`AnimationIteration`),animationstart:ti(`Animation`,`AnimationStart`),transitionrun:ti(`Transition`,`TransitionRun`),transitionstart:ti(`Transition`,`TransitionStart`),transitioncancel:ti(`Transition`,`TransitionCancel`),transitionend:ti(`Transition`,`TransitionEnd`)},ri={},ii={};Dn&&(ii=document.createElement(`div`).style,`AnimationEvent`in window||(delete ni.animationend.animation,delete ni.animationiteration.animation,delete ni.animationstart.animation),`TransitionEvent`in window||delete ni.transitionend.transition);function ai(e){if(ri[e])return ri[e];if(!ni[e])return e;var t=ni[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ii)return ri[e]=t[n];return e}var oi=ai(`animationend`),si=ai(`animationiteration`),ci=ai(`animationstart`),li=ai(`transitionrun`),ui=ai(`transitionstart`),di=ai(`transitioncancel`),fi=ai(`transitionend`),pi=new Map,mi=`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(` `);mi.push(`scrollEnd`);function hi(e,t){pi.set(e,t),Bt(t,[e])}var gi=0;function _i(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=kd.identifierPrefix;var n=gi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function vi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Ld;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 yi(e,t){return e=vi(e),t=vi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var bi=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)},xi=[],Si=0,Ci=0;function wi(){for(var e=Si,t=Ci=Si=0;t<e;){var n=xi[t];xi[t++]=null;var r=xi[t];xi[t++]=null;var i=xi[t];xi[t++]=null;var a=xi[t];if(xi[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&&Oi(n,i,a)}}function Ti(e,t,n,r){xi[Si++]=e,xi[Si++]=t,xi[Si++]=n,xi[Si++]=r,Ci|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ei(e,t,n,r){return Ti(e,t,n,r),ki(e)}function Di(e,t){return Ti(e,null,null,t),ki(e)}function Oi(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-tt(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ki(e){if(50<Rd)throw Rd=0,zd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ai={};function ji(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 Mi(e,t,n,r){return new ji(e,t,n,r)}function Ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pi(e,t){var n=e.alternate;return n===null?(n=Mi(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 Fi(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 Ii(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Ni(r)&&(s=1);else if(typeof r==`string`)s=ih(e,n,Ce.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case se:return e=Mi(31,n,t,a),e.elementType=se,e.lanes=o,e;case O:return Li(n.children,a,o,t);case ee:s=8,a|=24;break;case te:return e=Mi(12,n,t,a|2),e.elementType=te,e.lanes=o,e;case ie:return e=Mi(13,n,t,a),e.elementType=ie,e.lanes=o,e;case ae:return e=Mi(19,n,t,a),e.elementType=ae,e.lanes=o,e;case ce:case ue:return e=a|32,e=Mi(30,n,t,e),e.elementType=ue,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case re:s=10;break a;case ne:s=9;break a;case k:s=11;break a;case A:s=14;break a;case oe:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Mi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Li(e,t,n,r){return e=Mi(7,e,r,t),e.lanes=n,e}function Ri(e,t,n){return e=Mi(6,e,null,t),e.lanes=n,e}function zi(e){var t=Mi(18,null,null,0);return t.stateNode=e,t}function Bi(e,t,n){return t=Mi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Vi=new WeakMap;function Hi(e,t){if(typeof e==`object`&&e){var n=Vi.get(e);return n===void 0?(t={value:e,source:t,stack:Le(t)},Vi.set(e,t),t):n}return{value:e,source:t,stack:Le(t)}}var Ui=[],Wi=0,Gi=null,Ki=0,qi=[],Ji=0,Yi=null,Xi=1,Zi=``;function Qi(e,t){Ui[Wi++]=Ki,Ui[Wi++]=Gi,Gi=e,Ki=t}function $i(e,t,n){qi[Ji++]=Xi,qi[Ji++]=Zi,qi[Ji++]=Yi,Yi=e;var r=Xi;e=Zi;var i=32-tt(r)-1;r&=~(1<<i),n+=1;var a=32-tt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Xi=1<<32-tt(t)+i|n<<i|r,Zi=a+e}else Xi=1<<a|n<<i|r,Zi=e}function ea(e){e.return!==null&&(Qi(e,1),$i(e,1,0))}function ta(e){for(;e===Gi;)Gi=Ui[--Wi],Ui[Wi]=null,Ki=Ui[--Wi],Ui[Wi]=null;for(;e===Yi;)Yi=qi[--Ji],qi[Ji]=null,Zi=qi[--Ji],qi[Ji]=null,Xi=qi[--Ji],qi[Ji]=null}function na(e,t){qi[Ji++]=Xi,qi[Ji++]=Zi,qi[Ji++]=Yi,Xi=t.id,Zi=t.overflow,Yi=e}var ra=null,ia=null,aa=!1,oa=null,sa=!1,ca=Error(i(519));function la(e){throw ha(Hi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ca}function ua(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[St]=e,t[Ct]=r,n){case`dialog`:Zf(`cancel`,t),Zf(`close`,t);break;case`iframe`:case`object`:case`embed`:Zf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Jf.length;n++)Zf(Jf[n],t);break;case`source`:Zf(`error`,t);break;case`img`:case`image`:case`link`:Zf(`error`,t),Zf(`load`,t);break;case`details`:Zf(`toggle`,t);break;case`input`:Zf(`invalid`,t),an(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Zf(`invalid`,t);break;case`textarea`:Zf(`invalid`,t),ln(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||up(t.textContent,n)?(r.popover!=null&&(Zf(`beforetoggle`,t),Zf(`toggle`,t)),r.onScroll!=null&&Zf(`scroll`,t),r.onScrollEnd!=null&&Zf(`scrollend`,t),r.onClick!=null&&(t.onclick=vn),t=!0):t=!1,t||la(e,!0)}function da(e){for(ra=e.return;ra;)switch(ra.tag){case 5:case 31:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:ra=ra.return}}function fa(e){if(e!==ra)return!1;if(!aa)return da(e),aa=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||wp(e.type,e.memoizedProps)),n=!n),n&&ia&&la(e),da(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ia=Sm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ia=Sm(e)}else t===27?(t=ia,Np(e.type)?(e=xm,xm=null,ia=e):ia=t):ia=ra?bm(e.stateNode.nextSibling):null;return!0}function pa(){ia=ra=null,aa=!1}function ma(){var e=oa;return e!==null&&(xd===null?xd=e:xd.push.apply(xd,e),oa=null),e}function ha(e){oa===null?oa=[e]:oa.push(e)}var ga=be(null),_a=null,va=null;function ya(e,t,n){Se(ga,t._currentValue),t._currentValue=n}function ba(e){e._currentValue=ga.current,xe(ga)}function xa(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 Sa(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),xa(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),xa(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),xa(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 Ca(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;Vr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Ee.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[vh]:e.push(vh))}a=a.return}return e!==null&&Sa(t,e,n,r),t.flags|=262144,e!==null}function wa(e){for(e=e.firstContext;e!==null;){if(!Vr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ta(e){_a=e,va=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ea(e){return Oa(_a,e)}function Da(e,t){return _a===null&&Ta(e),Oa(e,t)}function Oa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},va===null){if(e===null)throw Error(i(308));va=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else va=va.next=t;return n}var ka=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()})}},Aa=t.unstable_scheduleCallback,ja=t.unstable_NormalPriority,Ma={$$typeof:re,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Na(){return{controller:new ka,data:new Map,refCount:0}}function Pa(e){e.refCount--,e.refCount===0&&Aa(ja,function(){e.controller.abort()})}function Fa(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 Ia=null;function La(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ra=null,za=0,Ba=0,Va=null;function Ha(e,t){if(Ra===null){var n=Ra=[];za=0,Ba=Uf(),Va={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return za++,t.then(Ua,Ua),t}function Ua(){if(--za===0&&(Ia=null,Ra!==null)){Va!==null&&(Va.status=`fulfilled`);var e=Ra;Ra=null,Ba=0,Va=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Wa(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 Ga=M.S;M.S=function(e,t){if(wd=Ue(),typeof t==`object`&&t&&typeof t.then==`function`&&Ha(e,t),Ia!==null)for(var n=kf;n!==null;)Fa(n,Ia),n=n.next;if(n=e.types,n!==null){for(var r=kf;r!==null;)Fa(r,n),r=r.next;if(Ba!==0){r=Ia,r===null&&(r=Ia=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ga!==null&&Ga(e,t)};var Ka=be(null);function qa(){var e=Ka.current;return e===null?od.pooledCache:e}function Ja(e,t){t===null?Se(Ka,Ka.current):Se(Ka,t.pool)}function Ya(){var e=qa();return e===null?null:{parent:Ma._currentValue,pool:e}}var Xa=Error(i(460)),Za=Error(i(474)),Qa=Error(i(542)),$a={then:function(){}};function eo(e){return e=e.status,e===`fulfilled`||e===`rejected`}function to(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(vn,vn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ao(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(vn,vn);else{if(e=od,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,ao(e),e}throw ro=t,Xa}}function no(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ro=e,Xa):e}}var ro=null;function io(){if(ro===null)throw Error(i(459));var e=ro;return ro=null,e}function ao(e){if(e===Xa||e===Qa)throw Error(i(483))}var oo=null,so=0;function co(e){var t=so;return so+=1,oo===null&&(oo=[]),to(oo,e,t)}function lo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function uo(e,t){throw t.$$typeof===T?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function fo(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=Pi(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=Ri(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===O?(e=d(e,t,n.props.children,r,n.key),lo(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===oe&&no(i)===t.type)?(t=a(t,n.props),lo(t,n),t.return=e,t):(t=Ii(n.type,n.key,n.props,null,e.mode,r),lo(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=Bi(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=Li(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=Ri(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case E:return n=Ii(t.type,t.key,t.props,null,e.mode,n),lo(n,t),n.return=e,n;case D:return t=Bi(t,e.mode,n),t.return=e,t;case oe:return t=no(t),f(e,t,n)}if(he(t)||pe(t))return t=Li(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,co(t),n);if(t.$$typeof===re)return f(e,Da(e,t),n);uo(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 E:return n.key===i?l(e,t,n,r):null;case D:return n.key===i?u(e,t,n,r):null;case oe:return n=no(n),p(e,t,n,r)}if(he(n)||pe(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,co(n),r);if(n.$$typeof===re)return p(e,t,Da(e,n),r);uo(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 E:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case D:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case oe:return r=no(r),m(e,t,n,r,i)}if(he(r)||pe(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,co(r),i);if(r.$$typeof===re)return m(e,t,n,Da(t,r),i);uo(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),aa&&Qi(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 aa&&Qi(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)}),aa&&Qi(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),aa&&Qi(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 aa&&Qi(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)}),aa&&Qi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===O&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case E:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===O){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),lo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===oe&&no(l)===r.type){n(e,r.sibling),c=a(r,o.props),lo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===O?(c=Li(o.props.children,e.mode,c,o.key),lo(c,o),c.return=e,e=c):(c=Ii(o.type,o.key,o.props,null,e.mode,c),lo(c,o),c.return=e,e=c)}return s(e);case D: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=Bi(o,e.mode,c),c.return=e,e=c}return s(e);case oe:return o=no(o),_(e,r,o,c)}if(he(o))return h(e,r,o,c);if(pe(o)){if(l=pe(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,co(o),c);if(o.$$typeof===re)return _(e,r,Da(e,o),c);uo(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=Ri(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{so=0;var i=_(e,t,n,r);return oo=null,i}catch(t){if(t===Xa||t===Qa)throw t;var a=Mi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var po=fo(!0),mo=fo(!1),ho=!1;function go(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _o(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 vo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function yo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ad&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ki(e),Oi(e,null,n),t}return Ti(e,r,t,n),ki(e)}function bo(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,vt(e,n)}}function xo(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 So=!1;function Co(){if(So){var e=Va;if(e!==null)throw e}}function wo(e,t,n,r){So=!1;var i=e.updateQueue;ho=!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?(V&f)===f:(r&f)===f){f!==0&&f===Ba&&(So=!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=w({},d,f);break a;case 2:ho=!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),hd|=o,e.lanes=o,e.memoizedState=d}}function To(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Eo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)To(n[e],t)}var Do=be(null),Oo=be(0);function ko(e,t){e=pd,Se(Oo,e),Se(Do,t),pd=e|t.baseLanes}function Ao(){Se(Oo,pd),Se(Do,Do.current)}function jo(){pd=Oo.current,xe(Do),xe(Oo)}var Mo=be(null),No=null;function Po(e){var t=e.alternate;Se(zo,zo.current&1),Se(Mo,e),No===null&&(t===null||Do.current!==null||t.memoizedState!==null)&&(No=e)}function Fo(e){Se(zo,zo.current),Se(Mo,e),No===null&&(No=e)}function Io(e){e.tag===22?(Se(zo,zo.current),Se(Mo,e),No===null&&(No=e)):Lo()}function Lo(){Se(zo,zo.current),Se(Mo,Mo.current)}function Ro(e){xe(Mo),No===e&&(No=null),xe(zo)}var zo=be(0);function Bo(e,t){Se(Mo,Mo.current),Se(zo,t)}function Vo(e){xe(zo),xe(Mo),No===e&&(No=null)}function Ho(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||_m(n)||vm(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 Uo=0,Wo=null,Go=null,Ko=null,qo=!1,Jo=!1,Yo=!1,Xo=0,Zo=0,Qo=null,$o=0;function es(){throw Error(i(321))}function ts(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vr(e[n],t[n]))return!1;return!0}function ns(e,t,n,r,i,a){return Uo=a,Wo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?vc:yc,Yo=!1,a=n(r,i),Yo=!1,Jo&&(a=is(t,n,r,i)),rs(e),a}function rs(e){M.H=_c;var t=Go!==null&&Go.next!==null;if(Uo=0,Ko=Go=Wo=null,qo=!1,Zo=0,Qo=null,t)throw Error(i(300));e===null||Ic||(e=e.dependencies,e!==null&&wa(e)&&(Ic=!0))}function is(e,t,n,r){Wo=e;var a=0;do{if(Jo&&(Qo=null),Zo=0,Jo=!1,25<=a)throw Error(i(301));if(a+=1,Ko=Go=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}M.H=bc,o=t(n,r)}while(Jo);return o}function as(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?fs(t):t,e=e.useState()[0],(Go===null?null:Go.memoizedState)!==e&&(Wo.flags|=1024),t}function os(){var e=Xo!==0;return Xo=0,e}function ss(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function cs(e){if(qo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}qo=!1}Uo=0,Ko=Go=Wo=null,Jo=!1,Zo=Xo=0,Qo=null}function ls(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ko===null?Wo.memoizedState=Ko=e:Ko=Ko.next=e,Ko}function us(){if(Go===null){var e=Wo.alternate;e=e===null?null:e.memoizedState}else e=Go.next;var t=Ko===null?Wo.memoizedState:Ko.next;if(t!==null)Ko=t,Go=e;else{if(e===null)throw Wo.alternate===null?Error(i(467)):Error(i(310));Go=e,e={memoizedState:Go.memoizedState,baseState:Go.baseState,baseQueue:Go.baseQueue,queue:Go.queue,next:null},Ko===null?Wo.memoizedState=Ko=e:Ko=Ko.next=e}return Ko}function ds(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fs(e){var t=Zo;return Zo+=1,Qo===null&&(Qo=[]),e=to(Qo,e,t),t=Wo,(Ko===null?t.memoizedState:Ko.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?vc:yc),e}function ps(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return fs(e);if(e.$$typeof===de)return;if(e.$$typeof===re)return Ea(e)}throw Error(i(438,String(e)))}function ms(e){var t=null,n=Wo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Wo.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=ds(),Wo.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]=le;return t.index++,n}function hs(e,t){return typeof t==`function`?t(e):t}function gs(e){return _s(us(),Go,e)}function _s(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?(Uo&f)===f:(V&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===Ba&&(d=!0);else if((Uo&p)===p){u=u.next,p===Ba&&(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,Wo.lanes|=p,hd|=p;f=u.action,Yo&&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,Wo.lanes|=f,hd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Vr(o,e.memoizedState)&&(Ic=!0,d&&(n=Va,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 vs(e){var t=us(),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);Vr(o,t.memoizedState)||(Ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ys(e,t,n){var r=Wo,a=us(),o=aa;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Vr((Go||a).memoizedState,n);if(s&&(a.memoizedState=n,Ic=!0),a=a.queue,Ws(Ss.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Ko!==null&&!!(Ko.memoizedState.tag&1),zs(e?9:8,{destroy:void 0},xs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,od===null)throw Error(i(349));o||Uo&127||bs(r,t,n)}return n}function bs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Wo.updateQueue,t===null?(t=ds(),Wo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function xs(e,t,n,r){t.value=n,t.getSnapshot=r,Cs(t)&&ws(e)}function Ss(e,t,n){return n(function(){Cs(t)&&ws(e)})}function Cs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vr(e,n)}catch{return!0}}function ws(e){var t=Di(e,2);t!==null&&Ud(t,e,2)}function Ts(e){var t=ls();if(typeof e==`function`){var n=e;if(e=n(),Yo){et(!0);try{n()}finally{et(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:e},t}function Es(e,t,n,r){return e.baseState=n,_s(e,Go,typeof r==`function`?r:hs)}function Ds(e,t,n,r,a){if(mc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};M.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Os(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Os(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};o.types=a===null?null:a.types,M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),ks(e,t,s)}catch(n){js(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),ks(e,t,a)}catch(n){js(e,t,n)}}function ks(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){As(e,t,n)},function(n){return js(e,t,n)}):As(e,t,n)}function As(e,t,n){t.status=`fulfilled`,t.value=n,Ms(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Os(e,n)))}function js(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ms(t),t=t.next;while(t!==r)}e.action=null}function Ms(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ns(e,t){return t}function Ps(e,t){if(aa){var n=od.formState;if(n!==null){a:{var r=Wo;if(aa){if(ia){b:{for(var i=ia,a=sa;i.nodeType!==8;)if(!a||(i=bm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ia=bm(i.nextSibling),r=i.data===`F!`;break a}}la(r)}r=!1}r&&(t=n[0])}}return n=ls(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ns,lastRenderedState:t},n.queue=r,n=dc.bind(null,Wo,r),r.dispatch=n,r=Ts(!1),a=pc.bind(null,Wo,!1,r.queue),r=ls(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ds.bind(null,Wo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Fs(e){return Is(us(),Go,e)}function Is(e,t,n){if(t=_s(e,t,Ns)[0],e=gs(hs)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=fs(t)}catch(e){throw e===Xa?Qa:e}else r=t;t=us();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Wo.flags|=2048,zs(9,{destroy:void 0},Ls.bind(null,i,n),null)),[r,a,e]}function Ls(e,t){e.action=t}function Rs(e){var t=us(),n=Go;if(n!==null)return Is(t,n,e);us(),t=t.memoizedState,n=us();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function zs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Wo.updateQueue,t===null&&(t=ds(),Wo.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 Bs(){return us().memoizedState}function Vs(e,t,n,r){var i=ls();Wo.flags|=e,i.memoizedState=zs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Hs(e,t,n,r){var i=us();r=r===void 0?null:r;var a=i.memoizedState.inst;Go!==null&&r!==null&&ts(r,Go.memoizedState.deps)?i.memoizedState=zs(t,a,n,r):(Wo.flags|=e,i.memoizedState=zs(1|t,a,n,r))}function Us(e,t){Vs(8390656,8,e,t)}function Ws(e,t){Hs(2048,8,e,t)}function Gs(e){Wo.flags|=4;var t=Wo.updateQueue;if(t===null)t=ds(),Wo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ks(e){var t=us().memoizedState;return Gs({ref:t,nextImpl:e}),function(){if(ad&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function qs(e,t){return Hs(4,2,e,t)}function Js(e,t){return Hs(4,4,e,t)}function Ys(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 Xs(e,t,n){n=n==null?null:n.concat([e]),Hs(4,4,Ys.bind(null,t,e),n)}function Zs(){}function Qs(e,t){var n=us();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&ts(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function $s(e,t){var n=us();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&ts(t,r[1]))return r[0];if(r=e(),Yo){et(!0);try{e()}finally{et(!1)}}return n.memoizedState=[r,t],r}function ec(e,t,n){return n===void 0||Uo&1073741824&&!(V&261930)?e.memoizedState=t:(e.memoizedState=n,e=Vd(),Wo.lanes|=e,hd|=e,n)}function tc(e,t,n,r){return Vr(n,t)?n:Do.current===null?!(Uo&106)||Uo&1073741824&&!(V&261930)?(Ic=!0,e.memoizedState=n):(e=Vd(),Wo.lanes|=e,hd|=e,t):(e=ec(e,n,r),Vr(e,t)||(Ic=!0),e)}function nc(e,t,n,r,i){var a=ge.p;ge.p=a!==0&&8>a?a:8;var o=M.T,s={};s.types=o===null?null:o.types,M.T=s,pc(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?fc(e,t,Wa(c,r),Bd(e)):fc(e,t,r,Bd(e))}catch(n){fc(e,t,{then:function(){},status:`rejected`,reason:n},Bd())}finally{ge.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function rc(){}function ic(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=B(e).queue;nc(e,a,t,_e,n===null?rc:function(){return ac(e),n(r)})}function B(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:_e,baseState:_e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:_e},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ac(e){var t=B(e);t.next===null&&(t=e.alternate.memoizedState),fc(e,t.next.queue,{},Bd())}function oc(){return Ea(vh)}function sc(){return us().memoizedState}function cc(){return us().memoizedState}function lc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Bd();e=vo(n);var r=yo(t,e,n);r!==null&&(Ud(r,t,n),bo(r,t,n)),t={cache:Na()},e.payload=t;return}t=t.return}}function uc(e,t,n){var r=Bd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},mc(e)?hc(t,n):(n=Ei(e,t,n,r),n!==null&&(Ud(n,e,r),gc(n,t,r)))}function dc(e,t,n){fc(e,t,n,Bd())}function fc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(mc(e))hc(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,Vr(s,o))return Ti(e,t,i,0),od===null&&wi(),!1}catch{}if(n=Ei(e,t,i,r),n!==null)return Ud(n,e,r),gc(n,t,r),!0}return!1}function pc(e,t,n,r){if(r={lane:2,revertLane:Uf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},mc(e)){if(t)throw Error(i(479))}else t=Ei(e,n,r,2),t!==null&&Ud(t,e,2)}function mc(e){var t=e.alternate;return e===Wo||t!==null&&t===Wo}function hc(e,t){Jo=qo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vt(e,n)}}var _c={readContext:Ea,use:ps,useCallback:es,useContext:es,useEffect:es,useImperativeHandle:es,useLayoutEffect:es,useInsertionEffect:es,useMemo:es,useReducer:es,useRef:es,useState:es,useDebugValue:es,useDeferredValue:es,useTransition:es,useSyncExternalStore:es,useId:es,useHostTransitionStatus:es,useFormState:es,useActionState:es,useOptimistic:es,useMemoCache:es,useCacheRefresh:es,useEffectEvent:es},vc={readContext:Ea,use:ps,useCallback:function(e,t){return ls().memoizedState=[e,t===void 0?null:t],e},useContext:Ea,useEffect:Us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Vs(4194308,4,Ys.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Vs(4194308,4,e,t)},useInsertionEffect:function(e,t){Vs(4,2,e,t)},useMemo:function(e,t){var n=ls();t=t===void 0?null:t;var r=e();if(Yo){et(!0);try{e()}finally{et(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ls();if(n!==void 0){var i=n(t);if(Yo){et(!0);try{n(t)}finally{et(!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=uc.bind(null,Wo,e),[r.memoizedState,e]},useRef:function(e){var t=ls();return e={current:e},t.memoizedState=e},useState:function(e){e=Ts(e);var t=e.queue,n=dc.bind(null,Wo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Zs,useDeferredValue:function(e,t){return ec(ls(),e,t)},useTransition:function(){var e=Ts(!1);return e=nc.bind(null,Wo,e.queue,!0,!1),ls().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Wo,a=ls();if(aa){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),od===null)throw Error(i(349));V&127||bs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Us(Ss.bind(null,r,o,e),[e]),r.flags|=2048,zs(9,{destroy:void 0},xs.bind(null,r,o,n,t),null),n},useId:function(){var e=ls(),t=od.identifierPrefix;if(aa){var n=Zi,r=Xi;n=(r&~(1<<32-tt(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Xo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=$o++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:oc,useFormState:Ps,useActionState:Ps,useOptimistic:function(e){var t=ls();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=pc.bind(null,Wo,!0,n),n.dispatch=t,[e,t]},useMemoCache:ms,useCacheRefresh:function(){return ls().memoizedState=lc.bind(null,Wo)},useEffectEvent:function(e){var t=ls(),n={impl:e};return t.memoizedState=n,function(){if(ad&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},yc={readContext:Ea,use:ps,useCallback:Qs,useContext:Ea,useEffect:Ws,useImperativeHandle:Xs,useInsertionEffect:qs,useLayoutEffect:Js,useMemo:$s,useReducer:gs,useRef:Bs,useState:function(){return gs(hs)},useDebugValue:Zs,useDeferredValue:function(e,t){return tc(us(),Go.memoizedState,e,t)},useTransition:function(){var e=gs(hs)[0],t=us().memoizedState;return[typeof e==`boolean`?e:fs(e),t]},useSyncExternalStore:ys,useId:sc,useHostTransitionStatus:oc,useFormState:Fs,useActionState:Fs,useOptimistic:function(e,t){return Es(us(),Go,e,t)},useMemoCache:ms,useCacheRefresh:cc,useEffectEvent:Ks},bc={readContext:Ea,use:ps,useCallback:Qs,useContext:Ea,useEffect:Ws,useImperativeHandle:Xs,useInsertionEffect:qs,useLayoutEffect:Js,useMemo:$s,useReducer:vs,useRef:Bs,useState:function(){return vs(hs)},useDebugValue:Zs,useDeferredValue:function(e,t){var n=us();return Go===null?ec(n,e,t):tc(n,Go.memoizedState,e,t)},useTransition:function(){var e=vs(hs)[0],t=us().memoizedState;return[typeof e==`boolean`?e:fs(e),t]},useSyncExternalStore:ys,useId:sc,useHostTransitionStatus:oc,useFormState:Rs,useActionState:Rs,useOptimistic:function(e,t){var n=us();return Go===null?(n.baseState=e,[e,n.queue.dispatch]):Es(n,Go,e,t)},useMemoCache:ms,useCacheRefresh:cc,useEffectEvent:Ks};function xc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Sc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Bd(),i=vo(r);i.payload=t,n!=null&&(i.callback=n),t=yo(e,i,r),t!==null&&(Ud(t,e,r),bo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Bd(),i=vo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=yo(e,i,r),t!==null&&(Ud(t,e,r),bo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Bd(),r=vo(n);r.tag=2,t!=null&&(r.callback=t),t=yo(e,r,n),t!==null&&(Ud(t,e,n),bo(t,e,n))}};function Cc(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?!Hr(n,r)||!Hr(i,a):!0}function wc(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&&Sc.enqueueReplaceState(t,t.state,null)}function Tc(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=w({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ec(e){bi(e)}function Dc(e){console.error(e)}function Oc(e){bi(e)}function kc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ac(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 jc(e,t,n){return n=vo(n),n.tag=3,n.payload={element:null},n.callback=function(){kc(e,t)},n}function Mc(e){return e=vo(e),e.tag=3,e}function Nc(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(){Ac(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ac(t,n,r),typeof i!=`function`&&(Dd===null?Dd=new Set([this]):Dd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Pc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ca(t,n,a,!0),n=Mo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return No===null?ef():n.alternate===null&&md===0&&(md=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===$a?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Cf(e,r,a)),!1;case 22:return n.flags|=65536,r===$a?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)),Cf(e,r,a)),!1}throw Error(i(435,n.tag))}return Cf(e,r,a),ef(),!1}if(aa)return t=Mo.current,t===null?(r!==ca&&(t=Error(i(423),{cause:r}),ha(Hi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Hi(r,n),a=jc(e.stateNode,r,a),xo(e,a),md!==4&&(md=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ca&&(e=Error(i(422),{cause:r}),ha(Hi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Hi(o,n),bd===null?bd=[o]:bd.push(o),md!==4&&(md=2),t===null)return!0;r=Hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=jc(n.stateNode,r,e),xo(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`&&(Dd===null||!Dd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Mc(a),Nc(a,e,n,r),xo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Fc=Error(i(461)),Ic=!1;function Lc(e,t,n,r){t.child=e===null?mo(t,null,n,r):po(t,e.child,n,r)}function Rc(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 Ta(t),r=ns(e,t,n,o,a,i),s=os(),e!==null&&!Ic?(ss(e,t,i),fl(e,t,i)):(aa&&s&&ea(t),t.flags|=1,Lc(e,t,r,i),t.child)}function zc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Bc(e,t,a,r,i)):(e=Ii(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!pl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Hr:n,n(o,r)&&e.ref===t.ref)return fl(e,t,i)}return t.flags|=1,e=Pi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Bc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Hr(a,r)&&e.ref===t.ref){if(Ic=!1,t.pendingProps=r=a,pl(e,i))e.flags&131072&&(Ic=!0);else return t.lanes=e.lanes,fl(e,t,i)}}return Jc(e,t,n,r,i)}function Vc(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 Uc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ja(t,a===null?null:a.cachePool),a===null?Ao():ko(t,a),Io(t);else return r=t.lanes=536870912,Uc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ja(t,null),Ao(),Lo()):(Ja(t,a.cachePool),ko(t,a),Lo(),t.memoizedState=null);return Lc(e,t,i,n),t.child}function Hc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Uc(e,t,n,r,i){var a=qa();return a=a===null?null:{parent:Ma._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ja(t,null),Ao(),Io(t),e!==null&&Ca(e,t,r,!0),t.childLanes=i,null}function Wc(e,t){return t=rl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Gc(e,t,n){return po(t,e.child,null,n),e=Wc(t,t.pendingProps),e.flags|=2,Ro(t),t.memoizedState=null,e}function Kc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(aa){if(r.mode===`hidden`)return e=Wc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Hc(null,e);if(Fo(t),(e=ia)?(e=gm(e,sa),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi===null?null:{id:Xi,overflow:Zi},retryLane:536870912,hydrationErrors:null},n=zi(e),n.return=t,t.child=n,ra=t,ia=null)):e=null,e===null)throw la(t);return t.lanes=536870912,null}return Wc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Fo(t),a){if(t.flags&256)t.flags&=-257,t=Gc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Ic||Ca(e,t,n,!1),a=(n&e.childLanes)!==0,Ic||a){if(Do.current===null){if(r=od,r!==null&&(s=N(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Di(e,s),Ud(r,e,s),Fc;ef()}t=Gc(e,t,n)}else e=o.treeContext,ia=bm(s.nextSibling),ra=t,aa=!0,oa=null,sa=!1,e!==null&&na(t,e),t=Wc(t,r),t.flags|=134221824;return t}return e=Pi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function qc(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 Jc(e,t,n,r,i){return Ta(t),n=ns(e,t,n,r,void 0,i),r=os(),e!==null&&!Ic?(ss(e,t,i),fl(e,t,i)):(aa&&r&&ea(t),t.flags|=1,Lc(e,t,n,i),t.child)}function Yc(e,t,n,r,i,a){return Ta(t),t.updateQueue=null,n=is(t,r,n,i),rs(e),r=os(),e!==null&&!Ic?(ss(e,t,a),fl(e,t,a)):(aa&&r&&ea(t),t.flags|=1,Lc(e,t,n,a),t.child)}function Xc(e,t,n,r,i){if(Ta(t),t.stateNode===null){var a=Ai,o=n.contextType;typeof o==`object`&&o&&(a=Ea(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Sc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},go(t),o=n.contextType,a.context=typeof o==`object`&&o?Ea(o):Ai,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(xc(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&&Sc.enqueueReplaceState(a,a.state,null),wo(t,r,a,i),Co(),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=Tc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ai,typeof u==`object`&&u&&(o=Ea(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)&&wc(t,a,r,o),ho=!1;var f=t.memoizedState;a.state=f,wo(t,r,a,i),Co(),l=t.memoizedState,s||f!==l||ho?(typeof d==`function`&&(xc(t,n,d,r),l=t.memoizedState),(c=ho||Cc(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,_o(e,t),o=t.memoizedProps,u=Tc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ai,typeof l==`object`&&l&&(c=Ea(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)&&wc(t,a,r,c),ho=!1,f=t.memoizedState,a.state=f,wo(t,r,a,i),Co();var p=t.memoizedState;o!==d||f!==p||ho||e!==null&&e.dependencies!==null&&wa(e.dependencies)?(typeof s==`function`&&(xc(t,n,s,r),p=t.memoizedState),(u=ho||Cc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&wa(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,qc(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=po(t,e.child,null,i),t.child=po(t,null,n,i)):Lc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=fl(e,t,i),e}function Zc(e,t,n,r){return pa(),t.flags|=256,Lc(e,t,n,r),t.child}var Qc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $c(e){return{baseLanes:e,cachePool:Ya()}}function el(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=vd),e}function tl(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(zo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(aa){if(i?Po(t):Lo(),(e=ia)?(e=gm(e,sa),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi===null?null:{id:Xi,overflow:Zi},retryLane:536870912,hydrationErrors:null},n=zi(e),n.return=t,t.child=n,ra=t,ia=null)):e=null,e===null)throw la(t);return t.lanes=vm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Lo(),i=t.mode,a=rl({mode:`hidden`,children:a},i),r=Li(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=$c(n),r.childLanes=el(e,o,n),t.memoizedState=Qc,Hc(null,r)):(Po(t),nl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return al(e,t,a,o,r,c,s,n)}return i?(Lo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Pi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Li(i,a,n,null),i.flags|=2):i=Pi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Hc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=$c(n):(a=i.cachePool,a===null?a=Ya():(s=Ma._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=el(e,o,n),t.memoizedState=Qc,Hc(e.child,r)):(Po(t),n=e.child,e=n.sibling,n=Pi(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 nl(e,t){return t=rl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function rl(e,t){return e=Mi(22,e,null,t),e.lanes=0,e}function il(e,t,n){return po(t,e.child,null,n),e=nl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function al(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Po(t),t.flags&=-257,il(e,t,c)):t.memoizedState===null?(Lo(),o=a.fallback,s=t.mode,a=rl({mode:`visible`,children:a.children},s),o=Li(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,po(t,e.child,null,c),a=t.child,a.memoizedState=$c(c),a.childLanes=el(e,r,c),t.memoizedState=Qc,Hc(null,a)):(Lo(),t.child=e.child,t.flags|=128,null);if(Po(t),vm(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,ha({value:a,source:null,stack:null})),il(e,t,c)}if(Ic||Ca(e,t,c,!1),r=(c&e.childLanes)!==0,Ic||r){if(Do.current!==null)return il(e,t,c);if(r=od,r!==null&&(a=N(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Di(e,a),Ud(r,e,a),Fc;return _m(o)||ef(),il(e,t,c)}return _m(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,ia=bm(o.nextSibling),ra=t,aa=!0,oa=null,sa=!1,e!==null&&na(t,e),t=nl(t,a.children),t.flags|=134221824,t)}function ol(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),xa(e.return,t,n)}function sl(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Ho(n)===null&&(t=e),e=e.sibling}return t}function cl(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 ll(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 ul(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=zo.current;if(t.flags&128)return Bo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Bo(t,o),i===`backwards`&&e!==null?(ll(e),Lc(e,t,r,n),ll(e)):Lc(e,t,r,n),r=aa?Ki:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ol(e,n,t);else if(e.tag===19)ol(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=sl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,ll(t)),cl(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&&Ho(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}cl(t,!0,n,null,a,r);break;case`together`:cl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=sl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),cl(t,!1,i,n,a,r)}return t.child}function dl(e,t,n){var r=t.pendingProps;return ya(t,t.type,r.value),Lc(e,t,r.children,n),t.child}function fl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),hd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ca(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=Pi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Pi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function pl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&wa(e)))}function ml(e,t,n){switch(t.tag){case 3:De(t,t.stateNode.containerInfo),ya(t,Ma,e.memoizedState.cache),pa();break;case 27:case 5:ke(t);break;case 4:De(t,t.stateNode.containerInfo);break;case 10:ya(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Fo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Po(t),t.flags|=128,null;r=Ca(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?tl(e,t,n):(Po(t),e=fl(e,t,n),e===null?null:e.sibling)}Po(t);break;case 19:if(t.flags&128)return ul(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Ca(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ul(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Bo(t,zo.current),r)break;return null;case 22:return t.lanes=0,Vc(e,t,n,t.pendingProps);case 24:ya(t,Ma,e.memoizedState.cache)}return fl(e,t,n)}function hl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Ic=!0;else{if(!pl(e,n)&&!(t.flags&128))return Ic=!1,ml(e,t,n);Ic=!!(e.flags&131072)}}else Ic=!1,aa&&t.flags&1048576&&$i(t,Ki,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=no(t.elementType),t.type=e,typeof e==`function`)Ni(e)?(r=Tc(e,r),t.tag=1,t=Xc(null,t,e,r,n)):(t.tag=0,t=Jc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===k){t.tag=11,t=Rc(null,t,e,r,n);break a}if(a===A){t.tag=14,t=zc(null,t,e,r,n);break a}if(a===re){t.tag=10,t.type=e,t=dl(null,t,n);break a}}throw t=j(e)||e,Error(i(306,t,``))}}return t;case 0:return Jc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Tc(r,t.pendingProps),Xc(e,t,r,a,n);case 3:a:{if(De(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,_o(e,t),wo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ya(t,Ma,r),r!==o.cache&&Sa(t,[Ma],n,!0),Co(),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=Zc(e,t,r,n);break a}if(r!==a){a=Hi(Error(i(424)),t),ha(a),t=Zc(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(ia=bm(e.firstChild),ra=t,aa=!0,oa=null,sa=!0,n=mo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(pa(),r===a){t=fl(e,t,n);break a}Lc(e,t,r,n)}t=t.child}return t;case 26:return qc(e,t),e===null?(n=Wm(t.type,null,t.pendingProps,null))?t.memoizedState=n:aa||(t.stateNode=Cp(t.type,t.pendingProps,Te.current,t)):t.memoizedState=Wm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ke(t),e===null&&aa&&(r=t.stateNode=Em(t.type,t.pendingProps,Te.current),ra=t,sa=!0,a=ia,Np(t.type)?(xm=a,ia=bm(r.firstChild)):ia=a),Lc(e,t,t.pendingProps.children,n),qc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&aa&&((a=r=ia)&&(r=mm(r,t.type,t.pendingProps,sa),r===null?a=!1:(t.stateNode=r,ra=t,ia=bm(r.firstChild),sa=!1,a=!0)),a||la(t)),ke(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,wp(a,o)?r=null:s!==null&&wp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ns(e,t,as,null,null,n),vh._currentValue=a),qc(e,t),Lc(e,t,r,n),t.child;case 6:return e===null&&aa&&((e=n=ia)&&(n=hm(n,t.pendingProps,sa),n===null?e=!1:(t.stateNode=n,ra=t,ia=null,e=!0)),e||la(t)),null;case 13:return tl(e,t,n);case 4:return De(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=po(t,null,r,n):Lc(e,t,r,n),t.child;case 11:return Rc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,qc(e,t),Lc(e,t,r,n),t.child;case 8:return Lc(e,t,t.pendingProps.children,n),t.child;case 12:return Lc(e,t,t.pendingProps.children,n),t.child;case 10:return dl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,Ta(t),a=Ea(a),r=r(a),t.flags|=1,Lc(e,t,r,n),t.child;case 14:return zc(e,t,t.type,t.pendingProps,n);case 15:return Bc(e,t,t.type,t.pendingProps,n);case 19:return ul(e,t,n);case 31:return Kc(e,t,n);case 22:return Vc(e,t,n,t.pendingProps);case 24:return Ta(t),r=Ea(Ma),e===null?(a=qa(),a===null&&(a=od,o=Na(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},go(t),ya(t,Ma,a)):((e.lanes&n)!==0&&(_o(e,t),wo(t,null,null,n),Co()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,ya(t,Ma,r),r!==a.cache&&Sa(t,[Ma],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),ya(t,Ma,r))),Lc(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:aa&&ea(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:qc(e,t),Lc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function gl(e){e.flags|=4}function _l(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?ah(t,r):ah(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(Qd())e.flags|=8192;else throw ro=$a,Za}}else e.flags&=-16777217}function vl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!oh(t)){if(Qd())e.flags|=8192;else throw ro=$a,Za}}function yl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:pt(),e.lanes|=t,yd|=t)}function bl(e,t){if(!aa)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 xl(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 Sl(e,t,n){var r=t.pendingProps;switch(ta(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xl(t),null;case 1:return xl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ba(Ma),Oe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(fa(t)?gl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ma())),xl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(gl(t),o===null?(xl(t),_l(t,a,null,r,n)):(xl(t),vl(t,o))):o?o===e.memoizedState?(xl(t),t.flags&=-16777217):(gl(t),xl(t),vl(t,o)):(e=e.memoizedProps,e!==r&&gl(t),xl(t),_l(t,a,e,r,n)),null;case 27:if(Ae(t),n=Te.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return xl(t),t.subtreeFlags&=-33554433,null}e=Ce.current,fa(t)?ua(t,e):(e=Em(a,r,n),t.stateNode=e,gl(t))}return xl(t),t.subtreeFlags&=-33554433,null;case 5:if(Ae(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return xl(t),t.subtreeFlags&=-33554433,null}if(o=Ce.current,fa(t))ua(t,o);else{var s=bp(Te.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[St]=t,o[Ct]=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(pp(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&&gl(t)}}return xl(t),t.subtreeFlags&=-33554433,_l(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=Te.current,fa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ra,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[St]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||up(e.nodeValue,n)),e||la(t,!0)}else e=bp(e).createTextNode(r),e[St]=t,t.stateNode=e}return xl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=fa(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[St]=t}else pa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;xl(t),e=!1}else n=ma(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ro(t),t):(Ro(t),null);if(t.flags&128)throw Error(i(558))}return xl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=fa(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[St]=t}else pa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;xl(t),a=!1}else a=ma(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Ro(t),t):(Ro(t),null)}return Ro(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),yl(t,t.updateQueue),xl(t),null);case 4:return Oe(),e===null&&ep(t.stateNode.containerInfo),t.flags|=67108864,xl(t),null;case 10:return ba(t.type),xl(t),null;case 19:if(Vo(t),r=t.memoizedState,r===null)return xl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)bl(r,!1);else{if(md!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Ho(e),o!==null){for(t.flags|=128,bl(r,!1),e=o.updateQueue,t.updateQueue=e,yl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Fi(n,e),n=n.sibling;return Bo(t,zo.current&1|2),aa&&Qi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ue()>Td&&(t.flags|=128,a=!0,bl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Ho(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,yl(t,e),bl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!aa)return xl(t),null}else 2*Ue()-r.renderingStartTime>Td&&n!==536870912&&(t.flags|=128,a=!0,bl(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=Ue(),e.sibling=null,o=zo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||aa?Bo(t,o):(n=o,Se(Mo,t),Se(zo,n),No===null&&(No=t)),aa&&Qi(t,r.treeForkCount),e}return xl(t),null;case 22:case 23:return Ro(t),jo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(xl(t),t.subtreeFlags&6&&(t.flags|=8192)):xl(t),n=t.updateQueue,n!==null&&yl(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&&xe(Ka),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ba(Ma),xl(t),null;case 25:return null;case 30:return t.flags|=33554432,xl(t),null}throw Error(i(156,t.tag))}function Cl(e,t){switch(ta(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ba(Ma),Oe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ae(t),null;case 31:if(t.memoizedState!==null){if(Ro(t),t.alternate===null)throw Error(i(340));pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ro(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Vo(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 Oe(),null;case 10:return ba(t.type),null;case 22:case 23:return Ro(t),jo(),e!==null&&xe(Ka),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ba(Ma),null;case 25:return null;default:return null}}function wl(e,t){switch(ta(t),t.tag){case 3:ba(Ma),Oe();break;case 26:case 27:case 5:Ae(t);break;case 4:Oe();break;case 31:t.memoizedState!==null&&Ro(t);break;case 13:Ro(t);break;case 19:Vo(t);break;case 10:ba(t.type);break;case 22:case 23:Ro(t),jo(),e!==null&&xe(Ka);break;case 24:ba(Ma)}}function Tl(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){Sf(t,t.return,e)}}function El(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){Sf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Sf(t,t.return,e)}}function Dl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Eo(t,n)}catch(t){Sf(e,e.return,t)}}}function Ol(e,t,n){n.props=Tc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Sf(e,t,n)}}function kl(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=_i(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Gp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Kp(e);f(e.child,!1,lm,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){Sf(e,t,n)}}function Al(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Sf(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){Sf(e,t,n)}else n.current=null}}function jl(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++)dm(e.stateNode,t[n])}function Ml(e){for(var t=e.return;t!==null&&(Fl(t)&&dm(e.stateNode,t.stateNode),!Pl(t));)t=t.return}function Nl(e){for(var t=e.return;t!==null&&(Fl(t)&&fm(e.stateNode,t.stateNode),!Pl(t));)t=t.return}function Pl(e){return e.tag===5||e.tag===3||e.tag===27}function Fl(e){return e&&e.tag===7&&e.stateNode!==null}function Il(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){Sf(e,e.return,t)}}function Ll(e,t,n){try{var r=e.stateNode;hp(r,e.type,n,t),r[Ct]=t}catch(t){Sf(e,e.return,t)}}function Rl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Np(e.type)||e.tag===4}function zl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Rl(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&&Np(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 Bl(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=vn)),jl(e,r),Kt=!0;else if(i!==4&&(i===27&&(jl(e,r),r=null,Np(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Bl(e,t,n,r),e=e.sibling;e!==null;)Bl(e,t,n,r),e=e.sibling}function Vl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),jl(e,r),Kt=!0;else if(i!==4&&(i===27&&(jl(e,r),r=null,Np(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Vl(e,t,n,r),e=e.sibling;e!==null;)Vl(e,t,n,r),e=e.sibling}function Hl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);pp(t,r,n),t[St]=e,t[Ct]=n}catch(t){Sf(e,e.return,t)}}var Ul=!1,Wl=null;function Gl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Ul=!0)}var Kl=null;function ql(){var e=Kl;return Kl=null,e}var Jl=0;function Yl(e,t,n,r,i){return Jl=0,Xl(e.child,t,n,r,i)}function Xl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=zp(o);r.push(s),s.view&&(a=!0)}else a||zp(o).view&&(a=!0);Ul=!0,Ip(o,Jl===0?t:t+`_`+Jl,n),Jl++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Xl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function Zl(e,t){for(;e!==null;)e.tag===5?Lp(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||Zl(e.child,t),e=e.sibling}function Ql(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Ql(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=yi(t.default,t.share),t!==`none`&&(Yl(e,n,t,null,!1)||Zl(e.child,!1))}e=e.sibling}}function $l(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=_i(r,n),a=yi(r.default,n.paired?r.share:r.enter);a===`none`?Ql(e):Yl(e,i,a,null,!1)?(Ql(e),n.paired||t||Hd(e,r.onEnter)):Zl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)$l(e,t),e=e.sibling;else Ql(e)}function eu(e){if(Wl!==null&&Wl.size!==0){var t=Wl;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=yi(n.default,n.share);if(a!==`none`&&(Yl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Hd(e,n.onShare)):Zl(e.child,!1)),t.delete(r),t.size===0)break}}}eu(e)}e=e.sibling}}}function tu(e){if(e.tag===30){var t=e.memoizedProps,n=_i(t,e.stateNode),r=Wl===null?void 0:Wl.get(n),i=yi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Yl(e,n,i,null,!1)?r===void 0?Hd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Wl.delete(n),Hd(e,t.onShare)):Zl(e.child,!1)),Wl!==null&&eu(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)tu(e),e=e.sibling;else Wl!==null&&eu(e)}function nu(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=_i(t,e.stateNode);t=yi(t.default,t.update),e.flags&=-5,t!==`none`&&Yl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&nu(e);e=e.sibling}}function ru(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,Zl(e.child,!1))}ru(e)}e=e.sibling}}function iu(e){if(e.tag===30)e.stateNode.paired=null,Zl(e.child,!1),ru(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)iu(e),e=e.sibling;else ru(e)}function au(e){for(e=e.child;e!==null;)e.tag===30?Zl(e.child,!1):e.subtreeFlags&33554432&&au(e),e=e.sibling}function ou(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Jl<a.length){var l=a[Jl],u=zp(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&&Ip(c,Jl===0?n:n+`_`+Jl,i),s&&e.flags&4||(Kl===null&&(Kl=[]),Kl.push(c,Jl===0?r:r+`_`+Jl,t.memoizedProps)),Jl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:ou(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function su(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=_i(n,r),a=yi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Bp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Jl=0,i=ou(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Hd(e,n.onUpdate))}else e.subtreeFlags&33554432&&su(e,t);e=e.sibling}}var cu=!1,lu=!1,uu=!1,du=!1,fu=typeof WeakSet==`function`?WeakSet:Set,pu=null,mu=!1,hu=!1,gu=!1,_u=!1;function vu(e,t,n){if(e=e.containerInfo,vp=Dh,e=qr(e),Jr(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(yp={focusedElem:e,selectionRange:r},Dh=!1,n=(n&335544064)===n,pu=t,t=n?9270:1024;pu!==null;){if(e=pu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&tu(r[a]);if(e.alternate===null&&e.flags&2)n&&Gl(e),yu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&tu(r),yu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Gl(e),yu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,pu=r):(n&&nu(e),yu(n))}}Wl=null}function yu(e){for(;pu!==null;){var t=pu,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=Tc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){Sf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)pm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:pm(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=_i(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=yi(a.default,a.update),a!==`none`&&Yl(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,pu=r;break}pu=t.return}}function bu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Bu(e,n),r&4&&Tl(5,n);break;case 1:if(Bu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Sf(n,n.return,e)}else{var i=Tc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Sf(n,n.return,e)}}}r&64&&Dl(n),r&512&&kl(n,n.return);break;case 3:if(Bu(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{Eo(e,t)}catch(e){Sf(n,n.return,e)}}break;case 27:t===null&&r&4&&Hl(n);case 26:case 5:Bu(e,n),t===null&&r&4&&Il(n),r&512&&kl(n,n.return);break;case 12:Bu(e,n);break;case 31:Bu(e,n),r&4&&ku(e,n);break;case 13:Bu(e,n),r&4&&Au(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ef.bind(null,n),ym(e,n))));break;case 22:if(r=n.memoizedState!==null||cu,!r){var a=t!==null&&t.memoizedState!==null||lu;t=cu,i=lu,cu=r,(lu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Hu(e,n,r)):Bu(e,n),cu=t,lu=i}break;case 30:Bu(e,n),r&512&&kl(n,n.return);break;case 7:r&512&&kl(n,n.return);default:Bu(e,n)}}function xu(e,t){for(e=e.child;e!==null;)Su(e,t),e=e.sibling}function Su(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){Sf(e,e.return,t)}Cu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Kt=!0}catch(t){Sf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Fp(s,!0):Fp(e.stateNode,!1)}catch(t){Sf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&xu(e,t);break;default:xu(e,t)}}function Cu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:Su(n,r);break a;case 22:n.memoizedState===null&&Cu(n,r);break a;default:Cu(n,r)}}e=e.sibling}}function wu(e){var t=e.alternate;t!==null&&(e.alternate=null,wu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&jt(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 Tu=null,Eu=!1;function Du(e,t,n){for(n=n.child;n!==null;)Ou(e,t,n),n=n.sibling}function Ou(e,t,n){if($e&&typeof $e.onCommitFiberUnmount==`function`)try{$e.onCommitFiberUnmount(Qe,n)}catch{}switch(n.tag){case 26:lu||Al(n,t),Du(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!lu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:lu||Al(n,t),Nl(n);var r=Tu,i=Eu;Np(n.type)&&(Tu=n.stateNode,Eu=!1),Du(e,t,n),Dm(n.stateNode,n.type,n.memoizedProps),Tu=r,Eu=i;break;case 5:lu||Al(n,t),Nl(n);case 6:if(n.tag===6&&Nl(n),r=Tu,i=Eu,Tu=null,Du(e,t,n),Tu=r,Eu=i,Tu!==null){if(Eu)try{(Tu.nodeType===9?Tu.body:Tu.nodeName===`HTML`?Tu.ownerDocument.body:Tu).removeChild(n.stateNode),Kt=!0}catch(e){Sf(n,t,e)}else try{Tu.removeChild(n.stateNode),Kt=!0}catch(e){Sf(n,t,e)}}break;case 18:Tu!==null&&(Eu?(e=Tu,Pp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),$h(e)):Pp(Tu,n.stateNode));break;case 4:r=Tu,i=Eu,Tu=n.stateNode.containerInfo,Eu=!0,Du(e,t,n),Tu=r,Eu=i;break;case 0:case 11:case 14:case 15:El(2,n,t),lu||El(4,n,t),Du(e,t,n);break;case 1:lu||(Al(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Ol(n,t,r)),Du(e,t,n);break;case 21:Du(e,t,n);break;case 22:lu=(r=lu)||n.memoizedState!==null,Du(e,t,n),lu=r;break;case 30:Al(n,t),Du(e,t,n);break;case 7:lu||Al(n,t),Du(e,t,n);break;default:Du(e,t,n)}}function ku(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{$h(e)}catch(e){Sf(t,t.return,e)}}}function Au(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{$h(e)}catch(e){Sf(t,t.return,e)}}function ju(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new fu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new fu),t;default:throw Error(i(435,e.tag))}}function Mu(e,t){var n=ju(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Df.bind(null,e,t);t.then(r,r)}})}function Nu(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(Np(l.type)){Tu=l.stateNode,Eu=!1;break a}break;case 5:Tu=l.stateNode,Eu=!1;break a;case 3:case 4:Tu=l.stateNode.containerInfo,Eu=!0;break a}l=l.return}if(Tu===null)throw Error(i(160));Ou(s,c,o),Tu=null,Eu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Fu(t,e,n),t=t.sibling}var Pu=null;function Fu(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}Nu(t,e,n),Iu(e),a&4&&(El(3,e,e.return),Tl(3,e),El(5,e,e.return));break;case 1:Nu(t,e,n),Iu(e),a&512&&(lu||r===null||Al(r,r.return)),a&64&&cu&&(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=Pu,Nu(t,e,n),Iu(e),a&512&&(lu||r===null||Al(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(cu)e.stateNode=Cp(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[kt]||r[St]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),pp(r,t,n),r[St]=e,It(r),t=r;break a;case`link`:if(o=nh(`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),pp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=nh(`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),pp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[St]=e,It(r),t=r}e.stateNode=t}}else cu||rh(o,e.type,e.stateNode)}else e.stateNode=Zm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Ll(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||lu||t.parentNode.removeChild(t)):a.count--,n===null?cu||rh(o,e.type,e.stateNode):Zm(o,n,e.memoizedProps))}break;case 27:Nu(t,e,n),Iu(e),a&512&&(lu||r===null||Al(r,r.return)),r!==null&&a&4&&Ll(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=uu,uu=!1,Nu(t,e,n),uu=o,Iu(e),a&512&&(lu||r===null||Al(r,r.return)),e.flags&32){t=e.stateNode;try{un(t,``),Kt=!0}catch(t){Sf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Ll(e,t,r===null?t:r.memoizedProps)),a&1024&&(du=!0);break;case 6:if(Nu(t,e,n),Iu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Kt=!0}catch(t){Sf(e,e.return,t)}}break;case 3:if(Kt=!1,th=null,o=Pu,Pu=jm(t.containerInfo),Nu(t,e,n),Pu=o,Iu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{$h(t.containerInfo)}catch(t){Sf(e,e.return,t)}du&&(du=!1,Lu(e)),Kt=!1;break;case 4:a=uu,uu=cu,r=qt(),o=Pu,Pu=jm(e.stateNode.containerInfo),Nu(t,e,n),Iu(e),Pu=o,Kt&&hu&&(gu=!0),Kt=r,uu=a;break;case 12:Nu(t,e,n),Iu(e);break;case 31:Nu(t,e,n),Iu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Mu(e,t)));break;case 13:Nu(t,e,n),Iu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Cd=Ue()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Mu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=cu,l=lu,u=uu;cu=c||o,uu=u||o,lu=l||s,Nu(t,e,n),lu=l,uu=u,cu=c,Iu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||cu||lu||(t=s||lu,n=cu,r=lu,cu=o||cu,lu=t,Vu(e,2),cu=n,lu=r),!o&&uu||xu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Mu(e,n))));break;case 19:Nu(t,e,n),Iu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Mu(e,t)));break;case 30:a&512&&(lu||r===null||Al(r,r.return)),a=qt(),o=hu,s=(n&335544064)===n,c=e.memoizedProps,hu=s&&yi(c.default,c.update)!==`none`,Nu(t,e,n),Iu(e),s&&r!==null&&Kt&&(e.flags|=4),hu=o,Kt=a;break;case 21:break;case 7:a&512&&(lu||r===null||Al(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Nu(t,e,n),Iu(e)}}function Iu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Rl(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Fl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Pl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Vl(e,zl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(un(l,``),n.flags&=-33),Vl(e,zl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Bl(e,zl(e),u,s);break;default:throw Error(i(161))}}catch(t){Sf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Lu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Dh=!0,t.reset(),Dh=!1),e=e.sibling}}function Ru(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)zu(t,e),t=t.sibling;else su(t,!1)}function zu(e,t){var n=e.alternate;if(n===null)$l(e,!1);else switch(e.tag){case 3:if(_u=mu=!1,ql(),Ru(t,e),!mu&&!gu){if(e=Kl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Lp(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`})),_u=!0}Kl=null;break;case 5:Ru(t,e);break;case 4:r=mu,mu=!1,Ru(t,e),mu&&(gu=!0),mu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Ru(t,e):$l(e,!1));break;case 30:r=mu,i=ql(),mu=!1,Ru(t,e),mu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=_i(a,o),o=_i(n.memoizedProps,o);var s=yi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Jl=0,t=ou(e,n,t,o,s,a,!0),Jl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Hd(e,e.memoizedProps.onUpdate),Kl=i):i!==null&&(i.push.apply(i,Kl),Kl=i),mu=e.flags&32?!0:r;break;default:Ru(t,e)}}function Bu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)bu(e,t.alternate,t),t=t.sibling}function Vu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:El(4,n,n.return),Vu(n,r);break;case 1:Al(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Ol(n,n.return,i),Vu(n,r);break;case 27:r&2&&Dm(n.stateNode,n.type,n.memoizedProps);case 5:Al(n,n.return),n.tag!==5&&n.tag!==27||Nl(n),Vu(n,r);break;case 6:Nl(n);break;case 26:Al(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||lu||i.parentNode.removeChild(i),Vu(n,r);break;case 22:n.memoizedState===null&&Vu(n,r);break;case 30:Al(n,n.return),Vu(n,r);break;case 7:Al(n,n.return);default:Vu(n,r)}e=e.sibling}}function Hu(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:Hu(i,a,n),Tl(4,a);break;case 1:if(Hu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Sf(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++)To(l[i],c)}catch(e){Sf(r,r.return,e)}}s&&o&64&&Dl(a),kl(a,a.return);break;case 27:n&2&&Hl(a);case 5:a.tag!==5&&a.tag!==27||Ml(a),Hu(i,a,n),s&&r===null&&o&4&&Il(a),kl(a,a.return);break;case 6:Ml(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||cu||rh(jm(c.ownerDocument),a.type,c),Hu(i,a,n),s&&r===null&&o&4&&Il(a),kl(a,a.return);break;case 12:Hu(i,a,n);break;case 31:Hu(i,a,n),s&&o&4&&ku(i,a);break;case 13:Hu(i,a,n),s&&o&4&&Au(i,a);break;case 22:a.memoizedState===null&&Hu(i,a,n),kl(a,a.return);break;case 30:Hu(i,a,n),kl(a,a.return);break;case 7:kl(a,a.return);default:Hu(i,a,n)}t=t.sibling}}function Uu(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&&Pa(n))}function Wu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Pa(e))}function Gu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Ku(e,t,n,r),t=t.sibling;else i&&au(t)}function Ku(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&iu(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Gu(e,t,n,r),a&2048&&Tl(9,t);break;case 1:Gu(e,t,n,r);break;case 3:Gu(e,t,n,r),i&&_u&&(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&&Pa(a)));break;case 12:if(a&2048){Gu(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){Sf(t,t.return,e)}}else Gu(e,t,n,r);break;case 31:Gu(e,t,n,r);break;case 13:Gu(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&&iu(t),o._visibility&2?Gu(e,t,n,r):(o._visibility|=2,qu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&iu(s),o._visibility&2?Gu(e,t,n,r):Ju(e,t)),a&2048&&Uu(s,t);break;case 24:Gu(e,t,n,r),a&2048&&Wu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Zl(a.child,!0),Zl(t.child,!0))),Gu(e,t,n,r);break;default:Gu(e,t,n,r)}}function qu(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:qu(a,o,s,c,i),Tl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,qu(a,o,s,c,i)):u._visibility&2?qu(a,o,s,c,i):Ju(a,o),i&&l&2048&&Uu(o.alternate,o);break;case 24:qu(a,o,s,c,i),i&&l&2048&&Wu(o.alternate,o);break;default:qu(a,o,s,c,i)}t=t.sibling}}function Ju(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:Ju(n,r),i&2048&&Uu(r.alternate,r);break;case 24:Ju(n,r),i&2048&&Wu(r.alternate,r);break;default:Ju(n,r)}t=t.sibling}}var Yu=8192;function Xu(e,t,n){if(e.subtreeFlags&Yu)for(e=e.child;e!==null;)Zu(e,t,n),e=e.sibling}function Zu(e,t,n){switch(e.tag){case 26:Xu(e,t,n),e.flags&Yu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&ch(n,e)):lh(n,Pu,e.memoizedState,e.memoizedProps));break;case 5:Xu(e,t,n),e.flags&Yu&&(e=e.stateNode,(t&335544128)===t&&ch(n,e));break;case 3:case 4:var r=Pu;Pu=jm(e.stateNode.containerInfo),Xu(e,t,n),Pu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Yu,Yu=16777216,Xu(e,t,n),Yu=r):Xu(e,t,n));break;case 30:if((e.flags&Yu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Wl===null&&(Wl=new Map),Wl.set(r,i)}Xu(e,t,n);break;default:Xu(e,t,n)}}function Qu(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 $u(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];pu=r,nd(r,e)}Qu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ed(e),e=e.sibling}function ed(e){switch(e.tag){case 0:case 11:case 15:$u(e),e.flags&2048&&El(9,e,e.return);break;case 3:$u(e);break;case 12:$u(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,td(e)):$u(e);break;default:$u(e)}}function td(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];pu=r,nd(r,e)}Qu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:El(8,t,t.return),td(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,td(t));break;default:td(t)}e=e.sibling}}function nd(e,t){for(;pu!==null;){var n=pu;switch(n.tag){case 0:case 11:case 15:El(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:Pa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,pu=r;else a:for(n=e;pu!==null;){r=pu;var i=r.sibling,a=r.return;if(wu(r),r===n){pu=null;break a}if(i!==null){i.return=a,pu=i;break a}pu=a}}}var rd={getCacheForType:function(e){var t=Ea(Ma),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ea(Ma).controller.signal}},id=typeof WeakMap==`function`?WeakMap:Map,ad=0,od=null,sd=null,V=0,cd=0,ld=null,ud=!1,dd=!1,fd=!1,pd=0,md=0,hd=0,gd=0,_d=0,vd=0,yd=0,bd=null,xd=null,Sd=!1,Cd=0,wd=0,Td=1/0,Ed=null,Dd=null,Od=0,kd=null,Ad=null,jd=0,Md=0,Nd=null,Pd=null,Fd=null,Id=null,Ld=null,Rd=0,zd=null;function Bd(){return ad&2&&V!==0?V&-V:M.T===null?P():Uf()}function Vd(){if(vd===0){if(!(V&536870912)||aa){var e=ot;ot<<=1,!(ot&3932160)&&(ot=262144),vd=e}else vd=536870912}return e=Mo.current,e!==null&&(e.flags|=32),vd}function Hd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Gp(_i(e.memoizedProps,n))),Id===null&&(Id=[]),Id.push(t.bind(null,r))}}function Ud(e,t,n){(e===od&&(cd===2||cd===9)||e.cancelPendingCommit!==null)&&(Xd(e,0),qd(e,V,vd,!1)),ht(e,n),ad&2&&e===od||(e===od&&(!(ad&2)&&(gd|=n),md===4&&qd(e,V,vd,!1)),Ff(e))}function Wd(e,t,n){if(ad&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ut(e,t),a=r?rf(e,t):tf(e,t,!0),o=r;do{if(a===0){dd&&!r&&qd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Kd(n))a=tf(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=bd;var l=c.current.memoizedState.isDehydrated;if(l&&(Xd(c,s).flags|=256),s=tf(c,s,!1),s!==2&&s!==6){if(fd&&!l){c.errorRecoveryDisabledLanes|=o,gd|=o,a=4;break a}o=xd,xd=a,o!==null&&(xd===null?xd=o:xd.push.apply(xd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Xd(e,0),qd(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:qd(r,t,vd,!ud);break a;case 2:xd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Cd+300-Ue(),10<a)){if(qd(r,t,vd,!ud),lt(r,0,!0)!==0)break a;jd=t,r.timeoutHandle=Dp(Gd.bind(null,r,n,xd,Ed,Sd,t,vd,gd,yd,ud,o,`Throttled`,-0,0),a);break a}Gd(r,n,xd,Ed,Sd,t,vd,gd,yd,ud,o,null,-0,0)}break}}while(1);Ff(e)}function Gd(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:vn},Wl=null,Zu(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=ph.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?Cd-Ue():(a&4194048)===a?wd-Ue():0,m=dh(d,m),m!==null)?(jd=a,e.cancelPendingCommit=m(df.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),qd(e,a,o,!l)):df(e,t,a,n,r,i,o,s,c,l,u,d)}function Kd(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(!Vr(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 qd(e,t,n,r){t=dt(e,t),t&=~_d,t&=~gd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-tt(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&_t(e,n,t)}function Jd(){return ad&6?!0:(If(0,!1),!1)}function Yd(){if(sd!==null){if(cd===0)var e=sd.return;else e=sd,va=_a=null,cs(e),oo=null,so=0,e=sd;for(;e!==null;)wl(e.alternate,e),e=e.return;sd=null}}function Xd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Op(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),jd=0,Yd(),od=e,sd=n=Pi(e.current,null),V=t,cd=0,ld=null,ud=!1,dd=ut(e,t),fd=!1,yd=vd=_d=gd=hd=md=0,xd=bd=null,Sd=!1,pd=dt(e,t),wi(),n}function Zd(e,t){Wo=null,M.H=_c,t===Xa||t===Qa?(t=io(),cd=3):t===Za?(t=io(),cd=4):cd=t===Fc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,ld=t,sd===null&&(md=1,kc(e,Hi(t,e.current)))}function Qd(){var e=Mo.current;return e===null?!0:(V&4194048)===V?No===null:(V&62914560)===V||V&536870912?e===No:!1}function $d(){var e=M.H;return M.H=_c,e===null?_c:e}function H(){var e=M.A;return M.A=rd,e}function ef(){md=4,ud||(V&4194048)!==V&&Mo.current!==null||(dd=!0),!(hd&134217727)&&!(gd&134217727)||od===null||qd(od,V,vd,!1)}function tf(e,t,n){var r=ad;ad|=2;var i=$d(),a=H();(od!==e||V!==t)&&(Ed=null,Xd(e,t)),t=!1;var o=md;a:do try{if(cd!==0&&sd!==null){var s=sd,c=ld;switch(cd){case 8:Yd(),o=6;break a;case 3:case 2:case 9:case 6:Mo.current===null&&(t=!0);var l=cd;if(cd=0,ld=null,cf(e,s,c,l),n&&dd){o=0;break a}break;default:l=cd,cd=0,ld=null,cf(e,s,c,l)}}nf(),o=md;break}catch(t){Zd(e,t)}while(1);return t&&e.shellSuspendCounter++,va=_a=null,ad=r,M.H=i,M.A=a,sd===null&&(od=null,V=0,wi()),o}function nf(){for(;sd!==null;)of(sd)}function rf(e,t){var n=ad;ad|=2;var r=$d(),a=H();od!==e||V!==t?(Ed=null,Td=Ue()+500,Xd(e,t)):dd=ut(e,t);a:do try{if(cd!==0&&sd!==null){t=sd;var o=ld;b:switch(cd){case 1:cd=0,ld=null,cf(e,t,o,1);break;case 2:case 9:if(eo(o)){cd=0,ld=null,sf(t);break}t=function(){cd!==2&&cd!==9||od!==e||(cd=7),Ff(e)},o.then(t,t);break a;case 3:cd=7;break a;case 4:cd=5;break a;case 7:eo(o)?(cd=0,ld=null,sf(t)):(cd=0,ld=null,cf(e,t,o,7));break;case 5:var s=null;switch(sd.tag){case 26:s=sd.memoizedState;case 5:case 27:var c=sd;if(s?oh(s):c.stateNode.complete){cd=0,ld=null;var l=c.sibling;if(l!==null)sd=l;else{var u=c.return;u===null?sd=null:(sd=u,lf(u))}break b}}cd=0,ld=null,cf(e,t,o,5);break;case 6:cd=0,ld=null,cf(e,t,o,6);break;case 8:Yd(),md=6;break a;default:throw Error(i(462))}}af();break}catch(t){Zd(e,t)}while(1);return va=_a=null,M.H=r,M.A=a,ad=n,sd===null?(od=null,V=0,wi(),md):0}function af(){for(;sd!==null&&!Ve();)of(sd)}function of(e){var t=hl(e.alternate,e,pd);e.memoizedProps=e.pendingProps,t===null?lf(e):sd=t}function sf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Yc(n,t,t.pendingProps,t.type,void 0,V);break;case 11:t=Yc(n,t,t.pendingProps,t.type.render,t.ref,V);break;case 5:cs(t);var r=t;r===ra&&(aa?(da(r),r.tag===5&&r.stateNode!=null&&(ia=r.stateNode)):(da(r),aa=!0));default:wl(n,t),t=sd=Fi(t,pd),t=hl(n,t,pd)}e.memoizedProps=e.pendingProps,t===null?lf(e):sd=t}function cf(e,t,n,r){va=_a=null,cs(t),oo=null,so=0;var i=t.return;try{if(Pc(e,i,t,n,V)){md=1,kc(e,Hi(n,e.current)),sd=null;return}}catch(t){if(i!==null)throw sd=i,t;md=1,kc(e,Hi(n,e.current)),sd=null;return}t.flags&32768?(aa||r===1?e=!0:dd||V&536870912?e=!1:(ud=e=!0,(r===2||r===9||r===3||r===6)&&(r=Mo.current,r!==null&&r.tag===13&&(r.flags|=16384))),uf(t,e)):lf(t)}function lf(e){var t=e;do{if(t.flags&32768){uf(t,ud);return}e=t.return;var n=Sl(t.alternate,t,pd);if(n!==null){sd=n;return}if(t=t.sibling,t!==null){sd=t;return}sd=t=e}while(t!==null);md===0&&(md=5)}function uf(e,t){do{var n=Cl(e.alternate,e);if(n!==null){n.flags&=32767,sd=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){sd=e;return}sd=e=n}while(e!==null);md=6,sd=null}function df(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do yf();while(Od!==0);if(ad&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===od&&(sd=od=null,V=0),Ad=t,kd=e,jd=n,Nd=a,Pd=r,ff(e,t,n,s,c,l,f)}}function ff(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Md=s,s|=Ci,gt(e,n,s,r,i,a),Id=null,(n&335544064)===n?(Ld=La(e),r=10262):(Ld=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Of(qe,function(){return bf(),null})):(e.callbackNode=null,e.callbackPriority=0),Ul=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=M.T,M.T=null,i=ge.p,ge.p=2,a=ad,ad|=4;try{vu(e,t,n)}finally{ad=a,ge.p=i,M.T=r}}Od=1,Ul?Fd=Up(o,e.containerInfo,Ld,hf,gf,mf,_f,bf,pf,null,null):(hf(),gf(),_f())}function pf(e){if(Od!==0){var t=kd.onRecoverableError;t(e,{componentStack:null})}}function mf(){Od===3&&(Od=0,zu(Ad,kd),Od=4)}function hf(){if(Od===1){Od=0;var e=kd,t=Ad,n=jd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=M.T,M.T=null;var i=ge.p;ge.p=2;var a=ad;ad|=4;try{hu=gu=!1,Fu(t,e,n),n=yp;var o=qr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Kr(s.ownerDocument.documentElement,s)){if(c!==null&&Jr(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 _=Gr(s,h),v=Gr(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}}Dh=!!vp,yp=vp=null}finally{ad=a,ge.p=i,M.T=r}}e.current=t,Od=2}}function gf(){if(Od===2){Od=0;var e=kd,t=Ad,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=ge.p;ge.p=2;var i=ad;ad|=4;try{bu(e,t.alternate,t)}finally{ad=i,ge.p=r,M.T=n}}Od=3}}function _f(){if(Od===4||Od===3){Od=0;var e=Fd;Fd=null,He();var t=kd,n=Ad,r=jd,i=Pd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Od=5:(Od=0,Ad=kd=null,vf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Dd=null),bt(r),n=n.stateNode,$e&&typeof $e.onCommitFiberRoot==`function`)try{$e.onCommitFiberRoot(Qe,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=M.T,a=ge.p,ge.p=2,M.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{M.T=n,ge.p=a}}if(i=Id,o=Ld,Ld=null,i!==null&&(Id=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);jd&3&&yf(),Ff(t),a=t.pendingLanes,r&261930&&a&42?t===zd?Rd++:(Rd=0,zd=t):(Rd=0,zd=null),If(0,!1)}}function vf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Pa(t)))}function yf(){return Fd!==null&&(Fd.skipTransition(),Fd=null),hf(),gf(),_f(),bf()}function bf(){if(Od!==5)return!1;var e=kd,t=Md;Md=0;var n=bt(jd),r=M.T,a=ge.p;try{ge.p=32>n?32:n,M.T=null,n=Nd,Nd=null;var o=kd,s=jd;if(Od=0,Ad=kd=null,jd=0,ad&6)throw Error(i(331));var c=ad;if(ad|=4,ed(o.current),Ku(o,o.current,s,n),ad=c,If(0,!1),$e&&typeof $e.onPostCommitFiberRoot==`function`)try{$e.onPostCommitFiberRoot(Qe,o)}catch{}return!0}finally{ge.p=a,M.T=r,vf(e,t)}}function xf(e,t,n){t=Hi(n,t),t=jc(e.stateNode,t,2),e=yo(e,t,2),e!==null&&(ht(e,2),Ff(e))}function Sf(e,t,n){if(e.tag===3)xf(e,e,n);else for(;t!==null;){if(t.tag===3){xf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Dd===null||!Dd.has(r))){e=Hi(n,e),n=Mc(2),r=yo(t,n,2),r!==null&&(Nc(n,r,t,e),ht(r,2),Ff(r));break}}t=t.return}}function Cf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new id;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)||(fd=!0,i.add(n),e=wf.bind(null,e,t,n),t.then(e,e))}function wf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,od===e&&(V&n)===n&&(md===4||md===3&&(V&62914560)===V&&300>Ue()-Cd?ad&2?_d|=n:Xd(e,0):_d|=n,yd===V&&(yd=0)),Ff(e)}function Tf(e,t){t===0&&(t=pt()),e=Di(e,t),e!==null&&(ht(e,t),Ff(e))}function Ef(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Tf(e,n)}function Df(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),Tf(e,n)}function Of(e,t){return ze(e,t)}var kf=null,Af=null,jf=!1,Mf=!1,Nf=!1,Pf=0;function Ff(e){e!==Af&&e.next===null&&(Af===null?kf=Af=e:Af=Af.next=e),Mf=!0,jf||(jf=!0,Hf())}function If(e,t){if(!Nf&&Mf){Nf=!0;do for(var n=!1,r=kf;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-tt(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Vf(r,a))}else a=V,a=lt(r,r===od?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ut(r,a)||(n=!0,Vf(r,a))}r=r.next}while(n);Nf=!1}}function Lf(){Rf()}function Rf(){Mf=jf=!1;var e=0;Pf!==0&&Ep()&&(e=Pf);for(var t=Ue(),n=null,r=kf;r!==null;){var i=r.next,a=zf(r,t);a===0?(r.next=null,n===null?kf=i:n.next=i,i===null&&(Af=n)):(n=r,(e!==0||a&3)&&(Mf=!0)),r=i}Od!==0&&Od!==5||If(e,!1),Pf!==0&&(Pf=0)}function zf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-tt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=ft(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=od,n=V,n=lt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(cd===2||cd===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Be(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ut(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Be(r),bt(n)){case 2:case 8:n=Ke;break;case 32:n=qe;break;case 268435456:n=Ye;break;default:n=qe}return r=Bf.bind(null,e),n=ze(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Be(r),e.callbackPriority=2,e.callbackNode=null,2}function Bf(e,t){if(Od!==0&&Od!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(yf()&&e.callbackNode!==n)return null;var r=V;return r=lt(e,e===od?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Wd(e,r,t),zf(e,Ue()),e.callbackNode!=null&&e.callbackNode===n?Bf.bind(null,e):null)}function Vf(e,t){if(yf())return null;Wd(e,t,!0)}function Hf(){jp(function(){ad&6?ze(Ge,Lf):Rf()})}function Uf(){if(Pf===0){var e=Ba;e===0&&(e=at,at<<=1,!(at&261888)&&(at=256)),Pf=e}return Pf}function Wf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:_n(e)}function Gf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Wf((i[Ct]||null).action),o=r.submitter;o&&(t=(t=o[Ct]||null)?Wf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Rn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Pf!==0){var e=new FormData(i,o);ic(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),ic(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Kf=0;Kf<mi.length;Kf++){var qf=mi[Kf];hi(qf.toLowerCase(),`on`+(qf[0].toUpperCase()+qf.slice(1)))}hi(oi,`onAnimationEnd`),hi(si,`onAnimationIteration`),hi(ci,`onAnimationStart`),hi(`dblclick`,`onDoubleClick`),hi(`focusin`,`onFocus`),hi(`focusout`,`onBlur`),hi(li,`onTransitionRun`),hi(ui,`onTransitionStart`),hi(di,`onTransitionCancel`),hi(fi,`onTransitionEnd`),Vt(`onMouseEnter`,[`mouseout`,`mouseover`]),Vt(`onMouseLeave`,[`mouseout`,`mouseover`]),Vt(`onPointerEnter`,[`pointerout`,`pointerover`]),Vt(`onPointerLeave`,[`pointerout`,`pointerover`]),Bt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Bt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Bt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Bt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Bt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Bt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Jf=`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(` `),Yf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Jf));function Xf(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){bi(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){bi(e)}i.currentTarget=null,a=c}}}}function Zf(e,t){var n=t[Tt];n===void 0&&(n=t[Tt]=new Set);var r=e+`__bubble`;n.has(r)||(tp(t,e,2,!1),n.add(r))}function Qf(e,t,n){var r=0;t&&(r|=4),tp(n,e,r,t)}var $f=`_reactListening`+Math.random().toString(36).slice(2);function ep(e){if(!e[$f]){e[$f]=!0,zt.forEach(function(t){t!==`selectionchange`&&(Yf.has(t)||Qf(t,!1,e),Qf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[$f]||(t[$f]=!0,Qf(`selectionchange`,!1,t))}}function tp(e,t,n,r){switch(Ph(t)){case 2:var i=Oh;break;case 8:i=kh;break;default:i=Ah}n=i.bind(null,t,n,e),i=void 0,!On||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 np(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=Mt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}Tn(function(){var r=a,i=bn(n),s=[];a:{var c=pi.get(e);if(c!==void 0){var l=Rn,u=e;switch(e){case`keypress`:if(Nn(n)===0)break a;case`keydown`:case`keyup`:l=tr;break;case`focusin`:u=`focus`,l=Kn;break;case`focusout`:u=`blur`,l=Kn;break;case`beforeblur`:case`afterblur`:l=Kn;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=Wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Gn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=ir;break;case oi:case si:case ci:l=qn;break;case fi:l=ar;break;case`scroll`:case`scrollend`:l=Bn;break;case`wheel`:l=or;break;case`copy`:case`cut`:case`paste`:l=Jn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=nr;break;case`submit`:l=rr;break;case`toggle`:case`beforetoggle`:l=sr}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=En(m,p),g!=null&&d.push(rp(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!==yn&&(u=n.relatedTarget||n.fromElement)&&(Mt(u)||u[wt]))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?Mt(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=Wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=nr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Pt(c),h=l==null?u:Pt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Mt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?C(c,l,ap):null,c!==null&&op(s,u,c,d,!1),l!==null&&f!==null&&op(s,f,l,d,!0)))}a:{if(c=r?Pt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=kr;else if(Cr(c)){if(Ar)_=zr;else{_=Lr;var v=Ir}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&mn(r.elementType)&&(_=kr):_=Rr;if(_&&=_(e,r)){wr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Pt(r):window,e){case`focusin`:(Cr(v)||v.contentEditable===`true`)&&(Xr=v,Zr=r,Qr=null);break;case`focusout`:Qr=Zr=Xr=null;break;case`mousedown`:$r=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:$r=!1,ei(s,n,i);break;case`selectionchange`:if(Yr)break;case`keydown`:case`keyup`:ei(s,n,i)}var y;if(ur)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 yr?_r(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(mr&&n.locale!==`ko`&&(yr||b!==`onCompositionStart`?b===`onCompositionEnd`&&yr&&(y=R()):(An=i,jn=`value`in An?An.value:An.textContent,yr=!0)),v=ip(r,b),0<v.length&&(b=new Yn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=vr(n),y!==null&&(b.data=y)))),(y=pr?br(e,n):xr(e,n))&&(b=ip(r,`onBeforeInput`),0<b.length&&(v=new Yn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Gf(s,e,r,n,i)}Xf(s,t)})}function rp(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ip(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=En(e,n),i!=null&&r.unshift(rp(e,i,a)),i=En(e,t),i!=null&&r.push(rp(e,i,a))),e.tag===3)return r;e=e.return}return[]}function ap(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function op(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=En(n,a),l!=null&&o.unshift(rp(n,l,c))):i||(l=En(n,a),l!=null&&o.push(rp(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var sp=/\r\n?/g,cp=/\u0000|\uFFFD/g;function lp(e){return(typeof e==`string`?e:``+e).replace(sp,`
|
|
10
|
-
`).replace(cp,``)}function up(e,t){return t=lp(t),lp(e)===t}function dp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||un(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&un(e,``+r);else return;break;case`className`:Yt(e,`class`,r);break;case`tabIndex`:Yt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Yt(e,n,r);break;case`style`:pn(e,r,o);return;case`data`:if(t!==`object`){Yt(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=_n(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`&&dp(e,t,`name`,a.name,a,null),dp(e,t,`formEncType`,a.formEncType,a,null),dp(e,t,`formMethod`,a.formMethod,a,null),dp(e,t,`formTarget`,a.formTarget,a,null)):(dp(e,t,`encType`,a.encType,a,null),dp(e,t,`method`,a.method,a,null),dp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=_n(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=vn);return;case`onScroll`:r!=null&&Zf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Zf(`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=_n(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`:Zf(`beforetoggle`,e),Zf(`toggle`,e),Jt(e,`popover`,r);break;case`xlinkActuate`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Jt(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=hn.get(n)||n,Jt(e,n,r);else return}Kt=!0}function fp(e,t,n,r,a,o){switch(n){case`style`:pn(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`)un(e,r);else if(typeof r==`number`||typeof r==`bigint`)un(e,``+r);else return;break;case`onScroll`:r!=null&&Zf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Zf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=vn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!I.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[Ct]||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}Kt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Jt(e,n,r)}return}Kt=!0}function pp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Zf(`error`,e),Zf(`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:dp(e,t,o,s,n,null)}}a&&dp(e,t,`srcSet`,n.srcSet,n,null),r&&dp(e,t,`src`,n.src,n,null);return;case`input`:Zf(`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:dp(e,t,r,d,n,null)}}an(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Zf(`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:dp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&sn(e,!!r,n,!0):sn(e,!!r,t,!1);return;case`textarea`:for(s in Zf(`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:dp(e,t,s,c,n,null)}ln(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:dp(e,t,l,r,n,null)}return;case`dialog`:Zf(`beforetoggle`,e),Zf(`toggle`,e),Zf(`cancel`,e),Zf(`close`,e);break;case`iframe`:case`object`:Zf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Jf.length;r++)Zf(Jf[r],e);break;case`image`:Zf(`error`,e),Zf(`load`,e);break;case`details`:Zf(`toggle`,e);break;case`embed`:case`source`:case`link`:Zf(`error`,e),Zf(`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:dp(e,t,u,r,n,null)}return;default:if(mn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&fp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&dp(e,t,c,r,n,null))}var mp={};function hp(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)||dp(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&&(Kt=!0),o=m;break;case`name`:m!==f&&(Kt=!0),a=m;break;case`checked`:m!==f&&(Kt=!0),u=m;break;case`defaultChecked`:m!==f&&(Kt=!0),d=m;break;case`value`:m!==f&&(Kt=!0),s=m;break;case`defaultValue`:m!==f&&(Kt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&dp(e,t,p,m,r,f)}}rn(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)||dp(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&&(Kt=!0),p=o;break;case`defaultValue`:o!==l&&(Kt=!0),c=o;break;case`multiple`:o!==l&&(Kt=!0),s=o;default:o!==l&&dp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?sn(e,!!n,n?[]:``,!1):sn(e,!!n,t,!0)):sn(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:dp(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&&(Kt=!0),p=a;break;case`defaultValue`:a!==o&&(Kt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&dp(e,t,s,a,r,o)}cn(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:dp(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&&(Kt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:dp(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)&&dp(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:dp(e,t,u,p,r,m)}return;default:if(mn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&fp(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||fp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&dp(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||dp(e,t,f,p,r,m)}function gp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function _p(){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&&gp(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&&gp(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 vp=null,yp=null;function bp(e){return e.nodeType===9?e:e.ownerDocument}function xp(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 Sp(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 Cp(e,t,n,r){return n=bp(n).createElement(e),n[St]=r,n[Ct]=t,pp(n,e,t),It(n),n}function wp(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 Tp=null;function Ep(){var e=window.event;return e&&e.type===`popstate`?e!==Tp&&(Tp=e,!0):(Tp=null,!1)}var Dp=typeof setTimeout==`function`?setTimeout:void 0,Op=typeof clearTimeout==`function`?clearTimeout:void 0,kp=typeof Promise==`function`?Promise:void 0,Ap=typeof requestAnimationFrame==`function`?requestAnimationFrame:Dp,jp=typeof queueMicrotask==`function`?queueMicrotask:kp===void 0?Dp:function(e){return kp.resolve(null).then(e).catch(Mp)};function Mp(e){setTimeout(function(){throw e})}function Np(e){return e===`head`}function Pp(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),$h(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Om(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Om(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[kt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Om(e.ownerDocument.body)}n=i}while(n);$h(t)}function Fp(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 Ip(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 Lp(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 Rp(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 zp(e){return Rp(e.getBoundingClientRect(),getComputedStyle(e),e)}function Bp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Rp(t,n,e)}function Vp(e){return e.documentElement.clientHeight}function Hp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Up(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`&&(Vp(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+=sh(f),u>uh){s.length=o;break}f=new Promise(Hp.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 Wp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Wp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:w({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Wp.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},Wp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Gp(e){return{name:e,group:new Wp(`group`,e),imagePair:new Wp(`image-pair`,e),old:new Wp(`old`,e),new:new Wp(`new`,e)}}function Kp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Kp.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(Zp(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=Yp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,qp,e,s,r)}this._eventListeners=a}};function qp(e,t,n,r){return _(e).addEventListener(t,n,r),!1}Kp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Zp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Yp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,Jp,e,n,i),r.splice(t,1),a!==null&&a()}};function Jp(e,t,n,r){return _(e).removeEventListener(t,n,r),!1}function Yp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Xp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Zp(e,t,n,r){if(e.length===0)return-1;r=Xp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Xp(a.optionsOrUseCapture)===r)return i}return-1}Kp.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=_(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,Yp(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,Yp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Kp.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Qp,e,void 0,void 0)};function Qp(e,t){return e.tag!==6&&(e=_(e),wm(e,t))}Kp.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,$p,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Qp(t[n],e);n--);};function $p(e,t){return t.push(e),!1}Kp.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=_(e),e=bp(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,em,e,void 0,void 0))};function em(e,t){return e.tag!==6&&(e=_(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Kp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,tm,e,void 0,void 0)};function tm(e,t){return e.tag===6||(e=_(e),t.observe(e)),!1}Kp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,nm,e,void 0,void 0);for(var n=t=0;n<rm.length;n++){var r=rm[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):rm[t++]=r}rm.length=t}};function nm(e,t){return e.tag===6||(e=_(e),t.unobserve(e)),!1}var rm=[],im=!1;function am(e,t,n){rm.push({fragmentInstance:e,observer:t,instance:n}),im||(im=!0,Tm(function(){im=!1;var e=rm;rm=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Kp.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,om,e,void 0,void 0),e};function om(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=_(e),t.push.apply(t,e.getClientRects());return!1}Kp.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:_(t).getRootNode(e)},Kp.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,$p,n,void 0,void 0);var r=_(t);if(n.length===0){if(n=r,m(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=h(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=_(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=_(n[0]),i=_(n[n.length-1]);var a=m(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||sm(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function sm(e,t,n,r,i){var a=Mt(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=p(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=C(n,a,S),t===null?t=!1:(f(t,!0,b,a,n),a=v,v=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=C(r,a,S),t===null?t=!1:(f(t,!0,x,a,r),a=v,y=v=null,t=a!==null)),t):!1}function cm(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)}Kp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,$p,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=h(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=_(r),cm(e,n);return}if(r=_(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=_(a),cm(a,n)):_(a).scrollIntoView(e),r+=n?-1:1}};function lm(e,t){return e=_(e),um(e,t),!1}function um(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function dm(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,Yp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<rm.length;i++){var a=rm[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(rm[r++]=a)}rm.length=r,n.observe(e)}),um(e,t))}function fm(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,Yp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?am(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function pm(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`:pm(n),jt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function mm(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[kt])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=bm(e.nextSibling),e===null)break}return null}function hm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=bm(e.nextSibling),e===null))return null;return e}function gm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=bm(e.nextSibling),e===null))return null;return e}function _m(e){return e.data===`$?`||e.data===`$~`}function vm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function ym(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 bm(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 xm=null;function Sm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return bm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Cm(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 wm(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 Tm(e){Ap(function(){Ap(function(t){return e(t)})})}function Em(e,t,n){switch(t=bp(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 Dm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&dp(e,t,r,null,mp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===vn&&(e.onclick=null),jt(e)}function Om(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);jt(e)}var km=new Map,Am=new Set;function jm(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 Mm=ge.d;ge.d={f:Nm,r:Pm,D:Lm,C:Rm,L:zm,m:Bm,X:Hm,S:Vm,M:Um};function Nm(){var e=Mm.f(),t=Jd();return e||t}function Pm(e){var t=Nt(e);t!==null&&t.tag===5&&t.type===`form`?ac(t):Mm.r(e)}var Fm=typeof document>`u`?null:document;function Im(e,t,n){var r=Fm;if(r&&typeof t==`string`&&t){var i=nn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Am.has(i)||(Am.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),pp(t,`link`,e),It(t),r.head.appendChild(t)))}}function Lm(e){Mm.D(e),Im(`dns-prefetch`,e,null)}function Rm(e,t){Mm.C(e,t),Im(`preconnect`,e,t)}function zm(e,t,n){Mm.L(e,t,n);var r=Fm;if(r&&e&&t){var i=`link[rel="preload"][as="`+nn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+nn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+nn(n.imageSizes)+`"]`)):i+=`[href="`+nn(e)+`"]`;var a=i;switch(t){case`style`:a=Gm(e);break;case`script`:a=Ym(e)}if(!(km.has(a)||(e=w({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),km.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Km(a))||t===`script`&&r.querySelector(Xm(a))))){var o=r.createElement(`link`);pp(o,`link`,e),t===`style`&&(o[At]=!0,o.onload=o.onerror=function(){Lt(o)}),It(o),r.head.appendChild(o)}}}function Bm(e,t){Mm.m(e,t);var n=Fm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+nn(r)+`"][href="`+nn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Ym(e)}if(!km.has(a)&&(e=w({rel:`modulepreload`,href:e},t),km.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Xm(a)))return}r=n.createElement(`link`),pp(r,`link`,e),It(r),n.head.appendChild(r)}}}function Vm(e,t,n){Mm.S(e,t,n);var r=Fm;if(r&&e){var i=Ft(r).hoistableStyles,a=Gm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Km(a)))s.loading=5;else{e=w({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=km.get(a))&&$m(e,n);var c=o=r.createElement(`link`);It(c),pp(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,Qm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Hm(e,t){Mm.X(e,t);var n=Fm;if(n&&e){var r=Ft(n).hoistableScripts,i=Ym(e),a=r.get(i);a||(a=n.querySelector(Xm(i)),a||(e=w({src:e,async:!0},t),(t=km.get(i))&&eh(e,t),a=n.createElement(`script`),It(a),pp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Um(e,t){Mm.M(e,t);var n=Fm;if(n&&e){var r=Ft(n).hoistableScripts,i=Ym(e),a=r.get(i);a||(a=n.querySelector(Xm(i)),a||(e=w({src:e,async:!0,type:`module`},t),(t=km.get(i))&&eh(e,t),a=n.createElement(`script`),It(a),pp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Wm(e,t,n,r){var a=(a=Te.current)?jm(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=Gm(n.href),t=Ft(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=Gm(n.href);var o=Ft(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(Km(e)))?o._p||(s.instance=o,s.state.loading=5):(o=km.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},km.set(e,o)),Jm(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=Ym(n),t=Ft(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 Gm(e){return`href="`+nn(e)+`"`}function Km(e){return`link[rel="stylesheet"][`+e+`]`}function qm(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Jm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[At]){r.loading=1;return}}else t=e.createElement(`link`),t[At]=!0,t.onload=t.onerror=Lt.bind(null,t),pp(t,`link`,n),It(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 Ym(e){return`[src="`+nn(e)+`"]`}function Xm(e){return`script[async]`+e}function Zm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+nn(n.href)+`"]`);if(r)return t.instance=r,It(r),r;var a=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),It(r),pp(r,`style`,a),Qm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Gm(n.href);var o=e.querySelector(Km(a));if(o)return t.state.loading|=4,t.instance=o,It(o),o;r=qm(n),(a=km.get(a))&&$m(r,a),o=(e.ownerDocument||e).createElement(`link`),It(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),pp(o,`link`,r),t.state.loading|=4,Qm(o,n.precedence,e),t.instance=o;case`script`:return o=Ym(n.src),(a=e.querySelector(Xm(o)))?(t.instance=a,It(a),a):(r=n,(a=km.get(o))&&(r=w({},n),eh(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),It(a),pp(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,Qm(r,n.precedence,e));return t.instance}function Qm(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 $m(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function eh(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var th=null;function nh(e,t,n){if(th===null){var r=new Map,i=th=new Map;i.set(n,r)}else i=th,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[kt]||a[St]||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 rh(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function ih(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 ah(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function oh(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function sh(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function ch(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=sh(t),e.suspenseyImages.push(t)),e=mh.bind(e),t.decode().then(e,e))}function lh(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=Gm(r.href),a=t.querySelector(Km(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ph.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,It(a);return}a=t.ownerDocument||t,r=qm(r),(i=km.get(i))&&$m(r,i),a=a.createElement(`link`),It(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),pp(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=ph.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var uh=0;function dh(e,t){return e.stylesheets&&e.count===0&&gh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&gh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&uh===0&&(uh=62500*_p());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&gh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>uh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function fh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)gh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ph(){this.count--,fh(this)}function mh(){this.imgCount--,fh(this)}var hh=null;function gh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hh=new Map,t.forEach(_h,e),hh=null,ph.call(e))}function _h(e,t){if(!(t.state.loading&4)){var n=hh.get(e);if(n)var r=n.get(null);else{n=new Map,hh.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=ph.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 vh={$$typeof:re,Provider:null,Consumer:null,_currentValue:_e,_currentValue2:_e,_threadCount:0};function yh(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=mt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mt(0),this.hiddenUpdates=mt(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 bh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new yh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Mi(3,null,null,t),e.current=a,a.stateNode=e,t=Na(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},go(a),e}function xh(e){return e?(e=Ai,e):Ai}function Sh(e,t,n,r,i,a){i=xh(i),r.context===null?r.context=i:r.pendingContext=i,r=vo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=yo(e,r,t),n!==null&&(Ud(n,e,t),bo(n,e,t))}function Ch(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function wh(e,t){Ch(e,t),(e=e.alternate)&&Ch(e,t)}function Th(e){if(e.tag===13||e.tag===31){var t=Di(e,67108864);t!==null&&Ud(t,e,67108864),wh(e,67108864)}}function Eh(e){if(e.tag===13||e.tag===31){var t=Bd();t=yt(t);var n=Di(e,t);n!==null&&Ud(n,e,t),wh(e,t)}}var Dh=!0;function Oh(e,t,n,r){var i=M.T;M.T=null;var a=ge.p;try{ge.p=2,Ah(e,t,n,r)}finally{ge.p=a,M.T=i}}function kh(e,t,n,r){var i=M.T;M.T=null;var a=ge.p;try{ge.p=8,Ah(e,t,n,r)}finally{ge.p=a,M.T=i}}function Ah(e,t,n,r){if(Dh){var i=jh(r);if(i===null)np(e,t,r,Mh,n),Uh(e,r);else if(Gh(i,e,t,n,r))r.stopPropagation();else if(Uh(e,r),t&4&&-1<Hh.indexOf(e)){for(;i!==null;){var a=Nt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ct(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-tt(o);s.entanglements[1]|=c,o&=~c}Ff(a),!(ad&6)&&(Td=Ue()+500,If(0,!1))}}break;case 31:case 13:s=Di(a,2),s!==null&&Ud(s,a,2),Jd(),wh(a,2)}if(a=jh(r),a===null&&np(e,t,r,Mh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else np(e,t,r,null,n)}}function jh(e){return e=bn(e),Nh(e)}var Mh=null;function Nh(e){if(Mh=null,e=Mt(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 Mh=e,null}function Ph(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(We()){case Ge:return 2;case Ke:return 8;case qe:case Je:return 32;case Ye:return 268435456;default:return 32}default:return 32}}var Fh=!1,Ih=null,Lh=null,Rh=null,zh=new Map,Bh=new Map,Vh=[],Hh=`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 Uh(e,t){switch(e){case`focusin`:case`focusout`:Ih=null;break;case`dragenter`:case`dragleave`:Lh=null;break;case`mouseover`:case`mouseout`:Rh=null;break;case`pointerover`:case`pointerout`:zh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Bh.delete(t.pointerId)}}function Wh(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=Nt(t),t!==null&&Th(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Gh(e,t,n,r,i){switch(t){case`focusin`:return Ih=Wh(Ih,e,t,n,r,i),!0;case`dragenter`:return Lh=Wh(Lh,e,t,n,r,i),!0;case`mouseover`:return Rh=Wh(Rh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return zh.set(a,Wh(zh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Bh.set(a,Wh(Bh.get(a)||null,e,t,n,r,i)),!0}return!1}function Kh(e){var t=Mt(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,F(e.priority,function(){Eh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,F(e.priority,function(){Eh(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 qh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=jh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yn=r,n.target.dispatchEvent(r),yn=null}else return t=Nt(n),t!==null&&Th(t),e.blockedOn=n,!1;t.shift()}return!0}function Jh(e,t,n){qh(e)&&n.delete(t)}function Yh(){Fh=!1,Ih!==null&&qh(Ih)&&(Ih=null),Lh!==null&&qh(Lh)&&(Lh=null),Rh!==null&&qh(Rh)&&(Rh=null),zh.forEach(Jh),Bh.forEach(Jh)}function Xh(e,n){e.blockedOn===n&&(e.blockedOn=null,Fh||(Fh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Yh)))}var Zh=null;function Qh(e){Zh!==e&&(Zh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Zh===e&&(Zh=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(Nh(r||n)===null)continue;break}var a=Nt(n);a!==null&&(e.splice(t,3),t-=3,ic(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function $h(e){function t(t){return Xh(t,e)}Ih!==null&&Xh(Ih,e),Lh!==null&&Xh(Lh,e),Rh!==null&&Xh(Rh,e),zh.forEach(t),Bh.forEach(t);for(var n=0;n<Vh.length;n++){var r=Vh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Vh.length&&(n=Vh[0],n.blockedOn===null);)Kh(n),n.blockedOn===null&&Vh.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[Ct]||null;if(typeof a==`function`)o||Qh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Ct]||null)s=o.formAction;else if(Nh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Qh(n)}}}function eg(){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 tg(e){this._internalRoot=e}ng.prototype.render=tg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;Sh(n,Bd(),e,t,null,null)},ng.prototype.unmount=tg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Sh(e.current,2,null,e,null,null),Jd(),t[wt]=null}};function ng(e){this._internalRoot=e}ng.prototype.unstable_scheduleHydration=function(e){if(e){var t=P();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Vh.length&&t!==0&&t<Vh[n].priority;n++);Vh.splice(n,0,e),n===0&&Kh(e)}};var rg=n.version;if(rg!==`19.3.1`)throw Error(i(527,rg,`19.3.1`));ge.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 ig={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var ag=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ag.isDisabled&&ag.supportsFiber)try{Qe=ag.inject(ig),$e=ag}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ec,s=Dc,c=Oc;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=bh(e,1,!1,null,null,n,r,null,o,s,c,eg),e[wt]=t.current,ep(e),new tg(t)}})),pr=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=fr()})),mr={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`}]]};mr.node;var hr=I(mr),gr={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`}]]};gr.node;var _r=I(gr),vr={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};vr.node;var yr=I(vr),br={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};br.node;var xr=I(br),Sr={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Sr.node;var Cr=I(Sr),wr={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};wr.node;var Tr=I(wr),Er={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Er.node;var Dr=I(Er),Or={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`}]]};Or.node;var kr=I(Or),Ar={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};Ar.node;var jr=I(Ar),Mr={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`}]]};Mr.node;var Nr=I(Mr),Pr={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`}]]};Pr.node;var Fr=I(Pr),Ir={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`}]]};Ir.node;var Lr=I(Ir),Rr={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`}]]};Rr.node;var zr=I(Rr),Br={name:`calculator`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]};Br.node;var Vr=I(Br),Hr={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`}]]};Hr.node;var Ur=I(Hr),Wr={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`]};Wr.node;var Gr=I(Wr),Kr={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`]};Kr.node;var qr=I(Kr),Jr={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Jr.node;var Yr=I(Jr),Xr={name:`chef-hat`,size:24,node:[[`path`,{d:`M10 11v5`,key:`urfl79`}],[`path`,{d:`M14 11v5`,key:`w9lfkh`}],[`path`,{d:`M6 12.65c0-.457-.316-.844-.727-1.041A4 4 0 017.52 4.034a1.53 1.53 0 001.367-.547 4 4 0 016.225 0 1.53 1.53 0 001.367.547 4 4 0 012.248 7.575c-.411.197-.727.584-.727 1.04V19a2 2 0 01-2 2H8a2 2 0 01-2-2z`,key:`1dq1bt`}],[`path`,{d:`M6 16h12`,key:`u522kt`}]]};Xr.node;var Zr=I(Xr),Qr={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Qr.node;var $r=I(Qr),ei={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};ei.node;var ti=I(ei),ni={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};ni.node;var ri=I(ni),ii={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};ii.node;var ai=I(ii),oi={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`]};oi.node;var si=I(oi),ci={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`]};ci.node;var li=I(ci),ui={name:`circle-exclamation-point`,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`,`circle-alert`]};ui.node;var di=I(ui),fi={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5`,key:`1awbb0`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};fi.node;var pi=I(fi),mi={name:`circle-stop`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]],aliases:[`stop-circle`]};mi.node;var hi=I(mi),gi={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};gi.node;var _i=I(gi),vi={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};vi.node;var yi=I(vi),bi={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`}]]};bi.node;var xi=I(bi),Si={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`]};Si.node;var Ci=I(Si),wi={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`}]]};wi.node;var Ti=I(wi),Ei={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`}]]};Ei.node;var Di=I(Ei),Oi={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`}]]};Oi.node;var ki=I(Oi),Ai={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`}]]};Ai.node;var ji=I(Ai),Mi={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`}]]};Mi.node;var Ni=I(Mi),Pi={name:`dumbbell`,size:24,node:[[`path`,{d:`M17.596 12.768a2 2 0 1 0 2.829-2.829l-1.768-1.767a2 2 0 0 0 2.828-2.829l-2.828-2.828a2 2 0 0 0-2.829 2.828l-1.767-1.768a2 2 0 1 0-2.829 2.829z`,key:`9m4mmf`}],[`path`,{d:`m2.5 21.5 1.4-1.4`,key:`17g3f0`}],[`path`,{d:`m20.1 3.9 1.4-1.4`,key:`1qn309`}],[`path`,{d:`M5.343 21.485a2 2 0 1 0 2.829-2.828l1.767 1.768a2 2 0 1 0 2.829-2.829l-6.364-6.364a2 2 0 1 0-2.829 2.829l1.768 1.767a2 2 0 0 0-2.828 2.829z`,key:`1t2c92`}],[`path`,{d:`m9.6 14.4 4.8-4.8`,key:`6umqxw`}]]};Pi.node;var Fi=I(Pi),Ii={name:`eighth-notes`,size:24,node:[[`path`,{d:`M21 16V3a1 1 0 0 0-1.28-.96l-10 2.917a1 1 0 0 0-.72.96V19`,key:`uy6ho8`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}],[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}]],aliases:[`music`]};Ii.node;var Li=I(Ii),Ri={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`]};Ri.node;var zi=I(Ri),Bi={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};Bi.node;var Vi=I(Bi),Hi={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`}]]};Hi.node;var Ui=I(Hi),Wi={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`}]]};Wi.node;var Gi=I(Wi),Ki={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`}]]};Ki.node;var qi=I(Ki),Ji={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`}]]};Ji.node;var Yi=I(Ji),Xi={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`}]]};Xi.node;var Zi=I(Xi),Qi={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`]};Qi.node;var $i=I(Qi),ea={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`}]]};ea.node;var ta=I(ea),na={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`]};na.node;var ra=I(na),ia={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`]};ia.node;var aa=I(ia),oa={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`}]]};oa.node;var sa=I(oa),ca={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`}]]};ca.node;var la=I(ca),ua={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`}]]};ua.node;var da=I(ua),fa={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`}]]};fa.node;var pa=I(fa),ma={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`}]]};ma.node;var ha=I(ma),ga={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`}]]};ga.node;var _a=I(ga),va={name:`gauge`,size:24,node:[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]};va.node;var ya=I(va),ba={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`}]]};ba.node;var xa=I(ba),Sa={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`]};Sa.node;var Ca=I(Sa),wa={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`}]]};wa.node;var Ta=I(wa),Ea={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`}]]};Ea.node;var Da=I(Ea),Oa={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`}]]};Oa.node;var ka=I(Oa),Aa={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`}]]};Aa.node;var ja=I(Aa),Ma={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`}]]};Ma.node;var Na=I(Ma),Pa={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`}]]};Pa.node;var Fa=I(Pa),Ia={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`}]]};Ia.node;var La=I(Ia),Ra={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`]};Ra.node;var za=I(Ra),Ba={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`}]]};Ba.node;var Va=I(Ba),Ha={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};Ha.node;var Ua=I(Ha),Wa={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`}]]};Wa.node;var Ga=I(Wa),Ka={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`}]]};Ka.node;var qa=I(Ka),Ja={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`}]]};Ja.node;var Ya=I(Ja),Xa={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};Xa.node;var Za=I(Xa),Qa={name:`lock-open`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]],aliases:[`unlock`]};Qa.node;var $a=I(Qa),eo={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};eo.node;var to=I(eo),no={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`}]]};no.node;var ro=I(no),io={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};io.node;var ao=I(io),oo={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};oo.node;var so=I(oo),co={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 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5`,key:`1awbb0`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};co.node;var lo=I(co),uo={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};uo.node;var fo=I(uo),po={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};po.node;var mo=I(po),ho={name:`monitor-smartphone`,size:24,node:[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]};ho.node;var go=I(ho),_o={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`}]]};_o.node;var vo=I(_o),yo={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};yo.node;var bo=I(yo),xo={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`]};xo.node;var So=I(xo),Co={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`]};Co.node;var wo=I(Co),To={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`}]]};To.node;var Eo=I(To),Do={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`}]]};Do.node;var Oo=I(Do),ko={name:`panel-top-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m15 14-3 3-3-3`,key:`g215vf`}]]};ko.node;var Ao=I(ko),jo={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`}]]};jo.node;var Mo=I(jo),No={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`]};No.node;var Po=I(No),Fo={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`}]]};Fo.node;var Io=I(Fo),Lo={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`}]]};Lo.node;var Ro=I(Lo),zo={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`}]]};zo.node;var Bo=I(zo),Vo={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};Vo.node;var Ho=I(Vo),Uo={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};Uo.node;var Wo=I(Uo),Go={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Go.node;var Ko=I(Go),qo={name:`printer`,size:24,node:[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]};qo.node;var Jo=I(qo),Yo={name:`receipt`,size:24,node:[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]};Yo.node;var Xo=I(Yo),Zo={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`}]]};Zo.node;var Qo=I(Zo),$o={name:`rotate-ccw-square`,size:24,node:[[`path`,{d:`M20 9V7a2 2 0 0 0-2-2h-6`,key:`19z8uc`}],[`path`,{d:`m15 2-3 3 3 3`,key:`177bxs`}],[`path`,{d:`M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2`,key:`d36hnl`}]]};$o.node;var es=I($o),ts={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`}]]};ts.node;var ns=I(ts),rs={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`}]]};rs.node;var is=I(rs),as={name:`ruler`,size:24,node:[[`path`,{d:`M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z`,key:`icamh8`}],[`path`,{d:`m14.5 12.5 2-2`,key:`inckbg`}],[`path`,{d:`m11.5 9.5 2-2`,key:`fmmyf7`}],[`path`,{d:`m8.5 6.5 2-2`,key:`vc6u1g`}],[`path`,{d:`m17.5 15.5 2-2`,key:`wo5hmg`}]]};as.node;var os=I(as),ss={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};ss.node;var cs=I(ss),ls={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};ls.node;var us=I(ls),ds={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};ds.node;var fs=I(ds),ps={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`}]]};ps.node;var ms=I(ps),hs={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};hs.node;var gs=I(hs),_s={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`}]]};_s.node;var vs=I(_s),ys={name:`shield-exclamation-point`,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`}]],aliases:[`shield-alert`]};ys.node;var bs=I(ys),xs={name:`shield-question-mark`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 01-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 011-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 011.52 0C14.51 3.81 17 5 19 5a1 1 0 011 1z`,key:`1buusj`}],[`path`,{d:`M9 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5`,key:`1awbb0`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`shield-question`]};xs.node;var Ss=I(xs),Cs={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`}]]};Cs.node;var ws=I(Cs),Ts={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`}]]};Ts.node;var Es=I(Ts),Ds={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`]};Ds.node;var Os=I(Ds),ks={name:`square-code`,size:24,node:[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]],aliases:[`code-square`]};ks.node;var As=I(ks),js={name:`square-dashed-mouse-pointer`,size:24,node:[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h2`,key:`1qve2z`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v2`,key:`p14lih`}],[`path`,{d:`M3 14v1`,key:`vnatye`}]],aliases:[`mouse-pointer-square-dashed`]};js.node;var Ms=I(js),Ns={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`]};Ns.node;var Ps=I(Ns),Fs={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};Fs.node;var Is=I(Fs),Ls={name:`telescope`,size:24,node:[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]};Ls.node;var Rs=I(Ls),zs={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};zs.node;var Bs=I(zs),Vs={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`]};Vs.node;var Hs=I(Vs),Us={name:`triangle-exclamation-point`,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`,`triangle-alert`]};Us.node;var Ws=I(Us),Gs={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`}]]};Gs.node;var Ks=I(Gs),qs={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`}]]};qs.node;var Js=I(qs),Ys={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`}]]};Ys.node;var Xs=I(Ys),Zs={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`}]]};Zs.node;var Qs=I(Zs),$s={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`}]]};$s.node;var ec=I($s),tc={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};tc.node;var nc=I(tc),rc={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};rc.node;var ic=I(rc),B=t(Rt(),1),ac=t(pr(),1),oc=e=>Symbol.iterator in e,sc=e=>`entries`in e,cc=(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},lc=(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 uc(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:oc(e)&&oc(t)?sc(e)&&sc(t)?cc(e,t):lc(e,t):cc({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function dc(e){let t=B.useRef(void 0);return n=>{let r=e(n);return uc(t.current,r)?t.current:t.current=r}}var fc=14;function pc({open:e,onClose:t,anchor:n,label:r,placement:i=`above`,align:a=`start`,className:o,children:s}){let c=(0,B.useRef)(null),[l,u]=(0,B.useState)(i),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(0);return(0,B.useLayoutEffect)(()=>{if(!e)return;let t=()=>{let e=n.current?.getBoundingClientRect(),t=c.current;if(!e||!t)return;let r=e.top-fc,a=window.innerHeight-e.bottom-fc,o=i===`above`?r:a,s=i===`above`?a:r,l=t.scrollHeight>o&&s>o;u(l?i===`above`?`below`:`above`:i),f(Math.max(0,Math.floor(l?s:o)));let d=t.offsetParent;if(!d)return;let p=d.getBoundingClientRect().left+d.clientLeft-d.scrollLeft+t.offsetLeft,h=t.offsetWidth,g=window.innerWidth-28,_=getComputedStyle(t).direction===`rtl`,v=h>g?_?window.innerWidth-fc-h:fc:Math.min(Math.max(p,fc),window.innerWidth-fc-h);m(v-p)};t();let r=new MutationObserver(t);c.current&&r.observe(c.current,{childList:!0,subtree:!0});let a=typeof ResizeObserver>`u`?null:new ResizeObserver(t);for(let e of[c.current,n.current,c.current?.offsetParent])e&&a?.observe(e);return window.addEventListener(`resize`,t),()=>{r.disconnect(),a?.disconnect(),window.removeEventListener(`resize`,t)}},[e,i,n]),Lt(e),(0,B.useEffect)(()=>{if(!e)return;(c.current?.querySelector(`button:not(:disabled), input, [tabindex="0"]`))?.focus({preventScroll:!0});let r=e=>{let r=e.target;c.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?L(`div`,{ref:c,className:`popover popover-${l} popover-${a}${o?` ${o}`:``}`,style:{...d===null?{}:{"--popover-room":`${d}px`},...p?{transform:`translateX(${p}px)`}:{}},role:`dialog`,"aria-label":r,children:s}):null}var mc=[`model_server`,`gaia`,`service`,`agent`,`desktop`,`other`],hc=Pt(e=>({open:!1,source:`model_server`,show:(t=`model_server`)=>e({open:!0,source:t}),hide:()=>e({open:!1})})),gc=8e3,_c=[],vc=new Set,yc=e=>vc.has(e),bc=()=>vc.clear(),xc=Pt((e,t)=>({need:null,ensure:async n=>{if(vc.has(n))return!0;let r=t().need;if(r)return r.job===n&&new Promise(e=>{_c.push(e)});let i,a;try{i=await Promise.race([E(n),new Promise((e,t)=>{a=setTimeout(()=>t(Error(`the check timed out`)),gc)})])}catch(e){return console.warn(`[modelNeeded] could not check the model for ${n}`,e),!0}finally{clearTimeout(a)}if(!i?.needed&&!i?.off)return vc.add(n),!0;let o=t().need;return o&&o.job!==n?!1:new Promise(t=>{_c.push(t),o||e({need:i})})},settle:t=>{let n=_c;_c=[],e({need:null});for(let e of n)e(t)}})),Sc=e=>xc.getState().ensure(e),Cc=1e3,wc=5e3,Tc=24,Ec=1e3,Dc=3e4,Oc=0,kc=null,Ac=!1,jc=null,Mc=Ec,Nc=0;function Pc(){kc&&clearTimeout(kc),kc=null}function Fc(){jc&&clearTimeout(jc),jc=null}function Ic(e,t){return!e.model||Hc(e.model,t)}function Lc(e,t){let n=++Nc;t({pickLoad:{model:e,seconds:0,error:null}});let r=async()=>{let a=await ke();if(n!==Nc)return;let o=Math.floor(a.elapsed_seconds??0);a.state===`warming`?(t({pickLoad:{model:e,seconds:Ic(a,e)?o:0,error:null}}),setTimeout(()=>{r().catch(i)},Cc)):a.state===`failed`&&Ic(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===Nc&&(F.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 Rc(e){try{let t=await Gt(`local`);t?.models&&e(t.models)}catch(e){Ac=!1,F.system.warn(`Model names unavailable; raw model ids show until the model list loads`,e)}}var zc=Pt((e,t)=>({active:null,error:null,restoreNotice:null,queued:null,queueError:null,names:{},pickLoad:null,refresh:async()=>{Ac||(Ac=!0,Rc(t().rememberNames));try{let n=await y();Fc(),Mc=Ec;let r=n.restore;(r?.status===`pending`||r?.status===`failed`&&r.retry)&&!kc&&Oc<Tc&&(Oc+=1,kc=setTimeout(()=>{kc=null,t().refresh()},wc));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)}),jc||(jc=setTimeout(()=>{jc=null,t().refresh()},Mc),Mc=Math.min(Mc*2,Dc))}},retryNow:()=>{jc&&(Fc(),t().refresh())},select:async t=>{bc(),Pc();let n=await Re(t),r=null;try{r=(await gn()).sessions}catch(e){F.system.error(`Could not refresh chats after a model switch; the next poll will`,e)}e({active:n,error:null,restoreNotice:null}),n.remote?(Nc+=1,e({pickLoad:null})):Lc(t,e),r?.length&&N.getState().setSessions(r)},queue:n=>{e({queued:n,queueError:null}),n&&!N.getState().isStreaming&&t().applyQueued()},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 ${Uc(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 yt(!0)}catch(t){e({pickLoad:{model:n,seconds:0,error:{key:`banner.pickLoad.startFailed`,reason:t instanceof Error?t.message:String(t)}}});return}Lc(n,e)}},dismissPickLoad:()=>{Nc+=1,e({pickLoad:null})}}));async function Bc(e){bc(),await zc.getState().refresh();let t=zc.getState().active;t?.model&&!t.remote&&!Hc(t.model,e)&&Lc(t.model,zc.setState);try{let e=(await gn()).sessions;e.length&&N.getState().setSessions(e)}catch(e){F.system.error(`Could not refresh chats after a model setting change; the next poll will`,e)}}N.subscribe((e,t)=>{t.isStreaming&&!e.isStreaming&&zc.getState().queued&&zc.getState().applyQueued()});function Vc(){return zc(e=>e.names)}function Hc(e,t){if(!e||!t)return!1;let n=e=>e.toLowerCase().replace(/^user\./,``);return n(e)===n(t)}function Uc(e){let t=zc.getState();return t.names[e]?t.names[e]:t.active?.model===e&&t.active.display_name?t.active.display_name:Xc(e)}function Wc(e,t){return e.find(e=>e.id===t)??e[0]}function Gc(e,t,n=mt){let r=r=>{let i=t?.effective_model||e?.model;return{remote:!1,label:n.bare(`modelStatus.local`),description:r&&i?n.bare(`modelStatus.localNotice`,{model:Uc(i)}):null}},i=!!t?.effective_model&&!!e?.model&&t.effective_model!==e.model;return e?.remote&&!(i&&t?.inference_remote!==void 0)?{remote:!0,label:e.provider_name||`a cloud provider`,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?r(t.inference_description):t===void 0&&e?.inference_remote===!1?r(e.inference_description):null}var Kc=`GAIA can't tell whether this chat is answered on this PC or by a cloud provider, so it isn't claiming either.`;function qc(){return Gc(zc(e=>e.active),N(e=>Wc(e.sessions,e.currentSessionId)),R())}function Jc(e,t,n){return t.find(e=>e.id===n)?.effective_model||e?.model||null}function Yc(e){return/^(fireworks|amd)\./.test(e)?e.slice(e.indexOf(`.`)+1):e}function Xc(e){let t=Yc(e);return t.slice(t.lastIndexOf(`/`)+1)}function Zc(e){let t={};for(let n of e)t[n.id]=n.display_name||Uc(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=>Yc(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 Qc(e){return e===`fireworks`?`Fireworks AI`:e===`amd`?`AMD LLM Gateway`:e}var $c={loaded:`Loaded`,downloaded:`Downloaded, ready to load`,not_downloaded:`Not downloaded`};function el(e){return e?.label?e.source===`expected`?`${e.label} (expected)`:e.label:null}function tl(e){return e?`${Math.round(e/1024)}K`:`unknown`}function nl(e){return e>=1024&&e%1024==0&&e<1048576?tl(e):e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}K`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`}function rl(e){return e.state??(e.downloaded?`downloaded`:`not_downloaded`)}function il(e){let t=e.download_progress?.state;return t===`starting`||t===`downloading`}var al=e=>`${e}`,ol=/([^]*)/;function sl({text:e}){return L(P.Fragment,{children:e.split(ol).map((e,t)=>t%2?L(`bdi`,{dir:`ltr`,children:e},t):e)})}function cl({text:e}){let[t,n]=b(e);return n===void 0?L(sl,{text:t}):z(P.Fragment,{children:[L(sl,{text:t}),` `,L(`small`,{className:`i18n-gloss`,lang:`en`,children:L(sl,{text:n})})]})}function ll({status:e}){let t=R();if(e.error_cause===`model_server_down`&&e.base_url){let n=e.owner===`gaia`?`modelStatus.serverDown.gaia`:`modelStatus.serverDown.notOurs`;return L(cl,{text:t(n,{url:al(e.base_url)})})}return L(P.Fragment,{children:e.error})}var ul=3e3,dl={loaded:`modelStatus.state.loaded`,warming:`modelStatus.state.warming`,idle:`modelStatus.state.idle`,stopped:`modelStatus.state.stopped`},fl={loaded:`modelStatus.pillAria.loaded`,warming:`modelStatus.pillAria.warming`,idle:`modelStatus.pillAria.idle`,stopped:`modelStatus.pillAria.stopped`};function pl(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(` ·\xA0`)):e.memory_error}function ml(e,t){return e.label?e.source===`expected`?t(`modelStatus.expected`,{label:e.label}):e.label:null}function hl(){let e=R(),t=zc(e=>e.active);zc(e=>e.names);let n=qc(),r=N(e=>e.systemStatus),i=N(e=>e.openSettings),a=hc(e=>e.show),o=(0,B.useRef)(null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(!1),_=(0,B.useCallback)(async()=>{try{u(await j()),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},[]);(0,B.useEffect)(()=>{if(!s)return;_();let e=setInterval(()=>{_()},ul);return()=>clearInterval(e)},[s,_]);let v=(0,B.useCallback)(async e=>{g(!1),m(!0),f(null);try{await $n(e),await _()}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}},[_]),y=r?r.lemonade_running?Hc(r.model_loaded,t?.model)?`loaded`:`idle`:`stopped`:`idle`,b=n?.remote?xi:n?ki:pi,x=t?.model?Uc(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`)):Kc,w=l,T=p||!!w?.restarting,E=!!w&&w.owner!==`gaia`,D=!!w&&!(E&&w.state===`stopped`);return z(`div`,{className:`sb-location-wrap`,children:[z(`button`,{ref:o,type:`button`,className:`sb-location`,onClick:()=>c(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":s,"aria-label":n?.remote?S:e(fl[y],{text:S}),title:x?`${S}. ${C}`:C,children:[L(b,{size:13,"aria-hidden":`true`}),z(`span`,{className:`sb-location-text`,children:[n?.label&&x&&L(`span`,{className:`sb-location-place`,children:n.label}),L(`span`,{className:`sb-location-name`,dir:`auto`,children:x??n?.label??e(`modelStatus.fallbackName`)})]}),!n?.remote&&L(`span`,{className:`sb-location-dot is-${y}`,"aria-hidden":`true`})]}),L(pc,{open:s,onClose:()=>c(!1),anchor:o,label:e(`modelStatus.label`),placement:`above`,children:z(`div`,{className:`model-status`,children:[!w&&!d&&z(`span`,{children:[L(Za,{size:13,className:`spin`}),` `,e(`modelStatus.checking`)]}),w&&z(P.Fragment,{children:[z(`div`,{className:`model-status-head`,children:[L(`span`,{className:`model-status-dot is-${w.state}`,"aria-hidden":`true`}),L(`span`,{role:`status`,children:w.state===`loaded`&&w.busy_reason===`request`?e(`modelStatus.state.loadedAnswering`):e(dl[w.state])})]}),w.active_remote&&L(`span`,{className:`settings-hint`,children:e(`modelStatus.cloudLine`,{name:w.active_display_name??w.active_model??`—`})}),z(`dl`,{className:`model-status-grid`,children:[L(`dt`,{children:e(`modelStatus.model`)}),L(`dd`,{title:w.model??w.active_model??void 0,children:L(`bdi`,{children:w.display_name??(w.active_remote?`—`:w.active_display_name)??`—`})}),w.placement&&z(P.Fragment,{children:[L(`dt`,{children:e(`modelStatus.runsOn`)}),L(`dd`,{children:L(`bdi`,{children:ml(w.placement,e)})})]}),w.state!==`stopped`&&z(P.Fragment,{children:[L(`dt`,{children:e(`modelStatus.memory`)}),L(`dd`,{children:pl(w,e)??e(`modelStatus.unknown`)})]}),w.ctx_size!=null&&z(P.Fragment,{children:[L(`dt`,{children:e(`modelStatus.context`)}),L(`dd`,{children:e(`settings.ctx.tokens`,{size:tl(w.ctx_size)})})]})]}),w.placement?.warning&&L(`span`,{className:`model-status-warning`,role:`alert`,children:w.placement.warning}),w.error&&L(`span`,{className:`settings-error`,role:`alert`,title:w.error_detail??void 0,children:L(ll,{status:w})}),w.restart_error&&L(`span`,{className:`settings-error`,role:`alert`,children:w.restart_error})]}),d&&L(`span`,{className:`settings-error`,role:`alert`,children:d}),h&&w&&z(`div`,{className:`model-status-confirm`,role:`alert`,children:[L(`span`,{children:e(`modelStatus.confirm`,{name:w.display_name??We(`modelStatus.theModel`),url:w.base_url??`—`})}),z(`div`,{className:`model-status-actions`,children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>g(!1),children:e(`modelStatus.cancel`)}),L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void v(!0),children:e(`modelStatus.reloadIt`)})]})]}),z(`div`,{className:`model-status-actions`,children:[z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{c(!1),i(`model`)},children:[L(ms,{size:13,"aria-hidden":`true`}),` `,e(`modelStatus.settings`)]}),!w?.active_remote&&z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{c(!1),a(`model_server`)},children:[L(cs,{size:13,"aria-hidden":`true`}),` `,e(`logs.serverLog`)]}),D&&z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>E?g(!0):void v(!1),disabled:T||!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:[T?L(Za,{size:13,className:`spin`}):L(is,{size:13,"aria-hidden":`true`}),e(T?`modelStatus.restarting`:`modelStatus.restart`)]})]})]})})]})}var gl=1e3;function _l(e){return e?e.state===`running`||e.state===`verifying`||!!e.models?.some(e=>e.state===`downloading`||e.state===`verifying`):!1}function vl(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 yl=null;function bl(e){return e instanceof Error?e.message:String(e)}var xl=Pt((e,t)=>{let n=()=>{let e=_l(t().status)||t().queue.length>0;e&&!yl&&(yl=setInterval(()=>{t().refresh()},gl)),!e&&yl&&(clearInterval(yl),yl=null)},r=async()=>{let{status:n,queue:r}=t();if(r.length===0||_l(n))return;let[i,...a]=r;e({queue:a});try{e({status:await Ke(i.id,i),error:null})}catch(t){e({error:bl(t)})}};return{status:null,error:null,queue:[],started:[],refresh:async()=>{try{e({status:await oe(),error:null})}catch(t){e({error:`Lost contact with GAIA: ${bl(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 S(n)}catch(t){e({error:bl(t)})}await t().refresh()}}});function Sl({placement:e=`sidebar`}){let t=R(),n=xl(e=>e.status),r=xl(e=>e.started),i=xl(e=>e.queue),a=vl(n,r),o=xl(e=>e.refresh),s=N(e=>e.openSettings),c=N(e=>e.dismissDownloadFailure),l=N(e=>e.systemStatus?.download_progress??null);(0,B.useEffect)(()=>{o()},[o]);let u=(a?.models??[]).filter(e=>e.state!==`skipped`),d=_l(a)||i.length>0,f=l?.state===`starting`||l?.state===`downloading`,p=d||f,m=u.some(e=>e.state===`failed`)&&a?.state!==`running`,h=!p&&(m||l?.state===`error`);if(!p&&!h)return null;let g=u.filter(e=>e.state!==`failed`&&e.state!==`cancelled`),_=g.length+i.length,v=g.filter(e=>e.state===`ready`||e.state===`verifying`||e.state===`unchecked`).length,y=d?a?.overall?.percent??0:l?.percent??0,b=d?Math.min(_,v+1):1,x=d?_:1,S=!p&&l?.state===`error`&&!!l.model_name;return z(`div`,{className:`download-chip-row is-${e}`,children:[z(`button`,{type:`button`,className:`download-chip is-${e}${h&&!p?` is-failed`:``}`,onClick:()=>s(`model`),"aria-label":t(`download.chipAria`),title:t(`download.chipAria`),children:[L(h?di:Ni,{size:13,"aria-hidden":`true`}),L(`span`,{children:h?t(`download.chipFailed`):t(`download.chip`,{done:String(b),count:String(x),pct:String(y)})}),p&&L(`span`,{className:`download-chip-bar`,"aria-hidden":`true`,children:L(`span`,{style:{inlineSize:`${y}%`}})})]}),S&&L(`button`,{type:`button`,className:`download-chip-dismiss`,onClick:()=>{let e=l?.model_name;e&&c(e).catch(()=>{})},"aria-label":t(`download.dismissFailed`),title:t(`download.dismissFailed`),children:L(nc,{size:12,"aria-hidden":`true`})})]})}var Cl=500,wl=`gaia_always_allow_tools`;function Tl(){try{localStorage.getItem(`gaia_always_allow_tools`)!==null&&(localStorage.removeItem(wl),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 El=`allow_path_access`;function Dl(e){let{path:t,kind:n}=e??{};return{target:typeof t==`string`&&t.trim()?t:null,kind:n}}function Ol(e,t=!1,n=mt,r=e=>e){let{target:i,kind:a}=Dl(e),o=i?We(a===`folder`?`prompt.path.what.folder`:a===`file`?`prompt.path.what.file`:`prompt.path.what.new`,{path:r(i)}):We(`prompt.path.what.unknown`);return n(t?`prompt.path.askAlso`:`prompt.path.ask`,{what:o})}function kl(e,t=!1,n=mt){let{kind:r}=Dl(e);return n(`prompt.path.${t?`titleAlso`:`title`}.${r===`folder`?`folder`:r===`file`?`file`:`location`}`)}var Al={run_python:`prompt.title.python`,execute_python_file:`prompt.title.pythonFile`,run_shell_command:`prompt.title.command`};function jl(e,t=mt,n=e=>e){let r=e.toolArgs??{};if(e.tool===`allow_path_access`)return{heading:kl(r,e.pathFollowUp,t),question:Ol(r,e.pathFollowUp,t,n)};if(e.tool===`trust_project_folder`)return{heading:t(`prompt.trust.title`),question:t(`prompt.trust.ask`)};let i=Ml(e,t)??n(e.toolLabel??e.tool??``),a=Al[e.tool??``];return{heading:a?t(a):t(e.toolLabel?`prompt.title.tool`:`prompt.title.toolId`,{tool:i}),question:t(`prompt.needsOk`,{tool:i})}}function Ml(e,t){let n=`tool.${e.tool}.active`;if(!e.toolLabel||!fe(n))return null;let r=t.bare(n);return r.charAt(0).toLowerCase()+r.slice(1)}var Nl=`changes to files in `;function Pl(e,t){if(e.alwaysScope?.startsWith(Nl))return t.bare(`prompt.always.changes`,{folder:e.alwaysScope.slice(20)});let n=Ml(e,t),r=`${e.tool} `;if(!n||!e.alwaysScope?.startsWith(r))return null;let i=e.alwaysScope.slice(r.length);return i.startsWith(`on files in `)?t.bare(`prompt.always.folder`,{action:n,folder:i.slice(12)}):t.bare(`prompt.always.file`,{action:n,name:i.startsWith(`on `)?i.slice(3):i})}function Fl(e){return e.trim().replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase()}function Il(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 Ll(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=Il(r.toolArgs),{path:a}=n??{};if(!i||typeof a!=`string`||!a.trim())return!1;let o=Fl(i),s=Fl(a);return o===s||o.startsWith(`${s}/`)?!0:!/^([a-z]:)?\//.test(o)&&!o.startsWith(`~`)&&s.endsWith(`/${o.replace(/^\.\//,``)}`)}function Rl(e){return e===`share_engineering_context`||e===`append_engineering_context`||e===`approve_engineering_code`||e===`allow_path_access`||e===`trust_project_folder`}function zl(e,t){return!t.alwaysScope||!t.sessionId||Rl(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 Bl=Pt((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,Cl)}}),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`&&!Rl(i.tool),s=window.gaiaAPI;if(i.sessionId)await jn(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=N.getState();i.sessionId&&i.sessionId===c.currentSessionId&&c.awaitingUser&&c.setAwaitingUser(!1)}})),Vl=e=>e.notifications.filter(e=>!e.read&&!e.dismissed).length,Hl=e=>{let t=e.notifications.filter(e=>!e.dismissed);return e.typeFilter?t.filter(t=>t.type===e.typeFilter):t},Ul=e=>[...new Set(e.notifications.filter(e=>!e.dismissed).map(e=>e.type))],Wl=e=>t=>t.notifications.find(t=>t.type===`permission_request`&&t.sessionId===e&&!t.response&&!t.dismissed)??null,Gl=e=>[...new Set(e.notifications.filter(e=>e.type===`permission_request`&&e.sessionId&&!e.response&&!e.dismissed).map(e=>e.sessionId))].sort(),Kl=`gaia_alert_settings`,ql={modes:{needs_approval:`banner`,question:`banner`,finished:`banner`},sound:!1,flash:!0,keepAwake:!0,batteryFloor:20},Jl=[`banner`,`badge`,`off`];function Yl(){let e=null;try{e=localStorage.getItem(Kl)}catch(e){return console.warn(`[alerts] Notification settings unreadable (site data blocked); using defaults.`,e),ql}if(!e)return ql;let t;try{t=JSON.parse(e)}catch(e){return console.warn(`[alerts] Saved notification settings are corrupt; using defaults.`,e),ql}let n={...ql.modes};for(let e of Object.keys(n)){let r=t.modes?.[e];r!==void 0&&Jl.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,ql.sound),flash:r(t.flash,ql.flash),keepAwake:r(t.keepAwake,ql.keepAwake),batteryFloor:typeof i==`number`&&i>=0&&i<=100?i:ql.batteryFloor}}function Xl(e){try{localStorage.setItem(Kl,JSON.stringify(e))}catch(e){console.warn(`[alerts] Notification settings not saved; they will reset on reload.`,e)}}var Zl=e=>({modes:e.modes,sound:e.sound,flash:e.flash,keepAwake:e.keepAwake,batteryFloor:e.batteryFloor}),Ql=Pt((e,t)=>({...Yl(),setMode:(n,r)=>{e({modes:{...t().modes,[n]:r}}),Xl(Zl(t()))},update:n=>{e(n),Xl(Zl(t()))}}));function $l(e){let t=new Date(e.updated_at).getTime();return Number.isNaN(t)?0:t}function eu(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)=>$l(t)-$l(e));for(let e of a){let t=$l(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 tu(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 nu(e){return e.kind===`eval`||e.kind===`scheduled`}function ru(e,t,{showAutomated:n=!1,now:r=new Date}={}){let i=n?e:e.filter(e=>!nu(e)),a=(e,t)=>$l(t)-$l(e),o=i.filter(e=>tu(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,...eu(c,r)]}function iu(e){return e.filter(nu).length}function au(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 ou(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 su={needs_approval:`GAIA needs your approval`,question:`GAIA has a question`,finished:`GAIA finished`};function cu(e,t){let n=t?.title||`A chat`;if(e!==`finished`)return{title:su[e],body:n};switch(t?.last_run_status){case`done`:return{title:su.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 lu(e,t,n){return n&&e===t}function uu(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 du(e,t){return!e||e.charging||t<=0?!0:e.level*100>=t}function fu(){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 pu(e){let t=e%100;return`${e}${t>=11&&t<=13?`th`:{1:`st`,2:`nd`,3:`rd`}[e%10]??`th`}`}function mu(){return typeof navigator<`u`&&/Mac/i.test(navigator.platform)}function hu(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 gu={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Mod:`⌘`},_u=[`Ctrl`,`Alt`,`Shift`,`Mod`];function vu(e,t=mu()){let n=e.split(`+`),r=n.pop(),i=n.filter(e=>!(e in gu));if(i.length)throw Error(`formatShortcut: unknown modifier(s) ${i.join(`, `)} in "${e}"; use Ctrl, Alt, Shift or Mod`);return t?_u.filter(e=>n.includes(e)).map(e=>gu[e]).join(``)+r:[...n.map(e=>e===`Mod`?`Ctrl`:e),r].join(`+`)}var yu=new Set([`New chat`,`New Task`]);function bu(e,t){let n=t.sessions.find(t=>t.id===e);return!(!n||!yu.has(n.title)||(n.message_count??0)!==0||t.runningSessionIds.includes(e)||t.messageQueues?.[e]?.length||t.pendingPrompt?.sessionId===e||t.currentSessionId===e&&(t.messages.length!==0||t.isStreaming))}async function xu(e){if(!e)return!1;let t=N.getState();if(!bu(e,{sessions:t.sessions,currentSessionId:t.currentSessionId,messages:t.messages,isStreaming:t.isStreaming,runningSessionIds:t.runningSessionIds,messageQueues:t.messageQueues,pendingPrompt:t.pendingPrompt}))return!1;F.chat.info(`Removing abandoned draft session ${e}`),t.addPendingDelete(e),t.removeSession(e);try{return await rr(e),!0}catch(t){return F.chat.warn(`Failed to delete abandoned draft ${e}`,t),!1}finally{t.removePendingDelete(e)}}var Su=32768,Cu=`Gemma-4-E4B-it-GGUF`,wu=3e5,Tu=18e5,Eu=1e4,Du=`GAIA is starting…`;function Ou(e){let[t,n]=(0,B.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(e).matches);return(0,B.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 ku=e=>`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`;function Au(){let[e,t]=(0,B.useState)(()=>new Date);return(0,B.useEffect)(()=>{let e,n=()=>t(e=>ku(e)===ku(new Date)?e:new Date),r=()=>{let t=new Date,i=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1).getTime();e=setTimeout(()=>{n(),r()},i-t.getTime()+1e3)};return r(),document.addEventListener(`visibilitychange`,n),window.addEventListener(`focus`,n),()=>{clearTimeout(e),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`focus`,n)}},[]),e}var ju=new URL(`gaia-robot-NKaQnEIp.png`,import.meta.url).href,Mu=16,Nu=`gaia-chat-sidebar-width`,Pu=e=>Math.round(Math.max(200,Math.min(420,e)));function Fu(){try{let e=Number(localStorage.getItem(Nu));return e?Pu(e):260}catch(e){return F.system.warn(`Saved sidebar width unreadable; using the default.`,e),260}}function Iu(e){try{localStorage.setItem(Nu,String(e))}catch(e){F.system.warn(`Sidebar width not saved; it resets on reload.`,e)}}function Lu(e){return getComputedStyle(e).direction===`rtl`}function Ru(e){let t=R(),[n,r]=(0,B.useState)(Fu),[i,a]=(0,B.useState)(null),o=(0,B.useCallback)(e=>{let t=Pu(e);r(t),Iu(t)},[]),s=(0,B.useCallback)(t=>{if(t.button!==0)return;t.preventDefault();let r=t.clientX,i=n,s=t.currentTarget,c=Lu(s)?-1:1;s.setPointerCapture?.(t.pointerId);let l=i,u=e=>{l=i+c*(e.clientX-r),a(l<150?l:Pu(l))},d=()=>{s.removeEventListener(`pointermove`,u),s.removeEventListener(`pointerup`,d),s.removeEventListener(`pointercancel`,d),a(null),l<150?e():o(l)};s.addEventListener(`pointermove`,u),s.addEventListener(`pointerup`,d),s.addEventListener(`pointercancel`,d)},[e,o,n]),c=(0,B.useCallback)(e=>{let t=Lu(e.currentTarget)?-16:Mu,r={ArrowLeft:n-t,ArrowRight:n+t,Home:200,End:420}[e.key];r!==void 0&&(e.preventDefault(),o(r))},[o,n]),l=L(`div`,{className:`sb-resize${i==null?``:` is-dragging`}`,role:`separator`,"aria-orientation":`vertical`,"aria-label":t(`sidebar.resize`),"aria-valuemin":200,"aria-valuemax":420,"aria-valuenow":Math.round(i??n),tabIndex:0,title:t(`sidebar.resizeTitle`),onPointerDown:s,onKeyDown:c,onDoubleClick:()=>o(260)});return{width:i??n,resizing:i!=null,handle:l}}function zu(e){return e.normalize(`NFKD`).replace(/\p{Mn}/gu,``).toLowerCase().replace(/ß/g,`ss`)}function Bu(e){return Array.from(e,zu).join(``)}function Vu(e,t){let n=Bu(t.trim());if(!n)return null;let r=``,i=[],a=0;for(let t of e){let e=zu(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 Hu=new Set([`calendar/create_calendar_event`,`calendar/update_calendar_event`,`calendar/cancel_calendar_event`]),Uu=/^(\d{4})-(\d{2})-(\d{2})$/,Wu={year:`numeric`,month:`short`,day:`numeric`},Gu={hour:`numeric`,minute:`2-digit`,timeZoneName:`short`},Ku=new Map;function qu(e){let t=Ku.get(e);return t||(t={time:new Intl.DateTimeFormat(e,{...Wu,...Gu}),timeOnly:new Intl.DateTimeFormat(e,Gu),date:new Intl.DateTimeFormat(e,Wu)},Ku.set(e,t)),t}var Ju=new Set([` `,`
|
|
11
|
-
`,``,``,``,``]),Yu=new Set([`͏`,`ᅟ`,`ᅠ`,`⠀`,`ㅤ`,`ᅠ`]),Xu=[[173,173],[847,847],[1564,1564],[4447,4448],[6068,6069],[6155,6159],[8203,8207],[8234,8238],[8288,8303],[12644,12644],[65024,65039],[65279,65279],[65440,65440],[65520,65528],[113824,113827],[119155,119162],[917504,921599]],Zu=[[65024,65039],[917760,917999]],Qu=[[169,169],[174,174],[8252,8252],[8265,8265],[8482,8482],[8505,8505],[8596,8601],[8617,8618],[8986,8987],[9e3,9e3],[9167,9167],[9193,9203],[9208,9210],[9410,9410],[9642,9643],[9654,9654],[9664,9664],[9723,9726],[9728,9732],[9742,9742],[9745,9745],[9748,9749],[9752,9752],[9757,9757],[9760,9760],[9762,9763],[9766,9766],[9770,9770],[9774,9775],[9784,9786],[9792,9792],[9794,9794],[9800,9811],[9823,9824],[9827,9827],[9829,9830],[9832,9832],[9851,9851],[9854,9855],[9874,9879],[9881,9881],[9883,9884],[9888,9889],[9895,9895],[9898,9899],[9904,9905],[9917,9918],[9924,9925],[9928,9928],[9934,9935],[9937,9937],[9939,9940],[9961,9962],[9968,9973],[9975,9978],[9981,9981],[9986,9986],[9989,9989],[9992,9997],[9999,9999],[10002,10002],[10004,10004],[10006,10006],[10013,10013],[10017,10017],[10024,10024],[10035,10036],[10052,10052],[10055,10055],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10083,10084],[10133,10135],[10145,10145],[10160,10160],[10175,10175],[10548,10549],[11013,11015],[11035,11036],[11088,11088],[11093,11093],[12336,12336],[12349,12349],[12951,12951],[12953,12953],[126980,126980],[127020,127023],[127124,127135],[127151,127152],[127168,127168],[127183,127184],[127222,127231],[127344,127345],[127358,127359],[127374,127374],[127377,127386],[127406,127461],[127489,127503],[127514,127514],[127535,127535],[127538,127546],[127548,127551],[127561,127583],[127590,127777],[127780,127891],[127894,127895],[127897,127899],[127902,127984],[127987,127989],[127991,127994],[128e3,128253],[128255,128317],[128329,128334],[128336,128359],[128367,128368],[128371,128378],[128391,128391],[128394,128397],[128400,128400],[128405,128406],[128420,128421],[128424,128424],[128433,128434],[128444,128444],[128450,128452],[128465,128467],[128476,128478],[128481,128481],[128483,128483],[128488,128488],[128495,128495],[128499,128499],[128506,128591],[128640,128709],[128715,128722],[128725,128741],[128745,128745],[128747,128752],[128755,128767],[128986,129023],[129036,129039],[129096,129103],[129114,129119],[129160,129167],[129198,129199],[129212,129215],[129218,129231],[129241,129279],[129292,129338],[129340,129349],[129351,129535],[129624,129631],[129646,129791],[130048,131069]],$u=[[13312,19903],[19968,40959],[63744,64255],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[191472,192095],[194560,195103],[196608,201551],[201552,205743]],ed=new Set([...`0123456789#*`]),td=/^[\p{Cf}\p{Cc}\p{Zl}\p{Zp}]$/u;function nd(e,t){let n=t.codePointAt(0)??-1;return e.some(([e,t])=>e<=n&&n<=t)}var rd=e=>nd(Zu,e);function id(e,t){return t.has(e)||rd(e)?!1:Yu.has(e)||td.test(e)||nd(Xu,e)}function ad(e,t){let n=e[t],r=t>0?e[t-1]:``;if(!r)return!1;if(n===`︎`||n===`️`)return nd(Qu,r)?!0:n===`️`&&ed.has(r)&&e[t+1]===`⃣`;let i=n.codePointAt(0)??0;return i>=917760&&i<=917999&&nd($u,r)}function od(e,t,n){let r=[...t.replace(/\r\n/g,`
|
|
12
|
-
`)],i=r.map((t,n)=>(rd(t)?!ad(r,n):id(t,e))?`[U+${t.codePointAt(0).toString(16).toUpperCase().padStart(4,`0`)}]`:t).join(``);return n?i:i.replace(/\n/g,`[U+000A]`)}function sd(e,t){return od(Ju,e,t)}function V(e){return sd(e,!1)}var cd=/[\u202A-\u202E]/,ld=/[\u2066-\u2068]/,ud=``;function dd(e){return e.split(`
|
|
13
|
-
`).map(e=>{let t=[...e],n=new Set,r=[];return t.forEach((e,t)=>{cd.test(e)?n.add(t):ld.test(e)?r.push(t):e===ud&&r.pop()===void 0&&n.add(t)}),r.forEach(e=>n.add(e)),t.map((e,t)=>n.has(t)?sd(e,!1):e).join(``)}).join(`
|
|
14
|
-
`)}var fd=`This text holds characters that don't show. Those that hide or reorder text appear as [U+XXXX]; ideograph variant marks are kept as written. They are saved as written.`;function pd(e,t){if(typeof t!=`string`)return!1;let n=[...t.replace(/\r\n/g,`
|
|
15
|
-
`)];return n.some((t,r)=>{let i=t.codePointAt(0)??0;return i>=917760&&i<=917999?!0:rd(t)?!ad(n,r):id(t,e)})}function md(e){return pd(Ju,e)}var hd=`<<<UNTRUSTED_TEXT>>>`,gd=`<<<END_UNTRUSTED_TEXT>>>`;function _d(e){if(e===`<`||e===`>`)return e;let t=e.normalize(`NFKC`);return t===`<`||t===`>`?t:``}function vd(e){if(typeof e!=`string`)return``;let t=e,n=``;for(;n!==t;)n=t,t=t.split(hd).join(``).split(gd).join(``);let r=[...t],i=``,a=0;for(;a<r.length;){let e=_d(r[a]);if(!e){i+=r[a],a+=1;continue}let t=0,n=a;for(let i=a;i<r.length;i++)if(_d(r[i])===e)t+=1,n=i;else if(!id(r[i],Ju))break;i+=t>=3?e+e:r.slice(a,n+1).join(``),a=n+1}return i}function yd(e,t=!1){return od(Ju,vd(e),t)}function bd(e){let t=Uu.exec(e);return t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):null}function xd({start:e,end:t}){let n=R(),{time:r,timeOnly:i,date:a}=qu(n.locale),o=bd(e);if(o){let e=bd(t),r=e&&e>o?`${a.format(o)} – ${a.format(e)}`:a.format(o);return z(P.Fragment,{children:[L(`bdi`,{dir:`auto`,children:r}),` (`,n(`permission.calendar.allDay`),`)`]})}let s=new Date(e),c=new Date(t);if(Number.isNaN(s.getTime()))return L(`bdi`,{dir:`ltr`,children:e});let l=r.format(s);if(!Number.isNaN(c.getTime())&&c>s){let e=a.format(s)===a.format(c);l+=` – ${(e?i:r).format(c)}`}return L(`bdi`,{dir:`auto`,children:l})}function Sd({value:e}){return L(`bdi`,{dir:`auto`,children:e})}function Cd({tool:e,args:t}){let n=R(),r=Array.isArray(t.notify_attendees)?t.notify_attendees.map(e=>yd(e)).filter(Boolean):[],i=[],a=(e,t,n=!1)=>{let r=yd(t,n);r&&i.push([e,L(Sd,{value:r})])},o=()=>{let e=yd(t.calendar_account);e&&i.push([n(`permission.calendar.account`),L(`bdi`,{dir:`ltr`,children:e})])};e===`calendar/create_calendar_event`?(a(n(`permission.calendar.title`),t.title),i.push([n(`permission.calendar.when`),L(xd,{start:yd(t.start),end:yd(t.end)})]),o(),a(n(`permission.calendar.location`),t.location),a(n(`permission.calendar.description`),t.description,!0)):(a(n(`permission.calendar.event`),t.expected_title),i.push([n(`permission.calendar.when`),L(xd,{start:yd(t.expected_start),end:``})]),o(),a(n(`permission.calendar.newTitle`),t.new_title),yd(t.new_start)&&i.push([n(`permission.calendar.newTime`),L(xd,{start:yd(t.new_start),end:yd(t.new_end)})]),a(n(`permission.calendar.newLocation`),t.new_location),a(n(`permission.calendar.newDescription`),t.new_description,!0));let s=[...Object.values(t),...Array.isArray(t.notify_attendees)?t.notify_attendees:[]],c=typeof t._risk_note!=`string`&&s.some(e=>pd(Ju,e))?fd:``;return z(P.Fragment,{children:[z(`dl`,{className:`perm-card-facts`,"data-testid":`perm-calendar`,children:[i.map(([e,t])=>z(B.Fragment,{children:[L(`dt`,{children:e}),L(`dd`,{children:t})]},e)),L(`dt`,{children:r.length?n.plural(`permission.calendar.notifies`,r.length):n(`permission.calendar.noOne`)}),L(`dd`,{children:r.length>0&&L(`div`,{className:`perm-card-people`,tabIndex:0,children:r.map(e=>L(Sd,{value:e},e))})})]}),c&&L(`p`,{className:`perm-card-risk`,role:`note`,"data-testid":`perm-calendar-unseen`,children:c})]})}var wd={running:`row.status.running`,queued:`row.status.queued`,waiting:`row.status.waiting`,done:`row.status.done`,failed:`row.status.failed`},Td={"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`},Ed=`gaia-show-automated-runs`,Dd=200,Od=new Map;function kd({parts:e}){return z(P.Fragment,{children:[dd(e.before),L(`mark`,{className:`sb-hit`,children:dd(e.match)}),dd(e.after)]})}function Ad(){try{return localStorage.getItem(Ed)===`1`}catch(e){return F.system.warn(`Chat-list filter unreadable (site data blocked); hiding eval and scheduled runs.`,e),!1}}var jd=e=>`sb-result-${e}`;function Md({session:e,active:t,phone:n,moved:r,focusPin:i,status:a,queuePlace:o,unsent:s,failed:c,onSelect:l,onDelete:d,onPin:f,onRename:p,rowId:m,kbdActive:h,titleMatch:g,snippet:_}){let v=R(),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(!1),C=(0,B.useRef)(null),w=(0,B.useCallback)(()=>{S(!1),b(!1)},[]),[T,E]=(0,B.useState)(null),D=T!==null,O=(0,B.useRef)(!1),ee=()=>{O.current=!1,E(e.title)},te=(0,B.useRef)(null),ne=(0,B.useRef)(null),re=(0,B.useRef)(!1),k=(t,n=!1)=>{T===null||O.current||(O.current=!0,re.current=n,E(null),t&&p(e.id,T))},[ie,ae]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!y||ie)return;let e=setTimeout(()=>b(!1),3e3);return()=>clearTimeout(e)},[y,ie]),(0,B.useEffect)(()=>{!D&&re.current&&(re.current=!1,te.current?.focus())},[D]),(0,B.useEffect)(()=>{i&&ne.current?.focus()},[i]);let A=(0,B.useRef)(null);(0,B.useEffect)(()=>{r&&A.current?.scrollIntoView?.({block:`nearest`})},[r]);let oe=e=>e.preventDefault(),se=!!e.unread&&!t,ce=a===`done`&&!se?null:a,le=o>0?`${pu(o)} in line`:null,ue=ce?[v(wd[ce]),le].filter(Boolean).join(`, `):void 0,de=c>0?`${c} not sent`:s>0?`${s} to send`:null,fe=[le,de].filter(Boolean).join(` · `),pe=_?`${_.before}${_.match}${_.after}`:null,me=dd(e.title),j=L(`span`,{className:`sb-row-title`,dir:`auto`,children:g?L(kd,{parts:g}):me});return z(`li`,{ref:A,className:`sb-row${t?` is-active`:``}${se?` is-unread`:``}${r?` is-moved`:``}${h?` is-kbd-active`:``}`,"data-status":ce??void 0,children:[D?L(`input`,{className:`sb-row-edit`,value:T,maxLength:200,onChange:e=>E(e.target.value),onBlur:()=>k(!0),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),k(!0,!0)),e.key===`Escape`&&(e.preventDefault(),k(!1,!0))},...Nt,autoFocus:!0,onFocus:e=>e.currentTarget.select(),"aria-label":v(`row.renameAria`,{title:me}),dir:`auto`}):z(`button`,{ref:te,type:`button`,id:m,className:`sb-row-main`,onClick:()=>l(e.id),onDoubleClick:ee,"aria-current":t?`page`:void 0,"aria-label":[me,ue,de,se?v(`row.unread`):null,pe&&dd(pe)].filter(Boolean).join(`, `),title:me,children:[ce&&L(`span`,{className:`sb-dot is-${ce}`,"aria-hidden":`true`,title:ue}),e.private&&L(Gi,{size:12,className:`sb-row-icon`,"aria-label":v(`row.private`)}),_?z(`span`,{className:`sb-row-text`,children:[j,L(`span`,{className:`sb-row-snippet`,children:L(kd,{parts:_})})]}):j,fe&&L(`span`,{className:`sb-row-queue${c>0?` is-failed`:``}`,children:fe})]}),n&&D&&z(P.Fragment,{children:[L(`button`,{type:`button`,className:`sb-row-edit-btn is-save`,onPointerDown:oe,onMouseDown:oe,onClick:()=>k(!0),"aria-label":v(`row.saveName`),children:L(Yr,{size:18,"aria-hidden":`true`})}),L(`button`,{type:`button`,className:`sb-row-edit-btn`,onPointerDown:oe,onMouseDown:oe,onClick:()=>k(!1),"aria-label":v(`row.cancelRename`),children:L(nc,{size:18,"aria-hidden":`true`})})]}),n?!D&&z(P.Fragment,{children:[L(`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:me}),children:L(zi,{size:18,"aria-hidden":`true`})}),L(pc,{open:x,onClose:w,anchor:C,label:v(`row.actions`),placement:`below`,align:`end`,children:z(`div`,{className:`sb-row-menu`,children:[z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{w(),ee()},children:[L(Io,{size:15,"aria-hidden":`true`}),v(`row.rename`)]}),z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{w(),f(e.id,!e.pinned,!0)},children:[e.pinned?L(Ro,{size:15,"aria-hidden":`true`}):L(Bo,{size:15,"aria-hidden":`true`}),e.pinned?v(`row.unpin`):v(`row.pin`)]}),z(`button`,{type:`button`,className:`popover-item sb-row-menu-delete`,onClick:()=>y?d(e.id):b(!0),children:[L(Hs,{size:15,"aria-hidden":`true`}),y?v(`row.tapAgain`,{label:s>0?We(u(`row.deleteUnsent`,s),{n:s}):We(`row.deleteConfirm`)}):v(`row.delete`)]}),y&&L(`p`,{className:`sb-row-menu-note`,children:v(`row.deleteMemoryNote`)})]})})]}):z(`span`,{className:`sb-row-actions${D?` is-editing`:``}`,children:[!D&&L(`button`,{type:`button`,className:`sb-row-rename`,onClick:ee,"aria-label":v(`row.renameAria`,{title:me}),title:v(`row.rename`),children:L(Io,{size:13})}),L(`button`,{ref:ne,type:`button`,className:`sb-row-pin${e.pinned?` is-pinned`:``}`,onClick:t=>f(e.id,!e.pinned,!1,t.detail===0),"aria-label":v(e.pinned?`row.unpinAria`:`row.pinAria`,{title:me}),"aria-pressed":!!e.pinned,title:e.pinned?v(`row.unpin`):v(`row.pinToTop`),children:e.pinned?L(Ro,{size:13}):L(Bo,{size:13})}),L(`button`,{type:`button`,className:`sb-row-delete${y?` is-confirm`:``}`,onClick:()=>y?d(e.id):b(!0),onPointerEnter:()=>ae(!0),onPointerLeave:()=>ae(!1),"aria-label":y?s>0?v.plural(`row.confirmDeleteUnsentAria`,s,{title:me}):v(`row.confirmDeleteAria`,{title:me}):v(`row.deleteAria`,{title:me}),title:y?`${s>0?v.plural(`row.clickAgainUnsent`,s):v(`row.clickAgain`)}\n${v(`row.deleteMemoryNote`)}`:v(`row.delete`),children:y?L(`span`,{className:`sb-row-delete-label`,children:s>0?v.plural(`row.deleteUnsent`,s):v(`row.deleteConfirm`)}):L(Hs,{size:13})})]})]})}function Nd({onNewChat:e,onMobileAccess:t,tunnelActive:n}){let r=R(),i=N(e=>e.sessions),a=N(e=>e.currentSessionId),o=N(e=>e.runningSessionIds),s=N(e=>e.queuedSessionIds),c=N(e=>e.awaitingBySession),l=N(e=>e.messageQueues),u=N(e=>e.updateSessionInList),d=Bl(dc(Gl)),f=N(e=>e.sidebarOpen),p=N(e=>e.sidebarCollapsed),m=N(e=>e.toggleSidebarCollapsed),h=N(e=>e.setSidebarOpen),g=N(e=>e.setCurrentSession),_=N(e=>e.setMessages),v=N(e=>e.removeSession),y=N(e=>e.addPendingDelete),b=N(e=>e.removePendingDelete),x=N(e=>e.openSettings),S=N(e=>e.settingsSection===`skills`),C=N(e=>e.setShowMemoryDashboard),w=N(e=>e.setShowSchedules),T=N(e=>e.setShowDocLibrary),E=N(e=>e.showMemoryDashboard),D=N(e=>e.showSchedules),O=Bl(Vl),ee=Bl(e=>e.showPanel),te=Bl(e=>e.setShowPanel),[ne,k]=(0,B.useState)(``),[ie,ae]=(0,B.useState)(null),[A,oe]=(0,B.useState)(null),[se,ce]=(0,B.useState)(-1),[le,ue]=(0,B.useState)(null),[de,fe]=(0,B.useState)(null),[pe,me]=(0,B.useState)(Ad),j=Ou(`(max-width: 768px)`),he=(0,B.useRef)(null),M=(0,B.useRef)(null);(0,B.useEffect)(()=>k(``),[a]),(0,B.useEffect)(()=>{let e=()=>{let e=document.activeElement;e instanceof HTMLElement&&e!==he.current&&(M.current=e),p&&m(),requestAnimationFrame(()=>he.current?.focus())};return window.addEventListener(`gaia:focus-search`,e),()=>window.removeEventListener(`gaia:focus-search`,e)},[p,m]);let ge=(0,B.useMemo)(()=>({running:o,queued:s,awaiting:c,prompting:d}),[o,s,c,d]),_e=ne.trim();(0,B.useEffect)(()=>{if(ce(-1),oe(null),!_e){ae(null);return}let e=new AbortController,t=setTimeout(()=>{Xn(_e,pe,e.signal).then(({results:e,truncated:t})=>ae({query:_e,results:e,truncated:!!t})).catch(t=>{e.signal.aborted||(F.chat.error(`Chat search failed`,t),oe(`Could not search inside chats: ${t instanceof Error?t.message:t}`),ae({query:_e,results:[],truncated:!1}))})},Dd);return()=>{clearTimeout(t),e.abort()}},[_e,pe]);let ve=!!_e&&ie?.query!==_e,ye=(0,B.useMemo)(()=>ie&&ie.query===_e?new Map(ie.results.map(e=>[e.session_id,e])):Od,[ie,_e]),be=iu(i),xe=Au(),Se=(0,B.useMemo)(()=>{let e=Bu(_e);return ru(_e?i.filter(t=>Bu(t.title).includes(e)||ye.has(t.id)):i,ge,{showAutomated:pe,now:xe})},[i,_e,ye,ge,pe,xe]),Ce=(0,B.useMemo)(()=>_e?Se.flatMap(e=>e.sessions):[],[_e,Se]),we=se>=0&&Ce.length>0?Ce[Math.min(se,Ce.length-1)]:void 0;(0,B.useEffect)(()=>{we&&document.getElementById(jd(we.id))?.scrollIntoView?.({block:`nearest`})},[we]);let Te=(0,B.useCallback)(()=>{me(e=>{try{localStorage.setItem(Ed,e?`0`:`1`)}catch(e){F.system.warn(`Chat-list filter not saved; it will reset on reload.`,e)}return!e})},[]),Ee=(0,B.useCallback)(e=>{u(e,{unread:!1}),Un(e).catch(t=>{F.chat.error(`Could not mark chat ${e} read`,t),fe(`Could not mark the chat read: ${t instanceof Error?t.message:t}`)})},[u]),De=i.find(e=>e.id===a)?.unread;(0,B.useEffect)(()=>{if(!a||!De)return;if(document.hasFocus()){Ee(a);return}let e=()=>Ee(a);return window.addEventListener(`focus`,e,{once:!0}),()=>window.removeEventListener(`focus`,e)},[a,De,Ee]);let[Oe,ke]=(0,B.useState)(null),[Ae,je]=(0,B.useState)(null);(0,B.useEffect)(()=>{Ae&&je(null)},[Ae]),(0,B.useEffect)(()=>{if(!Oe)return;let e=setTimeout(()=>ke(null),1200);return()=>clearTimeout(e)},[Oe]);let Me=(0,B.useCallback)(async(e,t)=>{fe(null),u(e,{pinned:t});try{await Bt(e,t)}catch(n){F.chat.error(`Could not ${t?`pin`:`unpin`} chat ${e}`,n),u(e,{pinned:!t}),fe(n instanceof Error?n.message:`Could not ${t?`pin`:`unpin`} the chat.`)}},[u]),Ne=(0,B.useCallback)(async(e,t)=>{let n=t.trim().slice(0,200).trim(),r=N.getState().sessions.find(t=>t.id===e)?.title;if(n&&t!==r&&n!==r){fe(null),u(e,{title:n});try{await re(e,{title:n,title_is_custom:!0})}catch(t){F.chat.error(`Could not rename chat ${e}`,t),r!==void 0&&u(e,{title:r}),fe(t instanceof Error?t.message:`Could not rename the chat.`)}}},[u]),Pe=(0,B.useCallback)(()=>{window.innerWidth<=768&&h(!1)},[h]),Fe=(0,B.useCallback)(e=>{e===a?(g(e),Pe()):(xu(a),g(e),_([]),Pe())},[a,g,_,Pe]),Ie=e=>{if(e.key===`Escape`){e.preventDefault(),k(``);let t=M.current;M.current=null;let n=t?.isConnected&&t!==document.body?t:document.querySelector(`.composer-input`);n?n.focus():he.current?.blur();return}if(!_e||Ce.length===0||e.nativeEvent.isComposing)return;let t=we?Ce.indexOf(we):-1;e.key===`ArrowDown`?(e.preventDefault(),ce(Math.min(t+1,Ce.length-1))):e.key===`ArrowUp`?(e.preventDefault(),ce(Math.max(t-1,0))):e.key===`Enter`&&(e.preventDefault(),Fe((we??Ce[0]).id))},Le=(0,B.useCallback)(async e=>{ue(null),y(e);try{await rr(e),v(e)}catch(t){F.chat.error(`Delete failed for session ${e}`,t),ue(t instanceof Error?t.message:`Could not delete the chat.`)}finally{b(e)}},[y,b,v]),Re=p&&!j,ze=N(e=>e.setSidebarCollapsed),Be=Ru((0,B.useCallback)(()=>ze(!0),[ze])),Ve=!j&&!Re,He=[{key:`memory`,label:r(`sidebar.memory`),icon:Lr,on:E,onClick:()=>{C(!0),Pe()}},{key:`schedules`,label:r(`sidebar.schedules`),icon:yi,on:D,onClick:()=>{w(!0),Pe()}},{key:`connectors`,label:r(`settings.section.connectors`),icon:Wo,on:!1,onClick:()=>{x(`connectors`),Pe()}},{key:`documents`,label:r(`sidebar.documents`),icon:sa,on:!1,onClick:()=>{T(!0),Pe()}},{key:`skills`,label:r(`settings.section.skills`),icon:Os,on:S,onClick:()=>{x(`skills`),Pe()}}];return z(`aside`,{className:`sb${f?` is-open`:``}${Re?` is-collapsed`:``}${Be.resizing?` is-resizing`:``}`,style:Ve?{width:Be.width,minWidth:Be.width}:void 0,"aria-label":r(`sidebar.label`),children:[Ve&&Be.handle,z(`div`,{className:`sb-top`,children:[z(`div`,{className:`sb-brand`,children:[L(`img`,{src:ju,alt:``,width:22,height:22}),!Re&&L(`span`,{children:`GAIA`})]}),L(`button`,{type:`button`,className:`sb-icon-btn`,onClick:j?()=>h(!1):m,"aria-label":r(Re?`sidebar.expand`:`sidebar.collapse`),title:r.hint(r(Re?`sidebar.expand`:`sidebar.collapse`),vu(`Mod+B`)),children:L(j?nc:Re?wo:So,{size:17})})]}),z(`div`,{className:`sb-actions`,children:[Re?L(`button`,{type:`button`,className:`sb-nav-item`,onClick:()=>window.dispatchEvent(new CustomEvent(`gaia:focus-search`)),"aria-label":r(`sidebar.search`),children:L(us,{size:16,"aria-hidden":`true`})}):z(`label`,{className:`sb-search`,children:[L(us,{size:14,"aria-hidden":`true`}),L(`input`,{ref:he,type:`search`,value:ne,onChange:e=>k(e.target.value),onKeyDown:Ie,onFocus:e=>{e.relatedTarget instanceof HTMLElement&&(M.current=e.relatedTarget)},...Nt,placeholder:r.bare(`sidebar.search`),"aria-label":r.hint(r(`sidebar.search`),vu(`Mod+K`)),"aria-controls":`sb-chat-list`,"aria-activedescendant":we?jd(we.id):void 0,dir:`auto`})]}),L(`p`,{className:`sb-sr-only`,role:`status`,"aria-live":`polite`,children:_e&&!ve?Ce.length===0?r(`sidebar.noMatch`):r.plural(`sidebar.matchCount`,Ce.length):``}),z(`button`,{type:`button`,className:`sb-nav-item`,onClick:()=>{e(),Pe()},title:r.hint(r(`sidebar.newChat`),vu(`Mod+Shift+O`)),children:[L(Ps,{size:16,"aria-hidden":`true`}),!Re&&L(`span`,{children:r(`sidebar.newChat`)})]}),He.map(({key:e,label:t,icon:n,on:r,onClick:i})=>z(`button`,{type:`button`,className:`sb-nav-item${r?` is-active`:``}`,onClick:i,"aria-current":r?`page`:void 0,"aria-label":t,title:Re?t:void 0,children:[L(n,{size:16,"aria-hidden":`true`}),!Re&&L(`span`,{children:t})]},e))]}),!Re&&z(`nav`,{className:`sb-list`,id:`sb-chat-list`,"aria-label":r(`sidebar.recent`),children:[Se.length===0&&L(`p`,{className:`sb-empty`,children:r(_e?ve?`sidebar.searching`:`sidebar.noMatch`:`sidebar.empty`)}),Se.map(e=>z(`section`,{className:`sb-group${e.label===`Needs you`?` is-needs-you`:``}`,children:[L(`h2`,{className:`sb-group-label`,children:r(Td[e.label])}),L(`ul`,{children:e.sessions.map(e=>L(Md,{session:e,active:e.id===a&&!E,phone:j,moved:e.id===Oe,focusPin:e.id===Ae,status:tu(e,ge),queuePlace:s.indexOf(e.id)+1,unsent:l[e.id]?.length??0,failed:l[e.id]?.filter(e=>e.state===`failed`).length??0,onSelect:Fe,onDelete:Le,onPin:(e,t,n,r)=>{n&&ke(e),r&&je(e),Me(e,t)},onRename:(e,t)=>void Ne(e,t),rowId:_e?jd(e.id):void 0,kbdActive:we?.id===e.id,titleMatch:_e?Vu(e.title,_e):null,snippet:ye.get(e.id)?.field===`message`?ye.get(e.id).snippet:null},e.id))})]},e.label)),be>0&&L(`button`,{type:`button`,className:`sb-filter`,onClick:Te,"aria-pressed":pe,children:pe?r(`sidebar.hideBackground`):r.plural(`sidebar.showBackground`,be)}),_e&&ie?.query===_e&&ie.truncated&&L(`p`,{className:`sb-empty`,children:r(`sidebar.searchCapped`,{n:ie.results.length})}),A&&L(`p`,{className:`sb-error`,role:`alert`,children:A}),le&&L(`p`,{className:`sb-error`,role:`alert`,children:le}),de&&L(`p`,{className:`sb-error`,role:`alert`,children:de})]}),!Re&&L(Sl,{}),z(`div`,{className:`sb-bottom`,children:[!Re&&L(hl,{}),z(`div`,{className:`sb-bottom-actions`,children:[z(`button`,{type:`button`,className:`sb-icon-btn${ee?` is-active`:``}`,onClick:()=>te(!ee),"aria-label":O>0?r(`sidebar.notificationsUnread`,{n:O}):r(`sidebar.notifications`),"aria-expanded":ee,title:r(`sidebar.notifications`),children:[L(Nr,{size:16}),O>0&&L(`span`,{className:`sb-badge`,"aria-hidden":`true`,children:O>99?`99+`:O})]}),t&&L(`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:L(Es,{size:16})}),L(`button`,{type:`button`,className:`sb-icon-btn`,onClick:()=>x(),"aria-label":r(`sidebar.settings`),title:r.hint(r(`sidebar.settings`),vu(`Mod+,`)),children:L(ms,{size:16})})]})]})]})}function Pd(e,t){let n=(0,B.useRef)(e),r=(0,B.useRef)(t);r.current=t,(0,B.useEffect)(()=>{let t=n.current&&!e;n.current=e,t&&r.current()},[e])}var Fd=2e3;function Id(e,t,n){let r=(0,B.useRef)(n);r.current=n;let[i,a]=(0,B.useState)(0);(0,B.useEffect)(()=>{if(!e||!t)return;let n=window.setTimeout(()=>{r.current(),a(e=>e+1)},Fd);return()=>window.clearTimeout(n)},[e,t,i])}function Ld(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Rd=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zd=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bd={};function Vd(e,t){return((t||Bd).jsx?zd:Rd).test(e)}var Hd=/[ \t\n\f\r]/g;function Ud(e){return typeof e==`object`?e.type===`text`&&Wd(e.value):Wd(e)}function Wd(e){return e.replace(Hd,``)===``}var Gd=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Gd.prototype.normal={},Gd.prototype.property={},Gd.prototype.space=void 0;function Kd(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Gd(n,r,t)}function qd(e){return e.toLowerCase()}var Jd=class{constructor(e,t){this.attribute=t,this.property=e}};Jd.prototype.attribute=``,Jd.prototype.booleanish=!1,Jd.prototype.boolean=!1,Jd.prototype.commaOrSpaceSeparated=!1,Jd.prototype.commaSeparated=!1,Jd.prototype.defined=!1,Jd.prototype.mustUseProperty=!1,Jd.prototype.number=!1,Jd.prototype.overloadedBoolean=!1,Jd.prototype.property=``,Jd.prototype.spaceSeparated=!1,Jd.prototype.space=void 0;var Yd=e({boolean:()=>Zd,booleanish:()=>Qd,commaOrSpaceSeparated:()=>nf,commaSeparated:()=>tf,number:()=>H,overloadedBoolean:()=>$d,spaceSeparated:()=>ef}),Xd=0,Zd=rf(),Qd=rf(),$d=rf(),H=rf(),ef=rf(),tf=rf(),nf=rf();function rf(){return 2**++Xd}var af=Object.keys(Yd),of=class extends Jd{constructor(e,t,n,r){let i=-1;if(super(e,t),sf(this,`space`,r),typeof n==`number`)for(;++i<af.length;){let e=af[i];sf(this,af[i],(n&Yd[e])===Yd[e])}}};of.prototype.defined=!0;function sf(e,t,n){n&&(e[t]=n)}function cf(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new of(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[qd(r)]=r,n[qd(a.attribute)]=r}return new Gd(t,n,e.space)}var lf=cf({properties:{ariaActiveDescendant:null,ariaAtomic:Qd,ariaAutoComplete:null,ariaBusy:Qd,ariaChecked:Qd,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:ef,ariaCurrent:null,ariaDescribedBy:ef,ariaDetails:null,ariaDisabled:Qd,ariaDropEffect:ef,ariaErrorMessage:null,ariaExpanded:Qd,ariaFlowTo:ef,ariaGrabbed:Qd,ariaHasPopup:null,ariaHidden:Qd,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ef,ariaLevel:H,ariaLive:null,ariaModal:Qd,ariaMultiLine:Qd,ariaMultiSelectable:Qd,ariaOrientation:null,ariaOwns:ef,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:Qd,ariaReadOnly:Qd,ariaRelevant:null,ariaRequired:Qd,ariaRoleDescription:ef,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:Qd,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function uf(e,t){return t in e?e[t]:t}function df(e,t){return uf(e,t.toLowerCase())}var ff=cf({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:tf,acceptCharset:ef,accessKey:ef,action:null,allow:null,allowFullScreen:Zd,allowPaymentRequest:Zd,allowUserMedia:Zd,alt:null,as:null,async:Zd,autoCapitalize:null,autoComplete:ef,autoFocus:Zd,autoPlay:Zd,blocking:ef,capture:null,charSet:null,checked:Zd,cite:null,className:ef,cols:H,colSpan:null,content:null,contentEditable:Qd,controls:Zd,controlsList:ef,coords:H|tf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Zd,defer:Zd,dir:null,dirName:null,disabled:Zd,download:$d,draggable:Qd,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Zd,formTarget:null,headers:ef,height:H,hidden:$d,high:H,href:null,hrefLang:null,htmlFor:ef,httpEquiv:ef,id:null,imageSizes:null,imageSrcSet:null,inert:Zd,inputMode:null,integrity:null,is:null,isMap:Zd,itemId:null,itemProp:ef,itemRef:ef,itemScope:Zd,itemType:ef,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Zd,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:Zd,muted:Zd,name:null,nonce:null,noModule:Zd,noValidate:Zd,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:Zd,optimum:H,pattern:null,ping:ef,placeholder:null,playsInline:Zd,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Zd,referrerPolicy:null,rel:ef,required:Zd,reversed:Zd,rows:H,rowSpan:H,sandbox:ef,scope:null,scoped:Zd,seamless:Zd,selected:Zd,shadowRootClonable:Zd,shadowRootDelegatesFocus:Zd,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:Qd,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:Zd,useMap:null,value:Qd,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ef,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Zd,declare:Zd,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:Zd,noHref:Zd,noShade:Zd,noWrap:Zd,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:Qd,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Zd,disableRemotePlayback:Zd,prefix:null,property:null,results:H,security:null,unselectable:null},space:`html`,transform:df}),pf=cf({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:nf,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:ef,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:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:Zd,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,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:tf,g2:tf,glyphName:tf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:nf,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,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:H,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:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ef,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nf,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nf,rev:nf,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nf,requiredFeatures:nf,requiredFonts:nf,requiredFormats:nf,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:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:nf,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nf,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nf,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:uf}),mf=cf({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()}}),hf=cf({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:df}),gf=cf({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),_f={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`},vf=/[A-Z]/g,yf=/-[a-z]/g,bf=/^data[-\w.:]+$/i;function xf(e,t){let n=qd(t),r=t,i=Jd;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&bf.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(yf,Cf);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!yf.test(e)){let n=e.replace(vf,Sf);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=of}return new i(r,t)}function Sf(e){return`-`+e.toLowerCase()}function Cf(e){return e.charAt(1).toUpperCase()}var wf=Kd([lf,ff,mf,hf,gf],`html`),Tf=Kd([lf,pf,mf,hf,gf],`svg`);function Ef(e){return e.join(` `).trim()}var Df=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(`
|
|
16
|
-
`);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})),Of=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(Df());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}})),kf=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))}})),Af=n(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Of()),i=kf();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})),jf=Nf(`end`),Mf=Nf(`start`);function Nf(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 Pf(e){let t=Mf(e),n=jf(e);if(t&&n)return{start:t,end:n}}function Ff(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Lf(e.position):`start`in e||`end`in e?Lf(e):`line`in e||`column`in e?If(e):``}function If(e){return Rf(e&&e.line)+`:`+Rf(e&&e.column)}function Lf(e){return If(e&&e.start)+`-`+If(e&&e.end)}function Rf(e){return e&&typeof e==`number`?e:1}var zf=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=Ff(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}};zf.prototype.file=``,zf.prototype.name=``,zf.prototype.reason=``,zf.prototype.message=``,zf.prototype.stack=``,zf.prototype.column=void 0,zf.prototype.line=void 0,zf.prototype.ancestors=void 0,zf.prototype.cause=void 0,zf.prototype.fatal=void 0,zf.prototype.place=void 0,zf.prototype.ruleId=void 0,zf.prototype.source=void 0;var Bf=t(Af(),1),Vf={}.hasOwnProperty,Hf=new Map,Uf=/[A-Z]/g,Wf=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Gf=new Set([`td`,`th`]),Kf=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function qf(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=ip(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=rp(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`?Tf:wf,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Jf(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Jf(e,t,n){if(t.type===`element`)return Yf(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Xf(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Qf(e,t,n);if(t.type===`mdxjsEsm`)return Zf(e,t);if(t.type===`root`)return $f(e,t,n);if(t.type===`text`)return ep(e,t)}function Yf(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Tf,e.schema=i),e.ancestors.push(t);let a=up(e,t.tagName,!1),o=ap(e,t),s=sp(e,t);return Wf.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Ud(e)})),tp(e,o,a,t),np(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Xf(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)}dp(e,t.position)}function Zf(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);dp(e,t.position)}function Qf(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Tf,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:up(e,t.name,!0),o=op(e,t),s=sp(e,t);return tp(e,o,a,t),np(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function $f(e,t,n){let r={};return np(r,sp(e,t)),e.create(t,e.Fragment,r,n)}function ep(e,t){return t.value}function tp(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function np(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function rp(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 ip(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Mf(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 ap(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Vf.call(t.properties,i)){let a=cp(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Gf.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 op(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 dp(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 dp(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function sp(e,t){let n=[],r=-1,i=e.passKeys?new Map:Hf;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=Jf(e,a,o);s!==void 0&&n.push(s)}return n}function cp(e,t,n){let r=xf(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ld(n):Ef(n)),r.property===`style`){let t=typeof n==`object`?n:lp(e,String(n));return e.stylePropertyNameCase===`css`&&(t=fp(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?_f[r.property]||r.property:r.attribute,n]}}function lp(e,t){try{return(0,Bf.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new zf("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=Kf+`#cannot-parse-style-attribute`,r}}function up(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=Vd(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=Vd(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Vf.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);dp(e)}function dp(e,t){let n=new zf("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=Kf+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function fp(e){let t={},n;for(n in e)Vf.call(e,n)&&(t[pp(n)]=e[n]);return t}function pp(e){let t=e.replace(Uf,mp);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function mp(e){return`-`+e.toLowerCase()}var hp={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`]},gp={};function _p(e,t){let n=t||gp;return vp(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function vp(e,t,n){if(bp(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 yp(e.children,t,n)}return Array.isArray(e)?yp(e,t,n):``}function yp(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=vp(e[i],t,n);return r.join(``)}function bp(e){return!!(e&&typeof e==`object`)}var xp=document.createElement(`i`);function Sp(e){let t=`&`+e+`;`;xp.innerHTML=t;let n=xp.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Cp(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 wp(e,t){return e.length>0?(Cp(e,e.length,0,t),e):t}var Tp={}.hasOwnProperty;function Ep(e){let t={},n=-1;for(;++n<e.length;)Dp(t,e[n]);return t}function Dp(e,t){let n;for(n in t){let r=(Tp.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Tp.call(r,a)||(r[a]=[]);let e=i[a];Op(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Op(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Cp(e,0,0,r)}function kp(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 Ap(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var jp=Up(/[A-Za-z]/),Mp=Up(/[\dA-Za-z]/),Np=Up(/[#-'*+\--9=?A-Z^-~]/);function Pp(e){return e!==null&&(e<32||e===127)}var Fp=Up(/\d/),Ip=Up(/[\dA-Fa-f]/),Lp=Up(/[!-/:-@[-`{-~]/);function Rp(e){return e!==null&&e<-2}function zp(e){return e!==null&&(e<0||e===32)}function Bp(e){return e===-2||e===-1||e===32}var Vp=Up(/\p{P}|\p{S}/u),Hp=Up(/\s/);function Up(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Wp(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Mp(e.charCodeAt(n+1))&&Mp(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 Gp(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Bp(r)?(e.enter(n),s(r)):t(r)}function s(r){return Bp(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Kp={tokenize:qp};function qp(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`),Gp(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 Rp(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Jp={tokenize:Xp},Yp={tokenize:Zp};function Xp(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 Cp(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(Yp,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(Yp,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 Rp(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++;Cp(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 Zp(e,t,n){return Gp(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Qp(e){if(e===null||zp(e)||Hp(e))return 1;if(Vp(e))return 2}function $p(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 em={name:`attention`,resolveAll:tm,tokenize:nm};function tm(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};rm(d,-c),rm(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=wp(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=wp(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=wp(l,$p(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=wp(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=wp(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Cp(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 nm(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qp(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=Qp(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 rm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var im={name:`autolink`,tokenize:am};function am(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 jp(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Mp(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||Mp(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||Pp(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Np(t)?(e.consume(t),l):n(t)}function u(e){return Mp(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||Mp(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var om={partial:!0,tokenize:sm};function sm(e,t,n){return r;function r(t){return Bp(t)?Gp(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Rp(e)?t(e):n(e)}}var cm={continuation:{tokenize:um},exit:dm,name:`blockQuote`,tokenize:lm};function lm(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 Bp(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function um(e,t,n){let r=this;return i;function i(t){return Bp(t)?Gp(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(cm,t,n)(r)}}function dm(e){e.exit(`blockQuote`)}var fm={name:`characterEscape`,tokenize:pm};function pm(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 Lp(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var mm={name:`characterReference`,tokenize:hm};function hm(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=Mp,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=Ip,u):(e.enter(`characterReferenceValue`),a=7,o=Fp,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Mp&&!Sp(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 gm={partial:!0,tokenize:ym},_m={concrete:!0,name:`codeFenced`,tokenize:vm};function vm(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`),Bp(t)?Gp(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Rp(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(gm,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Rp(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Bp(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Gp(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Rp(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Rp(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&&Bp(t)?Gp(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Rp(t)?e.check(gm,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Rp(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`),Bp(t)?Gp(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`),Bp(t)?Gp(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Rp(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function ym(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 bm={name:`codeIndented`,tokenize:Sm},xm={partial:!0,tokenize:Cm};function Sm(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Gp(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):Rp(t)?e.attempt(xm,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Rp(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Cm(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Rp(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Gp(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):Rp(e)?i(e):n(e)}}var wm={name:`codeText`,previous:Em,resolve:Tm,tokenize:Dm};function Tm(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 Em(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Dm(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)):Rp(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||Rp(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 Om=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&&km(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),km(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),km(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);km(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);km(this.left,t.reverse())}}}};function km(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 Am(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Om(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,jm(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 Cp(e,0,1/0,u.slice(0)),!l}function jm(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 Mm={resolve:Pm,tokenize:Fm},Nm={partial:!0,tokenize:Im};function Pm(e){return Am(e),e}function Fm(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):Rp(t)?e.check(Nm,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 Im(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Gp(e,a,`linePrefix`)}function a(i){if(i===null||Rp(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 Lm(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||Pp(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||Rp(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||zp(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||Pp(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 Rm(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):Rp(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||Rp(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Bp(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function zm(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):Rp(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Gp(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Rp(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 Bm(e,t){let n;return r;function r(i){return Rp(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Bp(i)?Gp(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Vm={name:`definition`,tokenize:Um},Hm={partial:!0,tokenize:Wm};function Um(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Rm.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Ap(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 zp(t)?Bm(e,l)(t):l(t)}function l(t){return Lm(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Hm,d,d)(t)}function d(t){return Bp(t)?Gp(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Rp(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Wm(e,t,n){return r;function r(t){return zp(t)?Bm(e,i)(t):n(t)}function i(t){return zm(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Bp(t)?Gp(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Rp(e)?t(e):n(e)}}var Gm={name:`hardBreakEscape`,tokenize:Km};function Km(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Rp(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var qm={name:`headingAtx`,resolve:Jm,tokenize:Ym};function Jm(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`},Cp(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Ym(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||zp(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Rp(n)?(e.exit(`atxHeading`),t(n)):Bp(n)?Gp(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||zp(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Xm=`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(`.`),Zm=[`pre`,`script`,`style`,`textarea`],Qm={concrete:!0,name:`htmlFlow`,resolveTo:th,tokenize:nh},$m={partial:!0,tokenize:ih},eh={partial:!0,tokenize:rh};function th(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 nh(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:A):jp(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):jp(a)?(e.consume(a),i=4,r.interrupt?t:A):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:A):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 jp(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||zp(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Zm.includes(l)?(i=1,r.interrupt?t(s):O(s)):Xm.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||Mp(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 Bp(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||jp(t)?(e.consume(t),b):Bp(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Mp(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Bp(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):Bp(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Rp(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||zp(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Bp(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Rp(t)?O(t):Bp(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),re):t===60&&i===1?(e.consume(t),k):t===62&&i===4?(e.consume(t),oe):t===63&&i===3?(e.consume(t),A):t===93&&i===5?(e.consume(t),ae):Rp(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check($m,se,ee)(t)):t===null||Rp(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(eh,te,se)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return t===null||Rp(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function re(t){return t===45?(e.consume(t),A):O(t)}function k(t){return t===47?(e.consume(t),o=``,ie):O(t)}function ie(t){if(t===62){let n=o.toLowerCase();return Zm.includes(n)?(e.consume(t),oe):O(t)}return jp(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ie):O(t)}function ae(t){return t===93?(e.consume(t),A):O(t)}function A(t){return t===62?(e.consume(t),oe):t===45&&i===2?(e.consume(t),A):O(t)}function oe(t){return t===null||Rp(t)?(e.exit(`htmlFlowData`),se(t)):(e.consume(t),oe)}function se(n){return e.exit(`htmlFlow`),t(n)}}function rh(e,t,n){let r=this;return i;function i(t){return Rp(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 ih(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(om,t,n)}}var ah={name:`htmlText`,tokenize:oh};function oh(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):jp(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):jp(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):Rp(t)?(o=d,k(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?re(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):Rp(t)?(o=h,k(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?re(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?re(t):Rp(t)?(o=v,k(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Rp(t)?(o=y,k(t)):(e.consume(t),y)}function b(e){return e===62?re(e):y(e)}function x(t){return jp(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Mp(t)?(e.consume(t),S):C(t)}function C(t){return Rp(t)?(o=C,k(t)):Bp(t)?(e.consume(t),C):re(t)}function w(t){return t===45||Mp(t)?(e.consume(t),w):t===47||t===62||zp(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),re):t===58||t===95||jp(t)?(e.consume(t),E):Rp(t)?(o=T,k(t)):Bp(t)?(e.consume(t),T):re(t)}function E(t){return t===45||t===46||t===58||t===95||Mp(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Rp(t)?(o=D,k(t)):Bp(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,ee):Rp(t)?(o=O,k(t)):Bp(t)?(e.consume(t),O):(e.consume(t),te)}function ee(t){return t===i?(e.consume(t),i=void 0,ne):t===null?n(t):Rp(t)?(o=ee,k(t)):(e.consume(t),ee)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||zp(t)?T(t):(e.consume(t),te)}function ne(e){return e===47||e===62||zp(e)?T(e):n(e)}function re(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function k(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return Bp(t)?Gp(e,ae,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ae(t)}function ae(t){return e.enter(`htmlTextData`),o(t)}}var sh={name:`labelEnd`,resolveAll:dh,resolveTo:fh,tokenize:ph},ch={tokenize:mh},lh={tokenize:hh},uh={tokenize:gh};function dh(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&&Cp(e,0,e.length,n),e}function fh(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=wp(s,e.slice(a+1,a+r+3)),s=wp(s,[[`enter`,u,t]]),s=wp(s,$p(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=wp(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=wp(s,e.slice(o+1)),s=wp(s,[[`exit`,c,t]]),Cp(e,a,e.length,s),e}function ph(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(Ap(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(ch,u,o?u:d)(t):t===91?e.attempt(lh,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(uh,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function mh(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 zp(t)?Bm(e,a)(t):a(t)}function a(t){return t===41?u(t):Lm(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return zp(t)?Bm(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?zm(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return zp(t)?Bm(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 hh(e,t,n){let r=this;return i;function i(t){return Rm.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Ap(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function gh(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 _h={name:`labelStartImage`,resolveAll:sh.resolveAll,tokenize:vh};function vh(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 yh={name:`labelStartLink`,resolveAll:sh.resolveAll,tokenize:bh};function bh(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 xh={name:`lineEnding`,tokenize:Sh};function Sh(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Gp(e,t,`linePrefix`)}}var Ch={name:`thematicBreak`,tokenize:wh};function wh(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||Rp(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Bp(t)?Gp(e,s,`whitespace`)(t):s(t))}}var Th={continuation:{tokenize:kh},exit:jh,name:`list`,tokenize:Oh},Eh={partial:!0,tokenize:Mh},Dh={partial:!0,tokenize:Ah};function Oh(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:Fp(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(Ch,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 Fp(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(om,r.interrupt?n:u,e.attempt(Eh,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Bp(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 kh(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(om,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Gp(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Bp(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(Dh,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Gp(e,e.attempt(Th,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ah(e,t,n){let r=this;return Gp(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 jh(e){e.exit(this.containerState.type)}function Mh(e,t,n){let r=this;return Gp(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!Bp(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Nh={name:`setextUnderline`,resolveTo:Ph,tokenize:Fh};function Ph(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 Fh(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`),Bp(t)?Gp(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Rp(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Ih={tokenize:Lh};function Lh(e){let t=this,n=e.attempt(om,r,e.attempt(this.parser.constructs.flowInitial,i,Gp(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Mm,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 Rh={resolveAll:Hh()},zh=Vh(`string`),Bh=Vh(`text`);function Vh(e){return{resolveAll:Hh(e===`text`?Uh: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 Hh(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 Uh(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 Wh=e({attentionMarkers:()=>Qh,contentInitial:()=>Kh,disable:()=>$h,document:()=>Gh,flow:()=>Jh,flowInitial:()=>qh,insideSpan:()=>Zh,string:()=>Yh,text:()=>Xh}),Gh={42:Th,43:Th,45:Th,48:Th,49:Th,50:Th,51:Th,52:Th,53:Th,54:Th,55:Th,56:Th,57:Th,62:cm},Kh={91:Vm},qh={[-2]:bm,[-1]:bm,32:bm},Jh={35:qm,42:Ch,45:[Nh,Ch],60:Qm,61:Nh,95:Ch,96:_m,126:_m},Yh={38:mm,92:fm},Xh={[-5]:xh,[-4]:xh,[-3]:xh,33:_h,38:mm,42:em,60:[im,ah],91:yh,92:[Gm,fm],93:sh,95:em,96:wm},Zh={null:[em,Rh]},Qh={null:[42,95]},$h={null:[]};function eg(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=wp(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=$p(a,l.events,l),l.events):[]}function f(e,t){return ng(p(e),t)}function p(e){return tg(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){Rp(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&&Cp(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 tg(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 ng(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=`
|
|
17
|
-
`;break;case-3:o=`\r
|
|
18
|
-
`;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 rg(e){let t={constructs:Ep([Wh,...(e||{}).extensions||[]]),content:n(Kp),defined:[],document:n(Jp),flow:n(Ih),lazy:{},string:n(zh),text:n(Bh)};return t;function n(e){return n;function n(n){return eg(t,e,n)}}}function ig(e){for(;!Am(e););return e}var ag=/[\0\t\n\r]/g;function og(){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(ag.lastIndex=u,c=ag.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 sg=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function cg(e){return e.replace(sg,lg)}function lg(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return kp(n.slice(t?2:1),t?16:10)}return Sp(n)||e}var ug={}.hasOwnProperty;function dg(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),fg(n)(ig(rg(n).document().write(og()(e,t,!0))))}function fg(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Se),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ve),blockQuote:a(j),characterEscape:T,characterReference:T,codeFenced:a(he),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(he,o),codeText:a(M,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(_e),hardBreakEscape:a(ye),hardBreakTrailing:a(ye),htmlFlow:a(be,o),htmlFlowData:T,htmlText:a(be,o),htmlTextData:T,image:a(xe),label:o,link:a(Se),listItem:a(we),listItemValue:f,listOrdered:a(Ce,d),listUnordered:a(Ce),paragraph:a(Te),reference:ce,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ve),strong:a(Ee),thematicBreak:a(Oe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:me,autolinkProtocol:pe,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:de,characterReference:fe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ne),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(ee),htmlFlowData:E,htmlText:c(te),htmlTextData:E,image:c(k),label:ae,labelText:ie,lineEnding:D,link:c(re),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:le,resourceDestinationString:A,resourceTitleString:oe,resource:se,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};mg(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]];ug.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]||gg).call(a,void 0,e[0])}for(r.position={start:pg(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:pg(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:pg(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]||gg).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Ff({start:e.start,end:e.end})+`): it’s not open`);n.position.end=pg(e.end)}function u(){return _p(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=Ap(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=De(),n.position={start:pg(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=pg(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=pg(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 ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){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 k(){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 ie(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=cg(t),n.identifier=Ap(t).toLowerCase()}function ae(){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 A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function oe(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function se(){this.data.inReference=void 0}function ce(){this.data.referenceType=`collapsed`}function le(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ap(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ue(e){this.data.characterReferenceType=e.type}function de(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=kp(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Sp(t);let i=this.stack[this.stack.length-1];i.value+=r}function fe(e){let t=this.stack.pop();t.position.end=pg(e.end)}function pe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function me(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function j(){return{type:`blockquote`,children:[]}}function he(){return{type:`code`,lang:null,meta:null,value:``}}function M(){return{type:`inlineCode`,value:``}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function _e(){return{type:`emphasis`,children:[]}}function ve(){return{type:`heading`,depth:0,children:[]}}function ye(){return{type:`break`}}function be(){return{type:`html`,value:``}}function xe(){return{type:`image`,title:null,url:``,alt:null}}function Se(){return{type:`link`,title:null,url:``,children:[]}}function Ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function we(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Te(){return{type:`paragraph`,children:[]}}function Ee(){return{type:`strong`,children:[]}}function De(){return{type:`text`,value:``}}function Oe(){return{type:`thematicBreak`}}}function pg(e){return{line:e.line,column:e.column,offset:e.offset}}function mg(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?mg(e,r):hg(e,r)}}function hg(e,t){let n;for(n in t)if(ug.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 gg(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Ff({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ff({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Ff({start:t.start,end:t.end})+`) is still open`)}function _g(e){let t=this;t.parser=n;function n(n){return dg(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function vg(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 yg(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
19
|
-
`}]}function bg(e,t){let n=t.value?t.value+`
|
|
20
|
-
`:``,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 xg(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Sg(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Cg(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Wp(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 wg(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 Tg(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Eg(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 Dg(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Eg(e,t);let i={src:Wp(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 Og(e,t){let n={src:Wp(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 kg(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 Ag(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Eg(e,t);let i={href:Wp(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 jg(e,t){let n={href:Wp(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 Mg(e,t,n){let r=e.all(t),i=n?Ng(n):Pg(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:`
|
|
21
|
-
`}),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:`
|
|
22
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Ng(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Pg(n[r])}return t}function Pg(e){return e.spread??e.children.length>1}function Fg(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 Ig(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Lg(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Rg(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zg(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=Mf(t.children[1]),o=jf(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 Bg(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 Vg(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Hg=9,Ug=32;function Wg(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Gg(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Gg(t.slice(i),i>0,!1)),a.join(``)}function Gg(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Hg||t===Ug;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Hg||t===Ug;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Kg(e,t){let n={type:`text`,value:Wg(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function qg(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Jg={blockquote:vg,break:yg,code:bg,delete:xg,emphasis:Sg,footnoteReference:Cg,heading:wg,html:Tg,imageReference:Dg,image:Og,inlineCode:kg,linkReference:Ag,link:jg,listItem:Mg,list:Fg,paragraph:Ig,root:Lg,strong:Rg,table:zg,tableCell:Vg,tableRow:Bg,text:Kg,thematicBreak:qg,toml:Yg,yaml:Yg,definition:Yg,footnoteDefinition:Yg};function Yg(){}var Xg=typeof self==`object`?self:globalThis,Zg=(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 Xg[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 Xg[a](o),i)};return r},Qg=e=>Zg(new Map,e)(0),$g=``,{toString:e_}={},{keys:t_}=Object,n_=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=e_.call(e).slice(8,-1);switch(n){case`Array`:return[1,$g];case`Object`:return[2,$g];case`Date`:return[3,$g];case`RegExp`:return[4,$g];case`Map`:return[5,$g];case`Set`:return[6,$g];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},r_=([e,t])=>e===0&&(t===`function`||t===`symbol`),i_=(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]=n_(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 t_(r))(e||!r_(n_(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||!(r_(n_(n))||r_(n_(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!r_(n_(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},a_=(e,{json:t,lossy:n}={})=>{let r=[];return i_(!(t||n),!!t,new Map,r)(e),r},o_=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Qg(a_(e,t)):structuredClone(e):(e,t)=>Qg(a_(e,t));function s_(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 c_(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function l_(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||s_,r=e.options.footnoteBackLabel||c_,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=Wp(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:{...o_(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
23
|
-
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
24
|
-
`}]}}var u_=(function(e){if(e==null)return h_;if(typeof e==`function`)return m_(e);if(typeof e==`object`)return Array.isArray(e)?d_(e):f_(e);if(typeof e==`string`)return p_(e);throw Error(`Expected function, string, or object as test`)});function d_(e){let t=[],n=-1;for(;++n<e.length;)t[n]=u_(e[n]);return m_(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function f_(e){let t=e;return m_(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function p_(e){return m_(t);function t(t){return t&&t.type===e}}function m_(e){return t;function t(t,n,r){return!!(g_(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function h_(){return!0}function g_(e){return typeof e==`object`&&!!e&&`type`in e}function __(e){return e}var v_=[];function y_(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=u_(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 (`+__(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=v_,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=b_(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 b_(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?v_:[e]}function x_(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),y_(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 S_={}.hasOwnProperty,C_={};function w_(e,t){let n=t||C_,r=new Map,i=new Map,a={all:s,applyData:E_,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Jg,...n.handlers},one:o,options:n,patch:T_,wrap:O_};return x_(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(S_.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=o_(n);return r.children=a.all(e),r}return o_(e)}return(a.options.unknownHandler||D_)(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=k_(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=k_(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function T_(e,t){e.position&&(t.position=Pf(e))}function E_(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,o_(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function D_(e,t){let n=t.data||{},r=`value`in t&&!(S_.call(n,`hProperties`)||S_.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 O_(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
25
|
-
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
26
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
27
|
-
`}),n}function k_(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function A_(e,t){let n=w_(e,t),r=n.one(e,void 0),i=l_(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
28
|
-
`},i)),a}function j_(e,t){return e&&`run`in e?async function(n,r){let i=A_(n,{file:r,...t});await e.run(i,r)}:function(n,r){return A_(n,{file:r,...e||t})}}function M_(e){if(e)throw e}var N_=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 P_(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 F_(){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?I_(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 I_(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 L_={basename:R_,dirname:z_,extname:B_,join:V_,sep:`/`};function R_(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);W_(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 z_(e){if(W_(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 B_(e){W_(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 V_(...e){let t=-1,n;for(;++t<e.length;)W_(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:H_(n)}function H_(e){W_(e);let t=e.codePointAt(0)===47,n=U_(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function U_(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 W_(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var G_={cwd:K_};function K_(){return`/`}function q_(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function J_(e){if(typeof e==`string`)e=new URL(e);else if(!q_(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 Y_(e)}function Y_(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 X_=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Z_=class{constructor(e){let t;t=e?q_(e)?{path:e}:typeof e==`string`||tv(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:G_.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<X_.length;){let e=X_[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)X_.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?L_.basename(this.path):void 0}set basename(e){$_(e,`basename`),Q_(e,`basename`),this.path=L_.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?L_.dirname(this.path):void 0}set dirname(e){ev(this.basename,`dirname`),this.path=L_.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?L_.extname(this.path):void 0}set extname(e){if(Q_(e,`extname`),ev(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=L_.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){q_(e)&&(e=J_(e)),$_(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?L_.basename(this.path,this.extname):void 0}set stem(e){$_(e,`stem`),Q_(e,`stem`),this.path=L_.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 zf(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 Q_(e,t){if(e&&e.includes(L_.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+L_.sep+"`")}function $_(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function ev(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function tv(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var nv=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),rv=t(N_(),1),iv={}.hasOwnProperty,av=new class e extends nv{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=F_()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,rv.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(cv(`data`,this.frozen),this.namespace[e]=t,this):iv.call(this.namespace,e)&&this.namespace[e]||void 0:e?(cv(`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=dv(e),n=this.parser||this.Parser;return ov(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),ov(`process`,this.parser||this.Parser),sv(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=dv(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);pv(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(),ov(`processSync`,this.parser||this.Parser),sv(`processSync`,this.compiler||this.Compiler),this.process(e,r),uv(`processSync`,`process`,t),n;function r(e,r){t=!0,M_(e),n=r}}run(e,t,n){lv(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=dv(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),uv(`runSync`,`run`,n),r;function i(e,t){M_(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=dv(t),r=this.compiler||this.Compiler;return sv(`stringify`,r),lv(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(cv(`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,rv.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];P_(o)&&P_(r)&&(r=(0,rv.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function ov(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function sv(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function cv(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 lv(e){if(!P_(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function uv(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function dv(e){return fv(e)?e:new Z_(e)}function fv(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function pv(e){return typeof e==`string`||mv(e)}function mv(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var hv=wt(),gv=[],_v={allowDangerousHtml:!0},vv=/^(https?|ircs?|mailto|xmpp)$/i,yv=[{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 bv(e){let t=xv(e),n=Sv(e);return Cv(t.runSync(t.parse(n),n),e)}function xv(e){let t=e.rehypePlugins||gv,n=e.remarkPlugins||gv,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,..._v}:_v;return av().use(_g).use(n).use(j_,r).use(t)}function Sv(e){let t=e.children||``,n=new Z_;return typeof t==`string`?n.value=t:``+t,n}function Cv(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||wv;for(let e of yv)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return x_(e,l),qf(e,{Fragment:hv.Fragment,components:i,ignoreInvalidStyle:!0,jsx:hv.jsx,jsxs:hv.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 hp)if(Object.hasOwn(hp,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=hp[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 wv(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||vv.test(e.slice(0,t))?e:``}var Tv=[`script`,`iframe`,`object`,`embed`,`style`],Ev=String.raw`(?:[A-Za-z0-9._~-]|%[0-9A-Fa-f]{2})+`,Dv=RegExp(`^/api/files/uploads/(${Ev})$`),Ov=RegExp(`^!?\\[([^\\]\\n]*)\\]\\((/api/files/uploads/${Ev})\\)$`);function kv(e){let t=Dv.exec(e);if(!t)return null;let n;try{n=decodeURIComponent(t[1])}catch{return null}return!n||n.startsWith(`.`)||n!==n.replace(/^[ .]+|[ .]+$/g,``)||/[/\\:\u0000-\u001f\u007f]/.test(n)?null:t[1]}function Av(e){let t=Ov.exec(e);return!t||kv(t[2])===null?null:{name:t[1],markdown:e}}function jv(e){let t=e.split(`
|
|
29
|
-
`),n=t.length;for(;n>0&&Av(t[n-1])!==null;)n--;if(n===t.length||n>0&&t[n-1]!==``)return{text:e,links:[]};let r=t.slice(n).map(e=>Av(e));return{text:t.slice(0,Math.max(0,n-1)).join(`
|
|
30
|
-
`),links:r}}function Mv(e,t){if(t.length===0)return e;let n=t.map(e=>e.markdown).join(`
|
|
31
|
-
`);return e?`${e}\n\n${n}`:n}function Nv(e){if(!e)return``;if(e.startsWith(`#`))return e;let t=kv(e);if(t!==null)return`${Hn()}/files/uploads/${t}`;let n=e.indexOf(`:`);if(n===-1)return``;let r=e.slice(0,n).toLowerCase();return r===`https`||r===`http`||r===`mailto`?e:``}function Pv(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 Fv(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Iv(e,t,n){let r=u_((n||{}).ignore||[]),i=Lv(t),a=-1;for(;++a<i.length;)y_(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 Lv(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([Rv(e[0]),zv(e[1])])}return t}function Rv(e){return typeof e==`string`?new RegExp(Fv(e),`g`):e}function zv(e){return typeof e==`function`?e:function(){return e}}var Bv=`phrasing`,Vv=[`autolink`,`link`,`image`,`label`];function Hv(){return{transforms:[Xv],enter:{literalAutolink:Wv,literalAutolinkEmail:Gv,literalAutolinkHttp:Gv,literalAutolinkWww:Gv},exit:{literalAutolink:Yv,literalAutolinkEmail:Jv,literalAutolinkHttp:Kv,literalAutolinkWww:qv}}}function Uv(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Bv,notInConstruct:Vv},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Bv,notInConstruct:Vv},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Bv,notInConstruct:Vv}]}}function Wv(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Gv(e){this.config.enter.autolinkProtocol.call(this,e)}function Kv(e){this.config.exit.autolinkProtocol.call(this,e)}function qv(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 Jv(e){this.config.exit.autolinkEmail.call(this,e)}function Yv(e){this.exit(e)}function Xv(e){Iv(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Zv],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Qv]],{ignore:[`link`,`linkReference`]})}function Zv(e,t,n,r,i){let a=``;if(!ty(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!$v(n)))return!1;let o=ey(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 Qv(e,t,n,r){return!ty(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function $v(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 ey(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=Pv(e,`(`),a=Pv(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 ty(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Hp(n)||Vp(n))&&(!t||n!==47)}dy.peek=uy;function ny(){this.buffer()}function ry(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function iy(){this.buffer()}function ay(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function oy(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ap(this.sliceSerialize(e)).toLowerCase(),n.label=t}function sy(e){this.exit(e)}function cy(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ap(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ly(e){this.exit(e)}function uy(){return`[`}function dy(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 fy(){return{enter:{gfmFootnoteCallString:ny,gfmFootnoteCall:ry,gfmFootnoteDefinitionLabelString:iy,gfmFootnoteDefinition:ay},exit:{gfmFootnoteCallString:oy,gfmFootnoteCall:sy,gfmFootnoteDefinitionLabelString:cy,gfmFootnoteDefinition:ly}}}function py(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:dy},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?`
|
|
32
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?hy:my))),s(),o}}function my(e,t,n){return t===0?e:hy(e,t,n)}function hy(e,t,n){return(n?``:` `)+e}var gy=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];xy.peek=Sy;function _y(){return{canContainEols:[`delete`],enter:{strikethrough:yy},exit:{strikethrough:by}}}function vy(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:gy}],handlers:{delete:xy}}}function yy(e){this.enter({type:`delete`,children:[]},e)}function by(e){this.exit(e)}function xy(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 Sy(){return`~`}function Cy(e){return e.length}function wy(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Cy,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=Ty(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]=Ey(r[d]);else{let e=Ey(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(`
|
|
33
|
-
`)}function Ty(e){return e==null?``:String(e)}function Ey(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 Dy(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()),Oy);return i(),o}function Oy(e,t,n){return`>`+(n?``:` `)+e}function ky(e,t){return Ay(e,t.inConstruct,!0)&&!Ay(e,t.notInConstruct,!1)}function Ay(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 jy(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
34
|
-
`&&ky(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
35
|
-
`}function My(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 Ny(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 Py(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Fy(e,t,n,r){let i=Py(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(Ny(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,Iy);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(My(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:`
|
|
36
|
-
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
37
|
-
`),a&&(u+=s.move(a+`
|
|
38
|
-
`)),u+=s.move(c),l(),u}function Iy(e,t,n){return(n?``:` `)+e}function Ly(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ry(e,t,n,r){let i=Ly(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?` `:`
|
|
39
|
-
`,...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 zy(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function By(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function Vy(e,t,n){let r=Qp(e),i=Qp(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}}Hy.peek=Uy;function Hy(e,t,n,r){let i=zy(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=Vy(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=By(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Vy(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+By(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Uy(e,t,n){return n.options.emphasis||`*`}function Wy(e,t){let n=!1;return x_(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)&&_p(e)&&(t.options.setext||n))}function Gy(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(Wy(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
40
|
-
`,after:`
|
|
41
|
-
`});return r(),t(),o+`
|
|
42
|
-
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
43
|
-
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
44
|
-
`,...a.current()});return/^[\t ]/.test(l)&&(l=By(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Ky.peek=qy;function Ky(e){return e.value||``}function qy(){return`<`}Jy.peek=Yy;function Jy(e,t,n,r){let i=Ly(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 Yy(){return`!`}Xy.peek=Zy;function Xy(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 Zy(){return`!`}Qy.peek=$y;function Qy(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 $y(){return"`"}function eb(e,t){let n=_p(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))}tb.peek=nb;function tb(e,t,n,r){let i=Ly(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(eb(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 nb(e,t,n){return eb(e,n)?`<`:`[`}rb.peek=ib;function rb(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 ib(){return`[`}function ab(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 ob(e){let t=ab(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 sb(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function cb(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 lb(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?sb(n):ab(n),s=e.ordered?o===`.`?`)`:`.`:ob(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),cb(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 ub(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 db(e,t,n,r){let i=ub(n),a=n.bulletCurrent||ab(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 fb(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var pb=u_([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function mb(e,t,n,r){return(e.children.some(function(e){return pb(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function hb(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}gb.peek=_b;function gb(e,t,n,r){let i=hb(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=Vy(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=By(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Vy(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+By(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function _b(e,t,n){return n.options.strong||`*`}function vb(e,t,n,r){return n.safe(e.value,r)}function yb(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 bb(e,t,n){let r=(cb(n)+(n.options.ruleSpaces?` `:``)).repeat(yb(n));return n.options.ruleSpaces?r.slice(0,-1):r}var xb={blockquote:Dy,break:jy,code:Fy,definition:Ry,emphasis:Hy,hardBreak:jy,heading:Gy,html:Ky,image:Jy,imageReference:Xy,inlineCode:Qy,link:tb,linkReference:rb,list:lb,listItem:db,paragraph:fb,root:mb,strong:gb,text:vb,thematicBreak:bb};function Sb(){return{enter:{table:Cb,tableData:Db,tableHeader:Db,tableRow:Tb},exit:{codeText:Ob,table:wb,tableData:Eb,tableHeader:Eb,tableRow:Eb}}}function Cb(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 wb(e){this.exit(e),this.data.inTable=void 0}function Tb(e){this.enter({type:`tableRow`,children:[]},e)}function Eb(e){this.exit(e)}function Db(e){this.enter({type:`tableCell`,children:[]},e)}function Ob(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,kb));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function kb(e,t){return t===`|`?t:e}function Ab(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
45
|
-
`,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(`
|
|
46
|
-
`))}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 wy(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=xb.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function jb(){return{exit:{taskListCheckValueChecked:Nb,taskListCheckValueUnchecked:Nb,paragraph:Pb}}}function Mb(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Fb}}}function Nb(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Pb(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 Fb(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=xb.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 Ib(){return[Hv(),fy(),_y(),Sb(),jb()]}function Lb(e){return{extensions:[Uv(),py(e),vy(),Ab(e),Mb()]}}var Rb={tokenize:Qb,partial:!0},zb={tokenize:$b,partial:!0},Bb={tokenize:ex,partial:!0},Vb={tokenize:tx,partial:!0},Hb={tokenize:nx,partial:!0},Ub={name:`wwwAutolink`,tokenize:Xb,previous:rx},Wb={name:`protocolAutolink`,tokenize:Zb,previous:ix},Gb={name:`emailAutolink`,tokenize:Yb,previous:ax},Kb={};function qb(){return{text:Kb}}for(var Jb=48;Jb<123;)Kb[Jb]=Gb,Jb++,Jb===58?Jb=65:Jb===91&&(Jb=97);Kb[43]=Gb,Kb[45]=Gb,Kb[46]=Gb,Kb[95]=Gb,Kb[72]=[Gb,Wb],Kb[104]=[Gb,Wb],Kb[87]=[Gb,Ub],Kb[119]=[Gb,Ub];function Yb(e,t,n){let r=this,i,a;return o;function o(t){return!ox(t)||!ax.call(r,r.previous)||sx(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return ox(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Hb,u,l)(t):t===45||t===95||Mp(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&&jp(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Xb(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!rx.call(r,r.previous)||sx(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Rb,e.attempt(zb,e.attempt(Bb,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Zb(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&ix.call(r,r.previous)&&!sx(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(jp(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||Pp(t)||zp(t)||Hp(t)||Vp(t)?n(t):e.attempt(zb,e.attempt(Bb,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Qb(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 $b(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Vb,c,s)(t):t===null||zp(t)||Hp(t)||t!==45&&Vp(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 ex(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(Vb,t,a)(o):o===null||zp(o)||Hp(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function tx(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||zp(o)||Hp(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||zp(e)||Hp(e)?t(e):r(e)}function a(e){return jp(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):jp(t)?(e.consume(t),o):n(t)}}function nx(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Mp(e)?n(e):t(e)}}function rx(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||zp(e)}function ix(e){return!jp(e)}function ax(e){return!(e===47||ox(e))}function ox(e){return e===43||e===45||e===46||e===95||Mp(e)}function sx(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 cx={tokenize:gx,partial:!0};function lx(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:px,continuation:{tokenize:mx},exit:hx}},text:{91:{name:`gfmFootnoteCall`,tokenize:fx},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:ux,resolveTo:dx}}}}function ux(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=Ap(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 dx(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 fx(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||zp(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Ap(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return zp(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 px(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||zp(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Ap(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return zp(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),Gp(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function mx(e,t,n){return e.check(om,t,e.attempt(cx,t,n))}function hx(e){e.exit(`gfmFootnoteDefinition`)}function gx(e,t,n){let r=this;return Gp(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 _x(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&&Cp(o,o.length,0,$p(s,e.slice(r+1,n),t)),Cp(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Cp(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=Qp(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=Qp(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var vx=class{constructor(){this.map=[]}add(e,t,n){yx(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 yx(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 bx(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 xx(){return{flow:{null:{name:`table`,tokenize:Sx,resolveAll:Cx}}}}function Sx(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):Rp(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Bp(t)?Gp(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||zp(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,Bp(t)?Gp(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 Bp(t)?Gp(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||Rp(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 Bp(t)?Gp(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Rp(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||Rp(n)?(e.exit(`tableRow`),t(n)):Bp(n)?Gp(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||zp(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 Cx(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 vx;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(Tx(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=wx(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=wx(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=wx(f,t,o,i,n,d)):(o[0]=o[1],d=wx(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&Tx(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=bx(t.events,n))}return e}function wx(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},Ex(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=Ex(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=Ex(t.events,n[2]),a=Ex(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({},Ex(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Tx(e,t,n,r,i){let a=[],o=Ex(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 Ex(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Dx={name:`tasklistCheck`,tokenize:kx};function Ox(){return{text:{91:Dx}}}function kx(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 zp(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 Rp(r)?t(r):Bp(r)?e.check({tokenize:Ax},t,n)(r):n(r)}}function Ax(e,t,n){return Gp(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function jx(e){return Ep([qb(),lx(),_x(e),xx(),Ox()])}var Mx={};function Nx(e){let t=this,n=e||Mx,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(jx(n)),a.push(Ib()),o.push(Lb(n))}function Px(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:s,mathText:o,mathTextData:s}};function e(e){this.enter({type:`math`,meta:null,value:``,data:{hName:`pre`,hChildren:[{type:`element`,tagName:`code`,properties:{className:[`language-math`,`math-display`]},children:[]}]}},e)}function t(){this.buffer()}function n(){let e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;let r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:`text`,value:t}),this.data.mathFlowInside=void 0}function a(e){this.enter({type:`inlineMath`,value:``,data:{hName:`code`,hProperties:{className:[`language-math`,`math-inline`]},hChildren:[]}},e),this.buffer()}function o(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t,n.data.hChildren.push({type:`text`,value:t})}function s(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}function Fx(e){let t=(e||{}).singleDollarTextMath;return t??=!0,r.peek=i,{unsafe:[{character:`\r`,inConstruct:`mathFlowMeta`},{character:`
|
|
47
|
-
`,inConstruct:`mathFlowMeta`},{character:`$`,after:t?void 0:`\\$`,inConstruct:`phrasing`},{character:`$`,inConstruct:`mathFlowMeta`},{atBreak:!0,character:`$`,after:`\\$`}],handlers:{math:n,inlineMath:r}};function n(e,t,n,r){let i=e.value||``,a=n.createTracker(r),o=`$`.repeat(Math.max(My(i,`$`)+1,2)),s=n.enter(`mathFlow`),c=a.move(o);if(e.meta){let t=n.enter(`mathFlowMeta`);c+=a.move(n.safe(e.meta,{after:`
|
|
48
|
-
`,before:c,encode:[`$`],...a.current()})),t()}return c+=a.move(`
|
|
49
|
-
`),i&&(c+=a.move(i+`
|
|
50
|
-
`)),c+=a.move(o),s(),c}function r(e,n,r){let i=e.value||``,a=1;for(t||a++;RegExp(`(^|[^$])`+`\\$`.repeat(a)+`([^$]|$)`).test(i);)a++;let o=`$`.repeat(a);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` `+i+` `);let s=-1;for(;++s<r.unsafe.length;){let e=r.unsafe[s];if(!e.atBreak)continue;let t=r.compilePattern(e),n;for(;n=t.exec(i);){let e=n.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=i.slice(0,e)+` `+i.slice(n.index+1)}}return o+i+o}function i(){return`$`}}var Ix={tokenize:Rx,concrete:!0,name:`mathFlow`},Lx={tokenize:zx,partial:!0};function Rx(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){return e.enter(`mathFlow`),e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),c(t)}function c(t){return t===36?(e.consume(t),o++,c):o<2?n(t):(e.exit(`mathFlowFenceSequence`),Gp(e,l,`whitespace`)(t))}function l(t){return t===null||Rp(t)?d(t):(e.enter(`mathFlowFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===null||Rp(t)?(e.exit(`chunkString`),e.exit(`mathFlowFenceMeta`),d(t)):t===36?n(t):(e.consume(t),u)}function d(n){return e.exit(`mathFlowFence`),r.interrupt?t(n):e.attempt(Lx,f,g)(n)}function f(t){return e.attempt({tokenize:_,partial:!0},g,p)(t)}function p(t){return(a?Gp(e,m,`linePrefix`,a+1):m)(t)}function m(t){return t===null?g(t):Rp(t)?e.attempt(Lx,f,g)(t):(e.enter(`mathFlowValue`),h(t))}function h(t){return t===null||Rp(t)?(e.exit(`mathFlowValue`),m(t)):(e.consume(t),h)}function g(n){return e.exit(`mathFlow`),t(n)}function _(e,t,n){let i=0;return Gp(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),s(t)}function s(t){return t===36?(i++,e.consume(t),s):i<o?n(t):(e.exit(`mathFlowFenceSequence`),Gp(e,c,`whitespace`)(t))}function c(r){return r===null||Rp(r)?(e.exit(`mathFlowFence`),t(r)):n(r)}}}function zx(e,t,n){let r=this;return i;function i(n){return n===null?t(n):(e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Bx(e){let t=(e||{}).singleDollarTextMath;return t??=!0,{tokenize:n,resolve:Vx,previous:Hx,name:`mathText`};function n(e,n,r){let i=0,a,o;return s;function s(t){return e.enter(`mathText`),e.enter(`mathTextSequence`),c(t)}function c(n){return n===36?(e.consume(n),i++,c):i<2&&!t?r(n):(e.exit(`mathTextSequence`),l(n))}function l(t){return t===null?r(t):t===36?(o=e.enter(`mathTextSequence`),a=0,d(t)):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),l):Rp(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),l):(e.enter(`mathTextData`),u(t))}function u(t){return t===null||t===32||t===36||Rp(t)?(e.exit(`mathTextData`),l(t)):(e.consume(t),u)}function d(t){return t===36?(e.consume(t),a++,d):a===i?(e.exit(`mathTextSequence`),e.exit(`mathText`),n(t)):(o.type=`mathTextData`,u(t))}}}function Vx(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===`mathTextData`){e[t][1].type=`mathTextPadding`,e[n][1].type=`mathTextPadding`,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=`mathTextData`,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 Hx(e){return e!==36||this.events[this.events.length-1][1].type===`characterEscape`}function Ux(e){return{flow:{36:Ix},text:{36:Bx(e)}}}var Wx={};function Gx(e){let t=this,n=e||Wx,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Ux(n)),a.push(Px()),o.push(Fx(n))}var U=class e{constructor(t,n){let r=` `+t,i,a=n&&n.loc;if(a&&a.start<=a.end){let e=a.lexer.input;i=a.start;let t=a.end;i===e.length?r+=` at end of input: `:r+=` at position `+(i+1)+`:
|
|
51
|
-
`;let n=e.slice(i,t).replace(/[^]/g,`$&̲`),o;o=i>15?`…`+e.slice(i-15,i):e.slice(0,i);let s;s=t+15<e.length?e.slice(t,t+15)+`…`:e.slice(t),r+=o+n+s}let o=Error(r);return o.name=`ParseError`,o.__proto__=e.prototype,o.position=i,o}};U.prototype.__proto__=Error.prototype;var Kx=function(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))return n;let r=e[t];return r===void 0?n:r},qx=/([A-Z])/g,Jx=function(e){return e.replace(qx,`-$1`).toLowerCase()},Yx={"&":`&`,">":`>`,"<":`<`,'"':`"`,"'":`'`},Xx=/[&><"']/g;function Zx(e){return String(e).replace(Xx,e=>Yx[e])}var Qx=function(e){return e.type===`ordgroup`||e.type===`color`?e.body.length===1?Qx(e.body[0]):e:e.type===`font`?Qx(e.body):e},$x=function(e){let t=Qx(e);return t.type===`mathord`||t.type===`textord`||t.type===`atom`},eS=function(e){if(!e)throw Error(`Expected non-null, but got `+String(e));return e},tS=function(e){let t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},nS=function(e){return+e.toFixed(4)},rS=`acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳`,iS=[`__proto__`,`prototype`,`constructor`],aS=e=>{if(typeof e!=`object`||!e)return Object.create(null);for(let t of iS)Object.prototype.hasOwnProperty.call(e,t)&&delete e[t];return Object.setPrototypeOf(e,null)},oS=class{constructor(e){e||={},this.displayMode=Kx(e,`displayMode`,!1),this.annotate=Kx(e,`annotate`,!1),this.leqno=Kx(e,`leqno`,!1),this.throwOnError=Kx(e,`throwOnError`,!1),this.errorColor=Kx(e,`errorColor`,`#b22222`),this.macros=aS(Object.prototype.hasOwnProperty.call(e,`macros`)?e.macros:void 0),this.wrap=Kx(e,`wrap`,`none`),this.xml=Kx(e,`xml`,!1),this.colorIsTextColor=Kx(e,`colorIsTextColor`,!1),this.strict=Kx(e,`strict`,!1),this.trust=Kx(e,`trust`,!1);let t=Object.prototype.hasOwnProperty.call(e,`maxSize`)?e.maxSize:void 0;this.maxSize=t===void 0?[1/0,1/0]:Array.isArray(t)?t:[1/0,1/0],this.maxExpand=Math.max(0,Kx(e,`maxExpand`,1e3)),this.wrapDelimiterPairs=!0}isTrusted(e){if(e.url&&!e.protocol){let t=tS(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},sS={},cS={};function lS({type:e,names:t,props:n,handler:r,mathmlBuilder:i}){let a={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0||n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:r};for(let e=0;e<t.length;++e)sS[t[e]]=a;e&&i&&(cS[e]=i)}function uS({type:e,mathmlBuilder:t}){lS({type:e,names:[],props:{numArgs:0},handler(){throw Error(`Should never be called.`)},mathmlBuilder:t})}var dS=function(e){return e.type===`ordgroup`&&e.body.length===1?e.body[0]:e},fS=function(e){return e.type===`ordgroup`?e.body:[e]},pS=class{constructor(e){this.children=e,this.classes=[],this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){let e=document.createDocumentFragment();for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e=``;for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>e.toText()).join(``)}},mS=function(e){return e.filter(e=>e).join(` `)},hS=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},gS=function(e){let t=document.createElement(e);t.className=mS(this.classes);for(let e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t.style[e]=this.style[e]);for(let e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(let e=0;e<this.children.length;e++)t.appendChild(this.children[e].toNode());return t},_S=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${Zx(mS(this.classes))}"`);let n=``;for(let e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(n+=`${Jx(e)}:${this.style[e]};`);n&&(t+=` style="${n}"`);for(let e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&(t+=` ${e}="${Zx(this.attributes[e])}"`);t+=`>`;for(let e=0;e<this.children.length;e++)t+=this.children[e].toMarkup();return t+=`</${e}>`,t},vS=class{constructor(e,t,n){hS.call(this,e,n),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}toNode(){return gS.call(this,`span`)}toMarkup(){return _S.call(this,`span`)}},yS=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Zx(this.text)}},bS=class{constructor(e,t,n){this.href=e,this.classes=t,this.children=n||[]}toNode(){let e=document.createElement(`a`);e.setAttribute(`href`,this.href),this.classes.length>0&&(e.className=mS(this.classes));for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e=`<a href='${Zx(this.href)}'`;this.classes.length>0&&(e+=` class="${Zx(mS(this.classes))}"`),e+=`>`;for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e+=`</a>`,e}},xS=class{constructor(e,t,n){this.alt=t,this.src=e,this.classes=[`mord`],this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){let e=document.createElement(`img`);e.src=this.src,e.alt=this.alt,e.className=`mord`;for(let t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);return e}toMarkup(){let e=`<img src='${this.src}' alt='${this.alt}'`,t=``;for(let e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t+=`${Jx(e)}:${this.style[e]};`);return t&&(e+=` style="${Zx(t)}"`),e+=`>`,e}};function SS(e){return new pS(e)}var W=class{constructor(e,t,n,r){this.type=e,this.attributes={},this.children=t||[],this.classes=n||[],this.style=r||{},this.label=``}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}setLabel(e){this.label=e}toNode(){let e=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,this.type);for(let t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=mS(this.classes));for(let t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e=`<`+this.type;for(let t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=` `+t+`="`,e+=Zx(this.attributes[t]),e+=`"`);this.classes.length>0&&(e+=` class="${Zx(mS(this.classes))}"`);let t=``;for(let e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t+=`${Jx(e)}:${this.style[e]};`);t&&(e+=` style="${t}"`),e+=`>`;for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e+=`</`+this.type+`>`,e}toText(){return this.children.map(e=>e.toText()).join(``)}},CS=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Zx(this.toText())}toText(){return this.text}},wS=e=>{let t;return e.length===1&&e[0].type===`mrow`?(t=e.pop(),t.type=`mstyle`):t=new W(`mstyle`,e),t},TS=e=>{let t=0;if(e.body&&Array.isArray(e.body))for(let n of e.body)t+=TS(n);else if(e.body)t+=TS(e.body);else if(e.type===`supsub`)t+=TS(e.base),e.sub&&(t+=.7*TS(e.sub)),e.sup&&(t+=.7*TS(e.sup));else if(e.type===`mathord`||e.type===`textord`)for(let n of e.text.split(``)){let e=n.codePointAt(0);t+=96<e&&e<123||944<e&&e<970?.56:47<e&&e<58?.5:.92}else t+=1;return t},ES={widehat:`ˆ`,widecheck:`ˇ`,widetilde:`~`,wideparen:`⏜`,utilde:`~`,overleftarrow:`←`,underleftarrow:`←`,xleftarrow:`←`,overrightarrow:`→`,underrightarrow:`→`,xrightarrow:`→`,underbrace:`⏟`,overbrace:`⏞`,overbracket:`⎴`,underbracket:`⎵`,overgroup:`⏠`,overparen:`⏜`,undergroup:`⏡`,underparen:`⏝`,overleftrightarrow:`↔`,underleftrightarrow:`↔`,xleftrightarrow:`↔`,Overrightarrow:`⇒`,xRightarrow:`⇒`,overleftharpoon:`↼`,xleftharpoonup:`↼`,overrightharpoon:`⇀`,xrightharpoonup:`⇀`,xLeftarrow:`⇐`,xLeftrightarrow:`⇔`,xhookleftarrow:`↩`,xhookrightarrow:`↪`,xmapsto:`↦`,xrightharpoondown:`⇁`,xleftharpoondown:`↽`,xtwoheadleftarrow:`↞`,xtwoheadrightarrow:`↠`,xlongequal:`=`,xrightleftarrows:`⇄`,xtofrom:`⇄`,xleftrightharpoons:`⇋`,xrightleftharpoons:`⇌`,yields:`→`,yieldsLeft:`←`,mesomerism:`↔`,longrightharpoonup:`⇀`,longleftharpoondown:`↽`,eqrightharpoonup:`⇀`,eqleftharpoondown:`↽`,"\\cdrightarrow":`→`,"\\cdleftarrow":`←`,"\\cdlongequal":`=`,yieldsLeftRight:`⇄`,chemequilibrium:`⇌`},DS=function(e){let t=new W(`mo`,[new CS(ES[e.slice(1)])]);return t.setAttribute(`stretchy`,`true`),t},OS=[`\\widehat`,`\\widecheck`],kS=e=>{let t=DS(e.label);if(e.label.indexOf(`tilde`)>-1){let n=TS(e.base);1<n&&n<1.6?t.classes.push(`tml-tilde-2`):1.6<=n&&n<2.5?t.classes.push(`tml-tilde-3`):2.5<=n&&t.classes.push(`tml-tilde-4`)}else if(OS.includes(e.label)){let n=TS(e.base);0<n&&n<=1?t.classes.push(`tml-hat-1`):1<n&&n<1.6?t.classes.push(`tml-hat-2`):1.6<=n&&n<2.5?t.classes.push(`tml-hat-3`):2.5<=n&&t.classes.push(`tml-hat-4`)}return t},AS={bin:1,close:1,inner:1,open:1,punct:1,rel:1},jS={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},MS=Object.create(null);MS.math=Object.create(null),MS.text=Object.create(null);function G(e,t,n,r,i){if(e!==`math`&&e!==`text`)throw TypeError(`Invalid mode: ${e} called in defineSymbol`);let a={group:t,replace:n};MS[e][r]=a,i&&n&&(MS[e][n]=a)}var K=`math`,q=`text`,NS=`accent-token`,J=`bin`,PS=`close`,FS=`inner`,Y=`mathord`,IS=`op-token`,LS=`open`,RS=`punct`,X=`rel`,zS=`spacing`,Z=`textord`;G(K,X,`≡`,`\\equiv`,!0),G(K,X,`≺`,`\\prec`,!0),G(K,X,`≻`,`\\succ`,!0),G(K,X,`∼`,`\\sim`,!0),G(K,X,`⟂`,`\\perp`,!0),G(K,X,`⪯`,`\\preceq`,!0),G(K,X,`⪰`,`\\succeq`,!0),G(K,X,`≃`,`\\simeq`,!0),G(K,X,`≌`,`\\backcong`,!0),G(K,X,`|`,`\\mid`,!0),G(K,X,`≪`,`\\ll`,!0),G(K,X,`≫`,`\\gg`,!0),G(K,X,`≍`,`\\asymp`,!0),G(K,X,`∥`,`\\parallel`),G(K,X,`⌣`,`\\smile`,!0),G(K,X,`⊑`,`\\sqsubseteq`,!0),G(K,X,`⊒`,`\\sqsupseteq`,!0),G(K,X,`≐`,`\\doteq`,!0),G(K,X,`⌢`,`\\frown`,!0),G(K,X,`∋`,`\\ni`,!0),G(K,X,`∌`,`\\notni`,!0),G(K,X,`∝`,`\\propto`,!0),G(K,X,`⊢`,`\\vdash`,!0),G(K,X,`⊣`,`\\dashv`,!0),G(K,X,`∋`,`\\owns`),G(K,X,`≘`,`\\arceq`,!0),G(K,X,`≙`,`\\wedgeq`,!0),G(K,X,`≚`,`\\veeeq`,!0),G(K,X,`≛`,`\\stareq`,!0),G(K,X,`≝`,`\\eqdef`,!0),G(K,X,`≞`,`\\measeq`,!0),G(K,X,`≟`,`\\questeq`,!0),G(K,X,`≠`,`\\ne`,!0),G(K,X,`≠`,`\\neq`),G(K,X,`⩵`,`\\eqeq`,!0),G(K,X,`⩶`,`\\eqeqeq`,!0),G(K,X,`∷`,`\\dblcolon`,!0),G(K,X,`≔`,`\\coloneqq`,!0),G(K,X,`≕`,`\\eqqcolon`,!0),G(K,X,`∹`,`\\eqcolon`,!0),G(K,X,`⩴`,`\\Coloneqq`,!0),G(K,RS,`.`,`\\ldotp`),G(K,RS,`·`,`\\cdotp`),G(K,Z,`#`,`\\#`),G(q,Z,`#`,`\\#`),G(K,Z,`&`,`\\&`),G(q,Z,`&`,`\\&`),G(K,Z,`ℵ`,`\\aleph`,!0),G(K,Z,`∀`,`\\forall`,!0),G(K,Z,`ℏ`,`\\hbar`,!0),G(K,Z,`∃`,`\\exists`,!0),G(K,LS,`∇`,`\\nabla`,!0),G(K,Z,`♭`,`\\flat`,!0),G(K,Z,`ℓ`,`\\ell`,!0),G(K,Z,`♮`,`\\natural`,!0),G(K,Z,`Å`,`\\Angstrom`,!0),G(q,Z,`Å`,`\\Angstrom`,!0),G(K,Z,`♣`,`\\clubsuit`,!0),G(K,Z,`♧`,`\\varclubsuit`,!0),G(K,Z,`℘`,`\\wp`,!0),G(K,Z,`♯`,`\\sharp`,!0),G(K,Z,`♢`,`\\diamondsuit`,!0),G(K,Z,`♦`,`\\vardiamondsuit`,!0),G(K,Z,`ℜ`,`\\Re`,!0),G(K,Z,`♡`,`\\heartsuit`,!0),G(K,Z,`♥`,`\\varheartsuit`,!0),G(K,Z,`ℑ`,`\\Im`,!0),G(K,Z,`♠`,`\\spadesuit`,!0),G(K,Z,`♤`,`\\varspadesuit`,!0),G(K,Z,`♀`,`\\female`,!0),G(K,Z,`♂`,`\\male`,!0),G(K,Z,`§`,`\\S`,!0),G(q,Z,`§`,`\\S`),G(K,Z,`¶`,`\\P`,!0),G(q,Z,`¶`,`\\P`),G(q,Z,`☺`,`\\smiley`,!0),G(K,Z,`☺`,`\\smiley`,!0),G(K,Z,`†`,`\\dag`),G(q,Z,`†`,`\\dag`),G(q,Z,`†`,`\\textdagger`),G(K,Z,`‡`,`\\ddag`),G(q,Z,`‡`,`\\ddag`),G(q,Z,`‡`,`\\textdaggerdbl`),G(K,PS,`⎱`,`\\rmoustache`,!0),G(K,LS,`⎰`,`\\lmoustache`,!0),G(K,PS,`⟯`,`\\rgroup`,!0),G(K,LS,`⟮`,`\\lgroup`,!0),G(K,J,`∓`,`\\mp`,!0),G(K,J,`⊖`,`\\ominus`,!0),G(K,J,`⊎`,`\\uplus`,!0),G(K,J,`⊓`,`\\sqcap`,!0),G(K,J,`∗`,`\\ast`),G(K,J,`⊔`,`\\sqcup`,!0),G(K,J,`◯`,`\\bigcirc`,!0),G(K,J,`∙`,`\\bullet`,!0),G(K,J,`‡`,`\\ddagger`),G(K,J,`≀`,`\\wr`,!0),G(K,J,`⨿`,`\\amalg`),G(K,J,`&`,`\\And`),G(K,J,`⫽`,`\\sslash`,!0),G(K,X,`⟵`,`\\longleftarrow`,!0),G(K,X,`⇐`,`\\Leftarrow`,!0),G(K,X,`⟸`,`\\Longleftarrow`,!0),G(K,X,`⟶`,`\\longrightarrow`,!0),G(K,X,`⇒`,`\\Rightarrow`,!0),G(K,X,`⟹`,`\\Longrightarrow`,!0),G(K,X,`↔`,`\\leftrightarrow`,!0),G(K,X,`⟷`,`\\longleftrightarrow`,!0),G(K,X,`⇔`,`\\Leftrightarrow`,!0),G(K,X,`⟺`,`\\Longleftrightarrow`,!0),G(K,X,`↤`,`\\mapsfrom`,!0),G(K,X,`↦`,`\\mapsto`,!0),G(K,X,`⟼`,`\\longmapsto`,!0),G(K,X,`↗`,`\\nearrow`,!0),G(K,X,`↩`,`\\hookleftarrow`,!0),G(K,X,`↪`,`\\hookrightarrow`,!0),G(K,X,`↘`,`\\searrow`,!0),G(K,X,`↼`,`\\leftharpoonup`,!0),G(K,X,`⇀`,`\\rightharpoonup`,!0),G(K,X,`↙`,`\\swarrow`,!0),G(K,X,`↽`,`\\leftharpoondown`,!0),G(K,X,`⇁`,`\\rightharpoondown`,!0),G(K,X,`↖`,`\\nwarrow`,!0),G(K,X,`⇌`,`\\rightleftharpoons`,!0),G(K,Y,`↯`,`\\lightning`,!0),G(K,Y,`∎`,`\\QED`,!0),G(K,Y,`‰`,`\\permil`,!0),G(q,Z,`‰`,`\\permil`),G(K,Y,`☉`,`\\astrosun`,!0),G(K,Y,`☼`,`\\sun`,!0),G(K,Y,`☾`,`\\leftmoon`,!0),G(K,Y,`☽`,`\\rightmoon`,!0),G(K,Y,`⊕`,`\\Earth`),G(K,X,`≮`,`\\nless`,!0),G(K,X,`⪇`,`\\lneq`,!0),G(K,X,`≨`,`\\lneqq`,!0),G(K,X,`≨︀`,`\\lvertneqq`),G(K,X,`⋦`,`\\lnsim`,!0),G(K,X,`⪉`,`\\lnapprox`,!0),G(K,X,`⊀`,`\\nprec`,!0),G(K,X,`⋠`,`\\npreceq`,!0),G(K,X,`⋨`,`\\precnsim`,!0),G(K,X,`⪹`,`\\precnapprox`,!0),G(K,X,`≁`,`\\nsim`,!0),G(K,X,`∤`,`\\nmid`,!0),G(K,X,`∤`,`\\nshortmid`),G(K,X,`⊬`,`\\nvdash`,!0),G(K,X,`⊭`,`\\nvDash`,!0),G(K,X,`⋪`,`\\ntriangleleft`),G(K,X,`⋬`,`\\ntrianglelefteq`,!0),G(K,X,`⊄`,`\\nsubset`,!0),G(K,X,`⊅`,`\\nsupset`,!0),G(K,X,`⊊`,`\\subsetneq`,!0),G(K,X,`⊊︀`,`\\varsubsetneq`),G(K,X,`⫋`,`\\subsetneqq`,!0),G(K,X,`⫋︀`,`\\varsubsetneqq`),G(K,X,`≯`,`\\ngtr`,!0),G(K,X,`⪈`,`\\gneq`,!0),G(K,X,`≩`,`\\gneqq`,!0),G(K,X,`≩︀`,`\\gvertneqq`),G(K,X,`⋧`,`\\gnsim`,!0),G(K,X,`⪊`,`\\gnapprox`,!0),G(K,X,`⊁`,`\\nsucc`,!0),G(K,X,`⋡`,`\\nsucceq`,!0),G(K,X,`⋩`,`\\succnsim`,!0),G(K,X,`⪺`,`\\succnapprox`,!0),G(K,X,`≆`,`\\ncong`,!0),G(K,X,`∦`,`\\nparallel`,!0),G(K,X,`∦`,`\\nshortparallel`),G(K,X,`⊯`,`\\nVDash`,!0),G(K,X,`⋫`,`\\ntriangleright`),G(K,X,`⋭`,`\\ntrianglerighteq`,!0),G(K,X,`⊋`,`\\supsetneq`,!0),G(K,X,`⊋`,`\\varsupsetneq`),G(K,X,`⫌`,`\\supsetneqq`,!0),G(K,X,`⫌︀`,`\\varsupsetneqq`),G(K,X,`⊮`,`\\nVdash`,!0),G(K,X,`⪵`,`\\precneqq`,!0),G(K,X,`⪶`,`\\succneqq`,!0),G(K,J,`⊴`,`\\unlhd`),G(K,J,`⊵`,`\\unrhd`),G(K,X,`↚`,`\\nleftarrow`,!0),G(K,X,`↛`,`\\nrightarrow`,!0),G(K,X,`⇍`,`\\nLeftarrow`,!0),G(K,X,`⇏`,`\\nRightarrow`,!0),G(K,X,`↮`,`\\nleftrightarrow`,!0),G(K,X,`⇎`,`\\nLeftrightarrow`,!0),G(K,X,`△`,`\\vartriangle`),G(K,Z,`ℏ`,`\\hslash`),G(K,Z,`▽`,`\\triangledown`),G(K,Z,`◊`,`\\lozenge`),G(K,Z,`Ⓢ`,`\\circledS`),G(K,Z,`®`,`\\circledR`,!0),G(q,Z,`®`,`\\circledR`),G(q,Z,`®`,`\\textregistered`),G(K,Z,`∡`,`\\measuredangle`,!0),G(K,Z,`∄`,`\\nexists`),G(K,Z,`℧`,`\\mho`),G(K,Z,`Ⅎ`,`\\Finv`,!0),G(K,Z,`⅁`,`\\Game`,!0),G(K,Z,`‵`,`\\backprime`),G(K,Z,`‶`,`\\backdprime`),G(K,Z,`‷`,`\\backtrprime`),G(K,Z,`▲`,`\\blacktriangle`),G(K,Z,`▼`,`\\blacktriangledown`),G(K,Z,`■`,`\\blacksquare`),G(K,Z,`⧫`,`\\blacklozenge`),G(K,Z,`★`,`\\bigstar`),G(K,Z,`∢`,`\\sphericalangle`,!0),G(K,Z,`∁`,`\\complement`,!0),G(K,Z,`╱`,`\\diagup`),G(K,Z,`╲`,`\\diagdown`),G(K,Z,`□`,`\\square`),G(K,Z,`□`,`\\Box`),G(K,Z,`◊`,`\\Diamond`),G(K,Z,`¥`,`\\yen`,!0),G(q,Z,`¥`,`\\yen`,!0),G(K,Z,`✓`,`\\checkmark`,!0),G(q,Z,`✓`,`\\checkmark`),G(K,Z,`✗`,`\\ballotx`,!0),G(q,Z,`✗`,`\\ballotx`),G(q,Z,`•`,`\\textbullet`),G(K,Z,`ℶ`,`\\beth`,!0),G(K,Z,`ℸ`,`\\daleth`,!0),G(K,Z,`ℷ`,`\\gimel`,!0),G(K,Z,`ϝ`,`\\digamma`,!0),G(K,Z,`ϰ`,`\\varkappa`),G(K,LS,`⌜`,`\\ulcorner`,!0),G(K,PS,`⌝`,`\\urcorner`,!0),G(K,LS,`⌞`,`\\llcorner`,!0),G(K,PS,`⌟`,`\\lrcorner`,!0),G(K,X,`≦`,`\\leqq`,!0),G(K,X,`⩽`,`\\leqslant`,!0),G(K,X,`⪕`,`\\eqslantless`,!0),G(K,X,`≲`,`\\lesssim`,!0),G(K,X,`⪅`,`\\lessapprox`,!0),G(K,X,`≊`,`\\approxeq`,!0),G(K,J,`⋖`,`\\lessdot`),G(K,X,`⋘`,`\\lll`,!0),G(K,X,`≶`,`\\lessgtr`,!0),G(K,X,`⋚`,`\\lesseqgtr`,!0),G(K,X,`⪋`,`\\lesseqqgtr`,!0),G(K,X,`≑`,`\\doteqdot`),G(K,X,`≓`,`\\risingdotseq`,!0),G(K,X,`≒`,`\\fallingdotseq`,!0),G(K,X,`∽`,`\\backsim`,!0),G(K,X,`⋍`,`\\backsimeq`,!0),G(K,X,`⫅`,`\\subseteqq`,!0),G(K,X,`⋐`,`\\Subset`,!0),G(K,X,`⊏`,`\\sqsubset`,!0),G(K,X,`≼`,`\\preccurlyeq`,!0),G(K,X,`⋞`,`\\curlyeqprec`,!0),G(K,X,`≾`,`\\precsim`,!0),G(K,X,`⪷`,`\\precapprox`,!0),G(K,X,`⊲`,`\\vartriangleleft`),G(K,X,`⊴`,`\\trianglelefteq`),G(K,X,`⊨`,`\\vDash`,!0),G(K,X,`⊫`,`\\VDash`,!0),G(K,X,`⊪`,`\\Vvdash`,!0),G(K,X,`⌣`,`\\smallsmile`),G(K,X,`⌢`,`\\smallfrown`),G(K,X,`≏`,`\\bumpeq`,!0),G(K,X,`≎`,`\\Bumpeq`,!0),G(K,X,`≧`,`\\geqq`,!0),G(K,X,`⩾`,`\\geqslant`,!0),G(K,X,`⪖`,`\\eqslantgtr`,!0),G(K,X,`≳`,`\\gtrsim`,!0),G(K,X,`⪆`,`\\gtrapprox`,!0),G(K,J,`⋗`,`\\gtrdot`),G(K,X,`⋙`,`\\ggg`,!0),G(K,X,`≷`,`\\gtrless`,!0),G(K,X,`⋛`,`\\gtreqless`,!0),G(K,X,`⪌`,`\\gtreqqless`,!0),G(K,X,`≖`,`\\eqcirc`,!0),G(K,X,`≗`,`\\circeq`,!0),G(K,X,`≜`,`\\triangleq`,!0),G(K,X,`∼`,`\\thicksim`),G(K,X,`≈`,`\\thickapprox`),G(K,X,`⫆`,`\\supseteqq`,!0),G(K,X,`⋑`,`\\Supset`,!0),G(K,X,`⊐`,`\\sqsupset`,!0),G(K,X,`≽`,`\\succcurlyeq`,!0),G(K,X,`⋟`,`\\curlyeqsucc`,!0),G(K,X,`≿`,`\\succsim`,!0),G(K,X,`⪸`,`\\succapprox`,!0),G(K,X,`⊳`,`\\vartriangleright`),G(K,X,`⊵`,`\\trianglerighteq`),G(K,X,`⊩`,`\\Vdash`,!0),G(K,X,`∣`,`\\shortmid`),G(K,X,`∥`,`\\shortparallel`),G(K,X,`≬`,`\\between`,!0),G(K,X,`⋔`,`\\pitchfork`,!0),G(K,X,`∝`,`\\varpropto`),G(K,X,`◀`,`\\blacktriangleleft`),G(K,X,`∴`,`\\therefore`,!0),G(K,X,`∍`,`\\backepsilon`),G(K,X,`▶`,`\\blacktriangleright`),G(K,X,`∵`,`\\because`,!0),G(K,X,`⋘`,`\\llless`),G(K,X,`⋙`,`\\gggtr`),G(K,J,`⊲`,`\\lhd`),G(K,J,`⊳`,`\\rhd`),G(K,X,`≂`,`\\eqsim`,!0),G(K,X,`≑`,`\\Doteq`,!0),G(K,X,`⥽`,`\\strictif`,!0),G(K,X,`⥼`,`\\strictfi`,!0),G(K,J,`∔`,`\\dotplus`,!0),G(K,J,`∖`,`\\smallsetminus`),G(K,J,`⋒`,`\\Cap`,!0),G(K,J,`⋓`,`\\Cup`,!0),G(K,J,`⩞`,`\\doublebarwedge`,!0),G(K,J,`⊟`,`\\boxminus`,!0),G(K,J,`⊞`,`\\boxplus`,!0),G(K,J,`⧄`,`\\boxslash`,!0),G(K,J,`⋇`,`\\divideontimes`,!0),G(K,J,`⋉`,`\\ltimes`,!0),G(K,J,`⋊`,`\\rtimes`,!0),G(K,J,`⋋`,`\\leftthreetimes`,!0),G(K,J,`⋌`,`\\rightthreetimes`,!0),G(K,J,`⋏`,`\\curlywedge`,!0),G(K,J,`⋎`,`\\curlyvee`,!0),G(K,J,`⊝`,`\\circleddash`,!0),G(K,J,`⊛`,`\\circledast`,!0),G(K,J,`⊺`,`\\intercal`,!0),G(K,J,`⋒`,`\\doublecap`),G(K,J,`⋓`,`\\doublecup`),G(K,J,`⊠`,`\\boxtimes`,!0),G(K,J,`⋈`,`\\bowtie`,!0),G(K,J,`⋈`,`\\Join`),G(K,J,`⟕`,`\\leftouterjoin`,!0),G(K,J,`⟖`,`\\rightouterjoin`,!0),G(K,J,`⟗`,`\\fullouterjoin`,!0),G(K,J,`∸`,`\\dotminus`,!0),G(K,J,`⟑`,`\\wedgedot`,!0),G(K,J,`⟇`,`\\veedot`,!0),G(K,J,`⩢`,`\\doublebarvee`,!0),G(K,J,`⩣`,`\\veedoublebar`,!0),G(K,J,`⩟`,`\\wedgebar`,!0),G(K,J,`⩠`,`\\wedgedoublebar`,!0),G(K,J,`⩔`,`\\Vee`,!0),G(K,J,`⩓`,`\\Wedge`,!0),G(K,J,`⩃`,`\\barcap`,!0),G(K,J,`⩂`,`\\barcup`,!0),G(K,J,`⩈`,`\\capbarcup`,!0),G(K,J,`⩀`,`\\capdot`,!0),G(K,J,`⩇`,`\\capovercup`,!0),G(K,J,`⩆`,`\\cupovercap`,!0),G(K,J,`⩍`,`\\closedvarcap`,!0),G(K,J,`⩌`,`\\closedvarcup`,!0),G(K,J,`⨪`,`\\minusdot`,!0),G(K,J,`⨫`,`\\minusfdots`,!0),G(K,J,`⨬`,`\\minusrdots`,!0),G(K,J,`⊻`,`\\Xor`,!0),G(K,J,`⊼`,`\\Nand`,!0),G(K,J,`⊽`,`\\Nor`,!0),G(K,J,`⊽`,`\\barvee`),G(K,J,`⫴`,`\\interleave`,!0),G(K,J,`⧢`,`\\shuffle`,!0),G(K,J,`⫶`,`\\threedotcolon`,!0),G(K,J,`⦂`,`\\typecolon`,!0),G(K,J,`∾`,`\\invlazys`,!0),G(K,J,`⩋`,`\\twocaps`,!0),G(K,J,`⩊`,`\\twocups`,!0),G(K,J,`⩎`,`\\Sqcap`,!0),G(K,J,`⩏`,`\\Sqcup`,!0),G(K,J,`⩖`,`\\veeonvee`,!0),G(K,J,`⩕`,`\\wedgeonwedge`,!0),G(K,J,`⧗`,`\\blackhourglass`,!0),G(K,J,`⧆`,`\\boxast`,!0),G(K,J,`⧈`,`\\boxbox`,!0),G(K,J,`⧇`,`\\boxcircle`,!0),G(K,J,`⊜`,`\\circledequal`,!0),G(K,J,`⦷`,`\\circledparallel`,!0),G(K,J,`⦶`,`\\circledvert`,!0),G(K,J,`⦵`,`\\circlehbar`,!0),G(K,J,`⟡`,`\\concavediamond`,!0),G(K,J,`⟢`,`\\concavediamondtickleft`,!0),G(K,J,`⟣`,`\\concavediamondtickright`,!0),G(K,J,`⋄`,`\\diamond`,!0),G(K,J,`⧖`,`\\hourglass`,!0),G(K,J,`⟠`,`\\lozengeminus`,!0),G(K,J,`⌽`,`\\obar`,!0),G(K,J,`⦸`,`\\obslash`,!0),G(K,J,`⨸`,`\\odiv`,!0),G(K,J,`⧁`,`\\ogreaterthan`,!0),G(K,J,`⧀`,`\\olessthan`,!0),G(K,J,`⦹`,`\\operp`,!0),G(K,J,`⨷`,`\\Otimes`,!0),G(K,J,`⨶`,`\\otimeshat`,!0),G(K,J,`⋆`,`\\star`,!0),G(K,J,`△`,`\\triangle`,!0),G(K,J,`⨺`,`\\triangleminus`,!0),G(K,J,`⨹`,`\\triangleplus`,!0),G(K,J,`⨻`,`\\triangletimes`,!0),G(K,J,`⟤`,`\\whitesquaretickleft`,!0),G(K,J,`⟥`,`\\whitesquaretickright`,!0),G(K,J,`⨳`,`\\smashtimes`,!0),G(K,X,`⇢`,`\\dashrightarrow`,!0),G(K,X,`⇠`,`\\dashleftarrow`,!0),G(K,X,`⇇`,`\\leftleftarrows`,!0),G(K,X,`⇆`,`\\leftrightarrows`,!0),G(K,X,`⇚`,`\\Lleftarrow`,!0),G(K,X,`↞`,`\\twoheadleftarrow`,!0),G(K,X,`↢`,`\\leftarrowtail`,!0),G(K,X,`↫`,`\\looparrowleft`,!0),G(K,X,`⇋`,`\\leftrightharpoons`,!0),G(K,X,`↶`,`\\curvearrowleft`,!0),G(K,X,`↺`,`\\circlearrowleft`,!0),G(K,X,`↰`,`\\Lsh`,!0),G(K,X,`⇈`,`\\upuparrows`,!0),G(K,X,`↿`,`\\upharpoonleft`,!0),G(K,X,`⇃`,`\\downharpoonleft`,!0),G(K,X,`⊶`,`\\origof`,!0),G(K,X,`⊷`,`\\imageof`,!0),G(K,X,`⊸`,`\\multimap`,!0),G(K,X,`↭`,`\\leftrightsquigarrow`,!0),G(K,X,`⇉`,`\\rightrightarrows`,!0),G(K,X,`⇄`,`\\rightleftarrows`,!0),G(K,X,`↠`,`\\twoheadrightarrow`,!0),G(K,X,`↣`,`\\rightarrowtail`,!0),G(K,X,`↬`,`\\looparrowright`,!0),G(K,X,`↷`,`\\curvearrowright`,!0),G(K,X,`↻`,`\\circlearrowright`,!0),G(K,X,`↱`,`\\Rsh`,!0),G(K,X,`⇊`,`\\downdownarrows`,!0),G(K,X,`↾`,`\\upharpoonright`,!0),G(K,X,`⇂`,`\\downharpoonright`,!0),G(K,X,`⇝`,`\\rightsquigarrow`,!0),G(K,X,`⇝`,`\\leadsto`),G(K,X,`⇛`,`\\Rrightarrow`,!0),G(K,X,`↾`,`\\restriction`),G(K,Z,`‘`,"`"),G(K,Z,`$`,`\\$`),G(q,Z,`$`,`\\$`),G(q,Z,`$`,`\\textdollar`),G(K,Z,`¢`,`\\cent`),G(q,Z,`¢`,`\\cent`),G(K,Z,`%`,`\\%`),G(q,Z,`%`,`\\%`),G(K,Z,`_`,`\\_`),G(q,Z,`_`,`\\_`),G(q,Z,`_`,`\\textunderscore`),G(q,Z,`␣`,`\\textvisiblespace`,!0),G(K,Z,`∠`,`\\angle`,!0),G(K,Z,`∞`,`\\infty`,!0),G(K,Z,`′`,`\\prime`),G(K,Z,`″`,`\\dprime`),G(K,Z,`‴`,`\\trprime`),G(K,Z,`⁗`,`\\qprime`),G(K,Z,`△`,`\\triangle`),G(q,Z,`Α`,`\\Alpha`,!0),G(q,Z,`Β`,`\\Beta`,!0),G(q,Z,`Γ`,`\\Gamma`,!0),G(q,Z,`Δ`,`\\Delta`,!0),G(q,Z,`Ε`,`\\Epsilon`,!0),G(q,Z,`Ζ`,`\\Zeta`,!0),G(q,Z,`Η`,`\\Eta`,!0),G(q,Z,`Θ`,`\\Theta`,!0),G(q,Z,`Ι`,`\\Iota`,!0),G(q,Z,`Κ`,`\\Kappa`,!0),G(q,Z,`Λ`,`\\Lambda`,!0),G(q,Z,`Μ`,`\\Mu`,!0),G(q,Z,`Ν`,`\\Nu`,!0),G(q,Z,`Ξ`,`\\Xi`,!0),G(q,Z,`Ο`,`\\Omicron`,!0),G(q,Z,`Π`,`\\Pi`,!0),G(q,Z,`Ρ`,`\\Rho`,!0),G(q,Z,`Σ`,`\\Sigma`,!0),G(q,Z,`Τ`,`\\Tau`,!0),G(q,Z,`Υ`,`\\Upsilon`,!0),G(q,Z,`Φ`,`\\Phi`,!0),G(q,Z,`Χ`,`\\Chi`,!0),G(q,Z,`Ψ`,`\\Psi`,!0),G(q,Z,`Ω`,`\\Omega`,!0),G(K,Y,`Α`,`\\Alpha`,!0),G(K,Y,`Β`,`\\Beta`,!0),G(K,Y,`Γ`,`\\Gamma`,!0),G(K,Y,`Δ`,`\\Delta`,!0),G(K,Y,`Ε`,`\\Epsilon`,!0),G(K,Y,`Ζ`,`\\Zeta`,!0),G(K,Y,`Η`,`\\Eta`,!0),G(K,Y,`Θ`,`\\Theta`,!0),G(K,Y,`Ι`,`\\Iota`,!0),G(K,Y,`Κ`,`\\Kappa`,!0),G(K,Y,`Λ`,`\\Lambda`,!0),G(K,Y,`Μ`,`\\Mu`,!0),G(K,Y,`Ν`,`\\Nu`,!0),G(K,Y,`Ξ`,`\\Xi`,!0),G(K,Y,`Ο`,`\\Omicron`,!0),G(K,Y,`Π`,`\\Pi`,!0),G(K,Y,`Ρ`,`\\Rho`,!0),G(K,Y,`Σ`,`\\Sigma`,!0),G(K,Y,`Τ`,`\\Tau`,!0),G(K,Y,`Υ`,`\\Upsilon`,!0),G(K,Y,`Φ`,`\\Phi`,!0),G(K,Y,`Χ`,`\\Chi`,!0),G(K,Y,`Ψ`,`\\Psi`,!0),G(K,Y,`Ω`,`\\Omega`,!0),G(K,LS,`¬`,`\\neg`,!0),G(K,LS,`¬`,`\\lnot`),G(K,Z,`⊤`,`\\top`),G(K,Z,`⊥`,`\\bot`),G(K,Z,`∅`,`\\emptyset`),G(K,Z,`⌀`,`\\varnothing`),G(K,Y,`α`,`\\alpha`,!0),G(K,Y,`β`,`\\beta`,!0),G(K,Y,`γ`,`\\gamma`,!0),G(K,Y,`δ`,`\\delta`,!0),G(K,Y,`ϵ`,`\\epsilon`,!0),G(K,Y,`ζ`,`\\zeta`,!0),G(K,Y,`η`,`\\eta`,!0),G(K,Y,`θ`,`\\theta`,!0),G(K,Y,`ι`,`\\iota`,!0),G(K,Y,`κ`,`\\kappa`,!0),G(K,Y,`λ`,`\\lambda`,!0),G(K,Y,`μ`,`\\mu`,!0),G(K,Y,`ν`,`\\nu`,!0),G(K,Y,`ξ`,`\\xi`,!0),G(K,Y,`ο`,`\\omicron`,!0),G(K,Y,`π`,`\\pi`,!0),G(K,Y,`ρ`,`\\rho`,!0),G(K,Y,`σ`,`\\sigma`,!0),G(K,Y,`τ`,`\\tau`,!0),G(K,Y,`υ`,`\\upsilon`,!0),G(K,Y,`ϕ`,`\\phi`,!0),G(K,Y,`χ`,`\\chi`,!0),G(K,Y,`ψ`,`\\psi`,!0),G(K,Y,`ω`,`\\omega`,!0),G(K,Y,`ε`,`\\varepsilon`,!0),G(K,Y,`ϑ`,`\\vartheta`,!0),G(K,Y,`ϖ`,`\\varpi`,!0),G(K,Y,`ϱ`,`\\varrho`,!0),G(K,Y,`ς`,`\\varsigma`,!0),G(K,Y,`φ`,`\\varphi`,!0),G(K,Y,`Ϙ`,`\\Coppa`,!0),G(K,Y,`ϙ`,`\\coppa`,!0),G(K,Y,`ϙ`,`\\varcoppa`,!0),G(K,Y,`Ϟ`,`\\Koppa`,!0),G(K,Y,`ϟ`,`\\koppa`,!0),G(K,Y,`Ϡ`,`\\Sampi`,!0),G(K,Y,`ϡ`,`\\sampi`,!0),G(K,Y,`Ϛ`,`\\Stigma`,!0),G(K,Y,`ϛ`,`\\stigma`,!0),G(K,Y,`⫫`,`\\Bot`),G(K,Z,`ð`,`\\eth`,!0),G(q,Z,`ð`,`ð`),G(K,Z,`Å`,`\\AA`),G(q,Z,`Å`,`\\AA`,!0),G(K,Z,`Æ`,`\\AE`,!0),G(q,Z,`Æ`,`\\AE`,!0),G(K,Z,`Ð`,`\\DH`,!0),G(q,Z,`Ð`,`\\DH`,!0),G(K,Z,`Þ`,`\\TH`,!0),G(q,Z,`Þ`,`\\TH`,!0),G(K,Z,`ß`,`\\ss`,!0),G(q,Z,`ß`,`\\ss`,!0),G(K,Z,`å`,`\\aa`),G(q,Z,`å`,`\\aa`,!0),G(K,Z,`æ`,`\\ae`,!0),G(q,Z,`æ`,`\\ae`,!0),G(K,Z,`ð`,`\\dh`),G(q,Z,`ð`,`\\dh`,!0),G(K,Z,`þ`,`\\th`,!0),G(q,Z,`þ`,`\\th`,!0),G(K,Z,`Đ`,`\\DJ`,!0),G(q,Z,`Đ`,`\\DJ`,!0),G(K,Z,`đ`,`\\dj`,!0),G(q,Z,`đ`,`\\dj`,!0),G(K,Z,`Ł`,`\\L`,!0),G(q,Z,`Ł`,`\\L`,!0),G(K,Z,`Ł`,`\\l`,!0),G(q,Z,`Ł`,`\\l`,!0),G(K,Z,`Ŋ`,`\\NG`,!0),G(q,Z,`Ŋ`,`\\NG`,!0),G(K,Z,`ŋ`,`\\ng`,!0),G(q,Z,`ŋ`,`\\ng`,!0),G(K,Z,`Œ`,`\\OE`,!0),G(q,Z,`Œ`,`\\OE`,!0),G(K,Z,`œ`,`\\oe`,!0),G(q,Z,`œ`,`\\oe`,!0),G(K,J,`∗`,`∗`,!0),G(K,J,`+`,`+`),G(K,J,`∗`,`*`),G(K,J,`⁄`,`/`,!0),G(K,J,`⁄`,`⁄`),G(K,J,`−`,`-`,!0),G(K,J,`⋅`,`\\cdot`,!0),G(K,J,`∘`,`\\circ`,!0),G(K,J,`÷`,`\\div`,!0),G(K,J,`±`,`\\pm`,!0),G(K,J,`×`,`\\times`,!0),G(K,J,`∩`,`\\cap`,!0),G(K,J,`∪`,`\\cup`,!0),G(K,J,`∖`,`\\setminus`,!0),G(K,J,`∧`,`\\land`),G(K,J,`∨`,`\\lor`),G(K,J,`∧`,`\\wedge`,!0),G(K,J,`∨`,`\\vee`,!0),G(K,LS,`⟦`,`\\llbracket`,!0),G(K,PS,`⟧`,`\\rrbracket`,!0),G(K,LS,`⟨`,`\\langle`,!0),G(K,LS,`⟪`,`\\lAngle`,!0),G(K,LS,`⦉`,`\\llangle`,!0),G(K,LS,`|`,`\\lvert`),G(K,LS,`‖`,`\\lVert`,!0),G(K,Z,`!`,`\\oc`),G(K,Z,`?`,`\\wn`),G(K,Z,`↓`,`\\shpos`),G(K,Z,`↕`,`\\shift`),G(K,Z,`↑`,`\\shneg`),G(K,PS,`?`,`?`),G(K,PS,`!`,`!`),G(K,PS,`‼`,`‼`),G(K,PS,`⟩`,`\\rangle`,!0),G(K,PS,`⟫`,`\\rAngle`,!0),G(K,PS,`⦊`,`\\rrangle`,!0),G(K,PS,`|`,`\\rvert`),G(K,PS,`‖`,`\\rVert`),G(K,LS,`⦃`,`\\lBrace`,!0),G(K,PS,`⦄`,`\\rBrace`,!0),G(K,X,`=`,`\\equal`,!0),G(K,X,`:`,`:`),G(K,X,`≈`,`\\approx`,!0),G(K,X,`≅`,`\\cong`,!0),G(K,X,`≥`,`\\ge`),G(K,X,`≥`,`\\geq`,!0),G(K,X,`←`,`\\gets`),G(K,X,`>`,`\\gt`,!0),G(K,X,`∈`,`\\in`,!0),G(K,X,`∉`,`\\notin`,!0),G(K,X,``,`\\@not`),G(K,X,`⊂`,`\\subset`,!0),G(K,X,`⊃`,`\\supset`,!0),G(K,X,`⊆`,`\\subseteq`,!0),G(K,X,`⊇`,`\\supseteq`,!0),G(K,X,`⊈`,`\\nsubseteq`,!0),G(K,X,`⊈`,`\\nsubseteqq`),G(K,X,`⊉`,`\\nsupseteq`,!0),G(K,X,`⊉`,`\\nsupseteqq`),G(K,X,`⊨`,`\\models`),G(K,X,`←`,`\\leftarrow`,!0),G(K,X,`≤`,`\\le`),G(K,X,`≤`,`\\leq`,!0),G(K,X,`<`,`\\lt`,!0),G(K,X,`→`,`\\rightarrow`,!0),G(K,X,`→`,`\\to`),G(K,X,`≱`,`\\ngeq`,!0),G(K,X,`≱`,`\\ngeqq`),G(K,X,`≱`,`\\ngeqslant`),G(K,X,`≰`,`\\nleq`,!0),G(K,X,`≰`,`\\nleqq`),G(K,X,`≰`,`\\nleqslant`),G(K,X,`⫫`,`\\Perp`,!0),G(K,zS,`\xA0`,`\\ `),G(K,zS,`\xA0`,`\\space`),G(K,zS,`\xA0`,`\\nobreakspace`),G(q,zS,`\xA0`,`\\ `),G(q,zS,`\xA0`,` `),G(q,zS,`\xA0`,`\\space`),G(q,zS,`\xA0`,`\\nobreakspace`),G(K,zS,null,`\\nobreak`),G(K,zS,null,`\\allowbreak`),G(K,RS,`,`,`,`),G(q,RS,`:`,`:`),G(K,RS,`;`,`;`),G(K,J,`⊼`,`\\barwedge`),G(K,J,`⊻`,`\\veebar`),G(K,J,`⊙`,`\\odot`,!0),G(K,J,`⊕︎`,`\\oplus`),G(K,J,`⊗`,`\\otimes`,!0),G(K,Z,`∂`,`\\partial`,!0),G(K,J,`⊘`,`\\oslash`,!0),G(K,J,`⊚`,`\\circledcirc`,!0),G(K,J,`⊡`,`\\boxdot`,!0),G(K,J,`△`,`\\bigtriangleup`),G(K,J,`▽`,`\\bigtriangledown`),G(K,J,`†`,`\\dagger`),G(K,J,`⋄`,`\\diamond`),G(K,J,`◃`,`\\triangleleft`),G(K,J,`▹`,`\\triangleright`),G(K,LS,`{`,`\\{`),G(q,Z,`{`,`\\{`),G(q,Z,`{`,`\\textbraceleft`),G(K,PS,`}`,`\\}`),G(q,Z,`}`,`\\}`),G(q,Z,`}`,`\\textbraceright`),G(K,LS,`{`,`\\lbrace`),G(K,PS,`}`,`\\rbrace`),G(K,LS,`[`,`\\lbrack`,!0),G(q,Z,`[`,`\\lbrack`,!0),G(K,PS,`]`,`\\rbrack`,!0),G(q,Z,`]`,`\\rbrack`,!0),G(K,LS,`(`,`\\lparen`,!0),G(K,PS,`)`,`\\rparen`,!0),G(K,LS,`⦇`,`\\llparenthesis`,!0),G(K,PS,`⦈`,`\\rrparenthesis`,!0),G(q,Z,`<`,`\\textless`,!0),G(q,Z,`>`,`\\textgreater`,!0),G(K,LS,`⌊`,`\\lfloor`,!0),G(K,PS,`⌋`,`\\rfloor`,!0),G(K,LS,`⌈`,`\\lceil`,!0),G(K,PS,`⌉`,`\\rceil`,!0),G(K,Z,`\\`,`\\backslash`),G(K,Z,`|`,`|`),G(K,Z,`|`,`\\vert`),G(q,Z,`|`,`\\textbar`,!0),G(K,Z,`‖`,`\\|`),G(K,Z,`‖`,`\\Vert`),G(q,Z,`‖`,`\\textbardbl`),G(q,Z,`~`,`\\textasciitilde`),G(q,Z,`\\`,`\\textbackslash`),G(q,Z,`^`,`\\textasciicircum`),G(K,X,`↑`,`\\uparrow`,!0),G(K,X,`⇑`,`\\Uparrow`,!0),G(K,X,`↓`,`\\downarrow`,!0),G(K,X,`⇓`,`\\Downarrow`,!0),G(K,X,`↕`,`\\updownarrow`,!0),G(K,X,`⇕`,`\\Updownarrow`,!0),G(K,IS,`∐`,`\\coprod`),G(K,IS,`⋁`,`\\bigvee`),G(K,IS,`⋀`,`\\bigwedge`),G(K,IS,`⨄`,`\\biguplus`),G(K,IS,`⨄`,`\\bigcupplus`),G(K,IS,`⨃`,`\\bigcupdot`),G(K,IS,`⨇`,`\\bigdoublevee`),G(K,IS,`⨈`,`\\bigdoublewedge`),G(K,IS,`⋂`,`\\bigcap`),G(K,IS,`⋃`,`\\bigcup`),G(K,IS,`∫`,`\\int`),G(K,IS,`∫`,`\\intop`),G(K,IS,`∬`,`\\iint`),G(K,IS,`∭`,`\\iiint`),G(K,IS,`∏`,`\\prod`),G(K,IS,`∑`,`\\sum`),G(K,IS,`⨂`,`\\bigotimes`),G(K,IS,`⨁`,`\\bigoplus`),G(K,IS,`⨀`,`\\bigodot`),G(K,IS,`⨉`,`\\bigtimes`),G(K,IS,`∮`,`\\oint`),G(K,IS,`∯`,`\\oiint`),G(K,IS,`∰`,`\\oiiint`),G(K,IS,`∱`,`\\intclockwise`),G(K,IS,`∲`,`\\varointclockwise`),G(K,IS,`⨌`,`\\iiiint`),G(K,IS,`⨍`,`\\intbar`),G(K,IS,`⨎`,`\\intBar`),G(K,IS,`⨏`,`\\fint`),G(K,IS,`⨒`,`\\rppolint`),G(K,IS,`⨓`,`\\scpolint`),G(K,IS,`⨕`,`\\pointint`),G(K,IS,`⨖`,`\\sqint`),G(K,IS,`⨗`,`\\intlarhk`),G(K,IS,`⨘`,`\\intx`),G(K,IS,`⨙`,`\\intcap`),G(K,IS,`⨚`,`\\intcup`),G(K,IS,`⨅`,`\\bigsqcap`),G(K,IS,`⨆`,`\\bigsqcup`),G(K,IS,`∫`,`\\smallint`),G(q,FS,`…`,`\\textellipsis`),G(K,FS,`…`,`\\mathellipsis`),G(q,FS,`…`,`\\ldots`,!0),G(K,FS,`…`,`\\dotso`),G(K,FS,`…`,`\\dotsc`),G(K,FS,`…`,`\\ldots`,!0),G(K,FS,`⋰`,`\\iddots`,!0),G(K,FS,`⋯`,`\\cdots`,!0),G(K,FS,`⋱`,`\\ddots`,!0),G(K,Z,`⋮`,`\\varvdots`),G(q,Z,`⋮`,`\\varvdots`),G(K,NS,`´`,`\\acute`),G(K,NS,"`",`\\grave`),G(K,NS,`¨`,`\\ddot`),G(K,NS,`…`,`\\dddot`),G(K,NS,`….`,`\\ddddot`),G(K,NS,`~`,`\\tilde`),G(K,NS,`‾`,`\\bar`),G(K,NS,`˘`,`\\breve`),G(K,NS,`ˇ`,`\\check`),G(K,NS,`ˆ`,`\\hat`),G(K,NS,`→`,`\\vec`),G(K,NS,`˙`,`\\dot`),G(K,NS,`˚`,`\\mathring`),G(K,Y,`ı`,`\\imath`,!0),G(K,Y,`ȷ`,`\\jmath`,!0),G(K,Z,`ı`,`ı`),G(K,Z,`ȷ`,`ȷ`),G(q,Z,`ı`,`\\i`,!0),G(q,Z,`ȷ`,`\\j`,!0),G(q,Z,`ø`,`\\o`,!0),G(K,Y,`ø`,`\\o`,!0),G(q,Z,`Ø`,`\\O`,!0),G(K,Y,`Ø`,`\\O`,!0),G(q,NS,`ˊ`,`\\'`),G(q,NS,`ˋ`,"\\`"),G(q,NS,`ˆ`,`\\^`),G(q,NS,`~`,`\\~`),G(q,NS,`ˉ`,`\\=`),G(q,NS,`˘`,`\\u`),G(q,NS,`˙`,`\\.`),G(q,NS,`¸`,`\\c`),G(q,NS,`˚`,`\\r`),G(q,NS,`ˇ`,`\\v`),G(q,NS,`¨`,`\\"`),G(q,NS,`˝`,`\\H`),G(K,NS,`ˊ`,`\\'`),G(K,NS,`ˋ`,"\\`"),G(K,NS,`ˆ`,`\\^`),G(K,NS,`~`,`\\~`),G(K,NS,`ˉ`,`\\=`),G(K,NS,`˘`,`\\u`),G(K,NS,`˙`,`\\.`),G(K,NS,`¸`,`\\c`),G(K,NS,`˚`,`\\r`),G(K,NS,`ˇ`,`\\v`),G(K,NS,`¨`,`\\"`),G(K,NS,`˝`,`\\H`);var BS={"--":!0,"---":!0,"``":!0,"''":!0};G(q,Z,`–`,`--`,!0),G(q,Z,`–`,`\\textendash`),G(q,Z,`—`,`---`,!0),G(q,Z,`—`,`\\textemdash`),G(q,Z,`‘`,"`",!0),G(q,Z,`‘`,`\\textquoteleft`),G(q,Z,`’`,`'`,!0),G(q,Z,`’`,`\\textquoteright`),G(q,Z,`“`,"``",!0),G(q,Z,`“`,`\\textquotedblleft`),G(q,Z,`”`,`''`,!0),G(q,Z,`”`,`\\textquotedblright`),G(K,Z,`°`,`\\degree`,!0),G(q,Z,`°`,`\\degree`),G(q,Z,`°`,`\\textdegree`,!0),G(K,Z,`£`,`\\pounds`),G(K,Z,`£`,`\\mathsterling`,!0),G(q,Z,`£`,`\\pounds`),G(q,Z,`£`,`\\textsterling`,!0),G(K,Z,`✠`,`\\maltese`),G(q,Z,`✠`,`\\maltese`),G(K,Z,`€`,`\\euro`,!0),G(q,Z,`€`,`\\euro`,!0),G(q,Z,`€`,`\\texteuro`),G(K,Z,`©`,`\\copyright`,!0),G(q,Z,`©`,`\\textcopyright`),G(K,Z,`⌀`,`\\diameter`,!0),G(q,Z,`⌀`,`\\diameter`),G(K,Z,`𝛤`,`\\varGamma`),G(K,Z,`𝛥`,`\\varDelta`),G(K,Z,`𝛩`,`\\varTheta`),G(K,Z,`𝛬`,`\\varLambda`),G(K,Z,`𝛯`,`\\varXi`),G(K,Z,`𝛱`,`\\varPi`),G(K,Z,`𝛴`,`\\varSigma`),G(K,Z,`𝛶`,`\\varUpsilon`),G(K,Z,`𝛷`,`\\varPhi`),G(K,Z,`𝛹`,`\\varPsi`),G(K,Z,`𝛺`,`\\varOmega`),G(q,Z,`𝛤`,`\\varGamma`),G(q,Z,`𝛥`,`\\varDelta`),G(q,Z,`𝛩`,`\\varTheta`),G(q,Z,`𝛬`,`\\varLambda`),G(q,Z,`𝛯`,`\\varXi`),G(q,Z,`𝛱`,`\\varPi`),G(q,Z,`𝛴`,`\\varSigma`),G(q,Z,`𝛶`,`\\varUpsilon`),G(q,Z,`𝛷`,`\\varPhi`),G(q,Z,`𝛹`,`\\varPsi`),G(q,Z,`𝛺`,`\\varOmega`);var VS=`0123456789/@."`;for(let e=0;e<14;e++){let t=VS.charAt(e);G(K,Z,t,t)}var HS=`0123456789!@*()-=+";:?/.,`;for(let e=0;e<25;e++){let t=HS.charAt(e);G(q,Z,t,t)}var US=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`;for(let e=0;e<52;e++){let t=US.charAt(e);G(K,Y,t,t),G(q,Z,t,t)}var WS=`ÇÐÞçþℂℍℕℙℚℝℤℎℏℊℋℌℐℑℒℓ℘ℛℜℬℰℱℳℭℨ`;for(let e=0;e<30;e++){let t=WS.charAt(e);G(K,Y,t,t),G(q,Z,t,t)}var GS=``;for(let e=0;e<52;e++){GS=String.fromCharCode(55349,56320+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,56372+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,56424+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,56580+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,56736+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,56788+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,56840+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,56944+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,56632+e),G(K,Y,GS,GS),G(q,Z,GS,GS);let t=US.charAt(e);GS=String.fromCharCode(55349,56476+e),G(K,Y,t,GS),G(q,Z,t,GS)}for(let e=0;e<10;e++)GS=String.fromCharCode(55349,57294+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,57314+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,57324+e),G(K,Y,GS,GS),G(q,Z,GS,GS),GS=String.fromCharCode(55349,57334+e),G(K,Y,GS,GS),G(q,Z,GS,GS);function KS(e,t,n){let r=[],i=[],a=[],o=0,s=0;for(;s<e.length;){for(;e[s]instanceof pS;)e.splice(s,1,...e[s].children);let n=e[s];if(n.attributes&&n.attributes.linebreak&&n.attributes.linebreak===`newline`){a.length>0&&i.push(new W(`mrow`,a)),i.push(n),a=[];let e=new W(`mtd`,i);e.style.textAlign=`left`,r.push(new W(`mtr`,[e])),i=[],s+=1}else{if(a.push(n),n.type&&n.type===`mo`&&n.children.length===1&&!(n.attributes.form&&n.attributes.form===`prefix`)&&!Object.prototype.hasOwnProperty.call(n.attributes,`movablelimits`)){let r=n.children[0].text;if(t===`=`&&r===`=`){if(o+=1,o>1){a.pop();let e=new W(`mrow`,a);i.push(e),a=[n]}}else if(t===`tex`){let t=s<e.length-1?e[s+1]:null,n=!0;if(!(t&&t.type===`mtext`&&t.attributes.linebreak&&t.attributes.linebreak===`nobreak`))for(let t=s+1;t<e.length;t++){let r=e[t];if(r.type&&r.type===`mspace`&&!(r.attributes.linebreak&&r.attributes.linebreak===`newline`))a.push(r),s+=1,r.attributes&&r.attributes.linebreak&&r.attributes.linebreak===`nobreak`&&(n=!1);else break}if(n){let e=new W(`mrow`,a);i.push(e),a=[]}}}s+=1}}if(a.length>0){let e=new W(`mrow`,a);i.push(e)}if(r.length>0){let e=new W(`mtd`,i);e.style.textAlign=`left`;let t=new W(`mtr`,[e]);r.push(t);let a=new W(`mtable`,r);return n||(a.setAttribute(`columnalign`,`left`),a.setAttribute(`rowspacing`,`0em`)),a}return SS(i)}var qS=function(e,t,n){return MS[t][e]&&MS[t][e].replace&&e.charCodeAt(0)!==55349&&!(Object.prototype.hasOwnProperty.call(BS,e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)===`tt`||n.font&&n.font.slice(4,6)===`tt`))&&(e=MS[t][e].replace),new CS(e)},JS=(e,t)=>{if(e.children.length===0||e.children[e.children.length-1].type!==`mtext`){let n=new W(`mtext`,[new CS(t.children[0].text)]);e.children.push(n)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},YS=e=>{if(e.type!==`mrow`&&e.type!==`mstyle`||e.children.length===0)return e;let t=new W(`mrow`);for(let n=0;n<e.children.length;n++){let r=e.children[n];if(r.type===`mtext`&&Object.keys(r.attributes).length===0)JS(t,r);else if(r.type===`mrow`){let e=!0;for(let t=0;t<r.children.length;t++)if(r.children[t].type!==`mtext`||Object.keys(r.attributes).length!==0){e=!1;break}if(e)for(let e=0;e<r.children.length;e++){let n=r.children[e];JS(t,n)}else t.children.push(r)}else t.children.push(r)}for(let n=0;n<t.children.length;n++)if(t.children[n].type===`mtext`){let r=t.children[n];r.children[0].text.charAt(0)===` `&&(r.children[0].text=`\xA0`+r.children[0].text.slice(1));let i=r.children[0].text.length;i>0&&r.children[0].text.charAt(i-1)===` `&&(r.children[0].text=r.children[0].text.slice(0,-1)+`\xA0`);for(let[t,n]of Object.entries(e.attributes))r.attributes[t]=n}return t.children.length===1&&t.children[0].type===`mtext`?t.children[0]:t},XS=function(e,t=!1){if(e.length===1&&!(e[0]instanceof pS))return e[0];if(!t){e[0]instanceof W&&e[0].type===`mo`&&!e[0].attributes.fence&&(e[0].attributes.lspace=`0em`,e[0].attributes.rspace=`0em`);let t=e.length-1;e[t]instanceof W&&e[t].type===`mo`&&!e[t].attributes.fence&&(e[t].attributes.lspace=`0em`,e[t].attributes.rspace=`0em`)}return new W(`mrow`,e)};function ZS(e){if(!e)return!1;if(e.type===`mi`&&e.children.length===1){let t=e.children[0];return t instanceof CS&&t.text===`.`}if(e.type===`mtext`&&e.children.length===1){let t=e.children[0];return t instanceof CS&&t.text===` `}if(e.type===`mo`&&e.children.length===1&&e.getAttribute(`separator`)===`true`&&e.getAttribute(`lspace`)===`0em`&&e.getAttribute(`rspace`)===`0em`){let t=e.children[0];return t instanceof CS&&t.text===`,`}return!1}var QS=(e,t)=>{let n=e[t],r=e[t+1];return n.type===`atom`&&n.text===`,`&&n.loc&&r.loc&&n.loc.end===r.loc.start},$S=e=>e.type===`atom`&&e.family===`rel`||e.type===`mclass`&&e.mclass===`mrel`,eC=function(e,t,n=!1){if(!n&&e.length===1){let n=nC(e[0],t);return n instanceof W&&n.type===`mo`&&(n.setAttribute(`lspace`,`0em`),n.setAttribute(`rspace`,`0em`)),[n]}let r=[],i=[],a;for(let n=0;n<e.length;n++)i.push(nC(e[n],t));for(let t=0;t<i.length;t++){let n=i[t];if(t<e.length-1&&$S(e[t])&&$S(e[t+1])&&n.setAttribute(`rspace`,`0em`),t>0&&$S(e[t])&&$S(e[t-1])&&n.setAttribute(`lspace`,`0em`),n.type===`mn`&&a&&a.type===`mn`)a.children.push(...n.children);else if(ZS(n)&&a&&a.type===`mn`)a.children.push(...n.children);else if(a&&a.type===`mn`&&t<i.length-1&&i[t+1].type===`mn`&&QS(e,t))a.children.push(...n.children);else{if(n.type===`mn`&&ZS(a))n.children=[...a.children,...n.children],r.pop();else if((n.type===`msup`||n.type===`msub`)&&n.children.length>=1&&a&&(a.type===`mn`||ZS(a))){let e=n.children[0];e instanceof W&&e.type===`mn`&&a&&(e.children=[...a.children,...e.children],r.pop())}r.push(n),a=n}}return r},tC=function(e,t,n=!1){return XS(eC(e,t,n),n)},nC=function(e,t){if(!e)return new W(`mrow`);if(cS[e.type])return cS[e.type](e,t);throw new U(`Got group of unknown type: '`+e.type+`'`)},rC=e=>new W(`mtd`,[],[],{padding:`0`,width:`50%`}),iC=[`mrow`,`mtd`,`mtable`,`mtr`],aC=e=>{for(let t of e.children)if(t.type&&iC.includes(t.type)){if(t.classes&&t.classes[0]===`tml-label`)return t.label;{let e=aC(t);if(e)return e}}else if(!t.type){let e=aC(t);if(e)return e}},oC=(e,t,n,r)=>{t=tC(t[0].body,n),t=YS(t),t.classes.push(`tml-tag`);let i=aC(e);e=new W(`mtd`,[e]);let a=[rC(),e,rC()];a[r?0:2].children.push(t);let o=new W(`mtr`,a,[`tml-tageqn`]);i&&o.setAttribute(`id`,i);let s=new W(`mtable`,[o]);return s.style.width=`100%`,s.setAttribute(`displaystyle`,`true`),s};function sC(e,t,n,r){let i=null;e.length===1&&e[0].type===`tag`&&(i=e[0].tag,e=e[0].body);let a=eC(e,n);if(a.length===1&&a[0]instanceof bS)return a[0];let o=r.displayMode||r.annotate?`none`:r.wrap,s=a.length===0?null:a[0],c=a.length===1&&i===null&&s instanceof W?a[0]:KS(a,o,r.displayMode);if(i&&(c=oC(c,i,n,r.leqno)),r.annotate){let e=new W(`annotation`,[new CS(t)]);e.setAttribute(`encoding`,`application/x-tex`),c=new W(`semantics`,[c,e])}let l=new W(`math`,[c]);return r.xml&&l.setAttribute(`xmlns`,`http://www.w3.org/1998/Math/MathML`),r.displayMode&&(l.setAttribute(`display`,`block`),l.style.display=`block math`,l.classes=[`tml-display`]),l}var cC=`DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ`,lC=`BCEGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ`,uC=`AFJdfΔΛ`,dC=(e,t)=>{let n=e.isStretchy?kS(e):new W(`mo`,[qS(e.label,e.mode)]);e.isStretchy||n.setAttribute(`stretchy`,`false`),e.label!==`\\vec`&&(n.style.mathDepth=`0`);let r=e.label===`\\c`?`munder`:`mover`,i=pC.has(e.label);if(r===`mover`&&e.mode===`math`&&!e.isStretchy&&e.base.text&&e.base.text.length===1){let t=e.base.text,r=e.label===`\\vec`,a=r===`\\vec`?`-vec`:``;r&&n.classes.push(`tml-vec`);let o=r?`-vec`:i?`-acc`:``;cC.indexOf(t)>-1?(n.classes.push(`chr-sml${a}`),n.classes.push(`wbk-sml${o}`)):lC.indexOf(t)>-1?(n.classes.push(`chr-med${a}`),n.classes.push(`wbk-med${o}`)):uC.indexOf(t)>-1?(n.classes.push(`chr-lrg${a}`),n.classes.push(`wbk-lrg${o}`)):r?n.classes.push(`wbk-vec`):i&&n.classes.push(`wbk-acc`)}else i&&n.classes.push(`wbk-acc`);return new W(r,[nC(e.base,t),n])},fC=new Set([`\\acute`,`\\check`,`\\grave`,`\\ddot`,`\\dddot`,`\\ddddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`]),pC=new Set([`\\acute`,`\\bar`,`\\breve`,`\\check`,`\\dot`,`\\ddot`,`\\grave`,`\\hat`,`\\mathring`,"\\`",`\\'`,`\\^`,`\\=`,`\\u`,`\\.`,`\\"`,`\\r`,`\\H`,`\\v`]),mC={"\\`":`̀`,"\\'":`́`,"\\^":`̂`,"\\~":`̃`,"\\=":`̄`,"\\u":`̆`,"\\.":`̇`,'\\"':`̈`,"\\r":`̊`,"\\H":`̋`,"\\v":`̌`,"\\c":`̧`};lS({type:`accent`,names:[`\\acute`,`\\grave`,`\\ddot`,`\\dddot`,`\\ddddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`,`\\overparen`,`\\widecheck`,`\\widehat`,`\\wideparen`,`\\widetilde`,`\\overrightarrow`,`\\overleftarrow`,`\\Overrightarrow`,`\\overleftrightarrow`,`\\overgroup`,`\\overleftharpoon`,`\\overrightharpoon`],props:{numArgs:1},handler:(e,t)=>{let n=dS(t[0]),r=!fC.has(e.funcName);return{type:`accent`,mode:e.parser.mode,label:e.funcName,isStretchy:r,base:n}},mathmlBuilder:dC}),lS({type:`accent`,names:[`\\'`,"\\`",`\\^`,`\\~`,`\\=`,`\\c`,`\\u`,`\\.`,`\\"`,`\\r`,`\\H`,`\\v`],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`primitive`]},handler:(e,t)=>{let n=dS(t[0]),r=e.parser.mode;return r===`math`&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),r===`text`&&n.text&&n.text.length===1&&e.funcName in mC&&rS.indexOf(n.text)>-1?{type:`textord`,mode:`text`,text:n.text+mC[e.funcName]}:e.funcName===`\\c`&&r===`text`&&n.text&&n.text.length===1?{type:`textord`,mode:`text`,text:n.text+`̧`}:{type:`accent`,mode:r,label:e.funcName,isStretchy:!1,base:n}},mathmlBuilder:dC}),lS({type:`accentUnder`,names:[`\\underleftarrow`,`\\underrightarrow`,`\\underleftrightarrow`,`\\undergroup`,`\\underparen`,`\\utilde`],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>{let r=n[0];return{type:`accentUnder`,mode:e.mode,label:t,base:r}},mathmlBuilder:(e,t)=>{let n=kS(e);return n.style[`math-depth`]=0,new W(`munder`,[nC(e.base,t),n])}});var hC={pt:800/803,pc:9600/803,dd:1238/1157*800/803,cc:14856/1157*800/803,nd:685/642*800/803,nc:1370/107*800/803,sp:1/65536*800/803,mm:25.4/72,cm:2.54/72,in:1/72,px:96/72},gC=[`em`,`ex`,`mu`,`pt`,`mm`,`cm`,`in`,`px`,`bp`,`pc`,`dd`,`cc`,`nd`,`nc`,`sp`],_C=function(e){return typeof e!=`string`&&(e=e.unit),gC.indexOf(e)>-1},vC=e=>[1,.7,.5][Math.max(e-1,0)],yC=function(e,t){let n=e.number;if(t.maxSize[0]<0&&n>0)return{number:0,unit:`em`};let r=e.unit;switch(r){case`mm`:case`cm`:case`in`:case`px`:return n*hC[r]>t.maxSize[1]?{number:t.maxSize[1],unit:`pt`}:{number:n,unit:r};case`em`:case`ex`:return r===`ex`&&(n*=.431),n=Math.min(n/vC(t.level),t.maxSize[0]),{number:nS(n),unit:`em`};case`bp`:return n>t.maxSize[1]&&(n=t.maxSize[1]),{number:n,unit:`pt`};case`pt`:case`pc`:case`dd`:case`cc`:case`nd`:case`nc`:case`sp`:return n=Math.min(n*hC[r],t.maxSize[1]),{number:nS(n),unit:`pt`};case`mu`:return n=Math.min(n/18,t.maxSize[0]),{number:nS(n),unit:`em`};default:throw new U(`Invalid unit: '`+r+`'`)}},bC=e=>{let t=new W(`mspace`);return t.setAttribute(`width`,e+`em`),t},xC=(e,t=.3,n=0,r=!1)=>{if(e==null&&n===0)return bC(t);let i=e?[e]:[];if(t!==0&&i.unshift(bC(t)),n>0&&i.push(bC(n)),r){let e=new W(`mpadded`,i);return e.setAttribute(`height`,`0.1px`),e}return new W(`mrow`,i)},SC=(e,t)=>Number(e)/vC(t),CC=(e,t,n,r)=>{let i=DS(e),a=e.slice(1,3)===`eq`,o=e.charAt(1)===`x`?`1.75`:e.slice(2,4)===`cd`?`3.0`:a?`1.0`:`2.0`;i.setAttribute(`lspace`,`0`),i.setAttribute(`rspace`,a?`0.5em`:`0`);let s=r.withLevel(r.level<2?2:3),c=SC(o,s.level),l=SC(o,3),u=xC(null,c.toFixed(4),0),d=xC(null,l.toFixed(4),0),f=SC(a?0:.3,s.level).toFixed(4),p,m,h=t&&t.body&&(t.body.body||t.body.length>0);if(h){let n=nC(t,s);n=xC(n,f,f,e===`\\\\cdrightarrow`||e===`\\\\cdleftarrow`),p=new W(`mover`,[n,d])}let g=n&&n.body&&(n.body.body||n.body.length>0);if(g){let e=nC(n,s);e=xC(e,f,f),m=new W(`munder`,[e,d])}let _;return _=!h&&!g?new W(`mover`,[i,u]):h&&g?new W(`munderover`,[i,m,p]):h?new W(`mover`,[i,p]):new W(`munder`,[i,m]),o===`3.0`&&(_.style.height=`1em`),_.setAttribute(`accent`,`false`),_};lS({type:`xArrow`,names:`\\xleftarrow.\\xrightarrow.\\xLeftarrow.\\xRightarrow.\\xleftrightarrow.\\xLeftrightarrow.\\xhookleftarrow.\\xhookrightarrow.\\xmapsto.\\xrightharpoondown.\\xrightharpoonup.\\xleftharpoondown.\\xleftharpoonup.\\xlongequal.\\xtwoheadrightarrow.\\xtwoheadleftarrow.\\xtofrom.\\xleftrightharpoons.\\xrightleftharpoons.\\yields.\\yieldsLeft.\\mesomerism.\\longrightharpoonup.\\longleftharpoondown.\\yieldsLeftRight.\\chemequilibrium.\\\\cdrightarrow.\\\\cdleftarrow.\\\\cdlongequal`.split(`.`),props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},n,r){return{type:`xArrow`,mode:e.mode,name:t,body:n[0],below:r[0]}},mathmlBuilder(e,t){let n=[CC(e.name,e.body,e.below,t)];return n.unshift(bC(.2778)),n.push(bC(.2778)),new W(`mrow`,n)}});var wC={"\\equilibriumRight":[`\\longrightharpoonup`,`\\eqleftharpoondown`],"\\equilibriumLeft":[`\\eqrightharpoonup`,`\\longleftharpoondown`]};lS({type:`stackedArrow`,names:[`\\equilibriumRight`,`\\equilibriumLeft`],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},n,r){let i=n[0]?{type:`hphantom`,mode:e.mode,body:n[0]}:null,a=r[0]?{type:`hphantom`,mode:e.mode,body:r[0]}:null;return{type:`stackedArrow`,mode:e.mode,name:t,body:n[0],upperArrowBelow:a,lowerArrowBody:i,below:r[0]}},mathmlBuilder(e,t){let n=wC[e.name][0],r=wC[e.name][1],i=CC(n,e.body,e.upperArrowBelow,t),a=CC(r,e.lowerArrowBody,e.below,t),o,s=new W(`mpadded`,[i]);if(s.setAttribute(`voffset`,`0.3em`),s.setAttribute(`height`,`+0.3em`),s.setAttribute(`depth`,`-0.3em`),e.name===`\\equilibriumLeft`){let e=new W(`mpadded`,[a]);e.setAttribute(`width`,`0.5em`),o=new W(`mpadded`,[bC(.2778),e,s,bC(.2778)])}else s.setAttribute(`width`,e.name===`\\equilibriumRight`?`0.5em`:`0`),o=new W(`mpadded`,[bC(.2778),s,a,bC(.2778)]);return o.setAttribute(`voffset`,`-0.18em`),o.setAttribute(`height`,`-0.18em`),o.setAttribute(`depth`,`+0.18em`),o}});var TC={};function EC({type:e,names:t,props:n,handler:r,mathmlBuilder:i}){let a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:r};for(let e=0;e<t.length;++e)TC[t[e]]=a;i&&(cS[e]=i)}function DC(e,t){if(!e||e.type!==t)throw Error(`Expected node of type ${t}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function OC(e){let t=kC(e);if(!t)throw Error(`Expected node of symbol group type, but got `+(e?`node of type ${e.type}`:String(e)));return t}function kC(e){return e&&(e.type===`atom`||e.type===`delimiter`||Object.prototype.hasOwnProperty.call(jS,e.type))?e:null}var AC={">":`\\\\cdrightarrow`,"<":`\\\\cdleftarrow`,"=":`\\\\cdlongequal`,A:`\\uparrow`,V:`\\downarrow`,"|":`\\Vert`,".":`no arrow`},jC=()=>({type:`styling`,body:[],mode:`math`,scriptLevel:`display`}),MC=e=>e.type===`textord`&&e.text===`@`,NC=(e,t)=>(e.type===`mathord`||e.type===`atom`)&&e.text===t;function PC(e,t,n){let r=AC[e];switch(r){case`\\\\cdrightarrow`:case`\\\\cdleftarrow`:return n.callFunction(r,[t[0]],[t[1]]);case`\\uparrow`:case`\\downarrow`:{let e=n.callFunction(`\\\\cdleft`,[t[0]],[]),i={type:`atom`,text:r,mode:`math`,family:`rel`},a={type:`ordgroup`,mode:`math`,body:[e,n.callFunction(`\\Big`,[i],[]),n.callFunction(`\\\\cdright`,[t[1]],[])],semisimple:!0};return n.callFunction(`\\\\cdparent`,[a],[])}case`\\\\cdlongequal`:return n.callFunction(`\\\\cdlongequal`,[],[]);case`\\Vert`:return n.callFunction(`\\Big`,[{type:`textord`,text:`\\Vert`,mode:`math`}],[]);default:return{type:`textord`,text:` `,mode:`math`}}}function FC(e){let t=[];for(e.gullet.beginGroup(),e.gullet.macros.set(`\\cr`,`\\\\\\relax`),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,`\\\\`)),e.gullet.endGroup(),e.gullet.beginGroup();let n=e.fetch().text;if(n===`&`||n===`\\\\`)e.consume();else if(n===`\\end`){t[t.length-1].length===0&&t.pop();break}else throw new U(`Expected \\\\ or \\cr or \\end`,e.nextToken)}let n=[],r=[n];for(let i=0;i<t.length;i++){let a=t[i],o=jC();for(let t=0;t<a.length;t++)if(!MC(a[t]))o.body.push(a[t]);else{n.push(o),t+=1;let r=OC(a[t]).text,i=[,,];if(i[0]={type:`ordgroup`,mode:`math`,body:[]},i[1]={type:`ordgroup`,mode:`math`,body:[]},!(`=|.`.indexOf(r)>-1)){if(`<>AV`.indexOf(r)>-1)for(let e=0;e<2;e++){let n=!0;for(let o=t+1;o<a.length;o++){if(NC(a[o],r)){n=!1,t=o;break}if(MC(a[o]))throw new U(`Missing a `+r+` character to complete a CD arrow.`,a[o]);i[e].body.push(a[o])}if(n)throw new U(`Missing a `+r+` character to complete a CD arrow.`,a[t])}else throw new U(`Expected one of "<>AV=|." after @.`)}let s=PC(r,i,e);n.push(s),o=jC()}i%2==0?n.push(o):n.shift(),n=[],r.push(n)}return r.pop(),e.gullet.endGroup(),e.gullet.endGroup(),{type:`array`,mode:`math`,body:r,tags:null,labels:Array(r.length+1).fill(``),envClasses:[`jot`,`cd`],cols:[],hLinesBeforeRow:Array(r.length+1).fill([])}}lS({type:`cdlabel`,names:[`\\\\cdleft`,`\\\\cdright`],props:{numArgs:1},handler({parser:e,funcName:t},n){return{type:`cdlabel`,mode:e.mode,side:t.slice(4),label:n[0]}},mathmlBuilder(e,t){if(e.label.body.length===0)return new W(`mrow`,t);let n=nC(e.label,t);e.side===`left`&&n.classes.push(`tml-shift-left`);let r=new W(`mtd`,[n]);r.style.padding=`0`;let i=new W(`mpadded`,[new W(`mtable`,[new W(`mtr`,[r])])]);return i.setAttribute(`width`,`0.1px`),i.setAttribute(`displaystyle`,`false`),i.setAttribute(`scriptlevel`,`1`),i}}),lS({type:`cdlabelparent`,names:[`\\\\cdparent`],props:{numArgs:1},handler({parser:e},t){return{type:`cdlabelparent`,mode:e.mode,fragment:t[0]}},mathmlBuilder(e,t){return new W(`mrow`,[nC(e.fragment,t)])}});var IC=e=>({type:`ordgroup`,mode:`math`,body:e,semisimple:!0}),LC=(e,t)=>({type:t,mode:`math`,body:IC(e)}),RC=(e,t)=>{let n=e.body;n[0].shift();let r=Array(n.length-1).fill().map(()=>[]);for(let e=1;e<n.length;e++){r[e-1].push(n[e].shift());let t=[];for(let r=0;r<n[e].length;r++)t.push(n[e][r]);r[e-1].push(LC(t,`vphantom`))}let i=Array(n.length).fill().map(()=>[]);for(let e=0;e<n[0].length;e++)i[0].push(n[0][e]);for(let e=1;e<n.length;e++)for(let t=0;t<n[0].length;t++)i[e].push(LC(n[e][t].body,`hphantom`));for(let e=0;e<n[0].length;e++)n[0][e]=LC(n[0][e].body,`hphantom`);let a={type:`array`,mode:`math`,body:r,cols:[{type:`align`,align:`c`}],rowGaps:Array(r.length-1).fill(null),hLinesBeforeRow:Array(r.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:`text`,arraystretch:1,labels:Array(r.length).fill(``),arraycolsep:{number:.04,unit:`em`}},o={type:`styling`,mode:`math`,scriptLevel:`text`,body:[{type:`array`,mode:`math`,body:i,cols:Array(i.length).fill({type:`align`,align:`c`}),rowGaps:Array(i.length-1).fill(null),hLinesBeforeRow:Array(i.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:`text`,arraystretch:1,labels:Array(i.length).fill(``),arraycolsep:null}]};return IC([a,{type:`supsub`,mode:`math`,stack:!0,base:{type:`op`,mode:`math`,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!0,symbol:!1,suppressBaseShift:!0,body:[{type:`leftright`,mode:`math`,body:[e],left:t?t[0]:`(`,right:t?t[1]:`)`,rightColor:void 0}]},sup:o,sub:null}])},zC=class e{constructor(e,t,n){this.lexer=e,this.start=t,this.end=n}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new e(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}},BC=class e{constructor(e,t){this.text=e,this.loc=t}range(t,n){return new e(n,zC.range(this,t))}},VC={DISPLAY:0,TEXT:1,SCRIPT:2,SCRIPTSCRIPT:3},HC=Object.create(null);function Q(e,t){HC[e]=t}var UC=HC;Q(`\\noexpand`,function(e){let t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),Q(`\\expandafter`,function(e){let t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),Q(`\\@firstoftwo`,function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),Q(`\\@secondoftwo`,function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),Q(`\\@ifnextchar`,function(e){let t=e.consumeArgs(3);e.consumeSpaces();let n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),Q(`\\@ifstar`,`\\@ifnextchar *{\\@firstoftwo{#1}}`),Q(`\\TextOrMath`,function(e){let t=e.consumeArgs(2);return e.mode===`text`?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var WC=e=>{let t=``;for(let n=e.length-1;n>-1;n--)t+=e[n].text;return t},GC={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},KC=e=>{let t=e.future().text;return t===`EOF`?[null,``]:[GC[t.charAt(0)],t]},qC=(e,t,n)=>{for(let r=1;r<t.length;r++){let i=GC[t.charAt(r)];e*=n,e+=i}return e};Q(`\\char`,function(e){let t=e.popToken(),n,r=``;if(t.text===`'`)n=8,t=e.popToken();else if(t.text===`"`)n=16,t=e.popToken();else if(t.text==="`"){if(t=e.popToken(),t.text[0]===`\\`)r=t.text.charCodeAt(1);else if(t.text===`EOF`)throw new U("\\char` missing argument");else r=t.text.charCodeAt(0)}else n=10;if(n){let i=t.text;if(r=GC[i.charAt(0)],r==null||r>=n)throw new U(`Invalid base-${n} digit ${t.text}`);r=qC(r,i,n);let a;for([a,i]=KC(e);a!=null&&a<n;)r*=n,r+=a,r=qC(r,i,n),e.popToken(),[a,i]=KC(e)}return`\\@char{${r}}`});function JC(e){let t=e.consumeArgs(1)[0],n=``,r=t[t.length-1].loc.start;for(let e=t.length-1;e>=0;e--){let i=t[e].loc.start;i>r&&(n+=` `,r=i),n+=t[e].text,r+=t[e].text.length}return n}Q(`\\surd`,`\\sqrt{\\vphantom{|}}`),Q(`⊕`,`\\oplus`),Q(`\\long`,``),Q(`\\bgroup`,`{`),Q(`\\egroup`,`}`),Q(`~`,`\\nobreakspace`),Q(`\\lq`,"`"),Q(`\\rq`,`'`),Q(`\\aa`,`\\r a`),Q(`\\Bbbk`,`\\Bbb{k}`),Q(`\\mathstrut`,`\\vphantom{(}`),Q(`\\underbar`,`\\underline{\\text{#1}}`),Q(`\\vdots`,`{\\varvdots\\rule{0pt}{15pt}}`),Q(`⋮`,`\\vdots`),Q(`\\arraystretch`,`1`),Q(`\\arraycolsep`,`6pt`),Q(`\\substack`,`\\begin{subarray}{c}#1\\end{subarray}`),Q(`\\iff`,`\\DOTSB\\;\\Longleftrightarrow\\;`),Q(`\\implies`,`\\DOTSB\\;\\Longrightarrow\\;`),Q(`\\impliedby`,`\\DOTSB\\;\\Longleftarrow\\;`);var YC={",":`\\dotsc`,"\\not":`\\dotsb`,"+":`\\dotsb`,"=":`\\dotsb`,"<":`\\dotsb`,">":`\\dotsb`,"-":`\\dotsb`,"*":`\\dotsb`,":":`\\dotsb`,"\\DOTSB":`\\dotsb`,"\\coprod":`\\dotsb`,"\\bigvee":`\\dotsb`,"\\bigwedge":`\\dotsb`,"\\biguplus":`\\dotsb`,"\\bigcap":`\\dotsb`,"\\bigcup":`\\dotsb`,"\\prod":`\\dotsb`,"\\sum":`\\dotsb`,"\\bigotimes":`\\dotsb`,"\\bigoplus":`\\dotsb`,"\\bigodot":`\\dotsb`,"\\bigsqcap":`\\dotsb`,"\\bigsqcup":`\\dotsb`,"\\bigtimes":`\\dotsb`,"\\And":`\\dotsb`,"\\longrightarrow":`\\dotsb`,"\\Longrightarrow":`\\dotsb`,"\\longleftarrow":`\\dotsb`,"\\Longleftarrow":`\\dotsb`,"\\longleftrightarrow":`\\dotsb`,"\\Longleftrightarrow":`\\dotsb`,"\\mapsto":`\\dotsb`,"\\longmapsto":`\\dotsb`,"\\hookrightarrow":`\\dotsb`,"\\doteq":`\\dotsb`,"\\mathbin":`\\dotsb`,"\\mathrel":`\\dotsb`,"\\relbar":`\\dotsb`,"\\Relbar":`\\dotsb`,"\\xrightarrow":`\\dotsb`,"\\xleftarrow":`\\dotsb`,"\\DOTSI":`\\dotsi`,"\\int":`\\dotsi`,"\\oint":`\\dotsi`,"\\iint":`\\dotsi`,"\\iiint":`\\dotsi`,"\\iiiint":`\\dotsi`,"\\DOTSX":`\\dotsx`};Q(`\\dots`,function(e){let t=`\\dotso`,n=e.expandAfterFuture().text;return n in YC?t=YC[n]:(n.slice(0,4)===`\\not`||n in MS.math&&[`bin`,`rel`].includes(MS.math[n].group))&&(t=`\\dotsb`),t}),Q(`\\dotsb`,`\\cdots`),Q(`\\dotsm`,`\\cdots`),Q(`\\dotsi`,`\\!\\cdots`),Q(`\\idotsint`,`\\int\\!\\cdots\\!\\int`),Q(`\\dotsx`,`\\ldots\\,`),Q(`\\DOTSI`,`\\relax`),Q(`\\DOTSB`,`\\relax`),Q(`\\DOTSX`,`\\relax`),Q(`\\tmspace`,`\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax`),Q(`\\,`,`{\\tmspace+{3mu}{.1667em}}`),Q(`\\thinspace`,`\\,`),Q(`\\>`,`\\mskip{4mu}`),Q(`\\:`,`{\\tmspace+{4mu}{.2222em}}`),Q(`\\medspace`,`\\:`),Q(`\\;`,`{\\tmspace+{5mu}{.2777em}}`),Q(`\\thickspace`,`\\;`),Q(`\\!`,`{\\tmspace-{3mu}{.1667em}}`),Q(`\\negthinspace`,`\\!`),Q(`\\negmedspace`,`{\\tmspace-{4mu}{.2222em}}`),Q(`\\negthickspace`,`{\\tmspace-{5mu}{.277em}}`),Q(`\\enspace`,`\\kern.5em `),Q(`\\enskip`,`\\hskip.5em\\relax`),Q(`\\quad`,`\\hskip1em\\relax`),Q(`\\qquad`,`\\hskip2em\\relax`),Q(`\\AA`,`\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax`),Q(`\\tag`,`\\@ifstar\\tag@literal\\tag@paren`),Q(`\\tag@paren`,`\\tag@literal{({#1})}`),Q(`\\tag@literal`,e=>{if(e.macros.get(`\\df@tag`))throw new U(`Multiple \\tag`);return`\\gdef\\df@tag{\\text{#1}}`}),Q(`\\notag`,`\\nonumber`),Q(`\\nonumber`,`\\gdef\\@eqnsw{0}`),Q(`\\bmod`,`\\mathbin{\\text{mod}}`),Q(`\\pod`,`\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)`),Q(`\\pmod`,`\\pod{{\\rm mod}\\mkern6mu#1}`),Q(`\\mod`,`\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1`),Q(`\\newline`,`\\\\\\relax`),Q(`\\TeX`,`\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}`),Q(`\\LaTeX`,`\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX`),Q(`\\Temml`,`\\textrm{T}\\kern-0.2em\\lower{0.2em}{\\textrm{E}}\\kern-0.08em{\\textrm{M}\\kern-0.08em\\raise{0.2em}\\textrm{M}\\kern-0.08em\\textrm{L}}`),Q(`\\hspace`,`\\@ifstar\\@hspacer\\@hspace`),Q(`\\@hspace`,`\\hskip #1\\relax`),Q(`\\@hspacer`,`\\rule{0pt}{0pt}\\hskip #1\\relax`),Q(`\\colon`,`\\mathpunct{\\char"3a}`),Q(`\\prescript`,`\\pres@cript{^{#1}_{#2}}{}{#3}`),Q(`\\ordinarycolon`,`\\char"3a`),Q(`\\vcentcolon`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}`),Q(`\\coloneq`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}`),Q(`\\Coloneq`,`\\mathrel{\\char"2237\\char"2212}`),Q(`\\Eqqcolon`,`\\mathrel{\\char"3d\\char"2237}`),Q(`\\Eqcolon`,`\\mathrel{\\char"2212\\char"2237}`),Q(`\\colonapprox`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}`),Q(`\\Colonapprox`,`\\mathrel{\\char"2237\\char"2248}`),Q(`\\colonsim`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}`),Q(`\\Colonsim`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}`),Q(`\\ratio`,`\\vcentcolon`),Q(`\\coloncolon`,`\\dblcolon`),Q(`\\colonequals`,`\\coloneqq`),Q(`\\coloncolonequals`,`\\Coloneqq`),Q(`\\equalscolon`,`\\eqqcolon`),Q(`\\equalscoloncolon`,`\\Eqqcolon`),Q(`\\colonminus`,`\\coloneq`),Q(`\\coloncolonminus`,`\\Coloneq`),Q(`\\minuscolon`,`\\eqcolon`),Q(`\\minuscoloncolon`,`\\Eqcolon`),Q(`\\coloncolonapprox`,`\\Colonapprox`),Q(`\\coloncolonsim`,`\\Colonsim`),Q(`\\notni`,"\\mathrel{\\char`∌}"),Q(`\\limsup`,`\\DOTSB\\operatorname*{lim\\,sup}`),Q(`\\liminf`,`\\DOTSB\\operatorname*{lim\\,inf}`),Q(`\\injlim`,`\\DOTSB\\operatorname*{inj\\,lim}`),Q(`\\projlim`,`\\DOTSB\\operatorname*{proj\\,lim}`),Q(`\\varlimsup`,`\\DOTSB\\operatorname*{\\overline{\\text{lim}}}`),Q(`\\varliminf`,`\\DOTSB\\operatorname*{\\underline{\\text{lim}}}`),Q(`\\varinjlim`,`\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}`),Q(`\\varprojlim`,`\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}`),Q(`\\centerdot`,`{\\medspace\\rule{0.167em}{0.189em}\\medspace}`),Q(`\\argmin`,`\\DOTSB\\operatorname*{arg\\,min}`),Q(`\\argmax`,`\\DOTSB\\operatorname*{arg\\,max}`),Q(`\\plim`,`\\DOTSB\\operatorname*{plim}`),Q(`\\leftmodels`,`\\mathop{\\reflectbox{$\\models$}}`),Q(`\\bra`,`\\mathinner{\\langle{#1}|}`),Q(`\\ket`,`\\mathinner{|{#1}\\rangle}`),Q(`\\braket`,`\\mathinner{\\langle{#1}\\rangle}`),Q(`\\Bra`,`\\left\\langle#1\\right|`),Q(`\\Ket`,`\\left|#1\\right\\rangle`);var XC=(e,t)=>{let n=`}\\,\\middle${t[0]===`|`?`\\vert`:`\\Vert`}\\,{`;return e.slice(0,t.index)+n+e.slice(t.index+t[0].length)};Q(`\\Braket`,function(e){let t=JC(e),n=/\|\||\||\\\|/g,r;for(;(r=n.exec(t))!==null;)t=XC(t,r);return`\\left\\langle{`+t+`}\\right\\rangle`}),Q(`\\Set`,function(e){let t=JC(e),n=/\|\||\||\\\|/.exec(t);return n&&(t=XC(t,n)),`\\left\\{\\:{`+t+`}\\:\\right\\}`}),Q(`\\set`,function(e){return`\\{{`+JC(e).replace(/\|/,`}\\mid{`)+`}\\}`}),Q(`\\angln`,`{\\angl n}`),Q(`\\odv`,`\\@ifstar\\odv@next\\odv@numerator`),Q(`\\odv@numerator`,`\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}`),Q(`\\odv@next`,`\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1`),Q(`\\pdv`,`\\@ifstar\\pdv@next\\pdv@numerator`);var ZC=e=>{let t=e[0][0].text,n=WC(e[1]).split(`,`),r=String(n.length),i=r===`1`?`\\partial`:`\\partial^${r}`,a=``;return n.map(e=>{a+=`\\partial `+e.trim()+`\\,`}),[t,i,a.replace(/\\,$/,``)]};Q(`\\pdv@numerator`,function(e){let[t,n,r]=ZC(e.consumeArgs(2));return`\\frac{${n} ${t}}{${r}}`}),Q(`\\pdv@next`,function(e){let[t,n,r]=ZC(e.consumeArgs(2));return`\\frac{${n}}{${r}} ${t}`}),Q(`\\upalpha`,`\\up@greek{\\alpha}`),Q(`\\upbeta`,`\\up@greek{\\beta}`),Q(`\\upgamma`,`\\up@greek{\\gamma}`),Q(`\\updelta`,`\\up@greek{\\delta}`),Q(`\\upepsilon`,`\\up@greek{\\epsilon}`),Q(`\\upzeta`,`\\up@greek{\\zeta}`),Q(`\\upeta`,`\\up@greek{\\eta}`),Q(`\\uptheta`,`\\up@greek{\\theta}`),Q(`\\upiota`,`\\up@greek{\\iota}`),Q(`\\upkappa`,`\\up@greek{\\kappa}`),Q(`\\uplambda`,`\\up@greek{\\lambda}`),Q(`\\upmu`,`\\up@greek{\\mu}`),Q(`\\upnu`,`\\up@greek{\\nu}`),Q(`\\upxi`,`\\up@greek{\\xi}`),Q(`\\upomicron`,`\\up@greek{\\omicron}`),Q(`\\uppi`,`\\up@greek{\\pi}`),Q(`\\upalpha`,`\\up@greek{\\alpha}`),Q(`\\uprho`,`\\up@greek{\\rho}`),Q(`\\upsigma`,`\\up@greek{\\sigma}`),Q(`\\uptau`,`\\up@greek{\\tau}`),Q(`\\upupsilon`,`\\up@greek{\\upsilon}`),Q(`\\upphi`,`\\up@greek{\\phi}`),Q(`\\upchi`,`\\up@greek{\\chi}`),Q(`\\uppsi`,`\\up@greek{\\psi}`),Q(`\\upomega`,`\\up@greek{\\omega}`),Q(`\\invamp`,`\\mathbin{\\char"214b}`),Q(`\\parr`,`\\mathbin{\\char"214b}`),Q(`\\upand`,`\\mathbin{\\char"214b}`),Q(`\\with`,`\\mathbin{\\char"26}`),Q(`\\multimapinv`,`\\mathrel{\\char"27dc}`),Q(`\\multimapboth`,`\\mathrel{\\char"29df}`),Q(`\\scoh`,`{\\mkern5mu\\char"2322\\mkern5mu}`),Q(`\\sincoh`,`{\\mkern5mu\\char"2323\\mkern5mu}`),Q(`\\coh`,`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}
|
|
52
|
-
{\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}`),Q(`\\incoh`,`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}
|
|
53
|
-
{\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}`),Q(`\\standardstate`,"\\text{\\tiny\\char`⦵}"),Q(`\\ce`,function(e){return QC(e.consumeArgs(1)[0],`ce`)}),Q(`\\pu`,function(e){return QC(e.consumeArgs(1)[0],`pu`)}),Q(`\\uniDash`,`{\\rule{0.672em}{0.06em}}`),Q(`\\triDash`,`{\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}}`),Q(`\\tripleDash`,`\\kern0.075em\\raise0.25em{\\triDash}\\kern0.075em`),Q(`\\tripleDashOverLine`,`\\kern0.075em\\mathrlap{\\raise0.125em{\\uniDash}}\\raise0.34em{\\triDash}\\kern0.075em`),Q(`\\tripleDashOverDoubleLine`,`\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\triDash}}\\raise0.27em{\\uniDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em`),Q(`\\tripleDashBetweenDoubleLine`,`\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\uniDash}}\\raise0.27em{\\triDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em`);var QC=function(e,t){for(var n=``,r=e.length&&e[e.length-1].loc.start,i=e.length-1;i>=0;i--)e[i].loc.start>r&&(n+=` `,r=e[i].loc.start),n+=e[i].text,r+=e[i].text.length;return $C.go($.go(n,t))},$={go:function(e,t){if(!e)return[];t===void 0&&(t=`ce`);var n=`0`,r={};r.parenthesisLevel=0,e=e.replace(/\n/g,` `),e=e.replace(/[\u2212\u2013\u2014\u2010]/g,`-`),e=e.replace(/[\u2026]/g,`...`);for(var i,a=10,o=[];;){i===e?a--:(a=10,i=e);var s=$.stateMachines[t],c=s.transitions[n]||s.transitions[`*`];iterateTransitions:for(var l=0;l<c.length;l++){var u=$.patterns.match_(c[l].pattern,e);if(u){for(var d=c[l].task,f=0;f<d.action_.length;f++){var p;if(s.actions[d.action_[f].type_])p=s.actions[d.action_[f].type_](r,u.match_,d.action_[f].option);else if($.actions[d.action_[f].type_])p=$.actions[d.action_[f].type_](r,u.match_,d.action_[f].option);else throw[`MhchemBugA`,`mhchem bug A. Please report. (`+d.action_[f].type_+`)`];$.concatArray(o,p)}if(n=d.nextState||n,e.length>0){if(d.revisit||(e=u.remainder),!d.toContinue)break iterateTransitions}else return o}}if(a<=0)throw[`MhchemBugU`,`mhchem bug U. Please report.`]}},concatArray:function(e,t){if(t){if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"(-)(9)^(-9)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"state of aggregation $":function(e){var t=$.patterns.findObserveGroups(e,``,/^\([a-z]{1,3}(?=[\),])/,`)`,``);if(t&&t.remainder.match(/^($|[\s,;\)\]\}])/))return t;var n=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return n?{match_:n[0],remainder:e.substr(n[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return $.patterns.findObserveGroups(e,`^{`,``,``,`}`)},"^($...$)":function(e){return $.patterns.findObserveGroups(e,`^`,`$`,`$`,``)},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return $.patterns.findObserveGroups(e,`^`,/^\\[a-zA-Z]+\{/,`}`,``,``,`{`,`}`,``,!0)},"^\\x{}":function(e){return $.patterns.findObserveGroups(e,`^`,/^\\[a-zA-Z]+\{/,`}`,``)},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return $.patterns.findObserveGroups(e,`_{`,``,``,`}`)},"_($...$)":function(e){return $.patterns.findObserveGroups(e,`_`,`$`,`$`,``)},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return $.patterns.findObserveGroups(e,`_`,/^\\[a-zA-Z]+\{/,`}`,``,``,`{`,`}`,``,!0)},"_\\x{}":function(e){return $.patterns.findObserveGroups(e,`_`,/^\\[a-zA-Z]+\{/,`}`,``)},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return $.patterns.findObserveGroups(e,``,`{`,`}`,``)},"{(...)}":function(e){return $.patterns.findObserveGroups(e,`{`,``,``,`}`)},"$...$":function(e){return $.patterns.findObserveGroups(e,``,`$`,`$`,``)},"${(...)}$":function(e){return $.patterns.findObserveGroups(e,"${",``,``,`}$`)},"$(...)$":function(e){return $.patterns.findObserveGroups(e,`$`,``,``,`$`)},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\bond{`,``,``,`}`)},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return $.patterns.findObserveGroups(e,`[`,``,``,`]`)},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return $.patterns.findObserveGroups(e,``,/^\\[a-zA-Z]+\{/,`}`,``,``,`{`,`}`,``,!0)},"\\x{}":function(e){return $.patterns.findObserveGroups(e,``,/^\\[a-zA-Z]+\{/,`}`,``)},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\frac{`,``,``,`}`,`{`,``,``,`}`)},"\\overset{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\overset{`,``,``,`}`,`{`,``,``,`}`)},"\\underset{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\underset{`,``,``,`}`,`{`,``,``,`}`)},"\\underbrace{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\underbrace{`,``,``,`}_`,`{`,``,``,`}`)},"\\color{(...)}0":function(e){return $.patterns.findObserveGroups(e,`\\color{`,``,``,`}`)},"\\color{(...)}{(...)}1":function(e){return $.patterns.findObserveGroups(e,`\\color{`,``,``,`}`,`{`,``,``,`}`)},"\\color(...){(...)}2":function(e){return $.patterns.findObserveGroups(e,`\\color`,`\\`,``,/^(?=\{)/,`{`,``,``,`}`)},"\\ce{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\ce{`,``,``,`}`)},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){var t=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/);if(t)return{match_:t[0],remainder:e.substr(t[0].length)};var n=$.patterns.findObserveGroups(e,``,`$`,`$`,``);return n&&(t=n.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),t)?{match_:t[0],remainder:e.substr(t[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var t=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return t?{match_:t[0],remainder:e.substr(t[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,t,n,r,i,a,o,s,c,l){var u=function(e,t){if(typeof t==`string`)return e.indexOf(t)===0?t:null;var n=e.match(t);return n?n[0]:null},d=function(e,t,n){for(var r=0;t<e.length;){var i=e.charAt(t),a=u(e.substr(t),n);if(a!==null&&r===0)return{endMatchBegin:t,endMatchEnd:t+a.length};if(i===`{`)r++;else if(i===`}`){if(r===0)throw[`ExtraCloseMissingOpen`,`Extra close brace or missing open brace`];r--}t++}return null},f=u(e,t);if(f===null||(e=e.substr(f.length),f=u(e,n),f===null))return null;var p=d(e,f.length,r||i);if(p===null)return null;var m=e.substring(0,r?p.endMatchEnd:p.endMatchBegin);if(a||o){var h=this.findObserveGroups(e.substr(p.endMatchEnd),a,o,s,c);if(h===null)return null;var g=[m,h.match_];return{match_:l?g.join(``):g,remainder:h.remainder}}return{match_:m,remainder:e.substr(p.endMatchEnd)}},match_:function(e,t){var n=$.patterns.patterns[e];if(n===void 0)throw[`MhchemBugP`,`mhchem bug P. Please report. (`+e+`)`];if(typeof n==`function`)return $.patterns.patterns[e](t);var r=t.match(n);return r?{match_:r[2]?[r[1],r[2]]:r[1]?r[1]:r[0],remainder:t.substr(r[0].length)}:null}},actions:{"a=":function(e,t){e.a=(e.a||``)+t},"b=":function(e,t){e.b=(e.b||``)+t},"p=":function(e,t){e.p=(e.p||``)+t},"o=":function(e,t){e.o=(e.o||``)+t},"q=":function(e,t){e.q=(e.q||``)+t},"d=":function(e,t){e.d=(e.d||``)+t},"rm=":function(e,t){e.rm=(e.rm||``)+t},"text=":function(e,t){e.text_=(e.text_||``)+t},insert:function(e,t,n){return{type_:n}},"insert+p1":function(e,t,n){return{type_:n,p1:t}},"insert+p1+p2":function(e,t,n){return{type_:n,p1:t[0],p2:t[1]}},copy:function(e,t){return t},rm:function(e,t){return{type_:`rm`,p1:t||``}},text:function(e,t){return $.go(t,`text`)},"{text}":function(e,t){var n=[`{`];return $.concatArray(n,$.go(t,`text`)),n.push(`}`),n},"tex-math":function(e,t){return $.go(t,`tex-math`)},"tex-math tight":function(e,t){return $.go(t,`tex-math tight`)},bond:function(e,t,n){return{type_:`bond`,kind_:n||t}},"color0-output":function(e,t){return{type_:`color0`,color:t[0]}},ce:function(e,t){return $.go(t)},"1/2":function(e,t){var n=[];t.match(/^[+\-]/)&&(n.push(t.substr(0,1)),t=t.substr(1));var r=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return r[1]=r[1].replace(/\$/g,``),n.push({type_:`frac`,p1:r[1],p2:r[2]}),r[3]&&(r[3]=r[3].replace(/\$/g,``),n.push({type_:`tex-math`,p1:r[3]})),n},"9,9":function(e,t){return $.go(t,`9,9`)}},createTransitions:function(e){var t,n,r,i,a={};for(t in e)for(n in e[t])for(r=n.split(`|`),e[t][n].stateArray=r,i=0;i<r.length;i++)a[r[i]]=[];for(t in e)for(n in e[t])for(r=e[t][n].stateArray||[],i=0;i<r.length;i++){var o=e[t][n];if(o.action_){o.action_=[].concat(o.action_);for(var s=0;s<o.action_.length;s++)typeof o.action_[s]==`string`&&(o.action_[s]={type_:o.action_[s]})}else o.action_=[];for(var c=t.split(`|`),l=0;l<c.length;l++)if(r[i]===`*`)for(var u in a)a[u].push({pattern:c[l],task:o});else a[r[i]].push({pattern:c[l],task:o})}return a},stateMachines:{}};$.stateMachines={ce:{transitions:$.createTransitions({empty:{"*":{action_:`output`}},else:{"0|1|2":{action_:`beginsWithBond=false`,revisit:!0,toContinue:!0}},oxidation$:{0:{action_:`oxidation-output`}},CMT:{r:{action_:`rdt=`,nextState:`rt`},rd:{action_:`rqt=`,nextState:`rdt`}},arrowUpDown:{"0|1|2|as":{action_:[`sb=false`,`output`,`operator`],nextState:`1`}},uprightEntities:{"0|1|2":{action_:[`o=`,`output`],nextState:`1`}},orbital:{"0|1|2|3":{action_:`o=`,nextState:`o`}},"->":{"0|1|2|3":{action_:`r=`,nextState:`r`},"a|as":{action_:[`output`,`r=`],nextState:`r`},"*":{action_:[`output`,`r=`],nextState:`r`}},"+":{o:{action_:`d= kv`,nextState:`d`},"d|D":{action_:`d=`,nextState:`d`},q:{action_:`d=`,nextState:`qd`},"qd|qD":{action_:`d=`,nextState:`qd`},dq:{action_:[`output`,`d=`],nextState:`d`},3:{action_:[`sb=false`,`output`,`operator`],nextState:`0`}},amount:{"0|2":{action_:`a=`,nextState:`a`}},"pm-operator":{"0|1|2|a|as":{action_:[`sb=false`,`output`,{type_:`operator`,option:`\\pm`}],nextState:`0`}},operator:{"0|1|2|a|as":{action_:[`sb=false`,`output`,`operator`],nextState:`0`}},"-$":{"o|q":{action_:[`charge or bond`,`output`],nextState:`qd`},d:{action_:`d=`,nextState:`d`},D:{action_:[`output`,{type_:`bond`,option:`-`}],nextState:`3`},q:{action_:`d=`,nextState:`qd`},qd:{action_:`d=`,nextState:`qd`},"qD|dq":{action_:[`output`,{type_:`bond`,option:`-`}],nextState:`3`}},"-9":{"3|o":{action_:[`output`,{type_:`insert`,option:`hyphen`}],nextState:`3`}},"- orbital overlap":{o:{action_:[`output`,{type_:`insert`,option:`hyphen`}],nextState:`2`},d:{action_:[`output`,{type_:`insert`,option:`hyphen`}],nextState:`2`}},"-":{"0|1|2":{action_:[{type_:`output`,option:1},`beginsWithBond=true`,{type_:`bond`,option:`-`}],nextState:`3`},3:{action_:{type_:`bond`,option:`-`}},a:{action_:[`output`,{type_:`insert`,option:`hyphen`}],nextState:`2`},as:{action_:[{type_:`output`,option:2},{type_:`bond`,option:`-`}],nextState:`3`},b:{action_:`b=`},o:{action_:{type_:`- after o/d`,option:!1},nextState:`2`},q:{action_:{type_:`- after o/d`,option:!1},nextState:`2`},"d|qd|dq":{action_:{type_:`- after o/d`,option:!0},nextState:`2`},"D|qD|p":{action_:[`output`,{type_:`bond`,option:`-`}],nextState:`3`}},amount2:{"1|3":{action_:`a=`,nextState:`a`}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:`o=`,nextState:`o`},"q|dq":{action_:[`output`,`o=`],nextState:`o`},"d|D|qd|qD":{action_:`o after d`,nextState:`o`}},digits:{o:{action_:`q=`,nextState:`q`},"d|D":{action_:`q=`,nextState:`dq`},q:{action_:[`output`,`o=`],nextState:`o`},a:{action_:`o=`,nextState:`o`}},"space A":{"b|p|bp":{}},space:{a:{nextState:`as`},0:{action_:`sb=false`},"1|2":{action_:`sb=true`},"r|rt|rd|rdt|rdq":{action_:`output`,nextState:`0`},"*":{action_:[`output`,`sb=true`],nextState:`1`}},"1st-level escape":{"1|2":{action_:[`output`,{type_:`insert+p1`,option:`1st-level escape`}]},"*":{action_:[`output`,{type_:`insert+p1`,option:`1st-level escape`}],nextState:`0`}},"[(...)]":{"r|rt":{action_:`rd=`,nextState:`rd`},"rd|rdt":{action_:`rq=`,nextState:`rdq`}},"...":{"o|d|D|dq|qd|qD":{action_:[`output`,{type_:`bond`,option:`...`}],nextState:`3`},"*":{action_:[{type_:`output`,option:1},{type_:`insert`,option:`ellipsis`}],nextState:`1`}},". |* ":{"*":{action_:[`output`,{type_:`insert`,option:`addition compound`}],nextState:`1`}},"state of aggregation $":{"*":{action_:[`output`,`state of aggregation`],nextState:`1`}},"{[(":{"a|as|o":{action_:[`o=`,`output`,`parenthesisLevel++`],nextState:`2`},"0|1|2|3":{action_:[`o=`,`output`,`parenthesisLevel++`],nextState:`2`},"*":{action_:[`output`,`o=`,`output`,`parenthesisLevel++`],nextState:`2`}},")]}":{"0|1|2|3|b|p|bp|o":{action_:[`o=`,`parenthesisLevel--`],nextState:`o`},"a|as|d|D|q|qd|qD|dq":{action_:[`output`,`o=`,`parenthesisLevel--`],nextState:`o`}},", ":{"*":{action_:[`output`,`comma`],nextState:`0`}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:`b=`,nextState:`b`},p:{action_:`b=`,nextState:`bp`},"3|o":{action_:`d= kv`,nextState:`D`},q:{action_:`d=`,nextState:`qD`},"d|D|qd|qD|dq":{action_:[`output`,`d=`],nextState:`D`}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:`b=`,nextState:`b`},p:{action_:`b=`,nextState:`bp`},"3|o":{action_:`d= kv`,nextState:`d`},q:{action_:`d=`,nextState:`qd`},"d|qd|D|qD":{action_:`d=`},dq:{action_:[`output`,`d=`],nextState:`d`}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:[`output`,`q=`],nextState:`q`}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:`p=`,nextState:`p`},b:{action_:`p=`,nextState:`bp`},"3|o":{action_:`q=`,nextState:`q`},"d|D":{action_:`q=`,nextState:`dq`},"q|qd|qD|dq":{action_:[`output`,`q=`],nextState:`q`}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:`output`,option:2},`bond`],nextState:`3`}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:`output`,option:2},{type_:`bond`,option:`#`}],nextState:`3`}},"{}":{"*":{action_:{type_:`output`,option:1},nextState:`1`}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:`o=`,nextState:`o`},"o|d|D|q|qd|qD|dq":{action_:[`output`,`o=`],nextState:`o`}},"$...$":{a:{action_:`a=`},"0|1|2|3|as|b|p|bp|o":{action_:`o=`,nextState:`o`},"as|o":{action_:`o=`},"q|d|D|qd|qD|dq":{action_:[`output`,`o=`],nextState:`o`}},"\\bond{(...)}":{"*":{action_:[{type_:`output`,option:2},`bond`],nextState:`3`}},"\\frac{(...)}":{"*":{action_:[{type_:`output`,option:1},`frac-output`],nextState:`3`}},"\\overset{(...)}":{"*":{action_:[{type_:`output`,option:2},`overset-output`],nextState:`3`}},"\\underset{(...)}":{"*":{action_:[{type_:`output`,option:2},`underset-output`],nextState:`3`}},"\\underbrace{(...)}":{"*":{action_:[{type_:`output`,option:2},`underbrace-output`],nextState:`3`}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:`output`,option:2},`color-output`],nextState:`3`}},"\\color{(...)}0":{"*":{action_:[{type_:`output`,option:2},`color0-output`]}},"\\ce{(...)}":{"*":{action_:[{type_:`output`,option:2},`ce`],nextState:`3`}},"\\,":{"*":{action_:[{type_:`output`,option:1},`copy`],nextState:`1`}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:[`o=`,`output`],nextState:`3`},"*":{action_:[`output`,`o=`,`output`],nextState:`3`}},others:{"*":{action_:[{type_:`output`,option:1},`copy`],nextState:`3`}},else2:{a:{action_:`a to o`,nextState:`o`,revisit:!0},as:{action_:[`output`,`sb=true`],nextState:`1`,revisit:!0},"r|rt|rd|rdt|rdq":{action_:[`output`],nextState:`0`,revisit:!0},"*":{action_:[`output`,`copy`],nextState:`3`}}}),actions:{"o after d":function(e,t){var n;if((e.d||``).match(/^[0-9]+$/)){var r=e.d;e.d=void 0,n=this.output(e),e.b=r}else n=this.output(e);return $.actions[`o=`](e,t),n},"d= kv":function(e,t){e.d=t,e.dType=`kv`},"charge or bond":function(e,t){if(e.beginsWithBond){var n=[];return $.concatArray(n,this.output(e)),$.concatArray(n,$.actions.bond(e,t,`-`)),n}e.d=t},"- after o/d":function(e,t,n){var r=$.patterns.match_(`orbital`,e.o||``),i=$.patterns.match_(`one lowercase greek letter $`,e.o||``),a=$.patterns.match_(`one lowercase latin letter $`,e.o||``),o=$.patterns.match_(`$one lowercase latin letter$ $`,e.o||``),s=t===`-`&&(r&&r.remainder===``||i||a||o);!s||e.a||e.b||e.p||e.d||e.q||r||!a||(e.o=`$`+e.o+`$`);var c=[];return s?($.concatArray(c,this.output(e)),c.push({type_:`hyphen`})):(r=$.patterns.match_(`digits`,e.d||``),n&&r&&r.remainder===``?($.concatArray(c,$.actions[`d=`](e,t)),$.concatArray(c,this.output(e))):($.concatArray(c,this.output(e)),$.concatArray(c,$.actions.bond(e,t,`-`)))),c},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,t){return{type_:`state of aggregation`,p1:$.go(t,`o`)}},comma:function(e,t){var n=t.replace(/\s*$/,``);return n!==t&&e.parenthesisLevel===0?{type_:`comma enumeration L`,p1:n}:{type_:`comma enumeration M`,p1:n}},output:function(e,t,n){var r;if(!e.r)r=[],(e.a||e.b||e.p||e.o||e.q||e.d||n)&&(e.sb&&r.push({type_:`entitySkip`}),!e.o&&!e.q&&!e.d&&!e.b&&!e.p&&n!==2?(e.o=e.a,e.a=void 0):!e.o&&!e.q&&!e.d&&(e.b||e.p)?(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):e.o&&e.dType===`kv`&&$.patterns.match_(`d-oxidation$`,e.d||``)?e.dType=`oxidation`:e.o&&e.dType===`kv`&&!e.q&&(e.dType=void 0),r.push({type_:`chemfive`,a:$.go(e.a,`a`),b:$.go(e.b,`bd`),p:$.go(e.p,`pq`),o:$.go(e.o,`o`),q:$.go(e.q,`pq`),d:$.go(e.d,e.dType===`oxidation`?`oxidation`:`bd`),dType:e.dType}));else{var i=e.rdt===`M`?$.go(e.rd,`tex-math`):e.rdt===`T`?[{type_:`text`,p1:e.rd||``}]:$.go(e.rd),a=e.rqt===`M`?$.go(e.rq,`tex-math`):e.rqt===`T`?[{type_:`text`,p1:e.rq||``}]:$.go(e.rq);r={type_:`arrow`,r:e.r,rd:i,rq:a}}for(var o in e)o!==`parenthesisLevel`&&o!==`beginsWithBond`&&delete e[o];return r},"oxidation-output":function(e,t){var n=[`{`];return $.concatArray(n,$.go(t,`oxidation`)),n.push(`}`),n},"frac-output":function(e,t){return{type_:`frac-ce`,p1:$.go(t[0]),p2:$.go(t[1])}},"overset-output":function(e,t){return{type_:`overset`,p1:$.go(t[0]),p2:$.go(t[1])}},"underset-output":function(e,t){return{type_:`underset`,p1:$.go(t[0]),p2:$.go(t[1])}},"underbrace-output":function(e,t){return{type_:`underbrace`,p1:$.go(t[0]),p2:$.go(t[1])}},"color-output":function(e,t){return{type_:`color`,color1:t[0],color2:$.go(t[1])}},"r=":function(e,t){e.r=t},"rdt=":function(e,t){e.rdt=t},"rd=":function(e,t){e.rd=t},"rqt=":function(e,t){e.rqt=t},"rq=":function(e,t){e.rq=t},operator:function(e,t,n){return{type_:`operator`,kind_:n||t}}}},a:{transitions:$.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:`1/2`}},else:{0:{nextState:`1`,revisit:!0}},"$(...)$":{"*":{action_:`tex-math tight`,nextState:`1`}},",":{"*":{action_:{type_:`insert`,option:`commaDecimal`}}},else2:{"*":{action_:`copy`}}}),actions:{}},o:{transitions:$.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:`1/2`}},else:{0:{nextState:`1`,revisit:!0}},letters:{"*":{action_:`rm`}},"\\ca":{"*":{action_:{type_:`insert`,option:`circa`}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:`copy`}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},"{(...)}":{"*":{action_:`{text}`}},else2:{"*":{action_:`copy`}}}),actions:{}},text:{transitions:$.createTransitions({empty:{"*":{action_:`output`}},"{...}":{"*":{action_:`text=`}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},"\\greek":{"*":{action_:[`output`,`rm`]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:[`output`,`copy`]}},else:{"*":{action_:`text=`}}}),actions:{output:function(e){if(e.text_){var t={type_:`text`,p1:e.text_};for(var n in e)delete e[n];return t}}}},pq:{transitions:$.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:`state of aggregation`}},i$:{0:{nextState:`!f`,revisit:!0}},"(KV letters),":{0:{action_:`rm`,nextState:`0`}},formula$:{0:{nextState:`f`,revisit:!0}},"1/2$":{0:{action_:`1/2`}},else:{0:{nextState:`!f`,revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},"{(...)}":{"*":{action_:`text`}},"a-z":{f:{action_:`tex-math`}},letters:{"*":{action_:`rm`}},"-9.,9":{"*":{action_:`9,9`}},",":{"*":{action_:{type_:`insert+p1`,option:`comma enumeration S`}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:`color-output`}},"\\color{(...)}0":{"*":{action_:`color0-output`}},"\\ce{(...)}":{"*":{action_:`ce`}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:`copy`}},else2:{"*":{action_:`copy`}}}),actions:{"state of aggregation":function(e,t){return{type_:`state of aggregation subscript`,p1:$.go(t,`o`)}},"color-output":function(e,t){return{type_:`color`,color1:t[0],color2:$.go(t[1],`pq`)}}}},bd:{transitions:$.createTransitions({empty:{"*":{}},x$:{0:{nextState:`!f`,revisit:!0}},formula$:{0:{nextState:`f`,revisit:!0}},else:{0:{nextState:`!f`,revisit:!0}},"-9.,9 no missing 0":{"*":{action_:`9,9`}},".":{"*":{action_:{type_:`insert`,option:`electron dot`}}},"a-z":{f:{action_:`tex-math`}},x:{"*":{action_:{type_:`insert`,option:`KV x`}}},letters:{"*":{action_:`rm`}},"'":{"*":{action_:{type_:`insert`,option:`prime`}}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},"{(...)}":{"*":{action_:`text`}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:`color-output`}},"\\color{(...)}0":{"*":{action_:`color0-output`}},"\\ce{(...)}":{"*":{action_:`ce`}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:`copy`}},else2:{"*":{action_:`copy`}}}),actions:{"color-output":function(e,t){return{type_:`color`,color1:t[0],color2:$.go(t[1],`bd`)}}}},oxidation:{transitions:$.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:`roman-numeral`}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},else:{"*":{action_:`copy`}}}),actions:{"roman-numeral":function(e,t){return{type_:`roman numeral`,p1:t||``}}}},"tex-math":{transitions:$.createTransitions({empty:{"*":{action_:`output`}},"\\ce{(...)}":{"*":{action_:[`output`,`ce`]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:`o=`}},else:{"*":{action_:`o=`}}}),actions:{output:function(e){if(e.o){var t={type_:`tex-math`,p1:e.o};for(var n in e)delete e[n];return t}}}},"tex-math tight":{transitions:$.createTransitions({empty:{"*":{action_:`output`}},"\\ce{(...)}":{"*":{action_:[`output`,`ce`]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:`o=`}},"-|+":{"*":{action_:`tight operator`}},else:{"*":{action_:`o=`}}}),actions:{"tight operator":function(e,t){e.o=(e.o||``)+`{`+t+`}`},output:function(e){if(e.o){var t={type_:`tex-math`,p1:e.o};for(var n in e)delete e[n];return t}}}},"9,9":{transitions:$.createTransitions({empty:{"*":{}},",":{"*":{action_:`comma`}},else:{"*":{action_:`copy`}}}),actions:{comma:function(){return{type_:`commaDecimal`}}}},pu:{transitions:$.createTransitions({empty:{"*":{action_:`output`}},space$:{"*":{action_:[`output`,`space`]}},"{[(|)]}":{"0|a":{action_:`copy`}},"(-)(9)^(-9)":{0:{action_:`number^`,nextState:`a`}},"(-)(9.,9)(e)(99)":{0:{action_:`enumber`,nextState:`a`}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:`operator`,option:`\\pm`},nextState:`0`}},operator:{"0|a":{action_:`copy`,nextState:`0`}},"//":{d:{action_:`o=`,nextState:`/`}},"/":{d:{action_:`o=`,nextState:`/`}},"{...}|else":{"0|d":{action_:`d=`,nextState:`d`},a:{action_:[`space`,`d=`],nextState:`d`},"/|q":{action_:`q=`,nextState:`q`}}}),actions:{enumber:function(e,t){var n=[];return t[0]===`+-`||t[0]===`+/-`?n.push(`\\pm `):t[0]&&n.push(t[0]),t[1]&&($.concatArray(n,$.go(t[1],`pu-9,9`)),t[2]&&(t[2].match(/[,.]/)?$.concatArray(n,$.go(t[2],`pu-9,9`)):n.push(t[2])),t[3]=t[4]||t[3],t[3]&&(t[3]=t[3].trim(),t[3]===`e`||t[3].substr(0,1)===`*`?n.push({type_:`cdot`}):n.push({type_:`times`}))),t[3]&&n.push(`10^{`+t[5]+`}`),n},"number^":function(e,t){var n=[];return t[0]===`+-`||t[0]===`+/-`?n.push(`\\pm `):t[0]&&n.push(t[0]),$.concatArray(n,$.go(t[1],`pu-9,9`)),n.push(`^{`+t[2]+`}`),n},operator:function(e,t,n){return{type_:`operator`,kind_:n||t}},space:function(){return{type_:`pu-space-1`}},output:function(e){var t,n=$.patterns.match_(`{(...)}`,e.d||``);n&&n.remainder===``&&(e.d=n.match_);var r=$.patterns.match_(`{(...)}`,e.q||``);if(r&&r.remainder===``&&(e.q=r.match_),e.d&&=(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,`{}^{\\circ}C`),e.d.replace(/\u00B0F|\^oF|\^{o}F/g,`{}^{\\circ}F`)),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,`{}^{\\circ}C`),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,`{}^{\\circ}F`);var i={d:$.go(e.d,`pu`),q:$.go(e.q,`pu`)};e.o===`//`?t={type_:`pu-frac`,p1:i.d,p2:i.q}:(t=i.d,i.d.length>1||i.q.length>1?t.push({type_:` / `}):t.push({type_:`/`}),$.concatArray(t,i.q))}else t=$.go(e.d,`pu-2`);for(var a in e)delete e[a];return t}}},"pu-2":{transitions:$.createTransitions({empty:{"*":{action_:`output`}},"*":{"*":{action_:[`output`,`cdot`],nextState:`0`}},"\\x":{"*":{action_:`rm=`}},space:{"*":{action_:[`output`,`space`],nextState:`0`}},"^{(...)}|^(-1)":{1:{action_:`^(-1)`}},"-9.,9":{0:{action_:`rm=`,nextState:`0`},1:{action_:`^(-1)`,nextState:`0`}},"{...}|else":{"*":{action_:`rm=`,nextState:`1`}}}),actions:{cdot:function(){return{type_:`tight cdot`}},"^(-1)":function(e,t){e.rm+=`^{`+t+`}`},space:function(){return{type_:`pu-space-2`}},output:function(e){var t=[];if(e.rm){var n=$.patterns.match_(`{(...)}`,e.rm||``);t=n&&n.remainder===``?$.go(n.match_,`pu`):{type_:`rm`,p1:e.rm}}for(var r in e)delete e[r];return t}}},"pu-9,9":{transitions:$.createTransitions({empty:{0:{action_:`output-0`},o:{action_:`output-o`}},",":{0:{action_:[`output-0`,`comma`],nextState:`o`}},".":{0:{action_:[`output-0`,`copy`],nextState:`o`}},else:{"*":{action_:`text=`}}}),actions:{comma:function(){return{type_:`commaDecimal`}},"output-0":function(e){var t=[];if(e.text_=e.text_||``,e.text_.length>4){var n=e.text_.length%3;n===0&&(n=3);for(var r=e.text_.length-3;r>0;r-=3)t.push(e.text_.substr(r,3)),t.push({type_:`1000 separator`});t.push(e.text_.substr(0,n)),t.reverse()}else t.push(e.text_);for(var i in e)delete e[i];return t},"output-o":function(e){var t=[];if(e.text_=e.text_||``,e.text_.length>4){for(var n=e.text_.length-3,r=0;r<n;r+=3)t.push(e.text_.substr(r,3)),t.push({type_:`1000 separator`});t.push(e.text_.substr(r))}else t.push(e.text_);for(var i in e)delete e[i];return t}}}};var $C={go:function(e,t){if(!e)return``;for(var n=``,r=!1,i=0;i<e.length;i++){var a=e[i];typeof a==`string`?n+=a:(n+=$C._go2(a),a.type_===`1st-level escape`&&(r=!0))}return!t&&!r&&n&&(n=`{`+n+`}`),n},_goInner:function(e){return e&&$C.go(e,!0)},_go2:function(e){var t;switch(e.type_){case`chemfive`:t=``;var n={a:$C._goInner(e.a),b:$C._goInner(e.b),p:$C._goInner(e.p),o:$C._goInner(e.o),q:$C._goInner(e.q),d:$C._goInner(e.d)};n.a&&(n.a.match(/^[+\-]/)&&(n.a=`{`+n.a+`}`),t+=n.a+`\\,`),(n.b||n.p)&&(t+=`{\\vphantom{X}}`,t+=`^{\\hphantom{`+(n.b||``)+`}}_{\\hphantom{`+(n.p||``)+`}}`,t+=`{\\vphantom{X}}`,t+=`^{\\vphantom{2}\\mathllap{`+(n.b||``)+`}}`,t+=`_{\\vphantom{2}\\mathllap{`+(n.p||``)+`}}`),n.o&&(n.o.match(/^[+\-]/)&&(n.o=`{`+n.o+`}`),t+=n.o),e.dType===`kv`?((n.d||n.q)&&(t+=`{\\vphantom{X}}`),n.d&&(t+=`^{`+n.d+`}`),n.q&&(t+=`_{`+n.q+`}`)):e.dType===`oxidation`?(n.d&&(t+=`{\\vphantom{X}}`,t+=`^{`+n.d+`}`),n.q&&(t+=`{{}}`,t+=`_{`+n.q+`}`)):(n.q&&(t+=`{{}}`,t+=`_{`+n.q+`}`),n.d&&(t+=`{{}}`,t+=`^{`+n.d+`}`));break;case`rm`:t=`\\mathrm{`+e.p1+`}`;break;case`text`:e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(` `,`~`).replace(`-`,`\\text{-}`),t=`\\mathrm{`+e.p1+`}`):t=`\\text{`+e.p1+`}`;break;case`roman numeral`:t=`\\mathrm{`+e.p1+`}`;break;case`state of aggregation`:t=`\\mskip2mu `+$C._goInner(e.p1);break;case`state of aggregation subscript`:t=`\\mskip1mu `+$C._goInner(e.p1);break;case`bond`:if(t=$C._getBond(e.kind_),!t)throw[`MhchemErrorBond`,`mhchem Error. Unknown bond type (`+e.kind_+`)`];break;case`frac`:var r=`\\frac{`+e.p1+`}{`+e.p2+`}`;t=`\\mathchoice{\\textstyle`+r+`}{`+r+`}{`+r+`}{`+r+`}`;break;case`pu-frac`:var i=`\\frac{`+$C._goInner(e.p1)+`}{`+$C._goInner(e.p2)+`}`;t=`\\mathchoice{\\textstyle`+i+`}{`+i+`}{`+i+`}{`+i+`}`;break;case`tex-math`:t=e.p1+` `;break;case`frac-ce`:t=`\\frac{`+$C._goInner(e.p1)+`}{`+$C._goInner(e.p2)+`}`;break;case`overset`:t=`\\overset{`+$C._goInner(e.p1)+`}{`+$C._goInner(e.p2)+`}`;break;case`underset`:t=`\\underset{`+$C._goInner(e.p1)+`}{`+$C._goInner(e.p2)+`}`;break;case`underbrace`:t=`\\underbrace{`+$C._goInner(e.p1)+`}_{`+$C._goInner(e.p2)+`}`;break;case`color`:t=`{\\color{`+e.color1+`}{`+$C._goInner(e.color2)+`}}`;break;case`color0`:t=`\\color{`+e.color+`}`;break;case`arrow`:var a={rd:$C._goInner(e.rd),rq:$C._goInner(e.rq)},o=$C._getArrow(e.r);a.rq&&(o+=`[{\\rm `+a.rq+`}]`),a.rd?o+=`{\\rm `+a.rd+`}`:o+=`{}`,t=o;break;case`operator`:t=$C._getOperator(e.kind_);break;case`1st-level escape`:t=e.p1+` `;break;case`space`:t=` `;break;case`entitySkip`:t=`~`;break;case`pu-space-1`:t=`~`;break;case`pu-space-2`:t=`\\mkern3mu `;break;case`1000 separator`:t=`\\mkern2mu `;break;case`commaDecimal`:t=`{,}`;break;case`comma enumeration L`:t=`{`+e.p1+`}\\mkern6mu `;break;case`comma enumeration M`:t=`{`+e.p1+`}\\mkern3mu `;break;case`comma enumeration S`:t=`{`+e.p1+`}\\mkern1mu `;break;case`hyphen`:t=`\\text{-}`;break;case`addition compound`:t=`\\,{\\cdot}\\,`;break;case`electron dot`:t=`\\mkern1mu \\text{\\textbullet}\\mkern1mu `;break;case`KV x`:t=`{\\times}`;break;case`prime`:t=`\\prime `;break;case`cdot`:t=`\\cdot `;break;case`tight cdot`:t=`\\mkern1mu{\\cdot}\\mkern1mu `;break;case`times`:t=`\\times `;break;case`circa`:t=`{\\sim}`;break;case`^`:t=`uparrow`;break;case`v`:t=`downarrow`;break;case`ellipsis`:t=`\\ldots `;break;case`/`:t=`/`;break;case` / `:t=`\\,/\\,`;break;default:throw[`MhchemBugT`,`mhchem bug T. Please report.`]}return t},_getArrow:function(e){switch(e){case`->`:return`\\yields`;case`→`:return`\\yields`;case`⟶`:return`\\yields`;case`<-`:return`\\yieldsLeft`;case`<->`:return`\\mesomerism`;case`<-->`:return`\\yieldsLeftRight`;case`<=>`:return`\\chemequilibrium`;case`⇌`:return`\\chemequilibrium`;case`<=>>`:return`\\equilibriumRight`;case`<<=>`:return`\\equilibriumLeft`;default:throw[`MhchemBugT`,`mhchem bug T. Please report.`]}},_getBond:function(e){switch(e){case`-`:return`{-}`;case`1`:return`{-}`;case`=`:return`{=}`;case`2`:return`{=}`;case`#`:return`{\\equiv}`;case`3`:return`{\\equiv}`;case`~`:return`{\\tripleDash}`;case`~-`:return`{\\tripleDashOverLine}`;case`~=`:return`{\\tripleDashOverDoubleLine}`;case`~--`:return`{\\tripleDashOverDoubleLine}`;case`-~-`:return`{\\tripleDashBetweenDoubleLine}`;case`...`:return`{{\\cdot}{\\cdot}{\\cdot}}`;case`....`:return`{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}`;case`->`:return`{\\rightarrow}`;case`<-`:return`{\\leftarrow}`;case`<`:return`{<}`;case`>`:return`{>}`;default:throw[`MhchemBugT`,`mhchem bug T. Please report.`]}},_getOperator:function(e){switch(e){case`+`:return` {}+{} `;case`-`:return` {}-{} `;case`=`:return` {}={} `;case`<`:return` {}<{} `;case`>`:return` {}>{} `;case`<<`:return` {}\\ll{} `;case`>>`:return` {}\\gg{} `;case`\\pm`:return` {}\\pm{} `;case`\\approx`:return` {}\\approx{} `;case`$\\approx$`:return` {}\\approx{} `;case`v`:return` \\downarrow{} `;case`(v)`:return` \\downarrow{} `;case`^`:return` \\uparrow{} `;case`(^)`:return` \\uparrow{} `;default:throw[`MhchemBugT`,`mhchem bug T. Please report.`]}}};Q(`\\darr`,`\\downarrow`),Q(`\\dArr`,`\\Downarrow`),Q(`\\Darr`,`\\Downarrow`),Q(`\\lang`,`\\langle`),Q(`\\rang`,`\\rangle`),Q(`\\uarr`,`\\uparrow`),Q(`\\uArr`,`\\Uparrow`),Q(`\\Uarr`,`\\Uparrow`),Q(`\\N`,`\\mathbb{N}`),Q(`\\R`,`\\mathbb{R}`),Q(`\\Z`,`\\mathbb{Z}`),Q(`\\alef`,`\\aleph`),Q(`\\alefsym`,`\\aleph`),Q(`\\bull`,`\\bullet`),Q(`\\clubs`,`\\clubsuit`),Q(`\\cnums`,`\\mathbb{C}`),Q(`\\Complex`,`\\mathbb{C}`),Q(`\\Dagger`,`\\ddagger`),Q(`\\diamonds`,`\\diamondsuit`),Q(`\\empty`,`\\emptyset`),Q(`\\exist`,`\\exists`),Q(`\\harr`,`\\leftrightarrow`),Q(`\\hArr`,`\\Leftrightarrow`),Q(`\\Harr`,`\\Leftrightarrow`),Q(`\\hearts`,`\\heartsuit`),Q(`\\image`,`\\Im`),Q(`\\infin`,`\\infty`),Q(`\\isin`,`\\in`),Q(`\\larr`,`\\leftarrow`),Q(`\\lArr`,`\\Leftarrow`),Q(`\\Larr`,`\\Leftarrow`),Q(`\\lrarr`,`\\leftrightarrow`),Q(`\\lrArr`,`\\Leftrightarrow`),Q(`\\Lrarr`,`\\Leftrightarrow`),Q(`\\natnums`,`\\mathbb{N}`),Q(`\\plusmn`,`\\pm`),Q(`\\rarr`,`\\rightarrow`),Q(`\\rArr`,`\\Rightarrow`),Q(`\\Rarr`,`\\Rightarrow`),Q(`\\real`,`\\Re`),Q(`\\reals`,`\\mathbb{R}`),Q(`\\Reals`,`\\mathbb{R}`),Q(`\\sdot`,`\\cdot`),Q(`\\sect`,`\\S`),Q(`\\spades`,`\\spadesuit`),Q(`\\sub`,`\\subset`),Q(`\\sube`,`\\subseteq`),Q(`\\supe`,`\\supseteq`),Q(`\\thetasym`,`\\vartheta`),Q(`\\weierp`,`\\wp`),Q(`\\quantity`,`{\\left\\{ #1 \\right\\}}`),Q(`\\qty`,`{\\left\\{ #1 \\right\\}}`),Q(`\\pqty`,`{\\left( #1 \\right)}`),Q(`\\bqty`,`{\\left[ #1 \\right]}`),Q(`\\vqty`,`{\\left\\vert #1 \\right\\vert}`),Q(`\\Bqty`,`{\\left\\{ #1 \\right\\}}`),Q(`\\absolutevalue`,`{\\left\\vert #1 \\right\\vert}`),Q(`\\abs`,`{\\left\\vert #1 \\right\\vert}`),Q(`\\norm`,`{\\left\\Vert #1 \\right\\Vert}`),Q(`\\evaluated`,`{\\left.#1 \\right\\vert}`),Q(`\\eval`,`{\\left.#1 \\right\\vert}`),Q(`\\order`,`{\\mathcal{O} \\left( #1 \\right)}`),Q(`\\commutator`,`{\\left[ #1 , #2 \\right]}`),Q(`\\comm`,`{\\left[ #1 , #2 \\right]}`),Q(`\\anticommutator`,`{\\left\\{ #1 , #2 \\right\\}}`),Q(`\\acomm`,`{\\left\\{ #1 , #2 \\right\\}}`),Q(`\\poissonbracket`,`{\\left\\{ #1 , #2 \\right\\}}`),Q(`\\pb`,`{\\left\\{ #1 , #2 \\right\\}}`),Q(`\\vectorbold`,`{\\boldsymbol{ #1 }}`),Q(`\\vb`,`{\\boldsymbol{ #1 }}`),Q(`\\vectorarrow`,`{\\vec{\\boldsymbol{ #1 }}}`),Q(`\\va`,`{\\vec{\\boldsymbol{ #1 }}}`),Q(`\\vectorunit`,`{{\\boldsymbol{\\hat{ #1 }}}}`),Q(`\\vu`,`{{\\boldsymbol{\\hat{ #1 }}}}`),Q(`\\dotproduct`,`\\mathbin{\\boldsymbol\\cdot}`),Q(`\\vdot`,`{\\boldsymbol\\cdot}`),Q(`\\crossproduct`,`\\mathbin{\\boldsymbol\\times}`),Q(`\\cross`,`\\mathbin{\\boldsymbol\\times}`),Q(`\\cp`,`\\mathbin{\\boldsymbol\\times}`),Q(`\\gradient`,`{\\boldsymbol\\nabla}`),Q(`\\grad`,`{\\boldsymbol\\nabla}`),Q(`\\divergence`,`{\\grad\\vdot}`),Q(`\\curl`,`{\\grad\\cross}`),Q(`\\laplacian`,`\\nabla^2`),Q(`\\tr`,`{\\operatorname{tr}}`),Q(`\\Tr`,`{\\operatorname{Tr}}`),Q(`\\rank`,`{\\operatorname{rank}}`),Q(`\\erf`,`{\\operatorname{erf}}`),Q(`\\Res`,`{\\operatorname{Res}}`),Q(`\\principalvalue`,`{\\mathcal{P}}`),Q(`\\pv`,`{\\mathcal{P}}`),Q(`\\PV`,`{\\operatorname{P.V.}}`),Q(`\\qqtext`,`{\\quad\\text{ #1 }\\quad}`),Q(`\\qq`,`{\\quad\\text{ #1 }\\quad}`),Q(`\\qcomma`,`{\\text{,}\\quad}`),Q(`\\qc`,`{\\text{,}\\quad}`),Q(`\\qcc`,`{\\quad\\text{c.c.}\\quad}`),Q(`\\qif`,`{\\quad\\text{if}\\quad}`),Q(`\\qthen`,`{\\quad\\text{then}\\quad}`),Q(`\\qelse`,`{\\quad\\text{else}\\quad}`),Q(`\\qotherwise`,`{\\quad\\text{otherwise}\\quad}`),Q(`\\qunless`,`{\\quad\\text{unless}\\quad}`),Q(`\\qgiven`,`{\\quad\\text{given}\\quad}`),Q(`\\qusing`,`{\\quad\\text{using}\\quad}`),Q(`\\qassume`,`{\\quad\\text{assume}\\quad}`),Q(`\\qsince`,`{\\quad\\text{since}\\quad}`),Q(`\\qlet`,`{\\quad\\text{let}\\quad}`),Q(`\\qfor`,`{\\quad\\text{for}\\quad}`),Q(`\\qall`,`{\\quad\\text{all}\\quad}`),Q(`\\qeven`,`{\\quad\\text{even}\\quad}`),Q(`\\qodd`,`{\\quad\\text{odd}\\quad}`),Q(`\\qinteger`,`{\\quad\\text{integer}\\quad}`),Q(`\\qand`,`{\\quad\\text{and}\\quad}`),Q(`\\qor`,`{\\quad\\text{or}\\quad}`),Q(`\\qas`,`{\\quad\\text{as}\\quad}`),Q(`\\qin`,`{\\quad\\text{in}\\quad}`),Q(`\\differential`,`{\\text{d}}`),Q(`\\dd`,`{\\text{d}}`),Q(`\\derivative`,`{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}`),Q(`\\dv`,`{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}`),Q(`\\partialderivative`,`{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}`),Q(`\\variation`,`{\\delta}`),Q(`\\var`,`{\\delta}`),Q(`\\functionalderivative`,`{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}`),Q(`\\fdv`,`{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}`),Q(`\\innerproduct`,`{\\left\\langle {#1} \\mid { #2} \\right\\rangle}`),Q(`\\outerproduct`,`{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}`),Q(`\\dyad`,`{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}`),Q(`\\ketbra`,`{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}`),Q(`\\op`,`{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}`),Q(`\\expectationvalue`,`{\\left\\langle {#1 } \\right\\rangle}`),Q(`\\expval`,`{\\left\\langle {#1 } \\right\\rangle}`),Q(`\\ev`,`{\\left\\langle {#1 } \\right\\rangle}`),Q(`\\matrixelement`,`{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}`),Q(`\\matrixel`,`{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}`),Q(`\\mel`,`{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}`);function ew(e){let t=[];e.consumeSpaces();let n=e.fetch().text;for(n===`\\relax`&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n===`\\hline`||n===`\\hdashline`;)e.consume(),t.push(n===`\\hdashline`),e.consumeSpaces(),n=e.fetch().text;return t}var tw=e=>{if(!e.parser.settings.displayMode)throw new U(`{${e.envName}} can be used only in display mode.`)},nw=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,rw=e=>{let t=e.get(`\\arraystretch`);typeof t!=`string`&&(t=WC(t.tokens)),t=isNaN(t)?null:Number(t);let n=e.get(`\\arraycolsep`);typeof n!=`string`&&(n=WC(n.tokens));let r=nw.exec(n),i=r?{number:+(r[1]+r[2]),unit:r[3]}:null;return[t,i]},iw=e=>{let t=``;for(let n=0;n<e.length;n++)if(e[n].type===`label`){if(t)throw new U(`Multiple \\labels in one row`);t=e[n].string}return t};function aw(e){if(e.indexOf(`ed`)===-1)return e.indexOf(`*`)===-1}function ow(e,{cols:t,envClasses:n,autoTag:r,singleRow:i,emptySingleRow:a,maxNumCols:o,leqno:s,arraystretch:c,arraycolsep:l},u){let d=n&&n.includes(`bordermatrix`)?`}`:`\\end`;e.gullet.beginGroup(),i||e.gullet.macros.set(`\\cr`,`\\\\\\relax`),e.gullet.beginGroup();let f=[],p=[f],m=[],h=[],g=[],_=r==null?void 0:[];function v(){r&&e.gullet.macros.set(`\\@eqnsw`,`1`,!0)}function y(){_&&(e.gullet.macros.get(`\\df@tag`)?(_.push(e.subparse([new BC(`\\df@tag`)])),e.gullet.macros.set(`\\df@tag`,void 0,!0)):_.push(!!r&&e.gullet.macros.get(`\\@eqnsw`)===`1`))}for(v(),g.push(ew(e));;){let t=e.parseExpression(!1,i?`\\end`:`\\\\`);e.gullet.endGroup(),e.gullet.beginGroup(),t={type:`ordgroup`,mode:e.mode,body:t,semisimple:!0},f.push(t);let r=e.fetch().text;if(r===`&`){if(o&&f.length===o){if(n.includes(`array`)){if(e.settings.strict)throw new U(`Too few columns specified in the {array} column argument.`,e.nextToken)}else if(o===2)throw new U(`The split environment accepts no more than two columns`,e.nextToken);else throw new U(`The equation environment accepts only one column`,e.nextToken)}e.consume()}else if(r===d){y(),f.length===1&&t.body.length===0&&(p.length>1||!a)&&p.pop(),h.push(iw(t.body)),g.length<p.length+1&&g.push([]);break}else if(r===`\\\\`){e.consume();let n;e.gullet.future().text!==` `&&(n=e.parseSizeGroup(!0)),m.push(n?n.value:null),y(),h.push(iw(t.body)),g.push(ew(e)),f=[],p.push(f),v()}else throw new U(`Expected & or \\\\ or \\cr or `+d,e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:`array`,mode:e.mode,body:p,cols:t,rowGaps:m,hLinesBeforeRow:g,envClasses:n,autoTag:r,scriptLevel:u,tags:_,labels:h,leqno:s,arraystretch:c,arraycolsep:l}}function sw(e){return e.slice(0,1)===`d`?`display`:`text`}var cw={c:`center `,l:`left `,r:`right `},lw=e=>{let t=new W(`mtd`,[]);return t.style={padding:`0`,width:`50%`},e.envClasses.includes(`multline`)&&(t.style.width=`7.5%`),t},uw=function(e,t){let n=[],r=e.body.length,i=e.hLinesBeforeRow,a=e.tags&&e.tags.some(e=>e);for(let o=0;o<r;o++){let s=e.body[o],c=[],l=e.scriptLevel===`text`?VC.TEXT:e.scriptLevel===`script`?VC.SCRIPT:VC.DISPLAY;for(let n=0;n<s.length;n++){let i=new W(`mtd`,[nC(s[n],t.withLevel(l))]);if(e.envClasses.includes(`multline`)){let e=o===0?`left`:o===r-1?`right`:`center`;e!==`center`&&i.classes.push(`tml-`+e)}c.push(i)}let u=e.body[0].length;for(let e=0;e<u-s.length;e++)c.push(new W(`mtd`,[],[],t));if(a){let n=e.tags[o],r;n===!0?r=new W(`mtext`,[new vS([`tml-eqn`])]):n===!1?r=new W(`mtext`,[],[]):(r=tC(n[0].body,t.withLevel(l),!0),r=YS(r),r.classes=[`tml-tag`]),r&&(c.unshift(lw(e)),c.push(lw(e)),e.leqno?c[0].children.push(r):c[c.length-1].children.push(r))}let d=new W(`mtr`,c,[]),f=e.labels.shift();f&&e.tags&&e.tags[o]&&(d.setAttribute(`id`,f),Array.isArray(e.tags[o])&&d.classes.push(`tml-tageqn`)),o===0&&i[0].length>0&&(i[0].length===2?d.children.forEach(e=>{e.style.borderTop=`0.15em double`}):d.children.forEach(e=>{e.style.borderTop=i[0][0]?`0.06em dashed`:`0.06em solid`})),i[o+1].length>0&&(i[o+1].length===2?d.children.forEach(e=>{e.style.borderBottom=`0.15em double`}):d.children.forEach(e=>{e.style.borderBottom=i[o+1][0]?`0.06em dashed`:`0.06em solid`}));let p=!0;for(let e=0;e<d.children.length;e++){let t=d.children[e].children[0];if(!(t&&t.type===`mpadded`&&t.attributes.height===`0px`)){p=!1;break}}if(p){d.classes.push(`ff-squash`);for(let e=0;e<d.children.length;e++)d.children[e].style.paddingTop=`0`,d.children[e].style.paddingBottom=`0`}n.push(d)}if(e.arraystretch&&e.arraystretch!==1){let t=String(1.4*e.arraystretch-.8)+`ex`;for(let e=0;e<n.length;e++)for(let r=0;r<n[e].children.length;r++)n[e].children[r].style.paddingTop=t,n[e].children[r].style.paddingBottom=t}let o,s;if(e.envClasses.length>0&&(o=e.envClasses.includes(`abut`)||e.envClasses.includes(`cases`)?`0`:e.envClasses.includes(`small`)?`0.1389`:e.envClasses.includes(`cd`)?`0.25`:`0.4`,s=`em`),e.arraycolsep){let n=yC(e.arraycolsep,t);o=n.number.toFixed(4),s=n.unit}if(o){let t=n.length===0?0:n[0].children.length,r=(n,r)=>n===0&&r===0||n===t-1&&r===1?`0`:e.envClasses[0]===`align`?r===1?`0`:a?n%2?`1`:`0`:n%2?`0`:`1`:o;for(let e=0;e<n.length;e++)for(let t=0;t<n[e].children.length;t++)n[e].children[t].style.paddingLeft=`${r(t,0)}${s}`,n[e].children[t].style.paddingRight=`${r(t,1)}${s}`}if(e.envClasses.length===0)for(let e=0;e<n.length;e++)n[e].children[0].style.paddingLeft=`0em`,n[e].children.length===n[0].children.length&&(n[e].children[n[e].children.length-1].style.paddingRight=`0em`);if(e.envClasses.length>0){let t=e.envClasses.includes(`align`)||e.envClasses.includes(`alignat`);for(let r=0;r<n.length;r++){let i=n[r];if(t){for(let e=0;e<i.children.length;e++)i.children[e].classes=[`tml-`+(e%2?`left`:`right`)];if(a){let t=e.leqno?0:i.children.length-1;i.children[t].classes=[]}}if(i.children.length>1&&e.envClasses.includes(`cases`)&&(i.children[1].style.paddingLeft=`1em`),e.envClasses.includes(`cases`)||e.envClasses.includes(`subarray`))for(let e of i.children)e.classes.push(`tml-left`)}}let c=new W(`mtable`,n);if(e.envClasses.length>0&&(e.envClasses.includes(`jot`)?c.classes.push(`tml-jot`):e.envClasses.includes(`small`)&&c.classes.push(`tml-small`)),e.scriptLevel===`display`&&c.setAttribute(`displaystyle`,`true`),(e.autoTag||e.envClasses.includes(`multline`))&&(c.style.width=`100%`),e.cols&&e.cols.length>0){let t=e.cols,n=!1,r=0,i=t.length;for(;t[r].type===`separator`;)r+=1;for(;t[i-1].type===`separator`;)--i;if(t[0].type===`separator`){let e=t[1].type===`separator`?`0.15em double`:t[0].separator===`|`?`0.06em solid `:`0.06em dashed `;for(let t of c.children)t.children[0].style.borderLeft=e}let o=a?0:-1;for(let e=r;e<i;e++)if(t[e].type===`align`){let r=cw[t[e].align];o+=1;for(let e of c.children)r.trim()!==`center`&&o<e.children.length&&(e.children[o].classes=[`tml-`+r.trim()]);n=!0}else if(t[e].type===`separator`){if(n){let n=t[e+1].type===`separator`?`0.15em double`:t[e].separator===`|`?`0.06em solid`:`0.06em dashed`;for(let e of c.children)o<e.children.length&&(e.children[o].style.borderRight=n)}n=!1}if(t[t.length-1].type===`separator`){let e=t[t.length-2].type===`separator`?`0.15em double`:t[t.length-1].separator===`|`?`0.06em solid`:`0.06em dashed`;for(let t of c.children)t.children[t.children.length-1].style.borderRight=e,t.children[t.children.length-1].style.paddingRight=`0.4em`}}return e.envClasses.includes(`small`)&&(c=new W(`mstyle`,[c]),c.setAttribute(`scriptlevel`,`1`)),c},dw=function(e,t){e.envName.indexOf(`ed`)===-1&&tw(e);let n=e.envName===`split`,r=[],i=ow(e.parser,{cols:r,emptySingleRow:!0,autoTag:n?void 0:aw(e.envName),envClasses:[`abut`,`jot`],maxNumCols:e.envName===`split`?2:void 0,leqno:e.parser.settings.leqno},`display`),a,o=0,s=e.envName.indexOf(`at`)>-1;if(t[0]&&s){let e=``;for(let n=0;n<t[0].body.length;n++){let r=DC(t[0].body[n],`textord`);e+=r.text}if(isNaN(e))throw new U(`The alignat enviroment requires a numeric first argument.`);a=Number(e),o=a*2}i.body.forEach(function(e){if(s){let t=e.length/2;if(a<t)throw new U(`Too many math in a row: expected ${a}, but got ${t}`,e[0])}else o<e.length&&(o=e.length)});for(let e=0;e<o;++e){let t=`r`;e%2==1&&(t=`l`),r[e]={type:`align`,align:t}}return e.envName===`split`||(s?i.envClasses.push(`alignat`):i.envClasses[0]=`align`),i};EC({type:`array`,names:[`array`,`darray`],props:{numArgs:1},handler(e,t){let n=(kC(t[0])?[t[0]]:DC(t[0],`ordgroup`).body).map(function(e){let t=OC(e).text;if(`lcr`.indexOf(t)!==-1)return{type:`align`,align:t};if(t===`|`)return{type:`separator`,separator:`|`};if(t===`:`)return{type:`separator`,separator:`:`};throw new U(`Unknown column alignment: `+t,e)}),[r,i]=rw(e.parser.gullet.macros),a={cols:n,envClasses:[`array`],maxNumCols:n.length,arraystretch:r,arraycolsep:i};return ow(e.parser,a,sw(e.envName))},mathmlBuilder:uw}),EC({type:`array`,names:[`matrix`,`pmatrix`,`bmatrix`,`Bmatrix`,`vmatrix`,`Vmatrix`,`matrix*`,`pmatrix*`,`bmatrix*`,`Bmatrix*`,`vmatrix*`,`Vmatrix*`],props:{numArgs:0},handler(e){let t={matrix:null,pmatrix:[`(`,`)`],bmatrix:[`[`,`]`],Bmatrix:[`\\{`,`\\}`],vmatrix:[`|`,`|`],Vmatrix:[`\\Vert`,`\\Vert`]}[e.envName.replace(`*`,``)],n=`c`,r={envClasses:[],cols:[]};if(e.envName.charAt(e.envName.length-1)===`*`){let t=e.parser;if(t.consumeSpaces(),t.fetch().text===`[`){if(t.consume(),t.consumeSpaces(),n=t.fetch().text,`lcr`.indexOf(n)===-1)throw new U(`Expected l or c or r`,t.nextToken);t.consume(),t.consumeSpaces(),t.expect(`]`),t.consume(),r.cols=[]}}let i=ow(e.parser,r,`text`);i.cols=i.body.length>0?Array(i.body[0].length).fill({type:`align`,align:n}):[];let[a,o]=rw(e.parser.gullet.macros);return i.arraystretch=a,o&&(o!==6||o!==`pt`)&&(i.arraycolsep=o),t?{type:`leftright`,mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},mathmlBuilder:uw}),EC({type:`array`,names:[`bordermatrix`],props:{numArgs:0},handler(e){let t=ow(e.parser,{cols:[],envClasses:[`bordermatrix`]},`text`);return t.cols=t.body.length>0?Array(t.body[0].length).fill({type:`align`,align:`c`}):[],t.envClasses=[],t.arraystretch=1,e.envName===`matrix`?t:RC(t,e.delimiters)},mathmlBuilder:uw}),EC({type:`array`,names:[`smallmatrix`],props:{numArgs:0},handler(e){return ow(e.parser,{envClasses:[`small`]},`script`)},mathmlBuilder:uw}),EC({type:`array`,names:[`subarray`],props:{numArgs:1},handler(e,t){let n=(kC(t[0])?[t[0]]:DC(t[0],`ordgroup`).body).map(function(e){let t=OC(e).text;if(`lc`.indexOf(t)!==-1)return{type:`align`,align:t};throw new U(`Unknown column alignment: `+t,e)});if(n.length>1)throw new U(`{subarray} can contain only one column`);let r={cols:n,envClasses:[`small`]};if(r=ow(e.parser,r,`script`),r.body.length>0&&r.body[0].length>1)throw new U(`{subarray} can contain only one column`);return r},mathmlBuilder:uw}),EC({type:`array`,names:[`cases`,`dcases`,`rcases`,`drcases`],props:{numArgs:0},handler(e){let t=ow(e.parser,{cols:[],envClasses:[`cases`]},sw(e.envName));return{type:`leftright`,mode:e.mode,body:[t],left:e.envName.indexOf(`r`)>-1?`.`:`\\{`,right:e.envName.indexOf(`r`)>-1?`\\}`:`.`,rightColor:void 0}},mathmlBuilder:uw}),EC({type:`array`,names:[`align`,`align*`,`aligned`,`split`],props:{numArgs:0},handler:dw,mathmlBuilder:uw}),EC({type:`array`,names:[`alignat`,`alignat*`,`alignedat`],props:{numArgs:1},handler:dw,mathmlBuilder:uw}),EC({type:`array`,names:[`gathered`,`gather`,`gather*`],props:{numArgs:0},handler(e){e.envName!==`gathered`&&tw(e);let t={cols:[],envClasses:[`abut`,`jot`],autoTag:aw(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return ow(e.parser,t,`display`)},mathmlBuilder:uw}),EC({type:`array`,names:[`equation`,`equation*`],props:{numArgs:0},handler(e){tw(e);let t={autoTag:aw(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:[`align`],leqno:e.parser.settings.leqno};return ow(e.parser,t,`display`)},mathmlBuilder:uw}),EC({type:`array`,names:[`multline`,`multline*`],props:{numArgs:0},handler(e){tw(e);let t={autoTag:e.envName===`multline`,maxNumCols:1,envClasses:[`jot`,`multline`],leqno:e.parser.settings.leqno};return ow(e.parser,t,`display`)},mathmlBuilder:uw}),EC({type:`array`,names:[`CD`],props:{numArgs:0},handler(e){return tw(e),FC(e.parser)},mathmlBuilder:uw}),lS({type:`text`,names:[`\\hline`,`\\hdashline`],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new U(`${e.funcName} valid only within array environment`)}});var fw=TC;lS({type:`bordermatrix`,names:[`\\bordermatrix`,`\\matrix`],props:{numArgs:0,numOptionalArgs:1},handler:({parser:e,funcName:t},n,r)=>{let i=[`(`,`)`];if(t===`\\bordermatrix`&&r[0]&&r[0].body){let e=r[0].body;e.length===1&&e[0].type===`delimiter`&&(i=[e[0].left,e[0].right])}e.consumeSpaces(),e.consume();let a=fw.bordermatrix,o={mode:e.mode,envName:t.slice(1),delimiters:i,parser:e},s=a.handler(o);return e.expect(`}`,!0),s}}),lS({type:`cancelto`,names:[`\\cancelto`],props:{numArgs:2},handler({parser:e},t){let n=t[0],r=t[1];return{type:`cancelto`,mode:e.mode,body:r,to:n,isCharacterBox:$x(r)}},mathmlBuilder(e,t){let n=new W(`mrow`,[nC(e.body,t)],[`ff-narrow`]),r=new W(`mphantom`,[nC(e.body,t)]),i=new W(`mrow`,[r],[`tml-cancelto`]);i.style.color=t.color,e.isCharacterBox&&rS.indexOf(e.body.body[0].text)>-1&&(i.style.left=`0.1em`,i.style.width=`90%`);let a=new W(`mrow`,[n,i],[`menclose`]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text))r.style.paddingRight=`0.2em`;else{r.style.padding=`0.5ex 0.1em 0 0`;let e=new W(`mspace`,[]);e.setAttribute(`height`,`0.85em`),n.children.push(e)}let o;if(e.isCharacterBox)o=new W(`mspace`,[]),o.setAttribute(`height`,`1em`);else{let n=new W(`mpadded`,[nC(e.body,t)]);n.setAttribute(`width`,`0.1px`),o=new W(`mphantom`,[n])}let s=nC(e.to,t);s.style.color=t.color;let c=new W(`mpadded`,[s]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text)){let e=new W(`mspace`,[]);e.setAttribute(`width`,`0.2em`),c.children.unshift(e)}c.setAttribute(`width`,`0.1px`);let l=new W(`mover`,[o,c]),u=new W(`mrow`,[],[`ff-nudge-left`]);return SS([XS([a,l]),u])}}),lS({type:`textord`,names:[`\\@char`],props:{numArgs:1,allowedInText:!0},handler({parser:e,token:t},n){let r=DC(n[0],`ordgroup`).body,i=``;for(let e=0;e<r.length;e++){let t=DC(r[e],`textord`);i+=t.text}let a=parseInt(i);if(isNaN(a))throw new U(`\\@char has non-numeric argument ${i}`,t);return{type:`textord`,mode:e.mode,text:String.fromCodePoint(a)}}});var pw=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,mw=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,hw=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,gw=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,_w=/^[a-f0-9]{6}$/i,vw=e=>{let t=e.toString(16);return t.length===1&&(t=`0`+t),t},yw=JSON.parse(`{
|
|
54
|
-
"Apricot": "#ffb484",
|
|
55
|
-
"Aquamarine": "#08b4bc",
|
|
56
|
-
"Bittersweet": "#c84c14",
|
|
57
|
-
"blue": "#0000FF",
|
|
58
|
-
"Blue": "#303494",
|
|
59
|
-
"BlueGreen": "#08b4bc",
|
|
60
|
-
"BlueViolet": "#503c94",
|
|
61
|
-
"BrickRed": "#b8341c",
|
|
62
|
-
"brown": "#BF8040",
|
|
63
|
-
"Brown": "#802404",
|
|
64
|
-
"BurntOrange": "#f8941c",
|
|
65
|
-
"CadetBlue": "#78749c",
|
|
66
|
-
"CarnationPink": "#f884b4",
|
|
67
|
-
"Cerulean": "#08a4e4",
|
|
68
|
-
"CornflowerBlue": "#40ace4",
|
|
69
|
-
"cyan": "#00FFFF",
|
|
70
|
-
"Cyan": "#08acec",
|
|
71
|
-
"Dandelion": "#ffbc44",
|
|
72
|
-
"darkgray": "#404040",
|
|
73
|
-
"DarkOrchid": "#a8548c",
|
|
74
|
-
"Emerald": "#08ac9c",
|
|
75
|
-
"ForestGreen": "#089c54",
|
|
76
|
-
"Fuchsia": "#90348c",
|
|
77
|
-
"Goldenrod": "#ffdc44",
|
|
78
|
-
"gray": "#808080",
|
|
79
|
-
"Gray": "#98949c",
|
|
80
|
-
"green": "#00FF00",
|
|
81
|
-
"Green": "#08a44c",
|
|
82
|
-
"GreenYellow": "#e0e474",
|
|
83
|
-
"JungleGreen": "#08ac9c",
|
|
84
|
-
"Lavender": "#f89cc4",
|
|
85
|
-
"lightgray": "#c0c0c0",
|
|
86
|
-
"lime": "#BFFF00",
|
|
87
|
-
"LimeGreen": "#90c43c",
|
|
88
|
-
"magenta": "#FF00FF",
|
|
89
|
-
"Magenta": "#f0048c",
|
|
90
|
-
"Mahogany": "#b0341c",
|
|
91
|
-
"Maroon": "#b03434",
|
|
92
|
-
"Melon": "#f89c7c",
|
|
93
|
-
"MidnightBlue": "#086494",
|
|
94
|
-
"Mulberry": "#b03c94",
|
|
95
|
-
"NavyBlue": "#086cbc",
|
|
96
|
-
"olive": "#7F7F00",
|
|
97
|
-
"OliveGreen": "#407c34",
|
|
98
|
-
"orange": "#FF8000",
|
|
99
|
-
"Orange": "#f8843c",
|
|
100
|
-
"OrangeRed": "#f0145c",
|
|
101
|
-
"Orchid": "#b074ac",
|
|
102
|
-
"Peach": "#f8945c",
|
|
103
|
-
"Periwinkle": "#8074bc",
|
|
104
|
-
"PineGreen": "#088c74",
|
|
105
|
-
"pink": "#ff7f7f",
|
|
106
|
-
"Plum": "#98248c",
|
|
107
|
-
"ProcessBlue": "#08b4ec",
|
|
108
|
-
"purple": "#BF0040",
|
|
109
|
-
"Purple": "#a0449c",
|
|
110
|
-
"RawSienna": "#983c04",
|
|
111
|
-
"red": "#ff0000",
|
|
112
|
-
"Red": "#f01c24",
|
|
113
|
-
"RedOrange": "#f86434",
|
|
114
|
-
"RedViolet": "#a0246c",
|
|
115
|
-
"Rhodamine": "#f0549c",
|
|
116
|
-
"Royallue": "#0874bc",
|
|
117
|
-
"RoyalPurple": "#683c9c",
|
|
118
|
-
"RubineRed": "#f0047c",
|
|
119
|
-
"Salmon": "#f8948c",
|
|
120
|
-
"SeaGreen": "#30bc9c",
|
|
121
|
-
"Sepia": "#701404",
|
|
122
|
-
"SkyBlue": "#48c4dc",
|
|
123
|
-
"SpringGreen": "#c8dc64",
|
|
124
|
-
"Tan": "#e09c74",
|
|
125
|
-
"teal": "#007F7F",
|
|
126
|
-
"TealBlue": "#08acb4",
|
|
127
|
-
"Thistle": "#d884b4",
|
|
128
|
-
"Turquoise": "#08b4cc",
|
|
129
|
-
"violet": "#800080",
|
|
130
|
-
"Violet": "#60449c",
|
|
131
|
-
"VioletRed": "#f054a4",
|
|
132
|
-
"WildStrawberry": "#f0246c",
|
|
133
|
-
"yellow": "#FFFF00",
|
|
134
|
-
"Yellow": "#fff404",
|
|
135
|
-
"YellowGreen": "#98cc6c",
|
|
136
|
-
"YellowOrange": "#ffa41c"
|
|
137
|
-
}`),bw=(e,t)=>{let n=``;if(e===`HTML`){if(!pw.test(t))throw new U(`Invalid HTML input.`);n=t}else if(e===`RGB`){if(!hw.test(t))throw new U(`Invalid RGB input.`);t.split(`,`).map(e=>{n+=vw(Number(e.trim()))})}else{if(!gw.test(t))throw new U(`Invalid rbg input.`);t.split(`,`).map(e=>{let t=Number(e.trim());if(t>1)throw new U(`Color rgb input must be < 1.`);n+=vw(Number((t*255).toFixed(0)))})}return n.charAt(0)!==`#`&&(n=`#`+n),n},xw=(e,t,n)=>{let r=`\\\\color@${e}`;if(!mw.exec(e))throw new U(`Invalid color: '`+e+`'`,n);return _w.test(e)?`#`+e:(e.charAt(0)===`#`||(t.has(r)?e=t.get(r).tokens[0].text:yw[e]&&(e=yw[e])),e)},Sw=(e,t)=>{let n=eC(e.body,t.withColor(e.color));return n.length===0&&n.push(new W(`mrow`)),n=n.map(t=>(t.style.color=e.color,t)),SS(n)};lS({type:`color`,names:[`\\textcolor`],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:[`raw`,`raw`,`original`]},handler({parser:e,token:t},n,r){let i=r[0]&&DC(r[0],`raw`).string,a=``;if(i){let e=DC(n[0],`raw`).string;a=bw(i,e)}else a=xw(DC(n[0],`raw`).string,e.gullet.macros,t);let o=n[1];return{type:`color`,mode:e.mode,color:a,isTextColor:!0,body:fS(o)}},mathmlBuilder:Sw}),lS({type:`color`,names:[`\\color`],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:[`raw`,`raw`]},handler({parser:e,breakOnTokenText:t,token:n},r,i){let a=i[0]&&DC(i[0],`raw`).string,o=``;if(a){let e=DC(r[0],`raw`).string;o=bw(a,e)}else o=xw(DC(r[0],`raw`).string,e.gullet.macros,n);let s=e.parseExpression(!0,t,!0);return{type:`color`,mode:e.mode,color:o,isTextColor:!1,body:s}},mathmlBuilder:Sw}),lS({type:`color`,names:[`\\definecolor`],props:{numArgs:3,allowedInText:!0,argTypes:[`raw`,`raw`,`raw`]},handler({parser:e,funcName:t,token:n},r){let i=DC(r[0],`raw`).string;if(!/^[A-Za-z]+$/.test(i))throw new U(`Color name must be latin letters.`,n);let a=DC(r[1],`raw`).string;if(![`HTML`,`RGB`,`rgb`].includes(a))throw new U(`Color model must be HTML, RGB, or rgb.`,n);let o=DC(r[2],`raw`).string,s=bw(a,o);return e.gullet.macros.set(`\\\\color@${i}`,{tokens:[{text:s}],numArgs:0}),{type:`internal`,mode:e.mode}}}),lS({type:`cr`,names:[`\\\\`],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,n){let r=e.gullet.future().text===`[`?e.parseSizeGroup(!0):null,i=!e.settings.displayMode;return{type:`cr`,mode:e.mode,newLine:i,size:r&&DC(r,`size`).value}},mathmlBuilder(e,t){let n=new W(`mo`);if(e.newLine&&(n.setAttribute(`linebreak`,`newline`),e.size)){let r=yC(e.size,t);n.setAttribute(`height`,r.number+r.unit)}return n}});var Cw={"\\global":`\\global`,"\\long":`\\\\globallong`,"\\\\globallong":`\\\\globallong`,"\\def":`\\gdef`,"\\gdef":`\\gdef`,"\\edef":`\\xdef`,"\\xdef":`\\xdef`,"\\let":`\\\\globallet`,"\\futurelet":`\\\\globalfuture`},ww=e=>{let t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new U(`Expected a control sequence`,e);return t},Tw=e=>{let t=e.gullet.popToken();return t.text===`=`&&(t=e.gullet.popToken(),t.text===` `&&(t=e.gullet.popToken())),t},Ew=(e,t,n,r)=>{let i=e.gullet.macros.get(n.text);i??=(n.noexpand=!0,{tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,i,r)};lS({type:`internal`,names:[`\\global`,`\\long`,`\\\\globallong`],props:{numArgs:0,allowedInText:!0},handler({parser:e,funcName:t}){e.consumeSpaces();let n=e.fetch();if(Cw[n.text])return(t===`\\global`||t===`\\\\globallong`)&&(n.text=Cw[n.text]),DC(e.parseFunction(),`internal`);throw new U(`Invalid token after macro prefix`,n)}}),lS({type:`internal`,names:[`\\def`,`\\gdef`,`\\edef`,`\\xdef`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=e.gullet.popToken(),r=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new U(`Expected a control sequence`,n);let i=0,a,o=[[]];for(;e.gullet.future().text!==`{`;)if(n=e.gullet.popToken(),n.text===`#`){if(e.gullet.future().text===`{`){a=e.gullet.future(),o[i].push(`{`);break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new U(`Invalid argument number "${n.text}"`);if(parseInt(n.text)!==i+1)throw new U(`Argument number "${n.text}" out of order`);i++,o.push([])}else if(n.text===`EOF`)throw new U(`Expected a macro definition`);else o[i].push(n.text);let{tokens:s}=e.gullet.consumeArg();if(a&&s.unshift(a),t===`\\edef`||t===`\\xdef`){if(s=e.gullet.expandTokens(s),s.length>e.gullet.settings.maxExpand)throw new U(`Too many expansions in an `+t);s.reverse()}return e.gullet.macros.set(r,{tokens:s,numArgs:i,delimiters:o},t===Cw[t]),{type:`internal`,mode:e.mode}}}),lS({type:`internal`,names:[`\\let`,`\\\\globallet`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=ww(e.gullet.popToken());return e.gullet.consumeSpaces(),Ew(e,n,Tw(e),t===`\\\\globallet`),{type:`internal`,mode:e.mode}}}),lS({type:`internal`,names:[`\\futurelet`,`\\\\globalfuture`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=ww(e.gullet.popToken()),r=e.gullet.popToken(),i=e.gullet.popToken();return Ew(e,n,i,t===`\\\\globalfuture`),e.gullet.pushToken(i),e.gullet.pushToken(r),{type:`internal`,mode:e.mode}}}),lS({type:`internal`,names:[`\\newcommand`,`\\renewcommand`,`\\providecommand`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=``,r=e.gullet.popToken();r.text===`{`?(n=ww(e.gullet.popToken()),e.gullet.popToken()):n=ww(r);let i=e.gullet.isDefined(n);if(i&&t===`\\newcommand`)throw new U(`\\newcommand{${n}} attempting to redefine ${n}; use \\renewcommand`);if(!i&&t===`\\renewcommand`)throw new U(`\\renewcommand{${n}} when command ${n} does not yet exist; use \\newcommand`);let a=0;if(e.gullet.future().text===`[`){let t=e.gullet.popToken();if(t=e.gullet.popToken(),!/^[0-9]$/.test(t.text))throw new U(`Invalid number of arguments: "${t.text}"`);if(a=parseInt(t.text),t=e.gullet.popToken(),t.text!==`]`)throw new U(`Invalid argument "${t.text}"`)}let{tokens:o}=e.gullet.consumeArg();return t===`\\providecommand`&&e.gullet.macros.has(n)||e.gullet.macros.set(n,{tokens:o,numArgs:a}),{type:`internal`,mode:e.mode}}});var Dw={"\\bigl":{mclass:`mopen`,size:1},"\\Bigl":{mclass:`mopen`,size:2},"\\biggl":{mclass:`mopen`,size:3},"\\Biggl":{mclass:`mopen`,size:4},"\\bigr":{mclass:`mclose`,size:1},"\\Bigr":{mclass:`mclose`,size:2},"\\biggr":{mclass:`mclose`,size:3},"\\Biggr":{mclass:`mclose`,size:4},"\\bigm":{mclass:`mrel`,size:1},"\\Bigm":{mclass:`mrel`,size:2},"\\biggm":{mclass:`mrel`,size:3},"\\Biggm":{mclass:`mrel`,size:4},"\\big":{mclass:`mord`,size:1},"\\Big":{mclass:`mord`,size:2},"\\bigg":{mclass:`mord`,size:3},"\\Bigg":{mclass:`mord`,size:4}},Ow={"(":`)`,"\\lparen":`\\rparen`,"[":`]`,"\\lbrack":`\\rbrack`,"\\{":`\\}`,"\\lbrace":`\\rbrace`,"⦇":`⦈`,"\\llparenthesis":`\\rrparenthesis`,"\\lfloor":`\\rfloor`,"⌊":`⌋`,"\\lceil":`\\rceil`,"⌈":`⌉`,"\\langle":`\\rangle`,"⟨":`⟩`,"\\lAngle":`\\rAngle`,"⟪":`⟫`,"\\llangle":`\\rrangle`,"⦉":`⦊`,"\\lvert":`\\rvert`,"\\lVert":`\\rVert`,"\\lgroup":`\\rgroup`,"⟮":`⟯`,"\\lmoustache":`\\rmoustache`,"⎰":`⎱`,"\\llbracket":`\\rrbracket`,"⟦":`⟧`,"\\lBrace":`\\rBrace`,"⦃":`⦄`},kw=new Set(Object.keys(Ow));new Set(Object.values(Ow));var Aw=new Set(`(,\\lparen,),\\rparen,[,\\lbrack,],\\rbrack,\\{,\\lbrace,\\},\\rbrace,⦇,\\llparenthesis,⦈,\\rrparenthesis,\\lfloor,\\rfloor,⌊,⌋,\\lceil,\\rceil,⌈,⌉,<,>,\\langle,⟨,\\rangle,⟩,\\lAngle,⟪,\\rAngle,⟫,\\llangle,⦉,\\rrangle,⦊,\\lt,\\gt,\\lvert,\\rvert,\\lVert,\\rVert,\\lgroup,\\rgroup,⟮,⟯,\\lmoustache,\\rmoustache,⎰,⎱,\\llbracket,\\rrbracket,⟦,⟧,\\lBrace,\\rBrace,⦃,⦄,/,\\backslash,|,\\vert,\\|,\\Vert,‖,\\uparrow,\\Uparrow,\\downarrow,\\Downarrow,\\updownarrow,\\Updownarrow,.`.split(`,`)),jw=new Set([`}`,`\\left`,`\\middle`,`\\right`]),Mw=e=>e.length>0&&(Aw.has(e)||Dw[e]||jw.has(e)),Nw=[0,1.2,1.8,2.4,3];function Pw(e,t){e.type===`ordgroup`&&e.body.length===1&&(e=e.body[0]);let n=kC(e);if(n&&Aw.has(n.text))return(n.text===`<`||n.text===`\\lt`)&&(n.text=`⟨`),(n.text===`>`||n.text===`\\gt`)&&(n.text=`⟩`),n;throw n?new U(`Invalid delimiter '${n.text}' after '${t.funcName}'`,e):new U(`Invalid delimiter type '${e.type}'`,e)}var Fw=new Set([`/`,`\\`,`\\backslash`,`∖`,`\\vert`,`|`]),Iw=(e,t,n,r)=>{let i=new W(`mo`,[qS(e===`.`?``:e,t)]);return i.setAttribute(`fence`,`true`),i.setAttribute(`form`,n),i.setAttribute(`stretchy`,r?`true`:`false`),i};lS({type:`delimsizing`,names:[`\\bigl`,`\\Bigl`,`\\biggl`,`\\Biggl`,`\\bigr`,`\\Bigr`,`\\biggr`,`\\Biggr`,`\\bigm`,`\\Bigm`,`\\biggm`,`\\Biggm`,`\\big`,`\\Big`,`\\bigg`,`\\Bigg`],props:{numArgs:1,argTypes:[`primitive`]},handler:(e,t)=>{let n=Pw(t[0],e),r={type:`delimsizing`,mode:e.parser.mode,size:Dw[e.funcName].size,mclass:Dw[e.funcName].mclass,delim:n.text},i=e.parser.fetch().text;return i!==`^`&&i!==`_`?r:{type:`ordgroup`,mode:`math`,body:[r,{type:`ordgroup`,mode:`math`,body:[]}]}},mathmlBuilder:e=>{let t=[],n=e.delim===`.`?``:e.delim;t.push(qS(n,e.mode));let r=new W(`mo`,t);return e.mclass===`mopen`||e.mclass===`mclose`?r.setAttribute(`fence`,`true`):r.setAttribute(`fence`,`false`),(Fw.has(n)||n.indexOf(`arrow`)>-1)&&r.setAttribute(`stretchy`,`true`),r.setAttribute(`symmetric`,`true`),r.setAttribute(`minsize`,Nw[e.size]+`em`),r.setAttribute(`maxsize`,Nw[e.size]+`em`),r}});function Lw(e){if(!e.body)throw Error(`Bug: The delim ParseNode wasn't fully parsed.`)}lS({type:`leftright-right`,names:[`\\right`],props:{numArgs:1,argTypes:[`primitive`]},handler:(e,t)=>({type:`leftright-right`,mode:e.parser.mode,delim:Pw(t[0],e).text})}),lS({type:`leftright`,names:[`\\left`],props:{numArgs:1,argTypes:[`primitive`]},handler:(e,t)=>{let n=Pw(t[0],e),r=e.parser;++r.leftrightDepth;let i=r.parseExpression(!1,`\\right`,!0),a=r.fetch();for(;a.text===`\\middle`;){r.consume();let e=r.fetch().text;if(!MS.math[e])throw new U(`Invalid delimiter '${e}' after '\\middle'`);Pw({type:`atom`,mode:`math`,text:e},{funcName:`\\middle`}),i.push({type:`middle`,mode:`math`,delim:e}),r.consume(),i=i.concat(r.parseExpression(!1,`\\right`,!0)),a=r.fetch()}--r.leftrightDepth,r.expect(`\\right`,!1);let o=DC(r.parseFunction(),`leftright-right`);return{type:`leftright`,mode:r.mode,body:i,left:n.text,right:o.delim,isStretchy:!0}},mathmlBuilder:(e,t)=>{Lw(e);let n=eC(e.body,t),r=Iw(e.left,e.mode,`prefix`,!0);n.unshift(r);let i=Iw(e.right,e.mode,`postfix`,!0);if(e.body.length>0){let t=e.body[e.body.length-1];t.type===`color`&&!t.isTextColor&&i.setAttribute(`mathcolor`,t.color)}return n.push(i),XS(n)}}),lS({type:`delimiter`,names:Array.from(kw),props:{numArgs:0,allowedInText:!0,allowedInMath:!0,allowedInArgument:!0},handler:({parser:e,funcName:t,token:n})=>{if(e.mode===`text`)return{type:`textord`,mode:`text`,text:t,loc:n.loc};if(!e.settings.wrapDelimiterPairs)return{type:`atom`,mode:`math`,family:`open`,loc:n.loc,text:t};let r=Ow[t],i=e.parseExpression(!1,r,!1);if(e.fetch().text!==r)throw new U(`Unmatched delimiter`);return e.consume(),{type:`delimiter`,mode:e.mode,body:i,left:t,right:r}},mathmlBuilder:(e,t)=>{Lw(e);let n=eC(e.body,t),r=Iw(e.left,e.mode,`prefix`,!1);n.unshift(r);let i=Iw(e.right,e.mode,`postfix`,!1);if(e.body.length>0){let t=e.body[e.body.length-1];t.type===`color`&&!t.isTextColor&&i.setAttribute(`mathcolor`,t.color)}return n.push(i),XS(n)}}),lS({type:`middle`,names:[`\\middle`],props:{numArgs:1,argTypes:[`primitive`]},handler:(e,t)=>{let n=Pw(t[0],e);if(!e.parser.leftrightDepth)throw new U(`\\middle without preceding \\left`,n);return{type:`middle`,mode:e.parser.mode,delim:n.text}},mathmlBuilder:e=>{let t=qS(e.delim,e.mode),n=new W(`mo`,[t]);return n.setAttribute(`stretchy`,`true`),n.setAttribute(`form`,`infix`),t.text!==`/`&&(n.setAttribute(`lspace`,`0.05em`),n.setAttribute(`rspace`,`0.05em`)),n}});var Rw=[`\\boxed`,`\\fcolorbox`,`\\colorbox`],zw=(e,t)=>{let n=new W(Rw.includes(e.label)?`mrow`:`menclose`,[nC(e.body,t)]);switch(e.label){case`\\overline`:n.setAttribute(`notation`,`top`),n.classes.push(`tml-overline`);break;case`\\underline`:n.setAttribute(`notation`,`bottom`),n.classes.push(`tml-underline`);break;case`\\cancel`:n.setAttribute(`notation`,`updiagonalstrike`),n.children.push(new W(`mrow`,[],[`tml-cancel`,`upstrike`]));break;case`\\bcancel`:n.setAttribute(`notation`,`downdiagonalstrike`),n.children.push(new W(`mrow`,[],[`tml-cancel`,`downstrike`]));break;case`\\sout`:n.setAttribute(`notation`,`horizontalstrike`),n.children.push(new W(`mrow`,[],[`tml-cancel`,`sout`]));break;case`\\xcancel`:n.setAttribute(`notation`,`updiagonalstrike downdiagonalstrike`),n.children.push(new W(`mrow`,[],[`tml-cancel`,`tml-xcancel`]));break;case`\\longdiv`:n.setAttribute(`notation`,`longdiv`),n.classes.push(`longdiv-top`),n.children.push(new W(`mrow`,[],[`longdiv-arc`]));break;case`\\phase`:n.setAttribute(`notation`,`phasorangle`),n.classes.push(`phasor-bottom`),n.children.push(new W(`mrow`,[],[`phasor-angle`]));break;case`\\textcircled`:n.setAttribute(`notation`,`circle`),n.classes.push(`circle-pad`),n.children.push(new W(`mrow`,[],[`textcircle`]));break;case`\\angl`:n.setAttribute(`notation`,`actuarial`),n.classes.push(`actuarial`);break;case`\\boxed`:n.style.padding=`3pt`,n.style.border=`1px solid`,n.setAttribute(`scriptlevel`,`0`),n.setAttribute(`displaystyle`,`true`);break;case`\\fbox`:n.setAttribute(`notation`,`box`),n.classes.push(`tml-fbox`);break;case`\\fcolorbox`:case`\\colorbox`:n.style.padding=`0.3em`,e.label===`\\fcolorbox`&&(n.style.border=`0.0667em solid `+String(e.borderColor))}return e.backgroundColor&&n.setAttribute(`mathbackground`,e.backgroundColor),n};lS({type:`enclose`,names:[`\\colorbox`],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:[`raw`,`raw`,`text`]},handler({parser:e,funcName:t},n,r){let i=r[0]&&DC(r[0],`raw`).string,a=``;if(i){let e=DC(n[0],`raw`).string;a=bw(i,e)}else a=xw(DC(n[0],`raw`).string,e.gullet.macros);let o=n[1];return{type:`enclose`,mode:e.mode,label:t,backgroundColor:a,body:o}},mathmlBuilder:zw}),lS({type:`enclose`,names:[`\\fcolorbox`],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:[`raw`,`raw`,`raw`,`text`]},handler({parser:e,funcName:t},n,r){let i=r[0]&&DC(r[0],`raw`).string,a=``,o;if(i){let e=DC(n[0],`raw`).string,t=DC(n[0],`raw`).string;a=bw(i,e),o=bw(i,t)}else a=xw(DC(n[0],`raw`).string,e.gullet.macros),o=xw(DC(n[1],`raw`).string,e.gullet.macros);let s=n[2];return{type:`enclose`,mode:e.mode,label:t,backgroundColor:o,borderColor:a,body:s}},mathmlBuilder:zw}),lS({type:`enclose`,names:[`\\fbox`],props:{numArgs:1,argTypes:[`hbox`],allowedInText:!0},handler({parser:e},t){return{type:`enclose`,mode:e.mode,label:`\\fbox`,body:t[0]}}}),lS({type:`enclose`,names:[`\\angl`,`\\cancel`,`\\bcancel`,`\\xcancel`,`\\overline`,`\\boxed`,`\\longdiv`,`\\phase`],props:{numArgs:1},handler({parser:e,funcName:t},n){let r=n[0];return{type:`enclose`,mode:e.mode,label:t,body:r}},mathmlBuilder:zw}),lS({type:`enclose`,names:[`\\sout`],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:`enclose`,mode:e.mode,label:t,body:r}},mathmlBuilder:zw}),lS({type:`enclose`,names:[`\\underline`],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:`enclose`,mode:e.mode,label:t,body:r}},mathmlBuilder:zw}),lS({type:`enclose`,names:[`\\textcircled`],props:{numArgs:1,argTypes:[`text`],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:`enclose`,mode:e.mode,label:t,body:r}},mathmlBuilder:zw}),lS({type:`environment`,names:[`\\begin`,`\\end`],props:{numArgs:1,argTypes:[`text`]},handler({parser:e,funcName:t},n){let r=n[0];if(r.type!==`ordgroup`)throw new U(`Invalid environment name`,r);let i=``;for(let e=0;e<r.body.length;++e)i+=DC(r.body[e],`textord`).text;if(t===`\\begin`){if(!Object.prototype.hasOwnProperty.call(fw,i))throw new U(`No such environment: `+i,r);let t=fw[i],{args:n,optArgs:a}=e.parseArguments(`\\begin{`+i+`}`,t),o={mode:e.mode,envName:i,parser:e},s=t.handler(o,n,a);e.expect(`\\end`,!1);let c=e.nextToken,l=DC(e.parseFunction(),`environment`);if(l.name!==i)throw new U(`Mismatch: \\begin{${i}} matched by \\end{${l.name}}`,c);return s}return{type:`environment`,mode:e.mode,name:i,nameGroup:r}}}),lS({type:`envTag`,names:[`\\env@tag`],props:{numArgs:1,argTypes:[`math`]},handler({parser:e},t){return{type:`envTag`,mode:e.mode,body:t[0]}},mathmlBuilder(e,t){return new W(`mrow`)}}),lS({type:`noTag`,names:[`\\env@notag`],props:{numArgs:0},handler({parser:e}){return{type:`noTag`,mode:e.mode}},mathmlBuilder(e,t){return new W(`mrow`)}});var Bw=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),Vw=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),Hw=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),Uw=Object.freeze({ϵ:119527,ϑ:119564,ϰ:119534,φ:119577,ϱ:119535,ϖ:119563}),Ww=Object.freeze({ϵ:119643,ϑ:119680,ϰ:119650,φ:119693,ϱ:119651,ϖ:119679}),Gw=Object.freeze({ϵ:119701,ϑ:119738,ϰ:119708,φ:119751,ϱ:119709,ϖ:119737}),Kw=Object.freeze({ϵ:119759,ϑ:119796,ϰ:119766,φ:119809,ϱ:119767,ϖ:119795}),qw=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>Bw[e]||119899,"script-bold":e=>119951,fraktur:e=>Vw[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>Hw[e]||120055,"sans-serif":e=>120159,"sans-serif-bold":e=>120211,"sans-serif-italic":e=>120263,"sans-serif-bold-italic":e=>120380,monospace:e=>120367},lowerCaseLatin:{normal:e=>0,bold:e=>119737,italic:e=>e===`h`?8358:119789,"bold-italic":e=>119841,script:e=>Bw[e]||119893,"script-bold":e=>119945,fraktur:e=>119997,"fraktur-bold":e=>120101,"double-struck":e=>120049,"sans-serif":e=>120153,"sans-serif-bold":e=>120205,"sans-serif-italic":e=>120257,"sans-serif-bold-italic":e=>120309,monospace:e=>120361},upperCaseGreek:{normal:e=>0,bold:e=>119575,italic:e=>119633,"bold-italic":e=>119575,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119749,"sans-serif-bold":e=>119749,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119807,monospace:e=>0},lowerCaseGreek:{normal:e=>0,bold:e=>119569,italic:e=>119627,"bold-italic":e=>e===`ϕ`?119678:119685,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119743,"sans-serif-bold":e=>119743,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119801,monospace:e=>0},varGreek:{normal:e=>0,bold:e=>Uw[e]||-51,italic:e=>0,"bold-italic":e=>Ww[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>Gw[e]||116,"sans-serif-bold":e=>Gw[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>Kw[e]||174,monospace:e=>0},numeral:{normal:e=>0,bold:e=>120734,italic:e=>0,"bold-italic":e=>0,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>120744,"sans-serif":e=>120754,"sans-serif-bold":e=>120764,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>0,monospace:e=>120774}}),Jw=(e,t)=>{let n=e.codePointAt(0),r=64<n&&n<91?`upperCaseLatin`:96<n&&n<123?`lowerCaseLatin`:912<n&&n<938?`upperCaseGreek`:944<n&&n<970||e===`ϕ`?`lowerCaseGreek`:120545<n&&n<120572||Uw[e]?`varGreek`:47<n&&n<58?`numeral`:`other`;return r===`other`?e:String.fromCodePoint(n+qw[r][t](e))},Yw=Object.freeze({a:`ᴀ`,b:`ʙ`,c:`ᴄ`,d:`ᴅ`,e:`ᴇ`,f:`ꜰ`,g:`ɢ`,h:`ʜ`,i:`ɪ`,j:`ᴊ`,k:`ᴋ`,l:`ʟ`,m:`ᴍ`,n:`ɴ`,o:`ᴏ`,p:`ᴘ`,q:`ǫ`,r:`ʀ`,s:`s`,t:`ᴛ`,u:`ᴜ`,v:`ᴠ`,w:`ᴡ`,x:`x`,y:`ʏ`,z:`ᴢ`}),Xw=[`mathrm`,`mathit`],Zw=(e,t)=>{if(!Xw.includes(t)||!e.body||e.body.type!==`ordgroup`||e.body.body.length===1||e.body.body[0].type!==`mathord`)return!1;for(let t=1;t<e.body.body.length;t++){let n=e.body.body[t].type;if(!(n===`mathord`||n===`textord`&&!isNaN(e.body.body[t].text)))return!1}return!0},Qw=(e,t)=>{let n=e.font,r=t.withFont(n),i=nC(e.body,r);if(i.children.length===0)return i;if(n===`boldsymbol`&&[`mo`,`mpadded`,`mrow`].includes(i.type))return i.style.fontWeight=`bold`,i;if(Zw(e,n)){let e=i.children[0].children[0].children?i.children[0].children[0]:i.children[0];delete e.attributes.mathvariant;for(let t=1;t<i.children.length;t++)e.children[0].text+=i.children[t].children[0].children?i.children[t].children[0].children[0].text:i.children[t].children[0].text;if(n===`mathit`)return e.children[0].text=e.children[0].text.split(``).map(e=>Jw(e,`italic`)).join(``),e;let t=new W(`mpadded`,[e]);return t.setAttribute(`lspace`,`0`),t}let a=i.children[0].type===`mo`;for(let e=1;e<i.children.length;e++)i.children[e].type===`mo`&&n===`boldsymbol`&&(i.children[e].style.fontWeight=`bold`),i.children[e].type!==`mi`&&(a=!1),(i.children[e].attributes&&i.children[e].attributes.mathvariant||``)!==`normal`&&(a=!1);if(!a)return i;let o=i.children[0];for(let e=1;e<i.children.length;e++)o.children.push(i.children[e].children[0]);return o.attributes.mathvariant&&o.attributes.mathvariant===`normal`?new W(`mrow`,[new W(`mtext`,new CS(``)),o]):o},$w={"\\Bbb":`\\mathbb`,"\\bold":`\\mathbf`,"\\frak":`\\mathfrak`,"\\bm":`\\boldsymbol`};lS({type:`font`,names:[`\\mathrm`,`\\mathit`,`\\mathbf`,`\\mathnormal`,`\\up@greek`,`\\boldsymbol`,`\\mathbb`,`\\mathcal`,`\\mathfrak`,`\\mathscr`,`\\mathsf`,`\\mathsfit`,`\\mathtt`,`\\Bbb`,`\\bm`,`\\bold`,`\\frak`],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let r=dS(n[0]),i=t;return i in $w&&(i=$w[i]),{type:`font`,mode:e.mode,font:i.slice(1),body:r}},mathmlBuilder:Qw}),lS({type:`font`,names:[`\\rm`,`\\sf`,`\\tt`,`\\bf`,`\\it`,`\\cal`],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:n},r)=>{let{mode:i}=e,a=e.parseExpression(!0,n,!0);return{type:`font`,mode:i,font:`math${t.slice(1)}`,body:{type:`ordgroup`,mode:e.mode,body:a}}},mathmlBuilder:Qw});var eT=[`display`,`text`,`script`,`scriptscript`],tT={auto:-1,display:0,text:0,script:1,scriptscript:2},nT=(e,t)=>{let n=t;if(e===`display`){let e=n.level>=VC.SCRIPT?VC.TEXT:VC.DISPLAY;n=n.withLevel(e)}else e===`text`&&n.level===VC.DISPLAY?n=n.withLevel(VC.TEXT):e===`auto`?n=n.incrementLevel():e===`script`?n=n.withLevel(VC.SCRIPT):e===`scriptscript`&&(n=n.withLevel(VC.SCRIPTSCRIPT));return n},rT=(e,t)=>{t=nT(e.scriptLevel,t);let n=nC(e.numer,t),r=nC(e.denom,t);t.level===3&&(n.style.mathDepth=`2`,n.setAttribute(`scriptlevel`,`2`),r.style.mathDepth=`2`,r.setAttribute(`scriptlevel`,`2`));let i=new W(`mfrac`,[n,r]);if(!e.hasBarLine)i.setAttribute(`linethickness`,`0px`);else if(e.barSize){let n=yC(e.barSize,t);i.setAttribute(`linethickness`,n.number+n.unit)}if(e.leftDelim!=null||e.rightDelim!=null){let t=[];if(e.leftDelim!=null){let n=new W(`mo`,[new CS(e.leftDelim.replace(`\\`,``))]);n.setAttribute(`fence`,`true`),t.push(n)}if(t.push(i),e.rightDelim!=null){let n=new W(`mo`,[new CS(e.rightDelim.replace(`\\`,``))]);n.setAttribute(`fence`,`true`),t.push(n)}i=XS(t)}return e.scriptLevel!==`auto`&&(i=new W(`mstyle`,[i]),i.setAttribute(`displaystyle`,String(e.scriptLevel===`display`)),i.setAttribute(`scriptlevel`,tT[e.scriptLevel])),i};lS({type:`genfrac`,names:[`\\cfrac`,`\\dfrac`,`\\frac`,`\\tfrac`,`\\dbinom`,`\\binom`,`\\tbinom`,`\\\\atopfrac`,`\\\\bracefrac`,`\\\\brackfrac`],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let r=n[0],i=n[1],a=!1,o=null,s=null,c=`auto`;switch(t){case`\\cfrac`:case`\\dfrac`:case`\\frac`:case`\\tfrac`:a=!0;break;case`\\\\atopfrac`:a=!1;break;case`\\dbinom`:case`\\binom`:case`\\tbinom`:o=`(`,s=`)`;break;case`\\\\bracefrac`:o=`\\{`,s=`\\}`;break;case`\\\\brackfrac`:o=`[`,s=`]`;break;default:throw Error(`Unrecognized genfrac command`)}return t===`\\cfrac`||t.startsWith(`\\d`)?c=`display`:t.startsWith(`\\t`)&&(c=`text`),{type:`genfrac`,mode:e.mode,continued:!1,numer:r,denom:i,hasBarLine:a,leftDelim:o,rightDelim:s,scriptLevel:c,barSize:null}},mathmlBuilder:rT}),lS({type:`infix`,names:[`\\over`,`\\choose`,`\\atop`,`\\brace`,`\\brack`],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:n}){let r;switch(t){case`\\over`:r=`\\frac`;break;case`\\choose`:r=`\\binom`;break;case`\\atop`:r=`\\\\atopfrac`;break;case`\\brace`:r=`\\\\bracefrac`;break;case`\\brack`:r=`\\\\brackfrac`;break;default:throw Error(`Unrecognized infix genfrac command`)}return{type:`infix`,mode:e.mode,replaceWith:r,token:n}}});var iT=function(e){let t=null;return e.length>0&&(t=e,t=t===`.`?null:t),t};lS({type:`genfrac`,names:[`\\genfrac`],props:{numArgs:6,allowedInArgument:!0,argTypes:[`math`,`math`,`size`,`text`,`math`,`math`]},handler({parser:e},t){let n=t[4],r=t[5],i=dS(t[0]),a=i.type===`atom`&&i.family===`open`?iT(i.text):null,o=dS(t[1]),s=o.type===`atom`&&o.family===`close`?iT(o.text):null,c=DC(t[2],`size`),l,u=null;c.isBlank?l=!0:(u=c.value,l=u.number>0);let d=`auto`,f=t[3];if(f.type===`ordgroup`){if(f.body.length>0){let e=DC(f.body[0],`textord`);d=eT[Number(e.text)]}}else f=DC(f,`textord`),d=eT[Number(f.text)];return{type:`genfrac`,mode:e.mode,numer:n,denom:r,continued:!1,hasBarLine:l,barSize:u,leftDelim:a,rightDelim:s,scriptLevel:d}},mathmlBuilder:rT}),lS({type:`infix`,names:[`\\above`],props:{numArgs:1,argTypes:[`size`],infix:!0},handler({parser:e,funcName:t,token:n},r){return{type:`infix`,mode:e.mode,replaceWith:`\\\\abovefrac`,barSize:DC(r[0],`size`).value,token:n}}}),lS({type:`genfrac`,names:[`\\\\abovefrac`],props:{numArgs:3,argTypes:[`math`,`size`,`math`]},handler:({parser:e,funcName:t},n)=>{let r=n[0],i=eS(DC(n[1],`infix`).barSize),a=n[2],o=i.number>0;return{type:`genfrac`,mode:e.mode,numer:r,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null,scriptLevel:`auto`}},mathmlBuilder:rT}),lS({type:`hbox`,names:[`\\hbox`],props:{numArgs:1,argTypes:[`hbox`],allowedInArgument:!0,allowedInText:!1},handler({parser:e},t){return{type:`hbox`,mode:e.mode,body:fS(t[0])}},mathmlBuilder(e,t){let n=t.withLevel(VC.TEXT);return YS(tC(e.body,n))}}),lS({type:`horizBracket`,names:[`\\overbrace`,`\\underbrace`,`\\overbracket`,`\\underbracket`],props:{numArgs:1},handler({parser:e,funcName:t},n){return{type:`horizBracket`,mode:e.mode,label:t,isOver:/^\\over/.test(t),base:n[0]}},mathmlBuilder:(e,t)=>{let n=DS(e.label);return n.style[`math-depth`]=0,new W(e.isOver?`mover`:`munder`,[nC(e.base,t),n])}}),lS({type:`html`,names:[`\\class`,`\\id`,`\\style`,`\\data`],props:{numArgs:2,argTypes:[`raw`,`original`],allowedInText:!0},handler:({parser:e,funcName:t,token:n},r)=>{let i=DC(r[0],`raw`).string,a=r[1];if(e.settings.strict)throw new U(`Function "${t}" is disabled in strict mode`,n);let o,s={};switch(t){case`\\class`:s.class=i,o={command:`\\class`,class:i};break;case`\\id`:s.id=i,o={command:`\\id`,id:i};break;case`\\style`:s.style=i,o={command:`\\style`,style:i};break;case`\\data`:{let e=i.split(`,`);for(let t=0;t<e.length;t++){let n=e[t].split(`=`);if(n.length!==2)throw new U(`Error parsing key-value for \\data`);s[`data-`+n[0].trim()]=n[1].trim()}o={command:`\\data`,attributes:s};break}default:throw Error(`Unrecognized html command`)}if(!e.settings.isTrusted(o))throw new U(`Function "${t}" is not trusted`,n);return{type:`html`,mode:e.mode,attributes:s,body:fS(a)}},mathmlBuilder:(e,t)=>{let n=tC(e.body,t),r=[];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/)),n.classes=r;for(let t in e.attributes)t!==`class`&&Object.prototype.hasOwnProperty.call(e.attributes,t)&&n.setAttribute(t,e.attributes[t]);return n}});var aT=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:`bp`};{let t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new U(`Invalid size: '`+e+`' in \\includegraphics`);let n={number:+(t[1]+t[2]),unit:t[3]};if(!_C(n))throw new U(`Invalid unit: '`+n.unit+`' in \\includegraphics.`);return n}};lS({type:`includegraphics`,names:[`\\includegraphics`],props:{numArgs:1,numOptionalArgs:1,argTypes:[`raw`,`url`],allowedInText:!1},handler:({parser:e,token:t},n,r)=>{let i={number:0,unit:`em`},a={number:.9,unit:`em`},o={number:0,unit:`em`},s=``;if(r[0]){let e=DC(r[0],`raw`).string.split(`,`);for(let t=0;t<e.length;t++){let n=e[t].split(`=`);if(n.length===2){let e=n[1].trim();switch(n[0].trim()){case`alt`:s=e;break;case`width`:i=aT(e);break;case`height`:a=aT(e);break;case`totalheight`:o=aT(e);break;default:throw new U(`Invalid key: '`+n[0]+`' in \\includegraphics.`)}}}}let c=DC(n[0],`url`).url;if(s===``&&(s=c,s=s.replace(/^.*[\\/]/,``),s=s.substring(0,s.lastIndexOf(`.`))),!e.settings.isTrusted({command:`\\includegraphics`,url:c}))throw new U(`Function "\\includegraphics" is not trusted`,t);return{type:`includegraphics`,mode:e.mode,alt:s,width:i,height:a,totalheight:o,src:c}},mathmlBuilder:(e,t)=>{let n=yC(e.height,t),r={number:0,unit:`em`};e.totalheight.number>0&&e.totalheight.unit===n.unit&&e.totalheight.number>n.number&&(r.number=e.totalheight.number-n.number,r.unit=n.unit);let i=0;e.width.number>0&&(i=yC(e.width,t));let a={height:n.number+r.number+`em`};i.number>0&&(a.width=i.number+i.unit),r.number>0&&(a.verticalAlign=-r.number+r.unit);let o=new xS(e.src,e.alt,a);return o.height=n,o.depth=r,new W(`mtext`,[o])}}),lS({type:`kern`,names:[`\\kern`,`\\mkern`,`\\hskip`,`\\mskip`],props:{numArgs:1,argTypes:[`size`],primitive:!0,allowedInText:!0},handler({parser:e,funcName:t,token:n},r){let i=DC(r[0],`size`);if(e.settings.strict){let r=t[1]===`m`,a=i.value.unit===`mu`;if(r){if(!a)throw new U(`LaTeX's ${t} supports only mu units, not ${i.value.unit} units`,n);if(e.mode!==`math`)throw new U(`LaTeX's ${t} works only in math mode`,n)}else if(a)throw new U(`LaTeX's ${t} doesn't support mu units`,n)}return{type:`kern`,mode:e.mode,dimension:i.value}},mathmlBuilder(e,t){let n=yC(e.dimension,t),r=n.number>0&&n.unit===`em`?oT(n.number):``;if(e.mode===`text`&&r.length>0)return new W(`mtext`,[new CS(r)]);if(n.number>=0){let e=new W(`mspace`);return e.setAttribute(`width`,n.number+n.unit),e}{let e=new W(`mrow`);return e.style.marginLeft=n.number+n.unit,e}}});var oT=function(e){return e>=.05555&&e<=.05556?` `:e>=.1666&&e<=.1667?` `:e>=.2222&&e<=.2223?` `:e>=.2777&&e<=.2778?` `:``},sT=/[^A-Za-z_0-9-]/g;lS({type:`label`,names:[`\\label`],props:{numArgs:1,argTypes:[`raw`]},handler({parser:e},t){return{type:`label`,mode:e.mode,string:t[0].string.replace(sT,``)}},mathmlBuilder(e,t){let n=new W(`mrow`,[],[`tml-label`]);return e.string.length>0&&n.setLabel(e.string),n}});var cT=[`\\clap`,`\\llap`,`\\rlap`];lS({type:`lap`,names:[`\\mathllap`,`\\mathrlap`,`\\mathclap`,`\\clap`,`\\llap`,`\\rlap`],props:{numArgs:1,allowedInText:!0},handler:({parser:e,funcName:t,token:n},r)=>{if(cT.includes(t)){if(e.settings.strict&&e.mode!==`text`)throw new U(`{${t}} can be used only in text mode.
|
|
138
|
-
Try \\math${t.slice(1)}`,n);t=t.slice(1)}else t=t.slice(5);let i=r[0];return{type:`lap`,mode:e.mode,alignment:t,body:i}},mathmlBuilder:(e,t)=>{let n;e.alignment===`llap`&&(n=new W(`mpadded`,[new W(`mphantom`,eC(fS(e.body),t))]),n.setAttribute(`width`,`0.1px`));let r=nC(e.body,t),i;if(e.alignment===`llap`?(r.style.position=`absolute`,r.style.right=`0`,r.style.bottom=`0`,i=new W(`mpadded`,[n,r])):i=new W(`mpadded`,[r]),e.alignment===`rlap`)e.body.body.length>0&&e.body.body[0].type===`genfrac`&&i.setAttribute(`lspace`,`0.16667em`);else{let t=e.alignment===`llap`?`-1`:`-0.5`;i.setAttribute(`lspace`,t+`width`),e.alignment===`llap`?i.style.position=`relative`:(i.style.display=`flex`,i.style.justifyContent=`center`)}return i.setAttribute(`width`,`0.1px`),i}}),lS({type:`ordgroup`,names:[`\\(`,`$`],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},n){let r=t.mode;t.switchMode(`math`);let i=e===`\\(`?`\\)`:`$`,a=t.parseExpression(!1,i);return t.expect(i),t.switchMode(r),{type:`ordgroup`,mode:t.mode,body:a}}}),lS({type:`text`,names:[`\\)`,`\\]`],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new U(`Mismatched ${e.funcName}`,t)}});var lT=(e,t)=>{switch(t.level){case VC.DISPLAY:return e.display;case VC.TEXT:return e.text;case VC.SCRIPT:return e.script;case VC.SCRIPTSCRIPT:return e.scriptscript;default:return e.text}};lS({type:`mathchoice`,names:[`\\mathchoice`],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:`mathchoice`,mode:e.mode,display:fS(t[0]),text:fS(t[1]),script:fS(t[2]),scriptscript:fS(t[3])}),mathmlBuilder:(e,t)=>tC(lT(e,t),t)});var uT=[`text`,`textord`,`mathord`,`atom`];function dT(e,t){let n,r=eC(e.body,t);if(e.mclass===`minner`)n=new W(`mpadded`,r);else if(e.mclass===`mord`)e.isCharacterBox||r[0].type===`mathord`?(n=r[0],n.type=`mi`,n.children.length===1&&n.children[0].text&&n.children[0].text===`∇`&&n.setAttribute(`mathvariant`,`normal`)):n=new W(`mi`,r);else{n=new W(`mrow`,r),e.mustPromote?(n=r[0],n.type=`mo`,e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&n.setAttribute(`mathvariant`,`italic`)):n=new W(`mrow`,r);let i=t.level<2;n.type===`mrow`?i&&(e.mclass===`mbin`?(n.children.unshift(bC(.2222)),n.children.push(bC(.2222))):e.mclass===`mrel`?(n.children.unshift(bC(.2778)),n.children.push(bC(.2778))):e.mclass===`mpunct`?n.children.push(bC(.1667)):e.mclass===`minner`&&(n.children.unshift(bC(.0556)),n.children.push(bC(.0556)))):e.mclass===`mbin`?(n.attributes.lspace=i?`0.2222em`:`0`,n.attributes.rspace=i?`0.2222em`:`0`):e.mclass===`mrel`?(n.attributes.lspace=i?`0.2778em`:`0`,n.attributes.rspace=i?`0.2778em`:`0`):e.mclass===`mpunct`?(n.attributes.lspace=`0em`,n.attributes.rspace=i?`0.1667em`:`0`):e.mclass===`mopen`||e.mclass===`mclose`?(n.attributes.lspace=`0em`,n.attributes.rspace=`0em`):e.mclass===`minner`&&i&&(n.attributes.lspace=`0.0556em`,n.attributes.width=`+0.1111em`),e.mclass!==`mopen`&&e.mclass!==`mclose`&&(delete n.attributes.stretchy,delete n.attributes.form)}return n}lS({type:`mclass`,names:[`\\mathord`,`\\mathbin`,`\\mathrel`,`\\mathopen`,`\\mathclose`,`\\mathpunct`,`\\mathinner`],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},n){let r=n[0],i=$x(r),a=!0,o={type:`mathord`,text:``,mode:e.mode},s=r.body?r.body:[r];for(let t of s)if(uT.includes(t.type))MS[e.mode][t.text]?o.text+=MS[e.mode][t.text].replace:t.text?o.text+=t.text:t.body&&t.body.map(e=>{o.text+=e.text});else{a=!1;break}return a&&t===`\\mathord`&&o.type===`mathord`&&o.text.length>1?o:{type:`mclass`,mode:e.mode,mclass:`m`+t.slice(5),body:fS(a?o:r),isCharacterBox:i,mustPromote:a}},mathmlBuilder:dT});var fT=e=>{let t=e.type===`ordgroup`&&e.body.length&&e.body.length===1?e.body[0]:e;if(t.type===`atom`){let n=e.body.length>0&&e.body[0].text&&MS.math[e.body[0].text]?MS.math[e.body[0].text].group:t.family;return n===`bin`||n===`rel`?`m`+n:`mord`}return`mord`};lS({type:`mclass`,names:[`\\@binrel`],props:{numArgs:2},handler({parser:e},t){return{type:`mclass`,mode:e.mode,mclass:fT(t[0]),body:fS(t[1]),isCharacterBox:$x(t[1])}}}),lS({type:`mclass`,names:[`\\stackrel`,`\\overset`,`\\underset`],props:{numArgs:2},handler({parser:e,funcName:t},n){let r=n[1],i=n[0],a;a=t===`\\stackrel`?`mrel`:fT(r);let o={type:a===`mrel`||a===`mbin`?`op`:`ordgroup`,mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:t!==`\\stackrel`,body:fS(r)};return{type:`supsub`,mode:i.mode,stack:!0,base:o,sup:t===`\\underset`?null:i,sub:t===`\\underset`?i:null}},mathmlBuilder:dT});var pT=(e,t,n)=>{if(!e)return n;let r=nC(e,t);return r.type===`mrow`&&r.children.length===0?n:r};lS({type:`multiscript`,names:[`\\sideset`,`\\pres@cript`],props:{numArgs:3},handler({parser:e,funcName:t,token:n},r){if(r[2].body.length===0)throw new U(t+`cannot parse an empty base.`);let i=r[2].body[0];if(e.settings.strict&&t===`\\sideset`&&!i.symbol)throw new U(`The base of \\sideset must be a big operator. Try \\prescript.`);if(r[0].body.length>0&&r[0].body[0].type!==`supsub`||r[1].body.length>0&&r[1].body[0].type!==`supsub`)throw new U(`\\sideset can parse only subscripts and superscripts in its first two arguments`,n);let a=r[0].body.length>0?r[0].body[0]:null,o=r[1].body.length>0?r[1].body[0]:null;return!a&&!o?i:a?{type:`multiscript`,mode:e.mode,isSideset:t===`\\sideset`,prescripts:a,postscripts:o,base:i}:{type:`styling`,mode:e.mode,scriptLevel:`text`,body:[{type:`supsub`,mode:e.mode,base:i,sup:o.sup,sub:o.sub}]}},mathmlBuilder(e,t){let n=nC(e.base,t),r=new W(`mprescripts`),i=new W(`none`),a=[],o=pT(e.prescripts.sub,t,i),s=pT(e.prescripts.sup,t,i);return e.isSideset&&(o.setAttribute(`style`,`text-align: left;`),s.setAttribute(`style`,`text-align: left;`)),a=e.postscripts?[n,pT(e.postscripts.sub,t,i),pT(e.postscripts.sup,t,i),r,o,s]:[n,r,o,s],new W(`mmultiscripts`,a)}}),lS({type:`not`,names:[`\\not`],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){let n=$x(t[0]),r;return n?(r=fS(t[0]),r[0].text.charAt(0)===`\\`&&(r[0].text=MS.math[r[0].text].replace),r[0].text=r[0].text.slice(0,1)+`̸`+r[0].text.slice(1)):r=[{type:`textord`,mode:`math`,text:`̸`},{type:`kern`,mode:`math`,dimension:{number:-.6,unit:`em`}},t[0]],{type:`not`,mode:e.mode,body:r,isCharacterBox:n}},mathmlBuilder(e,t){return e.isCharacterBox?eC(e.body,t,!0)[0]:tC(e.body,t)}});var mT=[`textord`,`mathord`,`atom`],hT=[`\\smallint`],gT=[`textord`,`mathord`,`ordgroup`,`close`,`leftright`,`font`],_T=e=>{e.attributes.lspace=`0.1667em`,e.attributes.rspace=`0.1667em`},vT=(e,t)=>{let n;if(e.symbol)n=new W(`mo`,[qS(e.name,e.mode)]),hT.includes(e.name)?n.setAttribute(`largeop`,`false`):n.setAttribute(`movablelimits`,`false`),e.fromMathOp&&_T(n);else if(e.body)n=new W(`mo`,eC(e.body,t)),e.fromMathOp&&_T(n);else if(n=new W(`mi`,[new CS(e.name.slice(1))]),!e.parentIsSupSub){let t=new W(`mo`,[qS(``,`text`)]),r=[n,t];if(e.needsLeadingSpace){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),r.unshift(e)}if(!e.isFollowedByDelimiter){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),r.push(e)}n=new W(`mrow`,r)}return n},yT={"∏":`\\prod`,"∐":`\\coprod`,"∑":`\\sum`,"⋀":`\\bigwedge`,"⋁":`\\bigvee`,"⋂":`\\bigcap`,"⋃":`\\bigcup`,"⨀":`\\bigodot`,"⨁":`\\bigoplus`,"⨂":`\\bigotimes`,"⨄":`\\biguplus`,"⨅":`\\bigsqcap`,"⨆":`\\bigsqcup`,"⨃":`\\bigcupdot`,"⨇":`\\bigdoublevee`,"⨈":`\\bigdoublewedge`,"⨉":`\\bigtimes`};lS({type:`op`,names:`\\coprod.\\bigvee.\\bigwedge.\\biguplus.\\bigcupplus.\\bigcupdot.\\bigcap.\\bigcup.\\bigdoublevee.\\bigdoublewedge.\\intop.\\prod.\\sum.\\bigotimes.\\bigoplus.\\bigodot.\\bigsqcap.\\bigsqcup.\\bigtimes.\\smallint.∏.∐.∑.⋀.⋁.⋂.⋃.⨀.⨁.⨂.⨃.⨄.⨅.⨆.⨇.⨈.⨉`.split(`.`),props:{numArgs:0},handler:({parser:e,funcName:t},n)=>{let r=t;return r.length===1&&(r=yT[r]),{type:`op`,mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:r}},mathmlBuilder:vT}),lS({type:`op`,names:[`\\mathop`],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{let n=t[0],r=n.body?n.body:[n],i=r.length===1&&mT.includes(r[0].type);return{type:`op`,mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:i,fromMathOp:!0,stack:!1,name:i?r[0].text:null,body:i?null:fS(n)}},mathmlBuilder:vT});var bT={"∫":`\\int`,"∬":`\\iint`,"∭":`\\iiint`,"∮":`\\oint`,"∯":`\\oiint`,"∰":`\\oiiint`,"∱":`\\intclockwise`,"∲":`\\varointclockwise`,"⨌":`\\iiiint`,"⨍":`\\intbar`,"⨎":`\\intBar`,"⨏":`\\fint`,"⨒":`\\rppolint`,"⨓":`\\scpolint`,"⨕":`\\pointint`,"⨖":`\\sqint`,"⨗":`\\intlarhk`,"⨘":`\\intx`,"⨙":`\\intcap`,"⨚":`\\intcup`};lS({type:`op`,names:`\\arcsin.\\arccos.\\arctan.\\arctg.\\arcctg.\\arg.\\ch.\\cos.\\cosec.\\cosh.\\cot.\\cotg.\\coth.\\csc.\\ctg.\\cth.\\deg.\\dim.\\exp.\\hom.\\ker.\\lg.\\ln.\\log.\\sec.\\sin.\\sinh.\\sh.\\sgn.\\tan.\\tanh.\\tg.\\th`.split(`.`),props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,r=e.gullet.future().text;return{type:`op`,mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Mw(r),needsLeadingSpace:n.length>0&&gT.includes(n),name:t}},mathmlBuilder:vT}),lS({type:`op`,names:[`\\det`,`\\gcd`,`\\inf`,`\\lim`,`\\max`,`\\min`,`\\Pr`,`\\sup`],props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,r=e.gullet.future().text;return{type:`op`,mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Mw(r),needsLeadingSpace:n.length>0&&gT.includes(n),name:t}},mathmlBuilder:vT}),lS({type:`op`,names:`\\int.\\iint.\\iiint.\\iiiint.\\oint.\\oiint.\\oiiint.\\intclockwise.\\varointclockwise.\\intbar.\\intBar.\\fint.\\rppolint.\\scpolint.\\pointint.\\sqint.\\intlarhk.\\intx.\\intcap.\\intcup.∫.∬.∭.∮.∯.∰.∱.∲.⨌.⨍.⨎.⨏.⨒.⨓.⨕.⨖.⨗.⨘.⨙.⨚`.split(`.`),props:{numArgs:0,allowedInArgument:!0},handler({parser:e,funcName:t}){let n=t;return n.length===1&&(n=bT[n]),{type:`op`,mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:n}},mathmlBuilder:vT}),lS({type:`operatorname`,names:[`\\operatorname@`,`\\operatornamewithlimits`],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let r=n[0],i=e.prevAtomType,a=e.gullet.future().text;return{type:`operatorname`,mode:e.mode,body:fS(r),alwaysHandleSupSub:t===`\\operatornamewithlimits`,limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:Mw(a),needsLeadingSpace:i.length>0&&gT.includes(i)}},mathmlBuilder:(e,t)=>{let n=eC(e.body,t.withFont(`mathrm`)),r=!0;for(let e=0;e<n.length;e++){let t=n[e];if(t instanceof W)switch(((t.type===`mrow`||t.type===`mpadded`)&&t.children.length===1&&t.children[0]instanceof W||t.type===`mrow`&&t.children.length===2&&t.children[0]instanceof W&&t.children[1]instanceof W&&t.children[1].type===`mspace`&&!t.children[1].attributes.width&&t.children[1].children.length===0)&&(t=t.children[0]),t.type){case`mi`:case`mn`:case`ms`:case`mtext`:break;case`mspace`:if(t.attributes.width){let i=t.attributes.width.replace(`em`,``),a=oT(Number(i));a===``?r=!1:n[e]=new W(`mtext`,[new CS(a)])}break;case`mo`:{let e=t.children[0];t.children.length===1&&e instanceof CS?e.text=e.text.replace(/\u2212/,`-`).replace(/\u2217/,`*`):r=!1;break}default:r=!1}else r=!1}if(r)n=[new CS(n.map(e=>e.toText()).join(``))];else if(n.length===1&&[`mover`,`munder`].includes(n[0].type)&&(n[0].children[0].type===`mi`||n[0].children[0].type===`mtext`)){if(n[0].children[0].type=`mi`,e.parentIsSupSub)return new W(`mrow`,n);{let e=new W(`mo`,[qS(``,`text`)]);return SS([n[0],e])}}let i;if(r?(i=new W(`mi`,n),n[0].text.length===1&&i.setAttribute(`mathvariant`,`normal`)):i=new W(`mrow`,n),!e.parentIsSupSub){let t=new W(`mo`,[qS(``,`text`)]),n=[i,t];if(e.needsLeadingSpace){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),n.unshift(e)}if(!e.isFollowedByDelimiter){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),n.push(e)}return SS(n)}return i}}),Q(`\\operatorname`,`\\@ifstar\\operatornamewithlimits\\operatorname@`),uS({type:`ordgroup`,mathmlBuilder(e,t){return tC(e.body,t,e.semisimple)}}),lS({type:`phantom`,names:[`\\phantom`],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:`phantom`,mode:e.mode,body:fS(n)}},mathmlBuilder:(e,t)=>new W(`mphantom`,eC(e.body,t))}),lS({type:`hphantom`,names:[`\\hphantom`],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:`hphantom`,mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=new W(`mpadded`,[new W(`mphantom`,eC(fS(e.body),t))]);return n.setAttribute(`height`,`0px`),n.setAttribute(`depth`,`0px`),n}}),lS({type:`vphantom`,names:[`\\vphantom`],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:`vphantom`,mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=new W(`mpadded`,[new W(`mphantom`,eC(fS(e.body),t))]);return n.setAttribute(`width`,`0.1px`),n}}),lS({type:`pmb`,names:[`\\pmb`],props:{numArgs:1,allowedInText:!0},handler({parser:e},t){return{type:`pmb`,mode:e.mode,body:fS(t[0])}},mathmlBuilder(e,t){let n=wS(eC(e.body,t));return n.setAttribute(`style`,`font-weight:bold`),n}});var xT=(e,t)=>{let n=t.withLevel(VC.TEXT),r=new W(`mpadded`,[nC(e.body,n)]),i=yC(e.dy,t);return r.setAttribute(`voffset`,i.number+i.unit),i.number>0?r.style.padding=i.number+i.unit+` 0 0 0`:r.style.padding=`0 0 `+Math.abs(i.number)+i.unit+` 0`,r};lS({type:`raise`,names:[`\\raise`,`\\lower`],props:{numArgs:2,argTypes:[`size`,`primitive`],primitive:!0},handler({parser:e,funcName:t},n){let r=DC(n[0],`size`).value;t===`\\lower`&&(r.number*=-1);let i=n[1];return{type:`raise`,mode:e.mode,dy:r,body:i}},mathmlBuilder:xT}),lS({type:`raise`,names:[`\\raisebox`],props:{numArgs:2,argTypes:[`size`,`hbox`],allowedInText:!0},handler({parser:e,funcName:t},n){let r=DC(n[0],`size`).value,i=n[1];return{type:`raise`,mode:e.mode,dy:r,body:i}},mathmlBuilder:xT}),lS({type:`ref`,names:[`\\ref`,`\\eqref`],props:{numArgs:1,argTypes:[`raw`]},handler({parser:e,funcName:t},n){return{type:`ref`,mode:e.mode,funcName:t,string:n[0].string.replace(sT,``)}},mathmlBuilder(e,t){let n=e.funcName===`\\ref`?[`tml-ref`]:[`tml-ref`,`tml-eqref`];return new bS(`#`+e.string,n,null)}}),lS({type:`reflect`,names:[`\\reflectbox`],props:{numArgs:1,argTypes:[`hbox`],allowedInText:!0},handler({parser:e},t){return{type:`reflect`,mode:e.mode,body:t[0]}},mathmlBuilder(e,t){let n=nC(e.body,t);return n.style.transform=`scaleX(-1)`,n}}),lS({type:`internal`,names:[`\\relax`],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler({parser:e}){return{type:`internal`,mode:e.mode}}}),lS({type:`rule`,names:[`\\rule`],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`size`,`size`,`size`]},handler({parser:e},t,n){let r=n[0],i=DC(t[0],`size`),a=DC(t[1],`size`);return{type:`rule`,mode:e.mode,shift:r&&DC(r,`size`).value,width:i.value,height:a.value}},mathmlBuilder(e,t){let n=yC(e.width,t),r=yC(e.height,t),i=e.shift?yC(e.shift,t):{number:0,unit:`em`},a=t.color&&t.getColor()||`black`,o=new W(`mspace`);if(n.number>0&&r.number>0&&o.setAttribute(`mathbackground`,a),o.setAttribute(`width`,n.number+n.unit),o.setAttribute(`height`,r.number+r.unit),i.number===0)return o;let s=new W(`mpadded`,[o]);return i.number>=0?s.setAttribute(`height`,`+`+i.number+i.unit):(s.setAttribute(`height`,i.number+i.unit),s.setAttribute(`depth`,`+`+-i.number+i.unit)),s.setAttribute(`voffset`,i.number+i.unit),s}});var ST=/^[0-9]$/,CT={0:`₀`,1:`₁`,2:`₂`,3:`₃`,4:`₄`,5:`₅`,6:`₆`,7:`₇`,8:`₈`,9:`₉`},wT={0:`⁰`,1:`¹`,2:`²`,3:`³`,4:`⁴`,5:`⁵`,6:`⁶`,7:`⁷`,8:`⁸`,9:`⁹`};lS({type:`sfrac`,names:[`\\sfrac`],props:{numArgs:2,allowedInText:!0,allowedInMath:!0},handler({parser:e},t){let n=``;for(let e of t[0].body){if(e.type!==`textord`||!ST.test(e.text))throw new U(`Numerator must be an integer.`,e);n+=e.text}let r=``;for(let e of t[1].body){if(e.type!==`textord`||!ST.test(e.text))throw new U(`Denominator must be an integer.`,e);r+=e.text}return{type:`sfrac`,mode:e.mode,numerator:n,denominator:r}},mathmlBuilder(e,t){let n=e.numerator.split(``).map(e=>wT[e]).join(``),r=e.denominator.split(``).map(e=>CT[e]).join(``);return new W(`mn`,[new CS(n+`⁄`+r,e.mode,t)],[`special-fraction`])}});var TT={"\\tiny":.5,"\\sixptsize":.6,"\\Tiny":.6,"\\scriptsize":.7,"\\footnotesize":.8,"\\small":.9,"\\normalsize":1,"\\large":1.2,"\\Large":1.44,"\\LARGE":1.728,"\\huge":2.074,"\\Huge":2.488};lS({type:`sizing`,names:[`\\tiny`,`\\sixptsize`,`\\Tiny`,`\\scriptsize`,`\\footnotesize`,`\\small`,`\\normalsize`,`\\large`,`\\Large`,`\\LARGE`,`\\huge`,`\\Huge`],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:t,parser:n},r)=>{n.settings.strict&&n.mode===`math`&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);let i=n.parseExpression(!1,e,!0);return{type:`sizing`,mode:n.mode,funcName:t,body:i}},mathmlBuilder:(e,t)=>{let n=t.withFontSize(TT[e.funcName]),r=wS(eC(e.body,n)),i=(TT[e.funcName]/t.fontSize).toFixed(4);return r.setAttribute(`mathsize`,i+`em`),r}}),lS({type:`smash`,names:[`\\smash`],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,n)=>{let r=!1,i=!1,a=n[0]&&DC(n[0],`ordgroup`);if(a){let e=``;for(let t=0;t<a.body.length;++t)if(e=a.body[t].text,e===`t`)r=!0;else if(e===`b`)i=!0;else{r=!1,i=!1;break}}else r=!0,i=!0;let o=t[0];return{type:`smash`,mode:e.mode,body:o,smashHeight:r,smashDepth:i}},mathmlBuilder:(e,t)=>{let n=new W(`mpadded`,[nC(e.body,t)]);return e.smashHeight&&n.setAttribute(`height`,`0px`),e.smashDepth&&n.setAttribute(`depth`,`0px`),n}});var ET=`a.c.e.ı.m.n.o.r.s.u.v.w.x.z.α.ε.ι.κ.ν.ο.π.σ.τ.υ.ω.\\alpha.\\epsilon.\\iota.\\kappa.\\nu.\\omega.\\pi.\\tau.\\omega`.split(`.`);lS({type:`sqrt`,names:[`\\sqrt`],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,n){let r=n[0],i=t[0];return i.body&&i.body.length===1&&i.body[0].text&&ET.includes(i.body[0].text)&&i.body.push({type:`rule`,mode:`math`,shift:null,width:{number:0,unit:`pt`},height:{number:.5,unit:`em`}}),{type:`sqrt`,mode:e.mode,body:i,index:r}},mathmlBuilder(e,t){let{body:n,index:r}=e;return r?new W(`mroot`,[nC(n,t),nC(r,t.incrementLevel())]):new W(`msqrt`,[nC(n,t)])}});var DT={display:0,text:1,script:2,scriptscript:3},OT={display:[`0`,`true`],text:[`0`,`false`],script:[`1`,`false`],scriptscript:[`2`,`false`]};lS({type:`styling`,names:[`\\displaystyle`,`\\textstyle`,`\\scriptstyle`,`\\scriptscriptstyle`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:n},r){let i=n.parseExpression(!0,e,!0),a=t.slice(1,t.length-5);return{type:`styling`,mode:n.mode,scriptLevel:a,body:i}},mathmlBuilder(e,t){let n=t.withLevel(DT[e.scriptLevel]),r=wS(eC(e.body,n)),i=OT[e.scriptLevel];return r.setAttribute(`scriptlevel`,i[0]),r.setAttribute(`displaystyle`,i[1]),r}});var kT=/^m(over|under|underover)$/,AT=`DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ`,jT=`BCEFGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ`,MT=`AJdfΔΛ`;uS({type:`supsub`,mathmlBuilder(e,t){let n=!1,r,i,a=!1,o=!1,s=!1;e.base&&e.base.type===`horizBracket`&&(i=!!e.sup,i===e.base.isOver&&(n=!0,r=e.base.isOver)),e.base&&!e.stack&&(e.base.type===`op`||e.base.type===`operatorname`)&&(e.base.parentIsSupSub=!0,a=!e.base.symbol,o=a&&!e.isFollowedByDelimiter,s=e.base.needsLeadingSpace);let c=e.stack&&e.base.body.length===1?[nC(e.base.body[0],t)]:[nC(e.base,t)],l=t.inSubOrSup();if(e.sub){let n=nC(e.sub,l);t.level===3&&n.setAttribute(`scriptlevel`,`2`),c.push(n)}if(e.sup){let n=nC(e.sup,l);if(t.level===3&&n.setAttribute(`scriptlevel`,`2`),e.base&&e.base.text&&e.base.text.length===1){let t=e.base.text;AT.indexOf(t)>-1?n.classes.push(`tml-sml-pad`):jT.indexOf(t)>-1?n.classes.push(`tml-med-pad`):MT.indexOf(t)>-1&&n.classes.push(`tml-lrg-pad`)}c.push(n)}let u;if(n)u=r?`mover`:`munder`;else if(!e.sub){let n=e.base;u=n&&n.type===`op`&&n.limits&&(t.level===VC.DISPLAY||n.alwaysHandleSupSub)||n&&n.type===`operatorname`&&n.alwaysHandleSupSub&&(n.limits||t.level===VC.DISPLAY)?`mover`:`msup`}else if(e.sup){let n=e.base;u=n&&(n.type===`op`&&n.limits||n.type===`multiscript`)&&(t.level===VC.DISPLAY||n.alwaysHandleSupSub)||n&&n.type===`operatorname`&&n.alwaysHandleSupSub&&(t.level===VC.DISPLAY||n.limits)?`munderover`:`msubsup`}else{let n=e.base;u=e.stack||n&&n.type===`op`&&n.limits&&(t.level===VC.DISPLAY||n.alwaysHandleSupSub)||n&&n.type===`operatorname`&&n.alwaysHandleSupSub&&(n.limits||t.level===VC.DISPLAY)?`munder`:`msub`}let d=new W(u,c);if(a){let e=new W(`mo`,[qS(``,`text`)]);if(s){let t=new W(`mspace`);t.setAttribute(`width`,`0.1667em`),d=SS([t,d,e])}else d=SS([d,e]);if(o){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),d.children.push(e)}}else kT.test(u)&&(d=new W(`mrow`,[d]));return d}});var NT=[`\\shortmid`,`\\nshortmid`,`\\shortparallel`,`\\nshortparallel`,`\\smallsetminus`],PT=[`\\Rsh`,`\\Lsh`,`\\restriction`],FT=e=>{if(e.length===1){let t=e.codePointAt(0);return 8591<t&&t<8704}return e.indexOf(`arrow`)>-1||e.indexOf(`harpoon`)>-1||PT.includes(e)};uS({type:`atom`,mathmlBuilder(e,t){if(e.family===`inner`)return new W(e.mode===`text`?`mtext`:`mi`,[qS(e.text,e.mode)]);let n=new W(`mo`,[qS(e.text,e.mode)]);if(e.family===`punct`)n.setAttribute(`separator`,`true`);else if(e.family===`open`||e.family===`close`)e.family===`open`?(n.setAttribute(`form`,`prefix`),n.setAttribute(`stretchy`,`false`)):e.family===`close`&&(n.setAttribute(`form`,`postfix`),n.setAttribute(`stretchy`,`false`));else if(e.text===`\\mid`)n.setAttribute(`lspace`,`0.22em`),n.setAttribute(`rspace`,`0.22em`),n.setAttribute(`stretchy`,`false`);else if(e.family===`rel`&&FT(e.text))n.setAttribute(`stretchy`,`false`);else if(NT.includes(e.text))n.setAttribute(`mathsize`,`70%`);else if(e.text===`:`)n.attributes.lspace=`0.2222em`,n.attributes.rspace=`0.2222em`;else if(e.needsSpacing)return e.family===`bin`?new W(`mrow`,[bC(.222),n,bC(.222)]):new W(`mrow`,[bC(.2778),n,bC(.2778)]);return n}});var IT={mathbf:`bold`,mathrm:`normal`,textit:`italic`,mathit:`italic`,mathnormal:`italic`,mathbb:`double-struck`,mathcal:`script`,mathfrak:`fraktur`,mathscr:`script`,mathsf:`sans-serif`,mathtt:`monospace`},LT=function(e,t){if(t.fontFamily===`texttt`)return`monospace`;if(t.fontFamily===`textsc`)return`normal`;if(t.fontFamily===`textsf`)return t.fontShape===`textit`&&t.fontWeight===`textbf`?`sans-serif-bold-italic`:t.fontShape===`textit`?`sans-serif-italic`:t.fontWeight===`textbf`?`sans-serif-bold`:`sans-serif`;if(t.fontShape===`textit`&&t.fontWeight===`textbf`)return`bold-italic`;if(t.fontShape===`textit`)return`italic`;if(t.fontWeight===`textbf`)return`bold`;let n=t.font;if(!n||n===`mathnormal`)return null;let r=e.mode;switch(n){case`mathit`:return`italic`;case`mathrm`:{let t=e.text.codePointAt(0);return 939<t&&t<975?`italic`:`normal`}case`greekItalic`:return`italic`;case`up@greek`:return`normal`;case`boldsymbol`:case`mathboldsymbol`:return`bold-italic`;case`mathbf`:return`bold`;case`mathbb`:return`double-struck`;case`mathfrak`:return`fraktur`;case`mathscr`:case`mathcal`:return`script`;case`mathsf`:return`sans-serif`;case`mathsfit`:return`sans-serif-italic`;case`mathtt`:return`monospace`}let i=e.text;return MS[r][i]&&MS[r][i].replace&&(i=MS[r][i].replace),Object.prototype.hasOwnProperty.call(IT,n)?IT[n]:null},RT=/^\d(?:[\d,.]*\d)?$/,zT=/[A-Ba-z]/,BT=new Set([`\\prime`,`\\dprime`,`\\trprime`,`\\qprime`,`\\backprime`,`\\backdprime`,`\\backtrprime`]),VT=(e,t,n)=>{let r=new W(`mstyle`,[new W(n,[e])]);return r.style[`font-style`]=`italic`,r.style[`font-family`]=`Cambria, 'Times New Roman', serif`,t===`bold-italic`&&(r.style[`font-weight`]=`bold`),r};uS({type:`mathord`,mathmlBuilder(e,t){let n=qS(e.text,e.mode,t),r=n.text.codePointAt(0),i=912<r&&r<938?`normal`:`italic`,a=LT(e,t)||i;if(a===`script`)return n.text=Jw(n.text,a),new W(`mi`,[n],[t.font]);a!==`italic`&&(n.text=Jw(n.text,a));let o=new W(`mi`,[n]);if(a===`normal`&&(o.setAttribute(`mathvariant`,`normal`),n.text.length===1)){let e=new W(`mspace`,[]);o=new W(`mrow`,[o,e])}return o}}),uS({type:`textord`,mathmlBuilder(e,t){let n=e.text,r=n.codePointAt(0);t.fontFamily===`textsc`&&96<r&&r<123&&(n=Yw[n]);let i=qS(n,e.mode,t),a=LT(e,t)||`normal`,o;if(RT.test(e.text)){let t=e.mode===`text`?`mtext`:`mn`;if(a===`italic`||a===`bold-italic`)return VT(i,a,t);a!==`normal`&&(i.text=i.text.split(``).map(e=>Jw(e,a)).join(``)),o=new W(t,[i])}else if(e.mode===`text`)a!==`normal`&&(i.text=Jw(i.text,a)),o=new W(`mtext`,[i]);else if(BT.has(e.text))o=new W(`mo`,[i]),o.classes.push(`tml-prime`);else{let e=i.text;a!==`italic`&&(i.text=Jw(i.text,a)),o=new W(`mi`,[i]),i.text===e&&zT.test(e)&&o.setAttribute(`mathvariant`,`italic`)}return o}});var HT={"\\nobreak":`nobreak`,"\\allowbreak":`allowbreak`},UT={" ":{},"\\ ":{},"~":{className:`nobreak`},"\\space":{},"\\nobreakspace":{className:`nobreak`}};uS({type:`spacing`,mathmlBuilder(e,t){let n;if(Object.prototype.hasOwnProperty.call(UT,e.text))n=new W(`mtext`,[new CS(`\xA0`)]);else if(Object.prototype.hasOwnProperty.call(HT,e.text))n=new W(`mo`),e.text===`\\nobreak`&&n.setAttribute(`linebreak`,`nobreak`);else throw new U(`Unknown type of space "${e.text}"`);return n}}),uS({type:`tag`});var WT={"\\text":void 0,"\\textrm":`textrm`,"\\textsf":`textsf`,"\\texttt":`texttt`,"\\textnormal":`textrm`,"\\textsc":`textsc`},GT={"\\textbf":`textbf`,"\\textmd":`textmd`},KT={"\\textit":`textit`,"\\textup":`textup`},qT=(e,t)=>{let n=e.font;return n?WT[n]?t.withTextFontFamily(WT[n]):GT[n]?t.withTextFontWeight(GT[n]):n===`\\emph`?t.fontShape===`textit`?t.withTextFontShape(`textup`):t.withTextFontShape(`textit`):t.withTextFontShape(KT[n]):t};lS({type:`text`,names:[`\\text`,`\\textrm`,`\\textsf`,`\\texttt`,`\\textnormal`,`\\textsc`,`\\textbf`,`\\textmd`,`\\textit`,`\\textup`,`\\emph`],props:{numArgs:1,argTypes:[`text`],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:`text`,mode:e.mode,body:fS(r),font:t}},mathmlBuilder(e,t){let n=qT(e,t);return YS(tC(e.body,n))}}),lS({type:`vcenter`,names:[`\\vcenter`],props:{numArgs:1,argTypes:[`original`],allowedInText:!1},handler({parser:e},t){return{type:`vcenter`,mode:e.mode,body:t[0]}},mathmlBuilder(e,t){let n=new W(`mtd`,[nC(e.body,t)]);return n.style.padding=`0`,new W(`mtable`,[new W(`mtr`,[n])])}}),lS({type:`verb`,names:[`\\verb`],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new U(`\\verb ended by end of line instead of matching delimiter`)},mathmlBuilder(e,t){let n=new W(`mtext`,[new CS(JT(e))]);return n.setAttribute(`mathvariant`,`monospace`),n}});var JT=e=>e.body.replace(/ /g,e.star?`␣`:`\xA0`),YT=sS,XT=`[ \r
|
|
139
|
-
]`,ZT=`\\\\[a-zA-Z@]+`,QT=`\\\\[^\ud800-\udfff]`,$T=`(${ZT})${XT}*`,eE=`\\\\(
|
|
140
|
-
|[ \r ]+
|
|
141
|
-
?)[ \r ]*`,tE=`[̀-ͯ]`,nE=RegExp(`${tE}+$`),rE=`(${XT}+)|${eE}|([!-\\[\\]-‧-豈-]${tE}*|[\ud800-\udbff][\udc00-\udfff]${tE}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${$T}|${QT})`,iE=class{constructor(e,t){this.input=e,this.settings=t,this.tokenRegex=new RegExp(rE,`g`),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){let e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new BC(`EOF`,new zC(this,t,t));let n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new U(`Unexpected character: '${e[t]}'`,new BC(e[t],new zC(this,t,t+1)));let r=n[6]||n[3]||(n[2]?`\\ `:` `);if(this.catcodes[r]===14){let t=e.indexOf(`
|
|
142
|
-
`,this.tokenRegex.lastIndex);if(t===-1){if(this.tokenRegex.lastIndex=e.length,this.settings.strict)throw new U(`% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode`)}else this.tokenRegex.lastIndex=t+1;return this.lex()}return new BC(r,new zC(this,t,this.tokenRegex.lastIndex))}},aE=class{constructor(e=Object.create(null),t=Object.create(null)){this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push(Object.create(null))}endGroup(){if(this.undefStack.length===0)throw new U(`Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug`);let e=this.undefStack.pop();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(e[t]===void 0?delete this.current[t]:this.current[t]=e[t])}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){return Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:this.builtins[e]}set(e,t,n=!1){if(n){for(let t=0;t<this.undefStack.length;t++)delete this.undefStack[t][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{let t=this.undefStack[this.undefStack.length-1];t&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=this.current[e])}this.current[e]=t}},oE={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},sE=class{constructor(e,t,n){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new aE(UC,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new iE(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){let t,n,r;if(e){if(this.consumeSpaces(),this.future().text!==`[`)return null;t=this.popToken(),{tokens:r,end:n}=this.consumeArg([`]`])}else({tokens:r,start:t,end:n}=this.consumeArg());return this.pushToken(new BC(`EOF`,n.loc)),this.pushTokens(r),new BC(``,zC.range(t,n))}consumeSpaces(){for(;this.future().text===` `;)this.stack.pop()}consumeArg(e){let t=[],n=e&&e.length>0;n||this.consumeSpaces();let r=this.future(),i,a=0,o=0;do{if(i=this.popToken(),t.push(i),i.text===`{`)++a;else if(i.text===`}`){if(--a,a===-1)throw new U(`Extra }`,i)}else if(i.text===`EOF`)throw new U(`Unexpected end of input in a macro argument, expected '`+(e&&n?e[o]:`}`)+`'`,i);if(e&&n){if((a===0||a===1&&e[o]===`{`)&&i.text===e[o]){if(++o,o===e.length){t.splice(-o,o);break}}else o=0}}while(a!==0||n);return r.text===`{`&&t[t.length-1].text===`}`&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:r,end:i}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new U(`The length of delimiters doesn't match the number of args!`);let n=t[0];for(let e=0;e<n.length;e++){let t=this.popToken();if(n[e]!==t.text)throw new U(`Use of the macro doesn't match its definition`,t)}}let n=[];for(let r=0;r<e;r++)n.push(this.consumeArg(t&&t[r+1]).tokens);return n}expandOnce(e){let t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(r==null||e&&r.unexpandable){if(e&&r==null&&n[0]===`\\`&&!this.isDefined(n))throw new U(`Undefined control sequence: `+n);return this.pushToken(t),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new U(`Too many expansions: infinite loop or need to increase maxExpand setting`);let i=r.tokens,a=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs){i=i.slice();for(let e=i.length-1;e>=0;--e){let t=i[e];if(t.text===`#`){if(e===0)throw new U(`Incomplete placeholder at end of macro body`,t);if(t=i[--e],t.text===`#`)i.splice(e+1,1);else if(/^[1-9]$/.test(t.text))i.splice(e,2,...a[t.text-1]);else throw new U(`Not a valid argument number`,t)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){let e=this.stack.pop();return e.treatAsRelax&&(e.text=`\\relax`),e}throw Error()}expandMacro(e){return this.macros.has(e)?this.expandTokens([new BC(e)]):void 0}expandTokens(e){let t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){let e=this.stack.pop();e.treatAsRelax&&=(e.noexpand=!1,!1),t.push(e)}return t}expandMacroAsText(e){let t=this.expandMacro(e);return t&&t.map(e=>e.text).join(``)}_getExpansion(e){let t=this.macros.get(e);if(t==null)return t;if(e.length===1){let t=this.lexer.catcodes[e];if(t!=null&&t!==13)return}let n=typeof t==`function`?t(this):t;if(typeof n==`string`){let e=0;if(n.indexOf(`#`)!==-1){let t=n.replace(/##/g,``);for(;t.indexOf(`#`+(e+1))!==-1;)++e}let t=new iE(n,this.settings),r=[],i=t.lex();for(;i.text!==`EOF`;)r.push(i),i=t.lex();return r.reverse(),{tokens:r,numArgs:e}}return n}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(YT,e)||Object.prototype.hasOwnProperty.call(MS.math,e)||Object.prototype.hasOwnProperty.call(MS.text,e)||Object.prototype.hasOwnProperty.call(oE,e)}isExpandable(e){let t=this.macros.get(e);return t==null?Object.prototype.hasOwnProperty.call(YT,e)&&!YT[e].primitive:typeof t==`string`||typeof t==`function`||!t.unexpandable}},cE=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,lE=Object.freeze({"₊":`+`,"₋":`-`,"₌":`=`,"₍":`(`,"₎":`)`,"₀":`0`,"₁":`1`,"₂":`2`,"₃":`3`,"₄":`4`,"₅":`5`,"₆":`6`,"₇":`7`,"₈":`8`,"₉":`9`,ₐ:`a`,ₑ:`e`,ₕ:`h`,ᵢ:`i`,ⱼ:`j`,ₖ:`k`,ₗ:`l`,ₘ:`m`,ₙ:`n`,ₒ:`o`,ₚ:`p`,ᵣ:`r`,ₛ:`s`,ₜ:`t`,ᵤ:`u`,ᵥ:`v`,ₓ:`x`,ᵦ:`β`,ᵧ:`γ`,ᵨ:`ρ`,ᵩ:`ϕ`,ᵪ:`χ`,"⁺":`+`,"⁻":`-`,"⁼":`=`,"⁽":`(`,"⁾":`)`,"⁰":`0`,"¹":`1`,"²":`2`,"³":`3`,"⁴":`4`,"⁵":`5`,"⁶":`6`,"⁷":`7`,"⁸":`8`,"⁹":`9`,ᴬ:`A`,ᴮ:`B`,ᴰ:`D`,ᴱ:`E`,ᴳ:`G`,ᴴ:`H`,ᴵ:`I`,ᴶ:`J`,ᴷ:`K`,ᴸ:`L`,ᴹ:`M`,ᴺ:`N`,ᴼ:`O`,ᴾ:`P`,ᴿ:`R`,ᵀ:`T`,ᵁ:`U`,ⱽ:`V`,ᵂ:`W`,ᵃ:`a`,ᵇ:`b`,ᶜ:`c`,ᵈ:`d`,ᵉ:`e`,ᶠ:`f`,ᵍ:`g`,ʰ:`h`,ⁱ:`i`,ʲ:`j`,ᵏ:`k`,ˡ:`l`,ᵐ:`m`,ⁿ:`n`,ᵒ:`o`,ᵖ:`p`,ʳ:`r`,ˢ:`s`,ᵗ:`t`,ᵘ:`u`,ᵛ:`v`,ʷ:`w`,ˣ:`x`,ʸ:`y`,ᶻ:`z`,ᵝ:`β`,ᵞ:`γ`,ᵟ:`δ`,ᵠ:`ϕ`,ᵡ:`χ`,ᶿ:`θ`}),uE=Object.freeze({𝒜:`A`,ℬ:`B`,𝒞:`C`,𝒟:`D`,ℰ:`E`,ℱ:`F`,𝒢:`G`,ℋ:`H`,ℐ:`I`,𝒥:`J`,𝒦:`K`,ℒ:`L`,ℳ:`M`,𝒩:`N`,𝒪:`O`,𝒫:`P`,𝒬:`Q`,ℛ:`R`,𝒮:`S`,𝒯:`T`,𝒰:`U`,𝒱:`V`,𝒲:`W`,𝒳:`X`,𝒴:`Y`,𝒵:`Z`}),dE={"́":{text:`\\'`,math:`\\acute`},"̀":{text:"\\`",math:`\\grave`},"̈":{text:`\\"`,math:`\\ddot`},"̃":{text:`\\~`,math:`\\tilde`},"̄":{text:`\\=`,math:`\\bar`},"̆":{text:`\\u`,math:`\\breve`},"̌":{text:`\\v`,math:`\\check`},"̂":{text:`\\^`,math:`\\hat`},"̇":{text:`\\.`,math:`\\dot`},"̊":{text:`\\r`,math:`\\mathring`},"̋":{text:`\\H`},"̧":{text:`\\c`}},fE={á:`á`,à:`à`,ä:`ä`,ǟ:`ǟ`,ã:`ã`,ā:`ā`,ă:`ă`,ắ:`ắ`,ằ:`ằ`,ẵ:`ẵ`,ǎ:`ǎ`,â:`â`,ấ:`ấ`,ầ:`ầ`,ẫ:`ẫ`,ȧ:`ȧ`,ǡ:`ǡ`,å:`å`,ǻ:`ǻ`,ḃ:`ḃ`,ć:`ć`,č:`č`,ĉ:`ĉ`,ċ:`ċ`,ď:`ď`,ḋ:`ḋ`,é:`é`,è:`è`,ë:`ë`,ẽ:`ẽ`,ē:`ē`,ḗ:`ḗ`,ḕ:`ḕ`,ĕ:`ĕ`,ě:`ě`,ê:`ê`,ế:`ế`,ề:`ề`,ễ:`ễ`,ė:`ė`,ḟ:`ḟ`,ǵ:`ǵ`,ḡ:`ḡ`,ğ:`ğ`,ǧ:`ǧ`,ĝ:`ĝ`,ġ:`ġ`,ḧ:`ḧ`,ȟ:`ȟ`,ĥ:`ĥ`,ḣ:`ḣ`,í:`í`,ì:`ì`,ï:`ï`,ḯ:`ḯ`,ĩ:`ĩ`,ī:`ī`,ĭ:`ĭ`,ǐ:`ǐ`,î:`î`,ǰ:`ǰ`,ĵ:`ĵ`,ḱ:`ḱ`,ǩ:`ǩ`,ĺ:`ĺ`,ľ:`ľ`,ḿ:`ḿ`,ṁ:`ṁ`,ń:`ń`,ǹ:`ǹ`,ñ:`ñ`,ň:`ň`,ṅ:`ṅ`,ó:`ó`,ò:`ò`,ö:`ö`,ȫ:`ȫ`,õ:`õ`,ṍ:`ṍ`,ṏ:`ṏ`,ȭ:`ȭ`,ō:`ō`,ṓ:`ṓ`,ṑ:`ṑ`,ŏ:`ŏ`,ǒ:`ǒ`,ô:`ô`,ố:`ố`,ồ:`ồ`,ỗ:`ỗ`,ȯ:`ȯ`,ȱ:`ȱ`,ő:`ő`,ṕ:`ṕ`,ṗ:`ṗ`,ŕ:`ŕ`,ř:`ř`,ṙ:`ṙ`,ś:`ś`,ṥ:`ṥ`,š:`š`,ṧ:`ṧ`,ŝ:`ŝ`,ṡ:`ṡ`,ẗ:`ẗ`,ť:`ť`,ṫ:`ṫ`,ú:`ú`,ù:`ù`,ü:`ü`,ǘ:`ǘ`,ǜ:`ǜ`,ǖ:`ǖ`,ǚ:`ǚ`,ũ:`ũ`,ṹ:`ṹ`,ū:`ū`,ṻ:`ṻ`,ŭ:`ŭ`,ǔ:`ǔ`,û:`û`,ů:`ů`,ű:`ű`,ṽ:`ṽ`,ẃ:`ẃ`,ẁ:`ẁ`,ẅ:`ẅ`,ŵ:`ŵ`,ẇ:`ẇ`,ẘ:`ẘ`,ẍ:`ẍ`,ẋ:`ẋ`,ý:`ý`,ỳ:`ỳ`,ÿ:`ÿ`,ỹ:`ỹ`,ȳ:`ȳ`,ŷ:`ŷ`,ẏ:`ẏ`,ẙ:`ẙ`,ź:`ź`,ž:`ž`,ẑ:`ẑ`,ż:`ż`,Á:`Á`,À:`À`,Ä:`Ä`,Ǟ:`Ǟ`,Ã:`Ã`,Ā:`Ā`,Ă:`Ă`,Ắ:`Ắ`,Ằ:`Ằ`,Ẵ:`Ẵ`,Ǎ:`Ǎ`,Â:`Â`,Ấ:`Ấ`,Ầ:`Ầ`,Ẫ:`Ẫ`,Ȧ:`Ȧ`,Ǡ:`Ǡ`,Å:`Å`,Ǻ:`Ǻ`,Ḃ:`Ḃ`,Ć:`Ć`,Č:`Č`,Ĉ:`Ĉ`,Ċ:`Ċ`,Ď:`Ď`,Ḋ:`Ḋ`,É:`É`,È:`È`,Ë:`Ë`,Ẽ:`Ẽ`,Ē:`Ē`,Ḗ:`Ḗ`,Ḕ:`Ḕ`,Ĕ:`Ĕ`,Ě:`Ě`,Ê:`Ê`,Ế:`Ế`,Ề:`Ề`,Ễ:`Ễ`,Ė:`Ė`,Ḟ:`Ḟ`,Ǵ:`Ǵ`,Ḡ:`Ḡ`,Ğ:`Ğ`,Ǧ:`Ǧ`,Ĝ:`Ĝ`,Ġ:`Ġ`,Ḧ:`Ḧ`,Ȟ:`Ȟ`,Ĥ:`Ĥ`,Ḣ:`Ḣ`,Í:`Í`,Ì:`Ì`,Ï:`Ï`,Ḯ:`Ḯ`,Ĩ:`Ĩ`,Ī:`Ī`,Ĭ:`Ĭ`,Ǐ:`Ǐ`,Î:`Î`,İ:`İ`,Ĵ:`Ĵ`,Ḱ:`Ḱ`,Ǩ:`Ǩ`,Ĺ:`Ĺ`,Ľ:`Ľ`,Ḿ:`Ḿ`,Ṁ:`Ṁ`,Ń:`Ń`,Ǹ:`Ǹ`,Ñ:`Ñ`,Ň:`Ň`,Ṅ:`Ṅ`,Ó:`Ó`,Ò:`Ò`,Ö:`Ö`,Ȫ:`Ȫ`,Õ:`Õ`,Ṍ:`Ṍ`,Ṏ:`Ṏ`,Ȭ:`Ȭ`,Ō:`Ō`,Ṓ:`Ṓ`,Ṑ:`Ṑ`,Ŏ:`Ŏ`,Ǒ:`Ǒ`,Ô:`Ô`,Ố:`Ố`,Ồ:`Ồ`,Ỗ:`Ỗ`,Ȯ:`Ȯ`,Ȱ:`Ȱ`,Ő:`Ő`,Ṕ:`Ṕ`,Ṗ:`Ṗ`,Ŕ:`Ŕ`,Ř:`Ř`,Ṙ:`Ṙ`,Ś:`Ś`,Ṥ:`Ṥ`,Š:`Š`,Ṧ:`Ṧ`,Ŝ:`Ŝ`,Ṡ:`Ṡ`,Ť:`Ť`,Ṫ:`Ṫ`,Ú:`Ú`,Ù:`Ù`,Ü:`Ü`,Ǘ:`Ǘ`,Ǜ:`Ǜ`,Ǖ:`Ǖ`,Ǚ:`Ǚ`,Ũ:`Ũ`,Ṹ:`Ṹ`,Ū:`Ū`,Ṻ:`Ṻ`,Ŭ:`Ŭ`,Ǔ:`Ǔ`,Û:`Û`,Ů:`Ů`,Ű:`Ű`,Ṽ:`Ṽ`,Ẃ:`Ẃ`,Ẁ:`Ẁ`,Ẅ:`Ẅ`,Ŵ:`Ŵ`,Ẇ:`Ẇ`,Ẍ:`Ẍ`,Ẋ:`Ẋ`,Ý:`Ý`,Ỳ:`Ỳ`,Ÿ:`Ÿ`,Ỹ:`Ỹ`,Ȳ:`Ȳ`,Ŷ:`Ŷ`,Ẏ:`Ẏ`,Ź:`Ź`,Ž:`Ž`,Ẑ:`Ẑ`,Ż:`Ż`,ά:`ά`,ὰ:`ὰ`,ᾱ:`ᾱ`,ᾰ:`ᾰ`,έ:`έ`,ὲ:`ὲ`,ή:`ή`,ὴ:`ὴ`,ί:`ί`,ὶ:`ὶ`,ϊ:`ϊ`,ΐ:`ΐ`,ῒ:`ῒ`,ῑ:`ῑ`,ῐ:`ῐ`,ό:`ό`,ὸ:`ὸ`,ύ:`ύ`,ὺ:`ὺ`,ϋ:`ϋ`,ΰ:`ΰ`,ῢ:`ῢ`,ῡ:`ῡ`,ῠ:`ῠ`,ώ:`ώ`,ὼ:`ὼ`,Ύ:`Ύ`,Ὺ:`Ὺ`,Ϋ:`Ϋ`,Ῡ:`Ῡ`,Ῠ:`Ῠ`,Ώ:`Ώ`,Ὼ:`Ὼ`},pE=[`bin`,`op`,`open`,`punct`,`rel`],mE=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,hE=/^ *\\text/,gE=class e{constructor(e,t,n=!1){this.mode=`math`,this.gullet=new sE(e,t,this.mode),this.settings=t,this.isPreamble=n,this.leftrightDepth=0,this.prevAtomType=``}expect(e,t=!0){if(this.fetch().text!==e)throw new U(`Expected '${e}', got '${this.fetch().text}'`,this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken??=this.gullet.expandNextToken(),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set(`\\color`,`\\textcolor`);let e=this.parseExpression(!1);if(this.expect(`EOF`),this.isPreamble){let e=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([t,n])=>{e[t]=n}),this.gullet.endGroup(),e}let t=this.gullet.macros.get(`\\df@tag`);return this.gullet.endGroup(),t&&(this.gullet.macros.current[`\\df@tag`]=t),e}static get endOfExpression(){return[`}`,`\\endgroup`,`\\end`,`\\right`,`\\endtoggle`,`&`]}subparse(e){let t=this.nextToken;this.consume(),this.gullet.pushToken(new BC(`}`)),this.gullet.pushTokens(e);let n=this.parseExpression(!1);return this.expect(`}`),this.nextToken=t,n}parseExpression(t,n,r){let i=[];for(this.prevAtomType=``;;){this.mode===`math`&&this.consumeSpaces();let a=this.fetch();if(e.endOfExpression.indexOf(a.text)!==-1||n&&a.text===n||r&&a.text===`\\middle`||t&&YT[a.text]&&YT[a.text].infix)break;let o=this.parseAtom(n);if(!o)break;o.type!==`internal`&&(i.push(o),this.prevAtomType=o.type===`atom`?o.family:o.type)}return this.mode===`text`&&this.formLigatures(i),this.handleInfixNodes(i)}handleInfixNodes(e){let t=-1,n;for(let r=0;r<e.length;r++)if(e[r].type===`infix`){if(t!==-1)throw new U(`only one infix operator per group`,e[r].token);t=r,n=e[r].replaceWith}if(t!==-1&&n){let r,i,a=e.slice(0,t),o=e.slice(t+1);r=a.length===1&&a[0].type===`ordgroup`?a[0]:{type:`ordgroup`,mode:this.mode,body:a},i=o.length===1&&o[0].type===`ordgroup`?o[0]:{type:`ordgroup`,mode:this.mode,body:o};let s;return s=n===`\\\\abovefrac`?this.callFunction(n,[r,e[t],i],[]):this.callFunction(n,[r,i],[]),[s]}return e}handleSupSubscript(e){let t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();let r;do r=this.parseGroup(e);while(r.type&&r.type===`internal`);if(!r)throw new U(`Expected group after '`+n+`'`,t);return r}formatUnsupportedCmd(e){let t=[];for(let n=0;n<e.length;n++)t.push({type:`textord`,mode:`text`,text:e[n]});let n={type:`text`,mode:this.mode,body:t};return{type:`color`,mode:this.mode,color:this.settings.errorColor,body:[n]}}parseAtom(e){let t=this.parseGroup(`atom`,e);if(t&&t.type===`internal`||this.mode===`text`)return t;let n,r;for(;;){this.consumeSpaces();let e=this.fetch();if(e.text===`\\limits`||e.text===`\\nolimits`){if(t&&t.type===`op`)t.limits=e.text===`\\limits`,t.alwaysHandleSupSub=!0;else if(t&&t.type===`operatorname`)t.alwaysHandleSupSub&&(t.limits=e.text===`\\limits`);else throw new U(`Limit controls must follow a math operator`,e);this.consume()}else if(e.text===`^`){if(n)throw new U(`Double superscript`,e);n=this.handleSupSubscript(`superscript`)}else if(e.text===`_`){if(r)throw new U(`Double subscript`,e);r=this.handleSupSubscript(`subscript`)}else if(e.text===`'`){if(n)throw new U(`Double superscript`,e);let t={type:`textord`,mode:this.mode,text:`\\prime`},r=[t];for(this.consume();this.fetch().text===`'`;)r.push(t),this.consume();this.fetch().text===`^`&&r.push(this.handleSupSubscript(`superscript`)),n={type:`ordgroup`,mode:this.mode,body:r}}else if(lE[e.text]){let t=cE.test(e.text),i=[];for(i.push(new BC(lE[e.text])),this.consume();;){let e=this.fetch().text;if(!lE[e]||cE.test(e)!==t)break;i.unshift(new BC(lE[e])),this.consume()}let a=this.subparse(i);t?r={type:`ordgroup`,mode:`math`,body:a}:n={type:`ordgroup`,mode:`math`,body:a}}else break}if(n||r){if(t&&t.type===`multiscript`&&!t.postscripts)return t.postscripts={sup:n,sub:r},t;{let e=!t||t.type!==`op`&&t.type!==`operatorname`?void 0:Mw(this.nextToken.text);return{type:`supsub`,mode:this.mode,base:t,sup:n,sub:r,isFollowedByDelimiter:e}}}return t}parseFunction(e,t){let n=this.fetch(),r=n.text,i=YT[r];if(!i)return null;if(this.consume(),t&&t!==`atom`&&!i.allowedInArgument)throw new U(`Got function '`+r+`' with no arguments`+(t?` as `+t:``),n);if(this.mode===`text`&&!i.allowedInText)throw new U(`Can't use function '`+r+`' in text mode`,n);if(this.mode===`math`&&i.allowedInMath===!1)throw new U(`Can't use function '`+r+`' in math mode`,n);let a=this.prevAtomType,{args:o,optArgs:s}=this.parseArguments(r,i);return this.prevAtomType=a,this.callFunction(r,o,s,n,e)}callFunction(e,t,n,r,i){let a={funcName:e,parser:this,token:r,breakOnTokenText:i},o=YT[e];if(o&&o.handler)return o.handler(a,t,n);throw new U(`No function handler for ${e}`)}parseArguments(e,t){let n=t.numArgs+t.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};let r=[],i=[];for(let a=0;a<n;a++){let n=t.argTypes&&t.argTypes[a],o=a<t.numOptionalArgs;(t.primitive&&n==null||t.type===`sqrt`&&a===1&&i[0]==null)&&(n=`primitive`);let s=this.parseGroupOfType(`argument to '${e}'`,n,o);if(o)i.push(s);else if(s!=null)r.push(s);else throw new U(`Null argument, please report this as a bug`)}return{args:r,optArgs:i}}parseGroupOfType(e,t,n){switch(t){case`size`:return this.parseSizeGroup(n);case`url`:return this.parseUrlGroup(n);case`math`:case`text`:return this.parseArgumentGroup(n,t);case`hbox`:{let e=this.parseArgumentGroup(n,`text`);return e==null?null:{type:`styling`,mode:e.mode,body:[e],scriptLevel:`text`}}case`raw`:{let e=this.parseStringGroup(`raw`,n);return e==null?null:{type:`raw`,mode:`text`,string:e.text}}case`primitive`:{if(n)throw new U(`A primitive argument cannot be optional`);let t=this.parseGroup(e);if(t==null)throw new U(`Expected group as `+e,this.fetch());return t}case`original`:case null:case void 0:return this.parseArgumentGroup(n);default:throw new U(`Unknown group type as `+e,this.fetch())}}consumeSpaces(){for(;;){let e=this.fetch().text;if(e===` `||e===`\xA0`||e===`︎`)this.consume();else break}}parseStringGroup(e,t){let n=this.gullet.scanArgument(t);if(n==null)return null;let r=``,i;for(;(i=this.fetch()).text!==`EOF`;)r+=i.text,this.consume();return this.consume(),n.text=r,n}parseRegexGroup(e,t){let n=this.fetch(),r=n,i=``,a;for(;(a=this.fetch()).text!==`EOF`&&e.test(i+a.text);)r=a,i+=r.text,this.consume();if(i===``)throw new U(`Invalid `+t+`: '`+n.text+`'`,n);return n.range(r,i)}parseSizeGroup(e){let t,n=!1;if(this.gullet.consumeSpaces(),t=!e&&this.gullet.future().text!==`{`?this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,`size`):this.parseStringGroup(`size`,e),!t)return null;!e&&t.text.length===0&&(t.text=`0pt`,n=!0);let r=mE.exec(t.text);if(!r)throw new U(`Invalid size: '`+t.text+`'`,t);let i={number:+(r[1]+r[2]),unit:r[3]};if(!_C(i))throw new U(`Invalid unit: '`+i.unit+`'`,t);return{type:`size`,mode:this.mode,value:i,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode(`%`,13),this.gullet.lexer.setCatcode(`~`,12);let t=this.parseStringGroup(`url`,e);if(this.gullet.lexer.setCatcode(`%`,14),this.gullet.lexer.setCatcode(`~`,13),t==null)return null;let n=t.text.replace(/\\([#$%&~_^{}])/g,`$1`);return n=t.text.replace(/{\u2044}/g,`/`),{type:`url`,mode:this.mode,url:n}}parseArgumentGroup(e,t){let n=this.gullet.scanArgument(e);if(n==null)return null;let r=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();let i=this.parseExpression(!1,`EOF`);this.expect(`EOF`),this.gullet.endGroup();let a={type:`ordgroup`,mode:this.mode,loc:n.loc,body:i};return t&&this.switchMode(r),a}parseGroup(e,t){let n=this.fetch(),r=n.text;if(e===`argument to '\\left'`)return this.parseSymbol();let i;if(r===`{`||r===`\\begingroup`||r===`\\toggle`){this.consume();let e=r===`{`?`}`:r===`\\begingroup`?`\\endgroup`:`\\endtoggle`;this.gullet.beginGroup();let t=this.parseExpression(!1,e),a=this.fetch();this.expect(e),this.gullet.endGroup(),i={type:a.text===`\\endtoggle`?`toggle`:`ordgroup`,mode:this.mode,loc:zC.range(n,a),body:t,semisimple:r===`\\begingroup`||void 0}}else if(i=this.parseFunction(t,e)||this.parseSymbol(),i==null&&r[0]===`\\`&&!Object.prototype.hasOwnProperty.call(oE,r)){if(this.settings.throwOnError)throw new U(`Unsupported function name: `+r,n);i=this.formatUnsupportedCmd(r),this.consume()}return i}formLigatures(e){let t=e.length-1;for(let n=0;n<t;++n){let r=e[n],i=r.text;i===`-`&&e[n+1].text===`-`&&(n+1<t&&e[n+2].text===`-`?(e.splice(n,3,{type:`textord`,mode:`text`,loc:zC.range(r,e[n+2]),text:`---`}),t-=2):(e.splice(n,2,{type:`textord`,mode:`text`,loc:zC.range(r,e[n+1]),text:`--`}),--t)),(i===`'`||i==="`")&&e[n+1].text===i&&(e.splice(n,2,{type:`textord`,mode:`text`,loc:zC.range(r,e[n+1]),text:i+i}),--t)}}parseSymbol(){let e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();let e=t.slice(5),n=e.charAt(0)===`*`;if(n&&(e=e.slice(1)),e.length<2||e.charAt(0)!==e.slice(-1))throw new U(`\\verb assertion failed --
|
|
143
|
-
please report what input caused this bug`);return e=e.slice(1,-1),{type:`verb`,mode:`text`,body:e,star:n}}if(Object.prototype.hasOwnProperty.call(fE,t[0])&&this.mode===`math`&&!MS[this.mode][t[0]]){if(this.settings.strict&&this.mode===`math`)throw new U(`Accented Unicode text character "${t[0]}" used in math mode`,e);t=fE[t[0]]+t.slice(1)}let n=this.mode===`math`?nE.exec(t):null;n&&(t=t.substring(0,n.index),t===`i`?t=`ı`:t===`j`&&(t=`ȷ`));let r;if(MS[this.mode][t]){let n=MS[this.mode][t].group;n===`bin`&&(pE.includes(this.prevAtomType)||this.prevAtomType===``)&&(n=`open`);let i=zC.range(e),a;if(Object.prototype.hasOwnProperty.call(AS,n)){let e=n;a={type:`atom`,mode:this.mode,family:e,loc:i,text:t},(e===`rel`||e===`bin`)&&this.prevAtomType===`text`&&hE.test(i.lexer.input.slice(i.end))&&(a.needsSpacing=!0)}else{if(uE[t]){this.consume();let e=this.fetch().text.charCodeAt(0),n=e===65025?`mathscr`:`mathcal`;return(e===65024||e===65025)&&this.consume(),{type:`font`,mode:`math`,font:n,body:{type:`mathord`,mode:`math`,loc:i,text:uE[t]}}}a={type:n,mode:this.mode,loc:i,text:t}}r=a}else if(t.charCodeAt(0)>=128||nE.exec(t)){if(this.settings.strict&&this.mode===`math`)throw new U(`Unicode text character "${t[0]}" used in math mode`,e);r={type:`textord`,mode:`text`,loc:zC.range(e),text:t}}else return null;if(this.consume(),n)for(let t=0;t<n[0].length;t++){let i=n[0][t];if(!dE[i])throw new U(`Unknown accent ' ${i}'`,e);let a=dE[i][this.mode]||dE[i].text;if(!a)throw new U(`Accent ${i} unsupported in ${this.mode} mode`,e);r={type:`accent`,mode:this.mode,loc:zC.range(e),label:a,isStretchy:!1,base:r}}return r}},_E=function(e,t){if(!(typeof e==`string`||e instanceof String))throw TypeError(`Temml can only parse string typed expression`);let n,r;try{r=new gE(e,t),delete r.gullet.macros.current[`\\df@tag`],n=r.parse()}catch(i){if(i.toString()===`ParseError: Unmatched delimiter`)t.wrapDelimiterPairs=!1,r=new gE(e,t),delete r.gullet.macros.current[`\\df@tag`],n=r.parse();else throw i}if(!(n.length>0&&n[0].type&&n[0].type===`array`&&n[0].addEqnNum)&&r.gullet.macros.get(`\\df@tag`)){if(!t.displayMode)throw new U(`\\tag works only in display mode`);r.gullet.feed(`\\df@tag`),n=[{type:`tag`,mode:`text`,body:n,tag:r.parse()}]}return n},vE=[2,2,3,3],yE=class e{constructor(e){this.level=e.level,this.color=e.color,this.font=e.font||``,this.fontFamily=e.fontFamily||``,this.fontSize=e.fontSize||1,this.fontWeight=e.fontWeight||``,this.fontShape=e.fontShape||``,this.maxSize=e.maxSize}extend(t){let n={level:this.level,color:this.color,font:this.font,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return new e(n)}withLevel(e){return this.extend({level:e})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:vE[this.level]})}withColor(e){return this.extend({color:e})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:``})}withFontSize(e){return this.extend({fontSize:e})}withTextFontWeight(e){return this.extend({fontWeight:e,font:``})}withTextFontShape(e){return this.extend({fontShape:e,font:``})}getColor(){return this.color}},bE=`0.14.0`;function xE(e){let t={},n=0,r=document.getElementsByClassName(`tml-eqn`);for(let e of r)for(n+=1,e.setAttribute(`id`,`tml-eqn-`+String(n));e.tagName!==`mtable`;){if(e.getElementsByClassName(`tml-label`).length>0){let r=e.attributes.id.value;t[r]=String(n);break}e=e.parentElement}let i=document.getElementsByClassName(`tml-tageqn`);for(let e of i)if(e.getElementsByClassName(`tml-label`).length>0){let n=e.getElementsByClassName(`tml-tag`);if(n.length>0){let r=e.attributes.id.value;t[r]=n[0].textContent}}[...e.getElementsByClassName(`tml-ref`)].forEach(e=>{let n=e.getAttribute(`href`),r=t[n.slice(1)];e.className.indexOf(`tml-eqref`)===-1?(r=r.replace(/^\(/,``),r=r.replace(/\)$/,``)):(r.charAt(0)!==`(`&&(r=`(`+r),r.slice(-1)!==`)`&&(r+=`)`));let i=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`mtext`);i.appendChild(document.createTextNode(r));let a=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`math`);a.appendChild(i),e.textContent=``,e.appendChild(a)})}var SE=function(e,t,n){let r=n,i=0,a=e.length;for(;r<t.length;){let n=t[r];if(i<=0&&t.slice(r,r+a)===e)return r;n===`\\`?r++:n===`{`?i++:n===`}`&&i--,r++}return-1},CE=function(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)},wE=/^\\(?:begin|(?:eq)?ref){/,TE=function(e,t){let n,r=[],i=RegExp(`(`+t.map(e=>CE(e.left)).join(`|`)+`)`);for(;n=e.search(i),n!==-1;){n>0&&(r.push({type:`text`,data:e.slice(0,n)}),e=e.slice(n));let i=t.findIndex(t=>e.startsWith(t.left));if(n=SE(t[i].right,e,t[i].left.length),n===-1)break;let a=e.slice(0,n+t[i].right.length),o=wE.test(a)?a:e.slice(t[i].left.length,n);r.push({type:`math`,data:o,rawData:a,display:t[i].display}),e=e.slice(n+t[i].right.length)}return e!==``&&r.push({type:`text`,data:e}),r},EE=[{left:`$$`,right:`$$`,display:!0},{left:`\\(`,right:`\\)`,display:!1},{left:`\\begin{equation}`,right:`\\end{equation}`,display:!0},{left:`\\begin{equation*}`,right:`\\end{equation*}`,display:!0},{left:`\\begin{align}`,right:`\\end{align}`,display:!0},{left:`\\begin{align*}`,right:`\\end{align*}`,display:!0},{left:`\\begin{alignat}`,right:`\\end{alignat}`,display:!0},{left:`\\begin{alignat*}`,right:`\\end{alignat*}`,display:!0},{left:`\\begin{gather}`,right:`\\end{gather}`,display:!0},{left:`\\begin{gather*}`,right:`\\end{gather*}`,display:!0},{left:`\\begin{CD}`,right:`\\end{CD}`,display:!0},{left:`\\ref{`,right:`}`,display:!1},{left:`\\eqref{`,right:`}`,display:!1},{left:`\\[`,right:`\\]`,display:!0}],DE={$:[{left:`$$`,right:`$$`,display:!0},{left:"$`",right:"`$",display:!1},{left:`$`,right:`$`,display:!1}],"(":[{left:`\\[`,right:`\\]`,display:!0},{left:`\\(`,right:`\\)`,display:!1}]},OE=[{left:`\\begin{equation}`,right:`\\end{equation}`,display:!0},{left:`\\begin{equation*}`,right:`\\end{equation*}`,display:!0},{left:`\\begin{align}`,right:`\\end{align}`,display:!0},{left:`\\begin{align*}`,right:`\\end{align*}`,display:!0},{left:`\\begin{alignat}`,right:`\\end{alignat}`,display:!0},{left:`\\begin{alignat*}`,right:`\\end{alignat*}`,display:!0},{left:`\\begin{gather}`,right:`\\end{gather}`,display:!0},{left:`\\begin{gather*}`,right:`\\end{gather*}`,display:!0},{left:`\\begin{CD}`,right:`\\end{CD}`,display:!0},{left:`\\ref{`,right:`}`,display:!1},{left:`\\eqref{`,right:`}`,display:!1}],kE=e=>e===`$`||e===`(`?DE[e]:e===`$+`||e===`(+`?DE[e.slice(0,1)].concat(OE):e===`ams`?OE:e===`all`?DE[`(`].concat(DE.$).concat(OE):EE,AE=function(e,t){let n=TE(e,t.delimiters);if(n.length===1&&n[0].type===`text`)return null;let r=document.createDocumentFragment();for(let e=0;e<n.length;e++)if(n[e].type===`text`)r.appendChild(document.createTextNode(n[e].data));else{let i=document.createElement(`span`),a=n[e].data;t.displayMode=n[e].display;try{t.preProcess&&(a=t.preProcess(a)),temml.render(a,i,t)}catch(i){if(!(i instanceof U))throw i;t.errorCallback("Temml auto-render: Failed to parse `"+n[e].data+"` with ",i),r.appendChild(document.createTextNode(n[e].rawData));continue}r.appendChild(i)}return r},jE=function(e,t){for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];if(r.nodeType===3){let i=AE(r.textContent,t);i&&(n+=i.childNodes.length-1,e.replaceChild(i,r))}else if(r.nodeType===1){let e=` `+r.className+` `;t.ignoredTags.indexOf(r.nodeName.toLowerCase())===-1&&t.ignoredClasses.every(t=>e.indexOf(` `+t+` `)===-1)&&jE(r,t)}}},ME=function(e,t){if(!e)throw Error(`No element provided to render`);let n={};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);n.delimiters=n.fences?kE(n.fences):n.delimiters||EE,n.ignoredTags=n.ignoredTags||[`script`,`noscript`,`style`,`textarea`,`pre`,`code`,`option`],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||Object.create(null),jE(e,n),xE(e)},NE=function(e,t,n={}){t.textContent=``;let r=t.tagName.toLowerCase()===`math`;r&&(n.wrap=`none`);let i=RE(e,n);r||i.children.length>1?(t.textContent=``,i.children.forEach(e=>{t.appendChild(e.toNode())})):t.appendChild(i.toNode())};typeof document<`u`&&document.compatMode!==`CSS1Compat`&&(typeof console<`u`&&console.warn(`Warning: Temml doesn't work in quirks mode. Make sure your website has a suitable doctype.`),NE=function(){throw new U(`Temml doesn't work in quirks mode.`)});var PE=function(e,t){return RE(e,t).toMarkup()},FE=function(e,t){return _E(e,new oS(t))},IE=function(e,t){let n=new oS(t);if(n.macros=Object.create(null),!(typeof e==`string`||e instanceof String))throw TypeError(`Temml can only parse string typed expression`);let r=new gE(e,n,!0);return delete r.gullet.macros.current[`\\df@tag`],r.parse()},LE=function(e,t,n){if(n.throwOnError||!(e instanceof U))throw e;let r=new vS([`temml-error`],[new yS(t+`
|
|
144
|
-
|
|
145
|
-
`+e.toString())]);return r.style.color=n.errorColor,r.style.whiteSpace=`pre-line`,r},RE=function(e,t){let n=new oS(t);try{return sC(_E(e,n),e,new yE({level:n.displayMode?VC.DISPLAY:VC.TEXT,maxSize:n.maxSize}),n)}catch(t){return LE(t,e,n)}},zE={version:bE,render:NE,renderToString:PE,renderMathInElement:ME,postProcess:xE,ParseError:U,definePreamble:IE,__parse:FE,__renderToMathMLTree:RE,__defineSymbol:G,__defineMacro:Q},BE=/(?<=["\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,VE=/\\([!-/:-@[-`{-~])/g;function HE(e){return e.replace(VE,`$1`)}function UE(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(BE)){let t=e[0],n=HE(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=>UE(e,t))}function WE(){return(e,t)=>{typeof t.value==`string`&&UE(e,t.value)}}function GE(e){if(!e.children)return;let t=[];for(let n of e.children)n.type===`text`&&n.value?.includes(`
|
|
146
|
-
`)?n.value.split(`
|
|
147
|
-
`).forEach((e,n)=>{n>0&&t.push({type:`break`}),e&&t.push({type:`text`,value:e})}):(GE(n),t.push(n));e.children=t}function KE(){return e=>{GE(e)}}var qE=/^\s*(```|~~~)/,JE=/(`+)[\s\S]*?\1/g,YE=/[\\^_{}]/,XE=e=>`$$${e}$$`;function ZE(e){return e.replace(/\\\((.+?)\\\)/g,(e,t)=>XE(t)).replace(/\\\[(.+?)\\\]/g,(e,t)=>XE(t)).replace(/(^|[^\\$])\$(?![\s$])([^$\n]*?[^\s$\\])\$(?![\d$])/g,(e,t,n)=>YE.test(n)?t+XE(n):e)}function QE(e){let t=/^(\s*)(?:\\\[((?:(?!\\\]).)+)\\\]|\$\$((?:(?!\$\$).)+)\$\$)\s*$/.exec(e);if(t){let e=t[1];return`${e}$$\n${e}${(t[2]??t[3]).trim()}\n${e}$$`}let n=/^(\s*)\\[[\]]\s*$/.exec(e);if(n)return`${n[1]}$$`;let r=``,i=0;for(let t of e.matchAll(JE))r+=ZE(e.slice(i,t.index))+t[0],i=t.index+t[0].length;return r+ZE(e.slice(i))}function $E(e){if(!e.includes(`$`)&&!e.includes(`\\`))return e;let t=!1;return e.split(`
|
|
148
|
-
`).map(e=>qE.test(e)?(t=!t,e):t?e:QE(e)).join(`
|
|
149
|
-
`)}var eD=/^[-+−]?[$€£¥]?\s?\d[\d,.\s]*\s?(?:%|[kKmMbB]|[KMGT]?B|[$€£¥])?$/,tD=/^[-—–]?$/;function nD(e){return e.value===void 0?(e.children??[]).map(nD).join(``):e.value}function rD(e){let t=e.children??[],n=t.slice(1);if(n.length===0)return;let r=Math.max(...t.map(e=>e.children?.length??0));for(let i=0;i<r;i++){if(e.align?.[i])continue;let r=n.map(e=>nD(e.children?.[i]??{type:`text`,value:``}).trim()).filter(e=>!tD.test(e));if(r.length!==0&&r.every(e=>eD.test(e)))for(let e of t){let t=e.children?.[i];t&&(t.data={...t.data,hProperties:{...t.data?.hProperties,className:`is-numeric`}})}}}function iD(e){e.type===`table`?rD(e):e.children?.forEach(iD)}function aD(){return e=>{iD(e)}}function oD(e){if(!/^[-/]/.test(e))return!1;let t=e.slice(1).split(`:`,1)[0].toLowerCase();return t===`e`||t===`ec`||t.length>=3&&`encodedcommand`.startsWith(t)}function sD(e){let t=e.split(/\s+/).filter(Boolean),n=t.findIndex(e=>/(^|[\\/])(powershell|pwsh)(\.exe)?["']?$/i.test(e.replace(/^["']/,``)));if(n<0)return``;for(let e=n+1;e<t.length-1;e++){if(!oD(t[e]))continue;let n=t[e+1].replace(/^["']|["']$/g,``);try{let e=Uint8Array.from(atob(n),e=>e.charCodeAt(0));return new TextDecoder(`utf-16le`,{fatal:!0}).decode(e)}catch(e){return console.debug(`EncodedCommand operand is not base64 UTF-16LE`,e),``}}return``}function cD(e){let t=``,n=!1;for(let r=0;r<e.length;r++){let i=e[r];i===`"`&&(n=!n),i===`^`&&!n?(r+=1,r<e.length&&(t+=e[r])):t+=i}return t}var lD=20,uD=2,dD=new Set([` `,`
|
|
150
|
-
`]),fD=(e,t)=>od(dD,e,t),pD=e=>pd(dD,e);function mD(e){return typeof e.old_content==`string`&&typeof e.new_content==`string`?{kind:`edit`,lines:hD(e.old_content,e.new_content)}:typeof e.content==`string`&&(typeof e.file_path==`string`||typeof e.path==`string`)?{kind:`write`,text:e.content}:null}function hD(e,t){let n=e=>e.replace(/\r\n/g,`
|
|
151
|
-
`).replace(/\n$/,``).split(`
|
|
152
|
-
`),r=e?n(e):[],i=t?n(t):[],a=0;for(;a<r.length&&a<i.length&&r[a]===i[a];)a++;let o=0;for(;o<r.length-a&&o<i.length-a&&r[r.length-1-o]===i[i.length-1-o];)o++;return a+o>=r.length&&a+o>=i.length&&e!==t?[...r.map(e=>`-${e}`),...i.map(e=>`+${e}`)]:[...r.slice(Math.max(0,a-uD),a).map(e=>` ${e}`),...r.slice(a,r.length-o).map(e=>`-${e}`),...i.slice(a,i.length-o).map(e=>`+${e}`),...r.slice(r.length-o,r.length-o+uD).map(e=>` ${e}`)]}function gD(e){return e.startsWith(`+`)?`render-diff__line render-diff__line--added`:e.startsWith(`-`)?`render-diff__line render-diff__line--removed`:`render-diff__line`}function _D({lines:e}){let t=R(),[n,r]=(0,B.useState)(!1),i=e.length>lD,a=i&&!n?e.slice(0,lD):e;return z(P.Fragment,{children:[L(`pre`,{dir:`ltr`,className:`render-diff__body perm-card-diff`,"data-testid":`perm-edit-diff`,children:a.map((e,t)=>L(`div`,{className:gD(e),children:fD(e,!0)},t))}),i&&L(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>r(e=>!e),"aria-expanded":n,children:n?t(`prompt.showLess`):t(`prompt.showAllLines`,{n:e.length})})]})}function vD({args:e}){let t=R(),n=mD(e);if(!n)return null;let r=n.kind===`edit`?pD(e.old_content)||pD(e.new_content):pD(n.text);return z(`div`,{className:`perm-card-change`,children:[L(`p`,{className:`perm-card-change-label`,children:t(n.kind===`edit`?`prompt.willChange`:`prompt.willWrite`)}),n.kind===`edit`?L(_D,{lines:n.lines}):n.text?L(PD,{code:fD(n.text,!0),previewLines:lD,testId:`perm-write-preview`,exact:!0}):L(`p`,{className:`perm-card-detail`,children:t(`prompt.emptyFile`)}),r&&L(`p`,{className:`perm-card-risk`,role:`note`,"data-testid":`perm-change-unseen`,children:t(`prompt.unseenChars`)})]})}function yD(e){let t=e.toolArgs??{},n=[`command`,`file_path`,`path`,`url`,`_site`,`query`,`name`].map(e=>t[e]).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n:``}var bD=new Set([`run_shell_command`,`wait_for_condition`]),xD=new Set([`run_python`,`execute_python_file`]),SD=[`send_now`,`send_draft`,`reply_to_message`,`forward_message`,`discard_draft`,`update_draft`],CD=new Set([...SD,...SD.map(e=>`send-email/${e}`)]),wD=[[`Attachments left out, not sent`,`permission.mail.leftOut`],[`Attachments`,`permission.mail.attachments`],[`Subject`,`permission.mail.subject`],[`Format`,`permission.mail.format`],[`From`,`permission.mail.from`],[`Bcc`,`permission.mail.bcc`],[`Cc`,`permission.mail.cc`],[`To`,`permission.mail.to`]],TD=RegExp(`^(${wD.map(([e])=>e).join(`|`)}): (.*)$`),ED=new Set([`From`,`To`,`Cc`,`Bcc`]);function DD(e){let t=e.split(`
|
|
153
|
-
`),n=e=>!!e&&/^(From|To): /.test(e),r=0;for(;!n(t[r]);){let e=t.indexOf(``,r);if(e<0)return null;r=e+1}let i=[],a=r;for(;a<t.length&&t[a]!==``;a++){let e=TD.exec(t[a]);if(!e)return null;i.push([e[1],e[2]])}return i.some(([e])=>e===`To`)?{before:t.slice(0,Math.max(0,r-1)).join(`
|
|
154
|
-
`),fields:i,body:t.slice(a+1).join(`
|
|
155
|
-
`)}:null}function OD({header:e}){let t=R(),n=new Map(wD);return L(`dl`,{className:`perm-card-facts perm-mail-header`,"data-testid":`perm-mail-header`,children:e.fields.map(([e,r],i)=>z(B.Fragment,{children:[L(`dt`,{children:t(n.get(e))}),L(`dd`,{className:e===`From`?`perm-mail-from`:void 0,children:L(`bdi`,{dir:ED.has(e)?`ltr`:`auto`,children:r})})]},i))})}function kD(e){let t=e.split(`
|
|
156
|
-
`);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(`
|
|
157
|
-
`),folder:``,extras:``,note:r}:{command:i.slice(0,a).join(`
|
|
158
|
-
`),folder:i[a].slice(3).trim(),extras:i.slice(a+1).join(` `).trim(),note:r}}var AD=`execute_python_file`,jD={missing:`prompt.scriptUnreadable.missing`,not_text:`prompt.scriptUnreadable.not_text`,too_large:`prompt.scriptUnreadable.too_large`,unreadable:`prompt.scriptUnreadable.unreadable`};function MD(e,t){let n=t._script;if(e!==AD||typeof n!=`object`||!n)return null;let{text:r,hidden_lines:i,unreadable:a}=n;return typeof r==`string`?{text:r,hiddenLines:typeof i==`number`&&i>0?i:0,unreadable:null}:{text:null,hiddenLines:0,unreadable:typeof a==`string`&&a in jD?a:`unreadable`}}function ND(e){return e.replace(/(\s\u2068?)((?:[A-Za-z]:)?[\\/][^\u2069]*)(\u2069?)$/,(e,t,n,r)=>`${t}${n.split(/[\\/]/).filter(Boolean).pop()??n}${r}`)}function PD({code:e,previewLines:t=12,testId:n=`perm-code`,exact:r=!1}){let i=R(),[a,o]=(0,B.useState)(!1),s=(r?e.replace(/\n$/,``):e.replace(/^\n+|\n+$/g,``)).split(`
|
|
159
|
-
`),c=s.length>t,l=(c&&!a?s.slice(0,t):s).join(`
|
|
160
|
-
`);return z(P.Fragment,{children:[L(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-code${a?` is-expanded`:``}`,"data-testid":n,children:l}),c&&L(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>o(e=>!e),"aria-expanded":a,children:a?i(`prompt.showLess`):i(`prompt.showAllLines`,{n:s.length})})]})}function FD({sessionId:e}){let t=Bl((0,B.useMemo)(()=>Wl(e),[e]));return t?L(LD,{notification:t},t.id):null}function ID(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,`0`)}`}function LD({notification:e}){let t=R(),n=Bl(e=>e.respondToPermission),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1),l=e.timeoutSeconds!=null&&e.timeoutSeconds>0,d=(0,B.useRef)(l?e.expiresAt??Date.now()+e.timeoutSeconds*1e3:null),[f,p]=(0,B.useState)(d.current===null?null:Math.max(0,Math.ceil((d.current-Date.now())/1e3))),m=(0,B.useRef)(null),h=Rl(e.tool),g=h?void 0:e.alwaysScope,_=e.alwaysScope&&sd(e.alwaysScope,!1),v=Pl({...e,alwaysScope:_},t)??sd(e.alwaysLabel??g??``,!1),y=Bl(t=>zl(t.notifications,e)),b=!!g&&y>0,x=yD(e),S=e.toolArgs??{},C=Object.keys(S).length>0,w=typeof S._risk_note==`string`?S._risk_note:``,T=w&&typeof S.working_directory==`string`?S.working_directory:``,E=MD(e.tool,S),D=typeof S.code==`string`&&S.code.trim()?S.code:E?.text?.trim()?E.text:``,O=(D||xD.has(e.tool??``))&&!w?t(`prompt.codeRisk`):``,ee=E?Object.fromEntries(Object.entries(S).filter(([e])=>e!==`_script`)):S,te=typeof S._exact_text==`string`?S._exact_text:CD.has(e.tool??``)?e.summary??``:``,ne=!C&&bD.has(e.tool??``)?kD(e.summary??``):null,re=te?DD(te):null,k=e.tool===El,{heading:ie,question:ae}=jl(e,t,e=>al(sd(e,!0))),A=sd(x,!0),oe=typeof S.command==`string`?S.command:ne?.command??``,se=oe?sD(oe):``,ce=oe.includes(`^`)?cD(oe):``,le=[x,D,oe,se,S.path,T,ne?.folder,ne?.extras].some(md),ue=Hu.has(e.tool??``);(0,B.useEffect)(()=>{m.current?.focus({preventScroll:!0})},[]),(0,B.useEffect)(()=>{if(d.current===null)return;let e=setInterval(()=>{let t=Math.max(0,Math.ceil((d.current-Date.now())/1e3));p(t),t===0&&clearInterval(e)},1e3);return()=>clearInterval(e)},[]);let de=(0,B.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,B.useEffect)(()=>{let e=e=>{e.key!==`Escape`||yn(e)||f!==null&&f<=0||(e.preventDefault(),r||de(`deny`))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[de,r,f]);let fe=f!==null&&f<=0;return z(`section`,{ref:m,tabIndex:-1,className:`perm-card`,role:`alertdialog`,"aria-labelledby":`perm-${e.id}`,children:[z(`div`,{className:`perm-card-head`,children:[L(Ss,{size:16,className:`perm-card-icon`,"aria-hidden":`true`}),z(`div`,{className:`perm-card-text`,children:[L(`h2`,{id:`perm-${e.id}`,className:`perm-card-title`,children:L(cl,{text:ie})}),x&&w&&L(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,children:A}),x&&!w&&L(`p`,{className:`perm-card-detail`,children:L(`code`,{dir:`ltr`,children:A})}),T&&z(`p`,{className:`perm-card-detail`,children:[t.bare(`prompt.in`),` `,L(`code`,{dir:`ltr`,children:sd(T,!1)})]}),w&&L(`p`,{className:`perm-card-risk`,role:`note`,children:L(`bdi`,{children:w})}),D&&L(PD,{code:sd(D,!0)}),E?.text!=null&&!E.text.trim()&&L(`p`,{className:`perm-card-detail`,"data-testid":`perm-script-empty`,children:t(`prompt.scriptEmpty`)}),!!E?.hiddenLines&&L(`p`,{className:`perm-card-risk`,role:`note`,"data-testid":`perm-script-more`,children:L(`bdi`,{children:t.plural(`prompt.scriptMoreLines`,E.hiddenLines,{n:E.hiddenLines})})}),E?.unreadable&&L(`p`,{className:`perm-card-risk`,role:`note`,"data-testid":`perm-script-unreadable`,children:L(`bdi`,{children:t(jD[E.unreadable])})}),O&&L(`p`,{className:`perm-card-risk`,role:`note`,"data-testid":`perm-code-risk`,children:L(`bdi`,{children:O})}),re?.before&&L(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,children:re.before}),re&&L(OD,{header:re}),te&&L(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,"data-testid":`perm-exact-text`,children:re?re.body:te}),ne&&L(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,children:sd(ne.command,!0)}),se&&L(`p`,{className:`perm-card-detail`,children:t(`prompt.decodedCommand`)}),se&&L(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,"data-testid":`perm-decoded`,children:sd(se,!0)}),ce&&ce!==oe&&L(`p`,{className:`perm-card-detail`,children:t(`prompt.cmdReading`)}),ce&&ce!==oe&&L(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,"data-testid":`perm-cmd-reading`,children:sd(ce,!0)}),le&&L(`p`,{className:`perm-card-risk`,role:`note`,"data-testid":`perm-hidden-note`,children:L(`bdi`,{children:t(`prompt.hiddenChars`)})}),ne?.folder&&z(`p`,{className:`perm-card-detail`,children:[t.bare(`prompt.in`),` `,L(`code`,{dir:`ltr`,children:sd(ne.folder,!1)})]}),ne?.extras&&L(`p`,{className:`perm-card-detail`,children:L(`bdi`,{children:sd(ne.extras,!1)})}),ne?.note&&L(`p`,{className:`perm-card-risk`,role:`note`,children:L(`bdi`,{children:ne.note})}),ue&&C&&L(Cd,{tool:e.tool,args:S}),ue&&!C&&e.summary&&L(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,"data-testid":`perm-exact-summary`,children:e.summary}),!x&&!D&&!te&&!ue&&e.summary&&!ne&&L(`p`,{className:`perm-card-detail`,children:L(`bdi`,{children:sd(e.summary,!0)})}),h&&L(`p`,{className:`perm-card-detail perm-card-question`,children:L(cl,{text:ae})}),L(vD,{args:S})]}),f!==null&&!fe&&L(`span`,{className:`perm-card-timer`,title:t(`prompt.timer`),children:ID(f)})]}),C&&!te&&z(`div`,{className:`perm-card-args`,children:[z(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>c(e=>!e),"aria-expanded":s,children:[L(ri,{size:13,className:s?`is-open`:``,"aria-hidden":`true`}),t(mD(S)?`prompt.technicalDetails`:`prompt.details`)]}),s&&L(`pre`,{dir:`ltr`,className:`perm-card-pre`,children:sd(JSON.stringify(ee,null,2),!0)})]}),b&&!fe&&L(`p`,{className:`perm-card-hint`,children:t.compose(e=>`${e(u(`prompt.repeated`,y),{n:y})} ${e(`prompt.alwaysHint`,{scope:v})}`)}),fe?L(`p`,{className:`perm-card-detail`,children:t(`prompt.expired`)}):z(`div`,{className:`perm-card-actions`,children:[L(`button`,{type:`button`,className:`perm-btn is-primary`,onClick:()=>de(`allow`),disabled:r,children:t(e.tool===`trust_project_folder`?`prompt.trust.allow`:k?`prompt.allowForChat`:`prompt.allowOnce`)}),g&&L(`button`,{type:`button`,className:`perm-btn${b?` is-suggested`:``}`,onClick:()=>de(`always`),disabled:r,title:v,children:t(`prompt.alwaysAllow`,{scope:ND(v)})}),L(`button`,{type:`button`,className:`perm-btn`,onClick:()=>de(`deny`),disabled:r,children:t(`prompt.deny`)})]}),a&&L(`p`,{className:`perm-card-error`,role:`alert`,children:a})]})}function RD(e,t){return e.bare(u(`size.lines`,t),{n:t.toLocaleString(`en-US`)})}function zD(e){return e?e.split(`
|
|
161
|
-
`).length:0}function BD(e){return zD(e)>15||e.length>1500}var VD=e=>e.length>300?`${e.slice(0,300)}…`:e;function HD(e){let t=e.split(`
|
|
162
|
-
`);return t.length<=15?null:{head:t.slice(0,3).map(VD).join(`
|
|
163
|
-
`),tail:t.slice(-3).map(VD).join(`
|
|
164
|
-
`),hidden:t.length-6}}function UD(e,t,n=15){let r=zD(t);return r>n?RD(e,r):e.bare(u(`size.characters`,t.length),{n:t.length.toLocaleString(`en-US`)})}function WD({expanded:e,onToggle:t,controls:n,collapsedLabel:r,expandedLabel:i,className:a}){return z(`button`,{type:`button`,className:`expand-toggle${a?` ${a}`:``}`,onClick:t,"aria-expanded":e,"aria-controls":n,children:[L(e?ai:$r,{size:13,"aria-hidden":`true`}),L(`span`,{children:e?i:r})]})}function GD(e){let t=e.replace(/\\(u[0-9a-fA-F]{0,3})?$/,``);try{return JSON.parse(`"${t}"`)}catch{return t}}function KD(e,t){let n=RegExp(`"${t}"\\s*:\\s*(\\d+)`).exec(e);return n?Number(n[1]):null}function qD(e,t){let n=RegExp(`"${t}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`).exec(e);return n?GD(n[1]):``}function JD(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:qD(t,`head`),tail:qD(t,`tail`),originalChars:KD(t,`original_chars`),omittedChars:KD(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 YD(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 XD({text:e,renderShort:t}){let n=R(),[r,i]=(0,B.useState)(!1),a=(0,B.useId)(),o=JD(e),s=o?o.tail?`${o.head}\n…\n${o.tail}`:o.head:e,c=zD(s)>25||s.length>2500;return z(P.Fragment,{children:[o&&L(`div`,{className:`detail-result-note`,children:YD(o)}),L(`div`,{id:a,className:`detail-result-content${c&&!r?` is-collapsed`:``}`,children:o||c?dd(s):t(s)}),c&&L(WD,{expanded:r,onToggle:()=>i(e=>!e),controls:a,collapsedLabel:n(`code.expand`,{size:UD(n,s,25)}),expandedLabel:n(`code.collapse`),className:`step-expand-toggle`})]})}var ZD={"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`},QD=new Map([[`its files could not be found`,`live.skillReloadMissing`],[`the current model does not offer the tools it needs`,`live.skillReloadModel`],[`the current settings do not permit it to load`,`live.skillReloadPermission`],[`it failed to load with the current settings`,`live.skillReloadFailed`]]);function $D(e,t){let n=ZD[t];if(n)return e(n);let r=/^Skill '([a-z0-9-]+)' was not restored after settings changed: ([^.]+)\. Reload it if needed\.$/.exec(t);if(r){let t=QD.get(r[2]);if(t)return e(t,{skill:r[1]})}let i=/^Reasoning — ([\d,]+) words so far$/.exec(t);return i?e(`live.reasoningWords`,{n:i[1]}):(i=/^Connection lost\. Reconnecting \(attempt (\d+) of (\d+)\)…$/.exec(t),i?e(`live.reconnectingStream`,{attempt:i[1],max:i[2]}):(i=/^Loading (\S+) into memory$/.exec(t),i?e(`live.loadingModel`,{model:i[1]}):(i=/^Reading page (\d+) of (\d+)…$/.exec(t),i?e(`live.readingPage`,{page:i[1],total:i[2]}):(i=/^Downloading the speech model, one time \(([\d.]+) GB\)$/.exec(t),i?e(`live.speechModelStart`,{size:i[1]}):(i=/^Downloading the speech model, one time — (\d+)% of ([\d.]+) GB$/.exec(t),i?e(`live.speechModelPercent`,{percent:i[1],size:i[2]}):(i=/^Downloading the speech model, one time — (\d+)% of ([\d.]+) GB, then ([\d.]+) GB for the NPU$/.exec(t),i?e(`live.speechModelPercentNpu`,{percent:i[1],size:i[2],npu:i[3]}):(i=/^Downloading the speech model's NPU part \(([\d.]+) GB\), no progress shown$/.exec(t),i?e(`live.speechModelNpu`,{size:i[1]}):t===`Downloading the speech model's NPU part, no progress shown`?e(`live.speechModelNpuNoSize`):t===`Loading the speech model`?e(`live.speechModelLoading`):(i=/^Downloaded the speech model \(([\d.]+) GB\)$/.exec(t),i?e(`live.speechModelDone`,{size:i[1]}):t===`Downloading the speech model, one time`?e(`live.speechModelStartNoSize`):(i=/^Downloading the speech model, one time — (\d+)%$/.exec(t),i?e(`live.speechModelPercentNoSize`,{percent:i[1]}):t===`Downloaded the speech model`?e(`live.speechModelDoneNoSize`):(i=/^Downloading (\S+)$/.exec(t),i?e(`live.downloadingModel`,{model:i[1]}):t))))))))))}var eO={search_file:us,search_files:us,search_file_content:us,search_directory:us,read_file:sa,write_file:ra,get_file_info:sa,browse_directory:da,list_directory:da,list_recent_files:da,analyze_data_file:qr,run_shell_command:Bs,run_python:Bs,execute_python_file:Bs,analyze_image:ja,answer_question_about_image:ja,generate_image:ja,take_screenshot:ja,query_documents:Fr,query_specific_file:Fr,search_indexed_chunks:Fr,evaluate_retrieval:Fr,index_document:ji,index_documents:ji,index_directory:ji,list_indexed_documents:ji,summarize_document:sa,dump_document:sa,rag_status:ji,add_watch_directory:da,transcribe_media:kr,refine_transcript:sa,analyze_transcript:Ya,export_transcript:Gr,web_search:Da,search_web:Da,fetch_page:Ga,fetch_webpage:Ga,find_files:us,edit_file:ra,recall:Lr,remember:Lr,update_memory:Lr,forget:Lr,forget_everything:Lr,search_past_conversations:Lr,request_user_input:lo,load_skill:Os,use_skill:Os,unload_skill:Os,list_skills:Os,search_skill_hub:Os,install_skill:Os,capture_skill:Os,remove_skill:Os,skill_status:Os};for(let e of Object.keys(eO))if(!fe(`tool.${e}.done`)||!fe(`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 tO=new Set([`load_skill`,`use_skill`]),nO=new Set([`remember`,`recall`,`update_memory`,`forget`]);function rO(e){return e.type===`tool`&&e.success!==!1&&nO.has(e.tool??``)}var iO={label:We(`tool.default.done`),activeLabel:We(`tool.default.active`),icon:ec},aO=(e,t)=>({label:We(`tool.named.done`,{what:e}),activeLabel:We(`tool.named.active`,{what:e}),icon:t}),oO=(e,t)=>e(t.ref,t.params);function sO(e,t){if(!e)return iO;if(e.startsWith(`mcp_`)){let e=t?.mcpServerLabel;return e?aO(t?.mcpTool?`${e}: ${t.mcpTool}`:e,Da):{label:We(`tool.mcp.done`),activeLabel:We(`tool.mcp.active`),icon:Da}}if(fe(`tool.${e}.done`)&&fe(`tool.${e}.active`))return{label:We(`tool.${e}.done`),activeLabel:We(`tool.${e}.active`),icon:Object.prototype.hasOwnProperty.call(eO,e)?eO[e]:ec};let n=e.replace(/[_-]+/g,` `).trim();return n?aO(n,ec):iO}function cO(e,t){let n=sO(e.tool,e),r=e.success==null&&!e.result;return e.active?oO(t,n.activeLabel):e.timedOut?t(`tool.timedOut`,{label:n.activeLabel}):e.autoDeclined?t(`tool.autoDeclined`,{label:n.activeLabel}):e.declined?t(`tool.declined`,{label:n.activeLabel}):e.refused?t(`tool.refused`,{label:n.activeLabel}):e.success===!1?t(`tool.failed`,{label:n.activeLabel}):r?t(`tool.unfinished`,{label:n.activeLabel}):oO(t,n.label)}function lO(e,t=mt){return e.mcpServerLabel?cO(e,t):e.tool===`use_skill`&&e.detail?t(`activity.usingSkill`,{name:V(e.detail)}):(e.declined||e.timedOut||e.refused||e.autoDeclined)&&!e.active?cO(e,t):e.narration?hO(dd(e.narration)):cO(e,t)}var uO=48,dO=5,fO=6,pO=/^Error fetching page:\s*(\d{3})?/;function mO(e,t){let n=e.result??``,r=e.tool===`fetch_page`?pO.exec(n):null;if(!r)return n;let i=r[1];return i&&[`401`,`403`,`429`].includes(i)?t(`activity.fetchBlocked`,{code:i}):t(`activity.fetchFailed`)}function hO(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>uO&&t.length>2?`${t[0]}/…/${t[t.length-1]}`:e}`}if(r.length>uO&&/[\\/]/.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}function gO(e){let t=[],n;for(let r of e)r.type===`thinking`&&!r.active&&(r.detail||``).trim()?(n&&t.push(n),n=r):n&&r.type===`tool`?(t.push({...r,thought:n}),n=void 0):(n&&t.push(n),n=void 0,t.push(r));return n&&t.push(n),t}var _O=/^(?:Executing step \d+ of the plan\.?|Following the plan to [\s\S]*)$/;function vO(e,t){return!!e&&!!t&&e.length===t.length&&e.every((e,n)=>e===t[n])}function yO(e,t){return e.tool===t.tool&&(e.detail??``)===(t.detail??``)&&e.mcpServer===t.mcpServer}function bO(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 xO(e,t){let n=[],r=new Map,i,a=!1;e.forEach((t,o)=>{if(rO(t))return;let s=n[n.length-1];if(!a||t.type!==`thinking`&&t.type!==`status`||!_O.test((t.detail||t.label||``).trim())){if(t.type===`plan`){if(a=!0,i&&vO(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&&yO(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.latencyMs!=null&&/\S$/.test(s.detail||``)&&/^\S/.test(t.detail||``)?`
|
|
165
|
-
|
|
166
|
-
`:``,r=(s.detail||``)+e+(t.detail||``);n[n.length-1]={...t,timestamp:s.timestamp,detail:r||s.detail}}else t.type===`status`&&s&&s.type===`status`&&s.success!==!1&&t.active!==!1&&!s.kept&&!t.kept?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&&!t.kept&&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=bO(a.planSteps.length,a.currentStep,o,s)}return n}function SO(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 CO(e){let[t,n]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function wO(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 TO(e){if(tO.has(e.tool??``))return/:\s*(.+)$/.exec(e.narration??``)?.[1]?.trim()||void 0}var EO=3;function DO(e,t=mt){let n=[];for(let t of e){let e,r;if(t.type===`tool`&&t.timedOut)e=We(`activity.timedOut`);else if(t.type===`tool`&&t.autoDeclined)e=We(`activity.autoDeclined`);else if(t.type===`tool`&&t.declined)e=We(`activity.youDeclined`);else if(t.type===`tool`&&t.refused)e=We(`activity.gaiaRefused`);else if(t.type===`tool`){let n=sO(t.tool,t),i=TO(t);e=i?We(`activity.usedSkill`,{name:i}):n.label,r=i?We(`activity.skillFailed`,{name:i}):We(`tool.failed`,{label:n.activeLabel})}else if(t.type===`policy_alert`)e=We(`activity.blocked`);else if(t.type===`error`)e=We(`activity.hitError`);else if(t.type===`plan`)e=We(`activity.madePlan`);else continue;let i=`${e.ref}:${JSON.stringify(e.params??{})}`,a=t.type===`tool`&&t.success===!1,o=n.find(e=>e.id===i),s=t.count??1;o?(o.count+=s,o.allFailed&&=a,o.failures+=a?s:0):n.push({label:e,failedLabel:r,allFailed:a,failures:a?s:0,id:i,count:s})}return t.compose(e=>{if(n.length===0)return e(`activity.thoughtThrough`);let t=n.slice(0,EO).map((t,n)=>{let r=t.allFailed&&t.failedLabel?t.failedLabel:t.label,i=e(r.ref,r.params),a=n===0?i:i.charAt(0).toLowerCase()+i.slice(1),o=t.count>1?`${a} ×${t.count}`:a;return t.failedLabel&&!t.allFailed&&t.failures>0?e(`activity.someFailed`,{text:o,n:t.failures}):o}),r=t.join(e(`activity.summarySep`)),i=n.length-t.length;return i>0?e(`activity.summaryMore`,{list:r,n:i}):r})}function OO(e){return e.type===`error`||e.type===`policy_alert`}function kO(e){return e.type===`status`&&e.success===!1}function AO(e){return e.type===`status`&&e.kept===!0}function jO(e){return e.type!==`status`&&!(e.type===`thinking`&&!(e.detail||``).trim())}function MO(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}var NO=e=>e.type===`tool`&&e.needsModel===`vision`&&!e.active;function PO(){let e=R();return z(`div`,{className:`flow-tool-offer`,children:[L(`span`,{children:e(`activity.visionNeeded`)}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{Sc(`vision`)},children:e(`activity.getVisionModel`)})]})}function FO({steps:e,isActive:t,running:n=t,awaitingUser:r=!1,liveLine:i,toolStatus:a=null,answer:o}){let s=R(),[c,l]=(0,B.useState)(new Map),[u,d]=(0,B.useState)(new Set),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(`all`),g=(0,B.useMemo)(()=>xO(e,n),[e,n]),_=(0,B.useMemo)(()=>wO(g,o),[g,o]),v=(0,B.useMemo)(()=>MO(e),[e]),y=CO(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,B.useCallback)(e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),T=e=>{if(e.type!==`tool`||!C)return!0;let t=f.toLowerCase();return!(t&&!e.tool?.toLowerCase().includes(t)&&!lO(e,s).toLowerCase().includes(t)||m===`success`&&e.success!==!0||m===`error`&&e.success!==!1)},E=e=>e.type===`thinking`?L(HO,{step:e,live:n&&!!e.active,durationMs:v.get(e.id),now:y},e.id):e.type===`tool`?L(GO,{step:e,isExpanded:u.has(e.id),thoughtMs:e.thought?v.get(e.thought.id):void 0,now:y,awaitingUser:n&&r,status:e.id===S?a:null,onToggle:()=>w(e.id)},e.id):e.type===`plan`?e===b?null:L(JO,{step:e},e.id):e.type===`status`?e.kept?L(RO,{step:e},e.id):L(LO,{step:e},e.id):e.type===`error`?L(YO,{step:e},e.id):e.type===`policy_alert`?L(XO,{step:e},e.id):null;if(g.length===0)return i?L(`div`,{className:`agent-activity active`,children:L(`div`,{className:`flow-live-line`,children:i})}):null;let D=_.length-1,O=e=>gO(e.filter(e=>(jO(e)||kO(e)||AO(e))&&!IO(e,b))),ee=_.reduce((e,t,r)=>{if(t.kind!==`steps`)return e;let i=n&&r===D,a=O(t.rows);return a.length<2&&!i?e:c.get(t.id)??(i||a.some(OO))?e+a.filter(e=>e.type===`tool`).length:e},0);return z(`div`,{className:`agent-activity ${n?`active`:`done`}`,children:[L(`div`,{className:`agent-timeline`,children:_.map((e,t)=>{if(e.kind===`note`)return L(zO,{text:e.row.detail??``},e.row.id);let r=n&&t===D,i=O(e.rows);if(i.length===0)return null;let a=i.some(OO);if(i.length===1&&!r)return T(i[0])?L(`div`,{className:`flow-steps single`,children:E(i[0])},e.id):null;let o=c.get(e.id)??(r||a),u=i.filter(T);return z(`div`,{className:`flow-steps ${o?`open`:`folded`} ${r?`live`:``}`,children:[!r&&z(`button`,{className:`flow-steps-summary`,onClick:()=>l(t=>new Map(t).set(e.id,!o)),"aria-expanded":o,children:[a?L(di,{size:13,className:`agent-icon-error`}):i.some(e=>e.type===`tool`&&(e.declined||e.refused||e.autoDeclined))?L(jr,{size:13,className:`flow-steps-done`}):L(li,{size:13,className:`flow-steps-done`}),L(`span`,{className:`flow-steps-text`,children:DO(i,s)}),L(ri,{size:12,className:`flow-tool-chevron ${o?`expanded`:``}`})]}),o&&L(`div`,{className:`flow-steps-rows`,children:u.map(E)}),!o&&i.filter(kO).map(E),!o&&!r&&i.some(NO)&&L(PO,{})]},e.id)})}),b&&L(JO,{step:b}),n&&!x&&i&&L(`div`,{className:`flow-live-line`,children:i}),!n&&ee>=fO&&z(`div`,{className:`activity-filter-bar`,children:[L(`input`,{type:`text`,className:`activity-filter-input`,placeholder:s(`activity.filterPlaceholder`),"aria-label":s(`activity.filterByTool`),value:f,onChange:e=>p(e.target.value)}),z(`select`,{className:`activity-filter-select`,"aria-label":s(`activity.filterByStatus`),value:m,onChange:e=>h(e.target.value),children:[L(`option`,{value:`all`,children:s.bare(`activity.filter.all`)}),L(`option`,{value:`success`,children:s.bare(`activity.filter.success`)}),L(`option`,{value:`error`,children:s.bare(`activity.filter.error`)})]})]})]})}function IO(e,t){return e.type===`plan`&&e===t}function LO({step:e}){let t=R();return z(`div`,{className:`flow-warning`,role:`status`,children:[L(di,{size:13}),L(`span`,{children:$D(t,e.label)})]})}function RO({step:e}){let t=R();return z(`div`,{className:`flow-done`,role:`status`,children:[L(Yr,{size:13,"aria-hidden":`true`}),L(`span`,{children:$D(t,e.label)})]})}function zO({text:e}){return L(`div`,{className:`flow-note md-content`,children:L(bv,{remarkPlugins:[Nx],disallowedElements:[...Tv],urlTransform:Nv,children:e})})}var BO=3e3;function VO(e,t,n=mt){return e?t!=null&&t>=BO?n(`activity.thinkingFor`,{time:SO(t/1e3)}):n(`activity.thinking`):t==null||t<1e3?n(`activity.thought`):n(`activity.thoughtFor`,{time:SO(t/1e3)})}function HO({step:e,live:t,durationMs:n,now:r}){let i=R(),a=(e.detail||``).trim(),[o,s]=(0,B.useState)(!1);return a?z(`div`,{className:`flow-reasoning ${t?`live`:``}`,children:[z(`button`,{className:`flow-reasoning-toggle`,onClick:()=>s(e=>!e),"aria-expanded":o,children:[t?L(Za,{size:13,className:`flow-tool-spinner`}):L(Lr,{size:13,className:`flow-tool-icon`}),L(`span`,{children:VO(t,t?r-e.timestamp:n,i)}),L(ri,{size:12,className:`flow-tool-chevron ${o?`expanded`:``}`})]}),o&&L(`div`,{className:`flow-thought-hacker`,children:a})]}):null}function UO(e,t=mt){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(dd(e.slice(i,a.index))+n);let o=n?a[2]:a[0],s=o.replace(/[)}\]]+$/,``),c=()=>{Ft(s).catch(e=>F.ui.error(`Failed to open path`,e))};r.push(z(`span`,{className:`tool-result-path`,onClick:c,title:t(`activity.openPath`,{path:V(s)}),role:`button`,tabIndex:0,onKeyDown:e=>{e.key===`Enter`&&c()},children:[L(da,{size:10,style:{flexShrink:0,opacity:.7}}),V(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?dd(e):(i<e.length&&r.push(dd(e.slice(i))),L(P.Fragment,{children:r}))}function WO({fileList:e}){let t=R(),[n,r]=(0,B.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 z(`div`,{className:`file-list-view`,children:[i.map((e,t)=>z(`div`,{className:`file-list-item`,children:[e.kind===`folder`?L(_a,{size:11,className:`file-list-icon`,"data-kind":`folder`}):L(la,{size:11,className:`file-list-icon`}),L(`span`,{className:`file-list-name`,children:V(o(e,t))}),s(e)&&L(`span`,{className:`file-list-dir`,children:V(s(e))})]},t)),a>0&&!n&&L(`button`,{className:`file-list-more`,onClick:()=>r(!0),children:t(`activity.files.more`,{n:a})}),n&&e.files.length<e.total&&L(`span`,{className:`file-list-truncated`,children:t(`activity.files.showing`,{shown:e.files.length,total:e.total})})]})}function GO({step:e,isExpanded:t,onToggle:n,now:r,awaitingUser:i=!1,status:a=null,thoughtMs:o}){let s=R(),c=sO(e.tool,e).icon,l=!!e.active&&i,u=!l&&e.active&&a?$D(s,a):``,d=l?s(`activity.waiting`):u||lO(e,s),f=e.count??1,p=(!!e.declined||!!e.timedOut||!!e.refused||!!e.autoDeclined)&&!e.active,m=e.success===!1&&e.result&&!p&&!e.needsModel?mO(e,s):``,h=l?``:e.active?SO((r-e.timestamp)/1e3):e.latencyMs==null?``:$O(e.latencyMs);return z(`div`,{className:`flow-tool ${e.active?`active`:``} ${e.success===!1&&!p?`error`:``} ${p?`declined`:``} ${tO.has(e.tool??``)?`skill`:``}`,children:[z(`button`,{className:`flow-tool-header`,onClick:n,"aria-expanded":t,title:l||u?lO(e,s):e.narration&&e.narration!==d?dd(e.narration):void 0,children:[z(`div`,{className:`flow-tool-left`,children:[e.active&&!l?L(Za,{size:13,className:`flow-tool-spinner`}):p?L(jr,{size:13,className:`flow-tool-icon`}):e.success===!1?L(di,{size:13,style:{color:`var(--danger)`}}):L(c,{size:13,className:`flow-tool-icon`}),L(`span`,{className:`flow-tool-label`,dir:`auto`,children:d}),f>1&&z(`span`,{className:`flow-tool-count`,"aria-label":s(`activity.identicalCalls`,{n:f}),children:[`×`,f]}),m&&L(`span`,{className:`flow-tool-failure`,dir:`auto`,children:m})]}),z(`div`,{className:`flow-tool-right`,children:[e.thought&&L(`span`,{className:`flow-tool-thought-mark`,title:s(`activity.thoughtFirst`),"aria-hidden":`true`,children:L(Lr,{size:11})}),h&&L(`span`,{className:`flow-tool-latency`,children:h}),L(`span`,{className:`flow-tool-chevron ${t?`expanded`:``}`,children:L(ri,{size:12})})]})]}),e.needsModel===`vision`&&!e.active&&L(PO,{}),t&&z(`div`,{className:`flow-tool-detail`,children:[e.thought?.detail&&z(`div`,{className:`flow-tool-thought`,children:[L(`span`,{className:`detail-section-label`,children:VO(!1,o,s)}),L(`div`,{className:`flow-thought-hacker`,children:e.thought.detail.trim()})]}),z(`div`,{className:`flow-tool-raw`,children:[L(`span`,{className:`detail-section-label`,children:s(`activity.detail.tool`)}),L(`code`,{className:`flow-tool-badge`,children:e.tool||`unknown`}),e.mcpServer&&L(`span`,{className:`flow-tool-mcp-server`,children:s(`activity.detail.via`,{server:e.mcpServer})})]}),e.detail&&!e.commandOutput&&z(`div`,{className:`step-detail-args`,children:[L(`span`,{className:`detail-section-label`,children:s(`activity.detail.arguments`)}),L(`div`,{className:`detail-args-content`,children:nk(e.detail)})]}),e.commandOutput&&L(QO,{output:e.commandOutput}),e.mcpOutput&&z(`div`,{className:`step-detail-result result-success`,children:[L(`span`,{className:`detail-section-label`,children:s(`activity.detail.output`)}),L(PD,{code:dd(e.mcpOutput.text),previewLines:dO,testId:`mcp-output`}),e.mcpOutput.truncated&&L(`div`,{className:`cmd-truncated`,children:s(`activity.truncated`)})]}),e.result&&!e.commandOutput&&!e.mcpOutput&&z(`div`,{className:`step-detail-result ${e.success===!1?`result-error`:`result-success`}`,children:[L(`span`,{className:`detail-section-label`,children:e.success===!1?s(`activity.detail.error`):s(`activity.detail.result`)}),L(XD,{text:e.result,renderShort:e=>UO(e,s)})]}),e.retrievalChunks&&e.retrievalChunks.length>0&&L(ZO,{chunks:e.retrievalChunks}),e.fileList&&e.fileList.files.length>0&&L(WO,{fileList:e.fileList})]})]})}var KO={done:`activity.planStatus.done`,running:`activity.planStatus.running`,failed:`activity.planStatus.failed`,stopped:`activity.planStatus.stopped`,pending:`activity.planStatus.pending`};function qO({status:e}){return e===`done`?L(li,{size:13,className:`plan-icon-done`}):e===`running`?L(Za,{size:13,className:`flow-tool-spinner`}):e===`failed`?L(di,{size:13,className:`plan-icon-failed`}):e===`stopped`?L(di,{size:13,className:`plan-icon-stopped`}):L(_i,{size:13,className:`plan-icon-pending`})}function JO({step:e}){let t=R(),n=e.planSteps??[];if(n.length===0)return null;let r=e.planStatuses,i=r?.filter(e=>e===`done`).length??0;return z(`div`,{className:`flow-plan`,children:[z(`div`,{className:`flow-plan-header`,children:[L(Ya,{size:13}),L(`span`,{children:t(`activity.plan`)}),r&&L(`span`,{className:`flow-plan-count`,children:t(`activity.planDone`,{done:i,total:n.length})})]}),L(`ol`,{className:`flow-plan-list`,children:n.map((n,i)=>{let a=r?.[i],o=hO(e.planNarrations?.[i]||n);return z(`li`,{className:`flow-plan-item ${a??``}`,title:n,"aria-label":a?t(`activity.planItem`,{status:We(KO[a]),text:o}):void 0,children:[L(qO,{status:a}),L(`span`,{className:`flow-plan-text`,children:o})]},i)})})]})}function YO({step:e}){let t=R();return z(`div`,{className:`flow-error`,children:[L(di,{size:13}),L(`span`,{children:e.detail||e.label||t(`activity.errorOccurred`)})]})}function XO({step:e}){let t=R();return z(`div`,{className:`flow-policy-alert`,children:[z(`div`,{className:`flow-policy-alert-header`,children:[L(bs,{size:14}),L(`span`,{className:`flow-policy-alert-title`,children:t(`activity.policy.title`)}),L(`span`,{className:`flow-policy-alert-decision`,children:e.decision||`BLOCK`})]}),z(`div`,{className:`flow-policy-alert-body`,children:[z(`div`,{className:`flow-policy-alert-line`,children:[L(`span`,{children:t(`activity.policy.tool`)}),L(`code`,{children:e.tool||`unknown tool`})]}),L(`div`,{className:`flow-policy-alert-reason`,children:e.reason||e.detail}),e.ruleIds&&e.ruleIds.length>0&&z(`div`,{className:`flow-policy-alert-line`,children:[L(`span`,{children:t(`activity.policy.rules`)}),L(`code`,{children:e.ruleIds.join(`, `)})]}),e.policyVersion&&z(`div`,{className:`flow-policy-alert-line`,children:[L(`span`,{children:t(`activity.policy.policy`)}),L(`code`,{children:e.policyVersion})]}),z(`div`,{className:`flow-policy-alert-line`,children:[L(`span`,{children:t(`activity.policy.receipt`)}),e.receiptId?L(`code`,{children:e.receiptId}):L(`em`,{children:t(`activity.policy.receiptUnavailable`)})]})]})]})}function ZO({chunks:e}){let t=R(),[n,r]=(0,B.useState)(new Set),i=e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return z(`div`,{className:`chunks-view`,children:[L(`span`,{className:`detail-section-label`,children:t(`activity.chunks`,{n:e.length})}),L(`div`,{className:`chunks-list`,children:e.map(e=>{let r=n.has(e.id);return z(`div`,{className:`chunk-card ${r?`expanded`:``}`,children:[z(`button`,{className:`chunk-header`,onClick:()=>i(e.id),children:[z(`div`,{className:`chunk-header-left`,children:[L(Fr,{size:11,style:{color:`var(--accent-cyan)`,flexShrink:0}}),e.source&&L(`span`,{className:`chunk-source`,children:V(e.source)}),e.page!=null&&L(`span`,{className:`chunk-page`,children:t(`activity.chunkPage`,{page:e.page})}),e.score!=null&&e.score>0&&L(`span`,{className:`chunk-score`,children:e.score.toFixed(2)})]}),L(`span`,{className:`chunk-chevron ${r?`expanded`:``}`,children:L(ri,{size:11})})]}),L(`div`,{className:`chunk-body ${r?`show`:``}`,children:r?L(`pre`,{className:`chunk-content`,children:dd(e.content)}):L(`div`,{className:`chunk-preview`,children:dd(e.preview)})})]},e.id)})})]})}function QO({output:e}){let t=R(),[n,r]=(0,B.useState)(!1),i=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let a=(0,B.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 z(`div`,{className:`cmd-output ${s?`cmd-error`:``}`,children:[z(`div`,{className:`cmd-header`,children:[z(`div`,{className:`cmd-header-left`,children:[L(Bs,{size:12,className:`cmd-header-icon`}),L(`span`,{className:`cmd-header-title`,children:t(`activity.terminal`)}),e.cwd&&L(`span`,{className:`cmd-cwd`,children:e.cwd})]}),z(`div`,{className:`cmd-header-right`,children:[e.durationSeconds!=null&&z(`span`,{className:`cmd-duration`,children:[e.durationSeconds.toFixed(1),`s`]}),e.returnCode!==0&&L(`span`,{className:`cmd-exit-code${s?``:` cmd-exit-expected`}`,title:e.expectedExit??void 0,children:t(`activity.exit`,{code:e.returnCode})}),o&&L(`button`,{className:`cmd-copy ${n?`copied`:``}`,onClick:a,title:t(n?`msg.copied`:`activity.copyOutput`),"aria-label":t(n?`msg.copiedAria`:`activity.copyOutputAria`),children:L(n?Yr:Ti,{size:11})})]})]}),z(`div`,{className:`cmd-line`,children:[L(`span`,{className:`cmd-prompt`,children:`$`}),L(`span`,{className:`cmd-text`,children:dd(e.command)})]}),e.stdout&&L(`pre`,{className:`cmd-stdout`,children:dd(e.stdout)}),e.stderr&&L(`pre`,{className:`cmd-stderr`,children:dd(e.stderr)}),e.truncated&&L(`div`,{className:`cmd-truncated`,children:t(`activity.truncated`)}),!o&&L(`div`,{className:`cmd-empty`,children:t(`activity.noOutput`)})]})}function $O(e){return e<1?`<1ms`:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function ek(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 tk=/^([A-Za-z_][\w.-]{0,29}):(?:\s+([\s\S]*))?$/;function nk(e){let t=e.includes(`
|
|
167
|
-
`)?e.split(`
|
|
168
|
-
`).filter(Boolean):e.split(/, (?=[A-Za-z_][\w.-]{0,29}:(?:\s|$))/).filter(Boolean);return t.length<=1?L(`span`,{className:`arg-value`,children:dd(e)}):L(`div`,{className:`args-grid`,children:t.map((e,t)=>{let n=tk.exec(e.trim());if(n){let e=n[1],r=ek((n[2]??``).trim());return z(`div`,{className:`arg-row`,children:[L(`span`,{className:`arg-key`,children:e}),L(`span`,{className:`arg-value`,children:dd(r)})]},t)}return L(`div`,{className:`arg-row`,children:L(`span`,{className:`arg-value`,children:dd(e)})},t)})})}var rk=`gaia`;function ik(e){return e.some(e=>e.id===rk)}var ak=class extends Error{constructor(){super(`The GAIA agent isn't installed. Install it from the notice above, then send again.`),this.name=`FlagshipMissing`}};function ok(e){let t=e;return t?.httpStatus===422&&`${typeof t.detail==`string`?t.detail:``} ${typeof t.message==`string`?t.message:``}`.includes(`Unknown agent_type '${rk}'`)}function sk(e){return e&&!(`error`in e)?e.accounts??[]:[]}function ck(e){return e.status!==`ok`}function lk(e){let t=e.accounts??[];return t.length>1||t.some(ck)}var uk=`default`;function dk(e){return e.account_id===uk&&e.email?e.email:e.account_id}function fk(e,t){let n=t.toLowerCase();return e.find(e=>e.account_id===t||!!e.email&&e.email.toLowerCase()===n)}var pk=e=>e.status===`ok`;function mk(e,t){let n=sk(e),r=(t?fk(n,t):void 0)??(n.length===1&&ck(n[0])?n[0]:null);return{account:r,otherAccount:r!==null||n.length>1}}function hk(e,t,n){if(!e||`error`in e)return!1;if(!e.accounts)return e.configured;let r=sk(t),i=new Set(r.map(dk)),a=e.accounts.filter(pk);if(a.some(e=>!i.has(dk(e))))return!0;let o=mk(t,n).account;if(o)return a.some(e=>dk(e)===dk(o));if(r.length<=1)return a.length>0;let s=new Set(r.filter(pk).map(dk));return a.some(e=>!s.has(dk(e)))}function gk(e,t=32){if(e.length<=t)return e;let n=e.lastIndexOf(`@`),r=n>0?e.length-n:0,i=r>0&&r<=t/2?r:Math.floor((t-1)/2);return`${e.slice(0,t-1-i).replace(/[.\-_]+$/,``)}…${e.slice(e.length-i)}`}function _k(e){let t=e,n=t?.httpStatus===409&&t.body?.error===`account_choice_required`?t.body.choices:null;return Array.isArray(n)?n.map(String):null}function vk(e,t){let n=new Set(sk(t).map(dk));return sk(e).find(e=>pk(e)&&!e.is_default&&!n.has(dk(e)))??null}var yk=F.api;function bk(e){switch(e){case`connector.configured`:return`configured`;case`connector.disconnected`:return`disconnected`;case`connection.revoked`:return`disconnected`;case`connector.oauth.completed`:return`oauth_completed`;case`connection.connected`:return`oauth_completed`;case`connector.oauth.error`:return`oauth_error`;case`connector.tested`:return`tested`;case`connector.enabled`:return`enabled`;case`connector.disabled`:return`disabled`;case`connector.grant.changed`:return`grant_changed`;case`connector.activation.changed`:return`activation_changed`;case`connector.account.changed`:return`account_changed`;default:return null}}function xk(e){let t=(0,B.useRef)(e);(0,B.useEffect)(()=>{t.current=e},[e]),(0,B.useEffect)(()=>{let e=null,n=1e3,r=null,i=!1,a=()=>{i||(e=new EventSource(`${Hn()}/connectors/events`),e.onopen=()=>{n=1e3},e.onmessage=e=>{try{let n=JSON.parse(e.data),r=bk(n.type);if(r===null){yk.debug(`connectors-sse: ignoring event`,n.type);return}let i=n.payload??{},a=i.connector_id??i.provider??null;t.current({connectorId:a,reason:r,payload:i})}catch(e){yk.warn(`connectors-sse: malformed event`,e)}},e.onerror=()=>{e?.close(),e=null,i||(r=setTimeout(a,n),n=Math.min(n*2,3e4))})};return a(),()=>{i=!0,r&&clearTimeout(r),e?.close()}},[])}var Sk=1e9;function Ck(e){return e>0&&e<1?`${Math.max(1,Math.round(e*1e3))} MB`:`${e.toFixed(1)} GB`}var wk=1024**3/Sk;function Tk(e,t){let n=e?Number.parseFloat(e):NaN;return Number.isFinite(n)&&e?.trim().toUpperCase().endsWith(`GB`)?Ck(n*wk):e||(t==null?null:Ck(t))}function Ek(e){return`${e.toFixed(1)} GB`}function Dk(e){return Ck(e/Sk)}function Ok(e){let t=e/1e6;return`${t>=10?Math.round(t):t.toFixed(1)} MB/s`}function kk(e,t){return ne(e).meta.dir===`rtl`?Ae(t,`ltr`):t}function Ak(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 jk(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 Mk=5,Nk=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/Mk);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}}};function Pk(e,t){return e.filter(e=>e.id===`gaia`&&!!e.namespaced_agent_id&&(e.required_connections?.some(e=>e.connector_id===t)??!1)).map(e=>e.namespaced_agent_id)}function Fk(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(`connectors → microsoft`)||t.includes(`connections → microsoft`)||t.includes(`microsoft is not currently connected`))}function Ik(e){if(!e)return`all`;let t=e.toLowerCase(),n=t.includes(`google`)||t.includes(`gmail`);return n===(t.includes(`microsoft`)||t.includes(`outlook`)||t.includes(`office365`)||t.includes(`o365`))?`all`:n?`google`:`microsoft`}function Lk(e){let t=window;t.gaia?.openExternal?t.gaia.openExternal(e):window.open(e,`_blank`,`noopener`)}function Rk({connectorId:e,label:t,grantAgents:n,onDone:r,target:i,title:a,ready:o}){let[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null),d=(0,B.useCallback)(async()=>{c(!0),u(null);try{Lk((i?await ft(e,[],n,i):await ft(e,[],n)).authorization_url),r()}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e,n,r,i]);return z(`div`,{className:`email-connect-cta__provider-slot`,children:[z(`button`,{className:`email-connect-cta__button`,onClick:()=>void d(),disabled:s||!o,title:a,children:[s?L(Za,{size:12,className:`email-connect-cta__spinner`}):L(Ui,{size:12}),L(`span`,{children:t})]}),l&&L(`div`,{className:`email-connect-cta__error`,role:`alert`,children:l})]})}var zk=[[`google`,`Google`],[`microsoft`,`Microsoft`]],Bk={addAccount:!0};function Vk({onChange:e}){return xk(e),null}function Hk({content:e=``,connectorId:t}){let n=R(),[r,i]=(0,B.useState)(new Set),a=(0,B.useCallback)(e=>i(t=>new Set([...t,e])),[]),[o,s]=(0,B.useState)([]),[l,u]=(0,B.useState)(!1),d=(0,B.useCallback)(()=>{c().then(e=>s(e.connectors||[])).catch(e=>F.ui.warn(`EmailConnectCta: connector fetch failed`,e)).finally(()=>u(!0))},[]);(0,B.useEffect)(()=>(d(),window.addEventListener(`focus`,d),()=>window.removeEventListener(`focus`,d)),[d]);let{agents:f}=N(),p=(0,B.useCallback)(e=>Pk(f,e),[f]),m=t===`google`||t===`microsoft`?t:Ik(e),h=zk.filter(([e])=>m===e||m===`all`);return z(`div`,{className:`email-connect-cta`,role:`region`,"aria-label":n(`emailCta.label`),children:[z(`div`,{className:`email-connect-cta__text`,children:[L(di,{size:14,className:`email-connect-cta__icon`}),L(`span`,{children:n(r.size>0?`connectCard.opened`:`emailCta.prompt`)})]}),r.size>0&&L(Vk,{onChange:d}),L(`div`,{className:`email-connect-cta__buttons`,children:h.map(([e,t])=>{let i=mk(o.find(t=>t.id===e)),s=r.has(e),c={connectorId:e,grantAgents:p(e),onDone:()=>a(e),ready:l};return[i.account?L(Rk,{...c,label:n(`connectCard.reconnectAccount`,{address:kk(n.locale,gk(i.account.email||i.account.account_id))}),title:i.account.email||void 0,target:{account:dk(i.account)}},`${e}:${i.account.account_id}`):L(Rk,{...c,label:n(s?`emailCta.reopen`:`connectCard.connect`,{name:t})},e),i.otherAccount&&L(Rk,{...c,label:n(`connectCard.otherAccount`),target:Bk},`${e}:other`)]})})]})}var Uk=2e6;function Wk({variant:e,render:t,data:n}){let r;try{r=JSON.stringify(n)}catch{r=String(n)}let i=r.length>Uk,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 z(`div`,{className:`render-unsupported`,children:[L(`p`,{className:`render-unsupported__message`,children:o}),z(`details`,{className:`render-unsupported__details`,children:[L(`summary`,{children:`Raw payload`}),i?z(`p`,{className:`render-unsupported__too-large`,children:[`Payload too large to display (`,r.length,` bytes)`]}):L(`pre`,{className:`render-unsupported__json`,children:a})]})]})}function Gk(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function Kk(e){return e===null?``:String(e)}function qk(e){return e===void 0||typeof e==`string`}function Jk(e){return`+${e-500} more (truncated)`}function Yk(e){if(!e||typeof e!=`object`)return!1;let t=e;return qk(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(Gk))}function Xk({data:e}){if(!Yk(e))return L(Wk,{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 z(`div`,{className:`render-table-card`,children:[e.title&&L(`div`,{className:`render-table-card__title`,children:e.title}),L(`div`,{className:`render-table`,children:z(`table`,{children:[L(`thead`,{children:z(`tr`,{children:[i.map((e,t)=>L(`th`,{children:e},t)),r&&L(`th`,{children:Jk(e.columns.length)})]})}),L(`tbody`,{children:n.map((e,t)=>L(`tr`,{children:e.slice(0,i.length).map((e,t)=>L(`td`,{children:Kk(e)},t))},t))})]})}),t&&L(`div`,{className:`render-truncation`,children:Jk(e.rows.length)})]})}function Zk(e){if(!e||typeof e!=`object`)return!1;let t=e;return qk(t.title)&&Array.isArray(t.items)&&t.items.every(e=>e&&typeof e==`object`&&typeof e.key==`string`&&Gk(e.value))}function Qk({data:e}){if(!Zk(e))return L(Wk,{variant:`invalid`,render:`key_value`,data:e});let t=e.items.length>500,n=t?e.items.slice(0,500):e.items;return z(`div`,{className:`render-kv`,children:[e.title&&L(`div`,{className:`render-kv__title`,children:e.title}),L(`dl`,{className:`render-kv__list`,children:n.map((e,t)=>z(`div`,{className:`render-kv__row`,children:[L(`dt`,{className:`render-kv__key`,children:e.key}),L(`dd`,{className:`render-kv__value`,children:Kk(e.value)})]},t))}),t&&L(`div`,{className:`render-truncation`,children:Jk(e.items.length)})]})}function $k(e){if(!e||typeof e!=`object`)return!1;let t=e;return qk(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 eA({data:e}){if(!$k(e))return L(Wk,{variant:`invalid`,render:`list`,data:e});let t=e.items.length>500,n=(t?e.items.slice(0,500):e.items).map((e,t)=>L(`li`,{children:String(e)},t));return z(`div`,{className:`render-list`,children:[e.title&&L(`div`,{className:`render-list__title`,children:e.title}),e.ordered?L(`ol`,{className:`render-list__items`,children:n}):L(`ul`,{className:`render-list__items`,children:n}),t&&L(`div`,{className:`render-truncation`,children:Jk(e.items.length)})]})}var tA=/^\/api\/media\/(image|audio)\/([A-Za-z0-9%._~-]+)$/;function nA(e,t){let n=tA.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:`${Hn()}/media/${e}/${n[2]}`}var rA=/^data:image\/(png|jpe?g|gif|webp);base64,/;function iA(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.src==`string`&&(rA.test(t.src)||nA(`image`,t.src)!==null)&&qk(t.alt)&&qk(t.caption)}function aA({data:e}){let t=R(),[n,r]=(0,B.useState)(!1);if(!iA(e))return L(Wk,{variant:`invalid`,render:`image`,data:e});let i=rA.test(e.src)?e.src:nA(`image`,e.src);return z(`figure`,{className:`render-image${n?` render-image--expanded`:``}`,children:[L(`button`,{type:`button`,className:`render-image__toggle`,"aria-expanded":n,"aria-label":t(n?`media.showSmaller`:`media.showFull`),onClick:()=>r(e=>!e),children:L(`img`,{className:`render-image__img`,src:i,alt:e.alt??``})}),e.caption&&L(`figcaption`,{className:`render-image__caption`,children:e.caption})]})}function oA(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.src==`string`&&nA(`audio`,t.src)!==null&&qk(t.caption)&&qk(t.path)&&qk(t.saved_to)&&qk(t.script_path)&&(t.duration_seconds===void 0||typeof t.duration_seconds==`number`&&Number.isFinite(t.duration_seconds)&&t.duration_seconds>=0)}function sA(e){let t=Math.round(e),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}function cA({data:e}){let t=R(),[n,r]=(0,B.useState)(!1);if(!oA(e))return L(Wk,{variant:`invalid`,render:`audio`,data:e});let i=nA(`audio`,e.src),a=e.path?e.path.split(/[\\/]/).pop():void 0;return z(`figure`,{className:`render-audio`,children:[L(`audio`,{className:`render-audio__player`,controls:!0,preload:`metadata`,src:i,onError:()=>r(!0)}),z(`figcaption`,{className:`render-audio__caption`,children:[n&&L(`span`,{className:`render-audio__error`,role:`alert`,children:t(`media.audioUnplayable`)}),e.caption&&L(`span`,{className:`render-audio__text`,children:e.caption}),(a||e.duration_seconds!==void 0)&&z(`span`,{className:`render-audio__meta`,children:[a&&V(a),a&&e.duration_seconds!==void 0&&` · `,e.duration_seconds!==void 0&&L(`bdi`,{dir:`ltr`,children:sA(e.duration_seconds)})]}),e.saved_to&&z(`span`,{className:`render-audio__where`,children:[t(`media.savedTo`),` `,L(`bdi`,{dir:`ltr`,children:e.saved_to})]}),e.script_path&&z(`span`,{className:`render-audio__where`,children:[t(`media.listeningScript`),` `,L(`bdi`,{dir:`ltr`,children:e.script_path})]})]})]})}function lA(e){if(!e||typeof e!=`object`)return!1;let t=e;return qk(t.title)&&qk(t.path)&&qk(t.badge)&&qk(t.note)&&typeof t.unified==`string`}function uA(e){return e.startsWith(`+`)?`render-diff__line render-diff__line--added`:e.startsWith(`-`)?`render-diff__line render-diff__line--removed`:`render-diff__line`}var dA=`⋯`;function fA(e){let t=e.replace(/\n$/,``).split(`
|
|
169
|
-
`).map(e=>e.replace(/\r$/,``)),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t:t.slice(n+1).map(e=>e.startsWith(`@@`)?dA:e)}function pA(e){return e.split(/(?<=[\\/])/).map((e,t)=>z(`span`,{children:[e,L(`wbr`,{})]},t))}function mA({data:e}){if(!lA(e))return L(Wk,{variant:`invalid`,render:`diff`,data:e});let t=fA(e.unified),n=e.title??(e.path?e.path.split(/[\\/]/).filter(Boolean).pop():void 0);return z(`div`,{className:`render-diff`,children:[(n||e.badge)&&z(`div`,{className:`render-diff__title`,children:[e.badge&&L(`span`,{className:`render-diff__badge`,children:e.badge}),n&&V(n)]}),e.path&&L(`div`,{className:`render-diff__path`,dir:`ltr`,children:pA(V(e.path))}),e.note&&L(`div`,{className:`render-diff__note`,children:e.note}),e.unified&&L(`pre`,{className:`render-diff__body`,children:t.map((e,t)=>L(`div`,{className:e===dA?`render-diff__line render-diff__line--hunk`:uA(e),children:V(e)},t))})]})}function hA(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.action==`string`&&typeof t.summary==`string`}function gA(e){let t=e.replace(/_/g,` `).trim();return t.length>0?t:`action`}function _A({data:e}){let[t,n]=(0,B.useState)(!1);return hA(e)?t?L(`div`,{className:`render-confirmation render-confirmation--dismissed`,children:L(`span`,{className:`render-confirmation__dismissed-note`,children:`Confirmation dismissed`})}):z(`div`,{className:`render-confirmation`,children:[z(`div`,{className:`render-confirmation__header`,children:[L(`span`,{className:`render-confirmation__badge`,children:`Approval needed`}),L(`span`,{className:`render-confirmation__label`,children:gA(e.action)}),L(`code`,{className:`render-confirmation__action`,children:e.action})]}),L(`pre`,{className:`render-confirmation__summary`,children:e.summary}),z(`div`,{className:`render-confirmation__footer`,children:[L(`span`,{className:`render-confirmation__note`,children:`Nothing was executed. Follow the assistant's guidance below to approve this action.`}),L(`button`,{type:`button`,className:`render-confirmation__dismiss`,onClick:()=>n(!0),children:`Dismiss`})]})]}):L(Wk,{variant:`invalid`,render:`needs_confirmation`,data:e})}var vA=[`p`,`strong`,`em`,`code`,`ul`,`ol`,`li`,`br`],yA={p:({children:e})=>L(`p`,{children:L(`bdi`,{children:e})}),li:({node:e,children:t})=>e?.children.some(e=>e.type===`element`&&[`p`,`ul`,`ol`].includes(e.tagName))?L(`li`,{children:t}):L(`li`,{children:L(`bdi`,{children:t})})};function bA({text:e}){return L(`div`,{className:`render-needs-input__question`,children:L(bv,{allowedElements:vA,unwrapDisallowed:!0,components:yA,children:e})})}var xA=e=>e;function SA(e,t=mt.bare,n=xA){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 CA={answered:[`answer.answeredIn`,`answer.answeredInPlace`],stopped:[`answer.stoppedAfter`,`answer.stoppedAfterPlace`],interrupted:[`answer.interruptedAfter`,`answer.interruptedAfterPlace`],failed:[`answer.failedAfter`,`answer.failedAfterPlace`]},wA={GPU:`device.gpu`,NPU:`device.npu`,CPU:`device.cpu`};function TA(e){if(e===`on this PC`)return We(`answer.place.thisPc`);let t=/^via (.+)$/.exec(e);if(t)return We(`answer.place.via`,{provider:t[1]});let n=/^on your (.+)$/.exec(e)?.[1].split(` and `).map(e=>wA[e]);if(n?.every(Boolean)){let e=n.slice(1).reduce((e,t)=>We(`answer.place.pair`,{a:e,b:We(t)}),We(n[0]));return We(`answer.place.on`,{device:e})}return e}function EA(e,t){return t!==`failed`&&e?.time_to_first_token!=null&&e.time_to_first_token>0}function DA(e,t,n,r,i,a=!1){let o=[],s=t?.place?TA(t.place):null;if(e!=null&&e>0){let[t,a]=CA[n??`answered`],c=SA(e,r,i);o.push(s?r(a,{time:c,place:s}):r(t,{time:c}))}else s&&o.push(r(n?`answer.ranPlace`:`answer.answeredPlace`,{place:s}));if(EA(t,n)){let e=SA(t.time_to_first_token*1e3,r,i);o.push(r(o.length?`answer.firstWord`:`answer.firstWordLead`,{time:e}))}return t?.steps!=null&&t.steps>0&&o.push(r(u(`answer.steps`,t.steps),{n:t.steps})),o.length?a?o[0]:o.join(` · `):null}function OA(e,t,n,r,i,a=!1){return DA(e,t,n,mt.bare,xA)===null?null:r.compose(r=>DA(e,t,n,r,i,a)??``)}function kA(e,t,n=mt,r=xA,i){let a=[];if(e!=null&&e>0&&a.push(n.compose(t=>t(`answer.exact.total`,{time:r(t(`answer.duration.sec`,{n:(e/1e3).toFixed(1)}))}))),EA(t,i)){let e=(t.time_to_first_token*1e3).toFixed(0);a.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()}`);a.push(n.compose(t=>t(`answer.exact.tokens`,{flow:e})))}return t?.tokens_per_second!=null&&t.tokens_per_second>0&&a.push(n(`answer.exact.rate`,{n:t.tokens_per_second})),a}function AA({latencyMs:e,stats:t,ended:n}){let r=R(),[i,a]=(0,B.useState)(!1),o=OA(e,t,n,r,al,!i),s=OA(e,t,n,r,xA),c=kA(e,t,r,al,n);return!o&&c.length===0?null:z(P.Fragment,{children:[L(`span`,{children:L(`button`,{type:`button`,className:`msg-stats-summary`,"aria-expanded":i,title:[s,...kA(e,t,r,xA,n)].filter(Boolean).join(`
|
|
170
|
-
`),onClick:()=>a(e=>!e),children:o?L(cl,{text:o}):r(`answer.details`)})}),i&&c.map(e=>L(`span`,{children:L(cl,{text:e})},e))]})}function jA(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`}mt(`question.expired`);var MA=`••••••`,NA=class extends Error{};function PA(e){return e?.httpStatus===404}async function FA(e,t,n,r){let i=N.getState();try{await Wn(e,t,n)}catch(e){throw PA(e)?(i.closeQuestion(t),new NA(mt(`question.expired`))):e}i.recordAnswer(t,r),i.closeQuestion(t)}function IA(e,t){let n=e.trim(),r=t.options??[],i=n.toLowerCase(),a=r[/^\d+$/.test(n)?Number(n)-1:-1]??r.find(e=>e.label.toLowerCase()===i||e.value.toLowerCase()===i);return a?{value:a.value,shown:a.label}:t.allowFreeText===!1&&r.length>0?null:{value:n,shown:n}}function LA(e,t){let n=null;for(let[r,i]of Object.entries(e))i.sessionId===t&&!i.sensitive&&(n=r);return n}function RA(e){let[t,n]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e?Math.max(0,e-t):null}function zA({data:e}){let t=R(),[n,r]=(0,B.useState)({status:`pending`}),[i,a]=(0,B.useState)(``),o=jA(e)?e.request_id:``,s=N(e=>e.liveQuestions[o]),c=N(e=>o in e.questionAnswers),l=N(e=>e.questionAnswers[o]??null),u=N(e=>e.closeQuestion),d=RA(s?.expiresAt);if((0,B.useEffect)(()=>{if(!s||s.expiresAt===null)return;let e=s.expiresAt-Date.now();if(e<=0){u(o);return}let t=setTimeout(()=>u(o),e);return()=>clearTimeout(t)},[s,o,u]),!jA(e))return L(Wk,{variant:`invalid`,render:`needs_input`,data:e});let f=n.status===`submitting`,p=async(n,i)=>{if(n.trim()&&!f&&s){r({status:`submitting`});try{await FA(e.session_id,e.request_id,n,e.sensitive?null:i),r({status:`pending`})}catch(e){if(e instanceof NA){r({status:`pending`});return}r({status:`error`,message:e instanceof Error?e.message:t(`question.sendFailed`)})}}};return c?z(`div`,{className:`render-needs-input render-needs-input--answered`,children:[L(bA,{text:e.question}),L(`p`,{className:`render-needs-input__answered-note`,role:`status`,children:l===null||e.sensitive?t(`question.youAnsweredHidden`):t(`question.youAnswered`,{answer:l})})]}):!s&&!f?z(`div`,{className:`render-needs-input render-needs-input--expired`,"aria-disabled":`true`,children:[L(`div`,{className:`render-needs-input__header`,children:L(`span`,{className:`render-needs-input__badge`,children:t(`question.badge`)})}),L(bA,{text:e.question}),L(`p`,{className:`render-needs-input__expired-note`,role:`status`,children:t(`question.expired`)})]}):z(`div`,{className:`render-needs-input`,children:[z(`div`,{className:`render-needs-input__header`,children:[L(`span`,{className:`render-needs-input__badge`,children:t(`question.badge`)}),e.sensitive&&L(`span`,{className:`render-needs-input__sensitive-badge`,children:t(`question.sensitive`)})]}),L(bA,{text:e.question}),e.options.length>0&&L(`div`,{className:`render-needs-input__options`,children:e.options.map(e=>L(`button`,{type:`button`,className:`render-needs-input__option`,disabled:f,title:e.description||void 0,onClick:()=>p(e.value,e.label),children:L(`bdi`,{children:e.label})},e.value))}),e.allow_free_text&&e.sensitive&&z(`form`,{className:`render-needs-input__free-text`,onSubmit:e=>{e.preventDefault(),p(i,i)},children:[L(`input`,{type:`password`,className:`render-needs-input__free-text-input`,value:i,disabled:f,placeholder:t(`question.hiddenPlaceholder`,{mask:MA}),onChange:e=>a(e.target.value),autoComplete:`off`,autoFocus:!0}),L(`button`,{type:`submit`,className:`render-needs-input__free-text-submit`,disabled:f||!i.trim(),children:t(`question.send`)})]}),e.allow_free_text&&!e.sensitive&&L(`p`,{className:`render-needs-input__hint`,children:e.options.length>0?t(`question.typeHint`):t(`question.typeHintNoOptions`)}),d!==null&&d>0&&L(`p`,{className:`render-needs-input__hint`,children:t(`question.timeLeft`,{time:SA(d>=6e4?Math.ceil(d/6e4)*6e4:d,t.bare)})}),n.status===`error`&&L(`p`,{className:`render-needs-input__error`,children:n.message})]})}var BA=4e3,VA=150;function HA(e,t){(0,B.useEffect)(()=>{if(!e)return;let n=VA,r=setInterval(()=>{t(),--n,n<=0&&clearInterval(r)},BA);return()=>clearInterval(r)},[e,t])}function UA(e,t){return e?.length?[...new Set([...t??[],...e])]:[]}function WA(e){return e.providers.filter(t=>!e.reconnect?.includes(t))}function GA(e){let t=new Set;for(let n of e?.cards??[])n.render===`connect_account`&&ce(n.data)&&WA(n.data).forEach(e=>t.add(e));return[...t]}function KA(e){let t={};for(let n of e?.cards??[])n.render===`connect_account`&&ce(n.data)&&Object.assign(t,n.data.account);return t}function qA(e){return(e?.cards??[]).some(e=>e.render===`connect_account`&&ce(e.data))}function JA(e,t,n){return t?e.filter(e=>e.namespaced_agent_id===t&&(e.required_connections?.some(e=>e.connector_id===n)??!1)).map(e=>e.namespaced_agent_id):[]}var YA={google:`Google`,microsoft:`Microsoft`,microsoft_work:`Microsoft 365`};function XA(e){let t=window.gaia;t?.openExternal?t.openExternal(e):window.open(e,`_blank`,`noopener`)}function ZA(e){let t=e;return t?.httpStatus===503&&t.body?.error===`not_configured`}function QA({connectorId:e,name:t,connected:n,saysConnected:r,added:i,offer:a,needsSetup:o,grantAgents:s,scopes:c,onOpened:l}){let u=R(),d=N(e=>e.openSettings),f=N(e=>e.openConnectorSettings),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(!1);(0,B.useEffect)(()=>{o||v(!1)},[o]);let y=(0,B.useCallback)(async t=>{if(o)g(null),v(!0);else if(v(!1),s.length===0)d(`connectors`);else{m(!0),g(null);try{XA((t?await ft(e,c,s,t):await ft(e,c,s)).authorization_url),l()}catch(e){ZA(e)?v(!0):g(e instanceof Error?e.message:String(e))}finally{m(!1)}}},[e,o,s,c,l,d]),b=p?L(Za,{size:12,className:`render-connect__spinner`,"aria-hidden":`true`}):L(Ui,{size:12,"aria-hidden":`true`}),x=u(n?`connectCard.reconnect`:`connectCard.connect`,{name:t}),{account:S}=a;return z(`div`,{className:`render-connect__provider`,children:[S?z(`button`,{type:`button`,className:`render-connect__button`,title:S.email||void 0,onClick:()=>void y({account:dk(S)}),disabled:p,children:[b,L(`span`,{children:u(`connectCard.reconnectAccount`,{address:kk(u.locale,gk(S.email||S.account_id))})})]}):z(`button`,{type:`button`,className:`render-connect__button${n?` render-connect__button--quiet`:``}`,onClick:()=>void y(),disabled:p,children:[b,L(`span`,{children:x})]}),a.otherAccount&&L(`button`,{type:`button`,className:`render-connect__button render-connect__button--quiet`,onClick:()=>void y({addAccount:!0}),disabled:p,children:L(`span`,{children:u(`connectCard.otherAccount`)})}),r&&!S&&z(`span`,{className:`render-connect__connected`,role:`status`,children:[L(li,{size:13,"aria-hidden":`true`}),i?u(`connectCard.addedAccount`,{address:kk(u.locale,gk(i.email||i.account_id)),name:t}):u(`connectCard.connected`,{name:t})]}),h&&L(`div`,{className:`render-connect__error`,role:`alert`,children:h}),_&&z(`div`,{className:`render-connect__setup`,role:`status`,children:[L(`span`,{children:u(`connectCard.needsSetup`,{name:t})}),L(`button`,{type:`button`,className:`render-connect__settings`,onClick:()=>f(e),children:u(`connectCard.setUp`,{name:t})})]})]})}function $A({providers:e,onEnded:t}){return xk((0,B.useCallback)(n=>{n.reason===`oauth_error`&&n.connectorId&&e.includes(n.connectorId)&&t(n.payload.reason===`cancelled`?`cancelled`:`failed`)},[e,t])),null}function ej({data:e}){let t=R(),n=N(e=>e.agents),r=N(e=>e.openSettings),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)(null),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(null),p=ce(e),m=(0,B.useCallback)(()=>{c().then(e=>{let t=e.connectors||[];a(t),s(e=>e??t)}).catch(e=>F.ui.warn(`ConnectAccountCard: connector fetch failed`,e))},[]);(0,B.useEffect)(()=>{if(p)return m(),window.addEventListener(`focus`,m),()=>window.removeEventListener(`focus`,m)},[p,m]);let h=N(e=>e.settingsSection!==null),g=(0,B.useRef)(h);(0,B.useEffect)(()=>{p&&g.current&&!h&&m(),g.current=h},[p,h,m]);let _=(e,t)=>e?.find(e=>e.id===t),v=t=>p&&o!==null&&hk(_(i,t),_(o,t),e.account?.[t]),y=p&&WA(e).some(v);HA(l&&!y,m);let b=(0,B.useCallback)(e=>{u(!1),f(e)},[]);if(!ce(e))return L(Wk,{variant:`invalid`,render:Je,data:e});let x=e=>i.some(t=>t.id===e&&!(`error`in t)&&t.configured),S=e=>v(e)||x(e)&&sk(_(i,e)).length<=1,C=e=>i.some(t=>t.id===e&&!(`error`in t)&&!t.configured&&t.configurable===!1),w=e=>YA[e]??i.find(t=>t.id===e&&!(`error`in t))?.display_name??e,T=e=>{let t=i.find(t=>t.id===e);return t&&!(`error`in t)?t.scopes:void 0},E=t(`connectCard.prompt`);return y?E=t(`connectCard.askAgain`):d?E=t(d===`cancelled`?`connectCard.cancelled`:`connectCard.failed`):l&&(E=t(`connectCard.opened`)),z(`div`,{className:`render-connect`,role:`group`,"aria-label":t(`connectCard.label`),children:[z(`div`,{className:`render-connect__text`,children:[L(qa,{size:14,className:`render-connect__icon`,"aria-hidden":`true`}),L(`span`,{role:d?`alert`:void 0,children:E})]}),l&&L($A,{providers:e.providers,onEnded:b}),L(`div`,{className:`render-connect__providers`,children:e.providers.map(t=>L(QA,{connectorId:t,name:w(t),connected:x(t),saysConnected:S(t),added:v(t)?vk(_(i,t),_(o,t)):null,offer:mk(_(i,t),e.account?.[t]),needsSetup:C(t),grantAgents:JA(n,e.agent_id,t),scopes:UA(e.scopes?.[t],T(t)),onOpened:()=>{f(null),u(!0)}},t))}),L(`button`,{type:`button`,className:`render-connect__settings`,onClick:()=>r(`connectors`),children:t(`connectCard.settings`)})]})}function tj(e,t,n,r,i,a,o,s){return{id:e,dimension:t,system:n,toBase:r,singular:i,plural:a,short:o,aliases:s}}var nj=[tj(`tsp`,`volume`,`us`,4.92892,`teaspoon`,`teaspoons`,`tsp`,[`teaspoons`,`teaspoon`,`tsps`,`tsp`]),tj(`tbsp`,`volume`,`us`,14.7868,`tablespoon`,`tablespoons`,`tbsp`,[`tablespoons`,`tablespoon`,`tbsps`,`tbsp`,`tbs`,`tbl`]),tj(`floz`,`volume`,`us`,29.5735,`fluid ounce`,`fluid ounces`,`fl oz`,[`fluid ounces`,`fluid ounce`,`fl. oz`,`fl oz`]),tj(`cup`,`volume`,`us`,236.588,`cup`,`cups`,`cup`,[`cups`,`cup`]),tj(`pint`,`volume`,`us`,473.176,`pint`,`pints`,`pt`,[`pints`,`pint`,`pt`]),tj(`quart`,`volume`,`us`,946.353,`quart`,`quarts`,`qt`,[`quarts`,`quart`,`qt`]),tj(`gallon`,`volume`,`us`,3785.41,`gallon`,`gallons`,`gal`,[`gallons`,`gallon`,`gal`]),tj(`oz`,`mass`,`us`,28.3495,`ounce`,`ounces`,`oz`,[`ounces`,`ounce`,`oz`]),tj(`lb`,`mass`,`us`,453.592,`pound`,`pounds`,`lb`,[`pounds`,`pound`,`lbs`,`lb`]),tj(`ml`,`volume`,`metric`,1,`ml`,`ml`,`ml`,[`millilitres`,`milliliters`,`millilitre`,`milliliter`,`ml`]),tj(`l`,`volume`,`metric`,1e3,`L`,`L`,`L`,[`litres`,`liters`,`litre`,`liter`,`l`]),tj(`g`,`mass`,`metric`,1,`g`,`g`,`g`,[`grams`,`gram`,`g`]),tj(`kg`,`mass`,`metric`,1e3,`kg`,`kg`,`kg`,[`kilograms`,`kilogram`,`kilos`,`kilo`,`kg`])],rj=Object.fromEntries(nj.map(e=>[e.id,e])),ij=nj.flatMap(e=>e.aliases.map(t=>({alias:t,unit:e}))).sort((e,t)=>t.alias.length-e.alias.length);function aj(e){let t=e.toLowerCase();for(let{alias:e,unit:n}of ij){if(!t.startsWith(e))continue;let r=t.charAt(e.length);if(/[a-z0-9]/.test(r))continue;let i=e.length+ +(r===`.`);return{unit:n,abbreviated:e!==n.singular.toLowerCase()&&e!==n.plural.toLowerCase(),length:i}}return null}var oj={us:{volume:[`tsp`,`tbsp`,`cup`],mass:[`oz`,`lb`]},metric:{volume:[`ml`,`l`],mass:[`g`,`kg`]}},sj={tbsp:1,cup:.25,lb:1,l:1,kg:1},cj=.04,lj=.1;function uj(e,t,n){let r=oj[n][t.dimension];if(t.system===n&&!r.includes(t.id))return t;let i=t.system===n?cj:lj;for(let t=r.length-1;t>0;t--){let n=rj[r[t]],a=e/n.toBase;if(!(a<sj[n.id]*(1-i))&&!(n.system===`us`&&n.dimension===`volume`&&Math.abs(fj(a)-a)/a>i))return n}return rj[r[0]]}var dj=[[0,``],[1/8,`⅛`],[1/4,`¼`],[1/3,`⅓`],[1/2,`½`],[2/3,`⅔`],[3/4,`¾`],[1,``]];function fj(e){let t=Math.floor(e),n=e-t,r=0;for(let[e]of dj)Math.abs(e-n)<Math.abs(r-n)&&(r=e);return Math.max(t+r,1/8)}function pj(e){let t=fj(e),n=Math.floor(t+1e-9),r=t-n,i=dj.find(([e])=>Math.abs(e-r)<1e-6)?.[1]??``;return n===0?i:`${n}${i}`}function mj(e,t){return t.id===`l`||t.id===`kg`?String(Math.round(e*10)/10):String(e>=20?Math.round(e/5)*5:Math.max(1,Math.round(e)))}var hj=/(\d{2,3})(?:\s*°\s*|\s*degrees?\s+|(?=[FC]\b))(Fahrenheit|Celsius|F|C)\b/g,gj=e=>e>=150?Math.round(e/5)*5:Math.round(e),_j=/^\s*(?:\/|\(|or)\s*$/;function vj(e,t){let n=[...e.matchAll(hj)].map(e=>({start:e.index,end:e.index+e[0].length,value:Number(e[1]),fahrenheit:e[2].charAt(0)===`F`,text:e[0]})),r=``,i=0;for(let a=0;a<n.length;a++){let o=n[a],s=n[a+1];if(r+=e.slice(i,o.start),s&&s.fahrenheit!==o.fahrenheit&&_j.test(e.slice(o.end,s.start))){let n=(o.fahrenheit?t===`us`:t===`metric`)?o:s;r+=n.text,i=s.end,e.slice(o.end,s.start).includes(`(`)&&e.charAt(i)===`)`&&(i+=1),a+=1}else o.fahrenheit&&t===`metric`?r+=`${gj((o.value-32)*5/9)}°C`:!o.fahrenheit&&t===`us`?r+=`${gj(o.value*9/5+32)}°F`:r+=o.text,i=o.end}return r+e.slice(i)}function yj(e){let t=new RegExp(hj.source).exec(e);return t?t[2].charAt(0)===`F`?`us`:`metric`:null}var bj={"½":1/2,"⅓":1/3,"⅔":2/3,"¼":1/4,"¾":3/4,"⅛":1/8,"⅜":3/8,"⅝":5/8,"⅞":7/8,"⅕":1/5,"⅖":2/5,"⅗":3/5,"⅘":4/5,"⅙":1/6,"⅚":5/6},xj=`[${Object.keys(bj).join(``)}]`,Sj=String.raw`(?:\d+\s+\d+\/\d+|\d+\s*${xj}|\d+\/\d+|\d*\.\d+|\d+|${xj})`,Cj=new RegExp(String.raw`^\s*(${Sj})(?:\s*(?:-|–|to)\s*(${Sj}))?`);function wj(e){let t=e.trim(),n=/^(\d+)\s+(\d+)\/(\d+)$/.exec(t);if(n)return Number(n[1])+Number(n[2])/Number(n[3]);let r=new RegExp(String.raw`^(\d*)\s*(${xj})$`).exec(t);if(r)return Number(r[1]||0)+bj[r[2]];let i=/^(\d+)\/(\d+)$/.exec(t);return i?Number(i[1])/Number(i[2]):Number(t)}var Tj=/^([^()]+?)\s*\(([^()]+)\)\s*$/;function Ej(e){return/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e}function Dj(e){let t=Cj.exec(e);if(!t){let t=Tj.exec(e),n=t?Dj(t[2]):null;return!t||!n||n.rest?null:{...n,rest:Ej(t[1].trim())}}let n=wj(t[1]),r=t[2]?wj(t[2]):null;if(!(n>0)||r!==null&&!(r>n))return null;let i=t[0].length,a=e.slice(i),o=/^\s*/.exec(a)[0].length,s=aj(a.slice(o));return s&&(i+=o+s.length),{amount:{low:n,high:r},unit:s?.unit??null,abbreviated:s?.abbreviated??!1,lead:e.slice(0,i).trim(),rest:e.slice(i).trim()}}var Oj=/\b(whole|chickens?|turkeys?|ducks?|eggs?|cans?|tins?|jars?|bottles?|loa(?:f|ves)|packages?|packets?|bags?|boxes|box)\b/i,kj=[[`egg`,`eggs`],[`clove`,`cloves`],[`can`,`cans`],[`tin`,`tins`],[`jar`,`jars`],[`onion`,`onions`],[`lemon`,`lemons`],[`lime`,`limes`],[`potato`,`potatoes`],[`tomato`,`tomatoes`],[`carrot`,`carrots`],[`shallot`,`shallots`],[`apple`,`apples`],[`banana`,`bananas`],[`avocado`,`avocados`],[`breast`,`breasts`],[`thigh`,`thighs`],[`fillet`,`fillets`],[`slice`,`slices`],[`sprig`,`sprigs`],[`stalk`,`stalks`],[`stick`,`sticks`],[`loaf`,`loaves`],[`package`,`packages`],[`packet`,`packets`],[`head`,`heads`],[`bunch`,`bunches`],[`leaf`,`leaves`],[`tortilla`,`tortillas`],[`pepper`,`peppers`],[`chicken`,`chickens`],[`cucumber`,`cucumbers`],[`yolk`,`yolks`],[`white`,`whites`],[`bag`,`bags`]];function Aj(e,t){let n=e.split(/(\s+)/),r=!1;for(let e=0;e<n.length&&e<12;e+=2){let i=n[e];if(i.startsWith(`(`)&&(r=!0),r){i.includes(`)`)&&(r=!1);continue}if(/^of$/i.test(i))break;let a=i.replace(/[,.;:]+$/,``),o=kj.find(([e,t])=>a.toLowerCase()===e||a.toLowerCase()===t);if(o){let r=t?o[1]:o[0],s=/^[A-Z]/.test(a)?r.charAt(0).toUpperCase()+r.slice(1):r;return n[e]=s+i.slice(a.length),n.join(``)}if(a!==i)break}return e}function jj(e,t){return t?Math.max(1,Math.round(e)):Math.max(.5,Math.round(e*2)/2)}function Mj(e,t,n){let r=e=>n?.system===`metric`?mj(e,n):pj(e),i=r(e);if(t===null)return i;let a=r(t);return a===i?i:`${i}–${a}`}function Nj(e,t,n){return e.system===`metric`||t?e.short:n?e.plural:e.singular}function Pj(e,t,n,r){if(!t)return{qty:null,text:e};let{amount:i,unit:a}=t,o=a!==null&&a.system!==r;if(n===1&&!o)return{qty:t.lead,text:t.rest};if(!a){let e=Oj.test(t.rest),r=jj(i.low*n,e),a=i.high===null?null:jj(i.high*n,e),o=(a??r)>1;return{qty:Mj(r,a,null),text:Aj(t.rest,o)}}let s=i.low*n*a.toBase,c=i.high===null?null:i.high*n*a.toBase,l=uj(s,a,r),u=s/l.toBase,d=c===null?null:c/l.toBase,f=d??u,p=(l.system===`us`?fj(f):f)>1,m=!o&&t.abbreviated;return{qty:`${Mj(u,d,l)} ${Nj(l,m,p)}`,text:t.rest}}var Fj=[[/^h/i,3600],[/^m/i,60],[/^s/i,1]],Ij=String.raw`(?:hours?|hrs?|minutes?|mins?|seconds?|secs?)\b`,Lj=new RegExp(String.raw`(?:(${Sj})(?:\s*(?:-|–|to)\s*(?:${Sj}))?|\b(an?))[\s-]*(${Ij})`,`gi`),Rj=/^\s*(?:,\s*)?(?:and\s+)?$/i;function zj(e){return Fj.find(([t])=>t.test(e))[1]}function Bj(e){let t=[];for(let n of e.matchAll(Lj)){let e=n[1]?wj(n[1]):1,r=zj(n[3]);e>0&&(!n[2]||/^(?:hour|minute)$/i.test(n[3]))&&t.push({start:n.index,end:n.index+n[0].length,seconds:Math.round(e*r),unit:r})}let n=[];for(let r of t){let t=n[n.length-1];t&&r.unit<t.unit&&Rj.test(e.slice(t.end,r.start))?(t.end=r.end,t.seconds+=r.seconds,t.unit=r.unit):n.push({...r})}return n.map(({start:e,end:t,seconds:n})=>({start:e,end:t,seconds:n}))}function Vj(e){let t=Math.max(0,Math.ceil(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}var Hj=6,Uj=/^day\s+\d+\b/i,Wj=/^(day\s+\d+)\s+[-–—]\s+([\s\S]+)$/i;function Gj(e,t=!1){let n=e.trim(),r=/^([^:\n]{1,80}):\s+([\s\S]+)$/.exec(n);if(r){let e=r[1].trim();if(e.split(/\s+/).length<=Hj&&!/\d$/.test(e)||t&&Uj.test(e))return{title:e,body:r[2].trim()}}let i=t?Wj.exec(n):null;return i?{title:i[1],body:i[2].trim()}:{title:null,body:n}}function Kj(e){let t=/(\d+)\s*(?:sets?\s*(?:of|x|×)\s*|[x×]\s*)(\d+)/i.exec(e),n=/(\d+)\s*sets?\b/i.exec(e),r=null,i=null;return Bj(e).forEach((t,n)=>{let a=e.slice(Math.max(0,t.start-16),t.start);i===null&&/\brest(?:\s+for)?\s*$/i.test(a)?i=n:r===null&&/\bhold(?:\s+(?:it|for))*\s*$/i.test(a)&&(r=n)}),{sets:t?Number(t[1]):n?Number(n[1]):null,reps:t?Number(t[2]):null,holdIndex:r,restIndex:i}}var qj={recipe:{itemsLabel:`cards.ingredients`,stepsLabel:`cards.stepsHeading`,scaling:!0,units:!0,timers:!0,checkItems:!1,startLabel:`cards.startCooking`,timeline:!1,tip:`cards.tip.recipe`},workout:{itemsLabel:`cards.equipment`,stepsLabel:`cards.exercises`,scaling:!1,units:!1,timers:!0,checkItems:!0,startLabel:`cards.startWorkout`,timeline:!1,tip:`cards.tip.workout`},howto:{itemsLabel:`cards.materials`,stepsLabel:`cards.stepsHeading`,scaling:!1,units:!0,timers:!0,checkItems:!0,startLabel:`cards.start`,timeline:!1,tip:`cards.tip.howto`},checklist:{itemsLabel:`cards.items`,stepsLabel:null,scaling:!1,units:!1,timers:!1,checkItems:!0,startLabel:null,timeline:!1,tip:null},itinerary:{itemsLabel:`cards.packing`,stepsLabel:`cards.daysHeading`,scaling:!1,units:!1,timers:!1,checkItems:!0,startLabel:null,timeline:!0,tip:null}},Jj=e=>typeof e==`string`,Yj=e=>e==null||Jj(e),Xj=e=>Array.isArray(e)&&e.every(Jj);function Zj(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind!==`guide`||!Jj(t.title)||!t.title.trim()||!(Jj(t.guideType)&&t.guideType in qj)||!Yj(t.description)||!Yj(t.notes)||!Xj(t.items)||!Xj(t.steps)?!1:t.guideType===`recipe`?typeof t.servings==`number`&&Number.isInteger(t.servings)&&t.servings>=1:t.servings===null||t.servings===void 0}function Qj(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}var $j=/^(?:step\s+\d+\s*[:.)-]|\d+[.)]|[-*•])\s+/i;function eM(e){let t=qj[e.guideType],n=e=>e.map(e=>e.trim().replace($j,``)).filter(Boolean),r=n(e.items).map(e=>({raw:e,parsed:t.units||t.scaling?Dj(e):null})),i=n(e.steps).map(e=>Gj(e,t.timeline)),a=[];if(t.units){for(let e of r)e.parsed?.unit&&a.push(e.parsed.unit.system);for(let e of i){let t=yj(e.body);t&&a.push(t)}}let o=a.filter(e=>e===`metric`).length;return{type:e.guideType,features:t,title:e.title.trim(),description:(e.description??``).trim(),notes:(e.notes??``).trim(),baseServings:t.scaling?e.servings:null,items:r,steps:i,nativeSystem:o>a.length-o?`metric`:`us`,convertible:a.length>0,key:Qj(JSON.stringify(e))}}function tM(e,t){return!e.baseServings||!t?1:t/e.baseServings}function nM(e,t,n){let r=e.items[t];return Pj(r.raw,r.parsed,tM(e,n.servings),n.system)}function rM(e,t,n){return e.features.units?vj(t,n):t}function iM(e,t){return e.plural(`cards.servingCount`,t)}function aM(e,t,n){return e.steps[t].title??(e.features.timeline?n(t+1):null)}function oM(e,t,n){let r=[e.title];return e.description&&r.push(e.description),e.baseServings&&t.servings&&r.push(n.bare(`cards.makes`,{servings:n.bare(u(`cards.servingCount`,t.servings),{n:t.servings})})),e.items.length&&(r.push(``,n.bare(e.features.itemsLabel)),e.items.forEach((n,i)=>{let{qty:a,text:o}=nM(e,i,t),s=a?`${a} ${o}`.trim():o,c=e.features.checkItems?t.checked.has(i)?`[x] `:`[ ] `:`- `;r.push(`${c}${s}`)})),e.steps.length&&e.features.stepsLabel&&(r.push(``,n.bare(e.features.stepsLabel)),e.steps.forEach((i,a)=>{let o=rM(e,i.body,t.system),s=aM(e,a,e=>n.bare(`cards.dayN`,{n:e})),c=s?`${s}: ${o}`:o;r.push(e.features.timeline?c:`${a+1}. ${c}`)})),e.notes&&r.push(``,n.bare(`cards.notes`),rM(e,e.notes,t.system)),r.join(`
|
|
171
|
-
`)}async function sM(e){if(!navigator.clipboard?.writeText)throw Error(`Clipboard is not available here`);await navigator.clipboard.writeText(e)}function cM(){return typeof navigator<`u`&&typeof navigator.share==`function`}async function lM(e,t){try{return await navigator.share({title:e,text:t}),!0}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return!1;throw e}}function uM(e){return e.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`)}function dM(e,t){let n=document.createElement(`iframe`);n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,n.style.position=`fixed`,n.style.width=`0`,n.style.height=`0`,n.style.border=`0`,document.body.appendChild(n);let r=n.contentWindow;if(!r)throw n.remove(),Error(`Could not open a print frame`);r.document.open(),r.document.write(`<!doctype html><html><head><meta charset="utf-8"><title>${uM(e)}</title><style>body{font:14px/1.6 system-ui,sans-serif;margin:32px;}pre{white-space:pre-wrap;font:inherit;}</style></head><body><pre>${uM(t)}</pre></body></html>`),r.document.close();let i=()=>n.remove();r.addEventListener(`afterprint`,i,{once:!0}),r.focus(),r.print(),setTimeout(i,6e4)}function fM(e,t){return`${e}:${t}`}function pM({id:e,seconds:t,timers:n,label:r}){let i=R(),a=n.read(e,t),o=a.status===`running`?`cards.timerPause`:a.status===`paused`?`cards.timerResume`:`cards.timerStart`,s=a.status===`running`?Mo:a.status===`done`?Yr:Ho;return z(`button`,{type:`button`,className:`render-guide-chip is-${a.status}`,onClick:()=>n.toggle(e,t),"aria-label":i(o,{label:r}),children:[L(s,{size:11,"aria-hidden":`true`}),L(`span`,{className:`render-guide-chip__clock`,children:a.status===`done`?i(`cards.done`):Vj(a.remainingSeconds)})]})}function mM({text:e,stepIndex:t,timers:n,withTimers:r}){if(!r)return L(P.Fragment,{children:e});let i=Bj(e),a=0;return z(P.Fragment,{children:[i.map((r,i)=>{let o=/^[.,;:!?]+/.exec(e.slice(r.end))?.[0]??``,s=e.slice(a,r.end+o.length),c=e.slice(r.start,r.end);return a=r.end+o.length,z(B.Fragment,{children:[s,` `,L(pM,{id:fM(t,i),seconds:r.seconds,timers:n,label:c})]},i)}),e.slice(a)]})}var hM=dr();function gM(){let[e,t]=(0,B.useState)(!0);return(0,B.useEffect)(()=>{if(!(`wakeLock`in navigator)){t(!1);return}let e=null,n=!0,r=()=>{document.visibilityState===`visible`&&navigator.wakeLock.request(`screen`).then(r=>{n?(e=r,t(!0)):r.release()},()=>{n&&t(!1)})};return r(),document.addEventListener(`visibilitychange`,r),()=>{n=!1,document.removeEventListener(`visibilitychange`,r),e?.release()}},[]),e}function _M({doc:e,state:t,timers:n,onClose:r}){let i=R(),[a,o]=(0,B.useState)(0),[s,c]=(0,B.useState)({}),l=(0,B.useRef)(null),u=gM(),d=e.steps.length,f=a===d-1;ut(!0,r),un(l,!0),(0,B.useEffect)(()=>{let e=document.activeElement;return l.current?.focus(),()=>e?.focus()},[]),(0,B.useEffect)(()=>{let e=e=>{if(!(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey)&&!(e.target instanceof HTMLElement&&e.target.closest(`input, textarea, select`))){if(e.key===`ArrowRight`)o(e=>Math.min(d-1,e+1));else if(e.key===`ArrowLeft`)o(e=>Math.max(0,e-1));else return;e.preventDefault()}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d]);let p=e.steps[a],m=rM(e,p.body,t.system),h=e.features.timers?Bj(m):[],g=e.type===`workout`?Kj(m):null,_=s[a]??0,v=g?.restIndex??null,y=v!==null&&n.read(fM(a,v),h[v].seconds).status!==`idle`?v:h.findIndex((e,t)=>t!==v),b=y===-1?h.length?0:null:y,x=b===null?null:{id:fM(a,b),seconds:h[b].seconds},S=x?n.read(x.id,x.seconds):null;return(0,hM.createPortal)(z(`div`,{ref:l,className:`render-guided`,role:`dialog`,"aria-modal":`true`,"aria-label":e.title,tabIndex:-1,children:[z(`div`,{className:`render-guided__top`,children:[z(`div`,{className:`render-guided__heading`,children:[L(`span`,{className:`render-guided__guide-title`,children:e.title}),e.items.length>0&&z(`details`,{className:`render-guided__items`,children:[L(`summary`,{children:i(e.features.itemsLabel)}),L(`ul`,{children:e.items.map((n,r)=>{let{qty:i,text:a}=nM(e,r,t);return z(`li`,{children:[i&&L(`strong`,{children:i}),` `,a]},r)})})]})]}),L(`button`,{type:`button`,className:`render-guided__icon`,onClick:r,"aria-label":i(`cards.closeGuided`),children:L(nc,{size:22})})]}),z(`div`,{className:`render-guided__stage`,children:[L(`h2`,{className:`render-guided__step-title`,children:p.title??i(`cards.stepTitle`,{n:a+1})}),L(`p`,{className:`render-guided__step-text`,children:L(mM,{text:m,stepIndex:a,timers:n,withTimers:e.features.timers})}),g?.sets&&z(`div`,{className:`render-guided__sets`,children:[L(`span`,{children:i(_>=g.sets?`cards.setAllDone`:`cards.setProgress`,{n:Math.min(_+1,g.sets),total:g.sets})}),L(`button`,{type:`button`,className:`render-guided__button`,onClick:()=>{if(g?.sets&&(c(e=>({...e,[a]:Math.min(g.sets,_+1)})),v!==null&&_+1<g.sets)){let e=fM(a,v);n.reset(e),n.toggle(e,h[v].seconds)}},disabled:_>=g.sets,children:i(`cards.setDone`)})]}),x&&S&&z(`div`,{className:`render-guided__timer is-${S.status}`,children:[L(`span`,{className:`render-guided__clock`,role:`timer`,children:S.status===`done`?i(`cards.done`):Vj(S.remainingSeconds)}),z(`div`,{className:`render-guided__timer-actions`,children:[z(`button`,{type:`button`,className:`render-guided__button is-primary`,onClick:()=>n.toggle(x.id,x.seconds),children:[S.status===`running`?L(Mo,{size:16}):L(Ho,{size:16}),i(S.status===`running`?`cards.pause`:S.status===`paused`?`cards.resume`:`cards.start`)]}),S.status!==`idle`&&z(`button`,{type:`button`,className:`render-guided__button`,onClick:()=>n.reset(x.id),children:[L(Is,{size:14}),` `,i(`cards.stop`)]})]})]})]}),z(`div`,{className:`render-guided__nav`,children:[L(`button`,{type:`button`,className:`render-guided__icon`,onClick:()=>o(e=>Math.max(0,e-1)),disabled:a===0,"aria-label":i(`cards.prevStep`),children:L(ti,{size:26})}),z(`div`,{className:`render-guided__progress`,children:[L(`span`,{"aria-live":`polite`,children:i(`cards.stepOf`,{n:a+1,total:d})}),!u&&L(`span`,{className:`render-guided__note`,children:i(`cards.screenMaySleep`)})]}),f?L(`button`,{type:`button`,className:`render-guided__button is-primary`,onClick:r,children:i(`cards.finish`)}):L(`button`,{type:`button`,className:`render-guided__icon`,onClick:()=>o(e=>Math.min(d-1,e+1)),"aria-label":i(`cards.nextStep`),children:L(ri,{size:26})})]})]}),document.body)}var vM=250,yM=null;function bM(){yM||typeof window>`u`||typeof window.AudioContext!=`function`||(yM=new window.AudioContext)}function xM(){if(!yM)return;let e=yM.currentTime;[0,.35,.7].forEach(t=>{let n=yM.createOscillator(),r=yM.createGain();n.frequency.value=880,r.gain.setValueAtTime(1e-4,e+t),r.gain.exponentialRampToValueAtTime(.25,e+t+.02),r.gain.exponentialRampToValueAtTime(1e-4,e+t+.3),n.connect(r).connect(yM.destination),n.start(e+t),n.stop(e+t+.32)})}function SM(){let[e,t]=(0,B.useState)({}),[n,r]=(0,B.useState)(()=>Date.now()),i=(0,B.useRef)(e);(0,B.useEffect)(()=>{i.current=e},[e]);let a=Object.values(e).some(e=>e.status===`running`);(0,B.useEffect)(()=>{if(!a)return;let e=setInterval(()=>{let e=Date.now();r(e);let n=Object.entries(i.current).filter(([,t])=>t.status===`running`&&t.endsAt!==null&&t.endsAt<=e);n.length&&(t(e=>{let t={...e};for(let[e]of n)t[e]={...t[e],status:`done`,endsAt:null,leftMs:0};return t}),xM())},vM);return()=>clearInterval(e)},[a]);let o=(0,B.useCallback)((e,n)=>{bM();let i=Date.now();r(i),t(t=>{let r=t[e],a=n*1e3;return!r||r.status===`idle`||r.status===`done`?{...t,[e]:{status:`running`,totalMs:a,endsAt:i+a,leftMs:a}}:r.status===`running`?{...t,[e]:{...r,status:`paused`,endsAt:null,leftMs:Math.max(0,r.endsAt-i)}}:{...t,[e]:{...r,status:`running`,endsAt:i+r.leftMs}}})},[]),s=(0,B.useCallback)(e=>{t(t=>{if(!t[e])return t;let n={...t};return delete n[e],n})},[]),c=(0,B.useCallback)((t,r)=>{let i=e[t];if(!i)return{status:`idle`,remainingSeconds:r};let a=i.status===`running`&&i.endsAt!==null?Math.max(0,i.endsAt-n):i.leftMs;return{status:i.status,remainingSeconds:a/1e3}},[e,n]);return(0,B.useMemo)(()=>({read:c,toggle:o,reset:s}),[c,o,s])}var CM=`gaia:guide-tip-dismissed`,wM=`gaia:guide-tip-dismissed`;function TM(){try{return localStorage.getItem(CM)===`1`}catch(e){return console.warn(`[guide] could not read whether the card tip was dismissed; showing it`,e),!1}}function EM(e){return window.addEventListener(wM,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(wM,e),window.removeEventListener(`storage`,e)}}function DM(){if(!TM()){try{localStorage.setItem(CM,`1`)}catch(e){console.warn(`[guide] could not save that the card tip was dismissed; it may show again`,e)}window.dispatchEvent(new Event(wM))}}function OM(){return(0,B.useSyncExternalStore)(EM,TM,()=>!0)}var kM=99,AM=2500,jM=e=>`gaia:guide:${e.key}`;function MM(e){try{let t=localStorage.getItem(jM(e)),n=t?JSON.parse(t):[];return new Set(Array.isArray(n)?n.filter(e=>Number.isInteger(e)):[])}catch(t){return console.warn(`[guide] could not read saved checks for "${e.title}"; starting unchecked`,t),new Set}}function NM(e,t){try{t.size?localStorage.setItem(jM(e),JSON.stringify([...t])):localStorage.removeItem(jM(e))}catch(t){console.warn(`[guide] could not save checks for "${e.title}"; they hold until the chat closes`,t)}}function PM({data:e}){return Zj(e)?L(FM,{wire:e}):L(Wk,{variant:`invalid`,render:`guide`,data:e})}function FM({wire:e}){let t=R(),n=(0,B.useMemo)(()=>eM(e),[e]),[r,i]=(0,B.useState)(n.baseServings),[a,o]=(0,B.useState)(n.nativeSystem),[s,c]=(0,B.useState)(()=>MM(n)),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(null),p=SM(),m=OM(),h={servings:r,system:a,checked:s},{features:g}=n,_=t(`cards.copied`);(0,B.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>f(null),AM);return()=>clearTimeout(e)},[d]);let v=e=>{let t=new Set(s);t.has(e)?t.delete(e):t.add(e),c(t),NM(n,t)},y=e=>n=>f(t(e,{error:n instanceof Error?n.message:String(n)})),b=()=>{sM(oM(n,h,t)).then(()=>f(_),y(`cards.copyFailed`))},x=()=>{lM(n.title,oM(n,h,t)).catch(y(`cards.shareFailed`))},S=()=>{try{dM(n.title,oM(n,h,t))}catch(e){y(`cards.printFailed`)(e)}},C=a===`us`?`metric`:`us`,w=e=>t.bare(e===`us`?`cards.system.us`:`cards.system.metric`),T=g.units&&n.convertible;return z(`article`,{className:`render-guide`,"aria-label":n.title,children:[z(`header`,{className:`render-guide__header`,children:[L(`h3`,{className:`render-guide__title`,children:n.title}),n.description&&L(`p`,{className:`render-guide__description`,children:n.description})]}),z(`div`,{className:`render-guide__toolbar`,children:[g.scaling&&r!==null&&z(`div`,{className:`render-guide__servings`,role:`group`,"aria-label":t(`cards.servings`),children:[L(`button`,{type:`button`,className:`render-guide__icon`,onClick:()=>{DM(),i(e=>Math.max(1,(e??1)-1))},disabled:r<=1,"aria-label":t(`cards.fewerServings`),children:L(mo,{size:14})}),L(`output`,{className:`render-guide__servings-count`,"aria-live":`polite`,children:iM(t,r)}),L(`button`,{type:`button`,className:`render-guide__icon`,onClick:()=>{DM(),i(e=>Math.min(kM,(e??1)+1))},disabled:r>=kM,"aria-label":t(`cards.moreServings`),children:L(Ko,{size:14})})]}),z(`div`,{className:`render-guide__tools`,children:[T&&z(`button`,{type:`button`,className:`render-guide__tool`,onClick:()=>{DM(),o(C)},"aria-label":t(`cards.unitsSwitch`,{current:w(a),other:w(C)}),title:t(`cards.unitsTitle`,{other:w(C)}),children:[L(os,{size:15}),L(`span`,{children:w(a)})]}),cM()&&L(`button`,{type:`button`,className:`render-guide__icon`,onClick:x,"aria-label":t(`cards.share`),title:t(`cards.share`),children:L(gs,{size:15})}),L(`button`,{type:`button`,className:`render-guide__icon`,onClick:S,"aria-label":t(`cards.print`),title:t(`cards.print`),children:L(Jo,{size:15})}),L(`button`,{type:`button`,className:`render-guide__icon`,onClick:b,"aria-label":t(`cards.copy`),title:t(`cards.copy`),children:L(d===_?Yr:Ti,{size:15})})]}),g.startLabel&&n.steps.length>0&&z(`button`,{type:`button`,className:`render-guide__start`,onClick:()=>{DM(),u(!0)},children:[L(Ho,{size:14}),t(g.startLabel)]})]}),L(`p`,{className:`render-guide__notice`,role:`status`,children:d}),n.items.length>0&&z(`section`,{className:`render-guide__section`,children:[L(`h4`,{className:`render-guide__label`,children:t(g.itemsLabel)}),L(`ul`,{className:`render-guide__items`,children:n.items.map((e,t)=>{let{qty:r,text:i}=nM(n,t,h),o=z(P.Fragment,{children:[r&&L(`span`,{className:`render-guide__qty`,children:r}),r&&` `,rM(n,i,a)]});return L(`li`,{className:`render-guide__item${s.has(t)?` is-checked`:``}`,children:g.checkItems?z(`label`,{className:`render-guide__check`,children:[L(`input`,{type:`checkbox`,checked:s.has(t),onChange:()=>v(t)}),L(`span`,{children:o})]}):o},t)})})]}),n.steps.length>0&&g.stepsLabel&&z(`section`,{className:`render-guide__section`,children:[L(`h4`,{className:`render-guide__label`,children:t(g.stepsLabel)}),L(`ol`,{className:`render-guide__steps${g.timeline?` is-timeline`:``}`,children:n.steps.map((e,r)=>{let i=aM(n,r,e=>t(`cards.dayN`,{n:e}));return z(`li`,{className:`render-guide__step`,children:[g.timeline?L(`span`,{className:`render-guide__step-dot`,"aria-hidden":`true`}):L(`span`,{className:`render-guide__step-number`,"aria-hidden":`true`,children:r+1}),z(`div`,{className:`render-guide__step-body`,children:[i&&L(`span`,{className:`render-guide__step-title`,children:i}),L(`span`,{children:L(mM,{text:rM(n,e.body,a),stepIndex:r,timers:p,withTimers:g.timers})})]})]},r)})})]}),n.notes&&z(`aside`,{className:`render-guide__notes`,children:[L(`h4`,{className:`render-guide__label`,children:t(`cards.notes`)}),L(`p`,{children:rM(n,n.notes,a)})]}),g.tip&&!m&&z(`div`,{className:`render-guide__tip`,role:`note`,children:[L(Ua,{size:15,"aria-hidden":`true`}),L(`span`,{children:t(g.tip)}),L(`button`,{type:`button`,className:`render-guide__icon`,onClick:DM,"aria-label":t(`cards.dismissTip`),children:L(nc,{size:14})})]}),l&&L(_M,{doc:n,state:h,timers:p,onClose:()=>u(!1)})]})}function IM({bill:e,tipPercent:t,people:n}){let r=e*t/100,i=e+r;return{tip:r,total:i,perPerson:i/n}}function LM({amount:e,annualRatePercent:t,years:n,downPayment:r}){let i=Math.max(0,e-r),a=Math.round(n*12),o=t/100/12,s=a===0?0:o===0?i/a:i*o/(1-(1+o)**-a),c=s*a;return{principal:i,monthly:s,totalPaid:c,interest:c-i}}var RM={tip:{defaultTitle:`cards.calc.tipTitle`,fields:{bill:{label:`cards.calc.bill`,min:0,max:1e9,step:.01,format:`currency`,sliderMax:500},tipPercent:{label:`cards.calc.tip`,min:0,max:100,step:1,format:`percent`,sliderMax:40},people:{label:`cards.calc.people`,min:1,max:50,step:1,format:`count`,sliderMax:20,integer:!0}},validWire:e=>e.bill>0&&e.people>=1,results:e=>{let{tip:t,total:n,perPerson:r}=IM(e),i=e.people>1;return[{label:`cards.calc.tip`,value:t,format:`currency`},{label:`cards.calc.total`,value:n,format:`currency`,primary:!i},...i?[{label:`cards.calc.perPerson`,value:r,format:`currency`,primary:!0}]:[]]}},loan:{defaultTitle:`cards.calc.loanTitle`,fields:{amount:{label:`cards.calc.price`,min:0,max:1e10,step:1e3,format:`currency`,sliderMax:1e6},downPayment:{label:`cards.calc.downPayment`,min:0,max:1e10,step:1e3,format:`currency`,sliderMax:3e5},annualRatePercent:{label:`cards.calc.rate`,min:0,max:50,step:.05,format:`percent`,sliderMax:15},years:{label:`cards.calc.term`,min:1,max:50,step:1,format:`years`}},validWire:e=>e.amount>0&&e.years>=1&&e.downPayment<e.amount,results:e=>{let{principal:t,monthly:n,totalPaid:r,interest:i}=LM(e);return[{label:`cards.calc.monthly`,value:n,format:`currency`,primary:!0},{label:`cards.calc.loanAmount`,value:t,format:`currency`},{label:`cards.calc.totalPaid`,value:r,format:`currency`},{label:`cards.calc.totalInterest`,value:i,format:`currency`}]}}};function zM(e){return RM[e]}function BM(e){if(!e||typeof e!=`object`)return!1;let t=e;if(t.kind!==`calculator`||t.calculator!==`tip`&&t.calculator!==`loan`||t.title!==void 0&&t.title!==null&&typeof t.title!=`string`||typeof t.currency!=`string`||!VM(t.currency)||!t.inputs||typeof t.inputs!=`object`)return!1;let n=t.inputs,r=zM(t.calculator);for(let[e,t]of Object.entries(r.fields)){let r=n[e];if(typeof r!=`number`||!Number.isFinite(r)||r<0||r>t.max||t.integer&&!Number.isInteger(r))return!1}return r.validWire(n)}function VM(e){if(!/^[A-Z]{3}$/.test(e))return!1;try{return new Intl.NumberFormat(`en`,{style:`currency`,currency:e}),!0}catch{return!1}}function HM(){return typeof navigator<`u`&&navigator.language||`en-US`}function UM(e,t,{locale:n,currency:r},i=mt){switch(t){case`currency`:return new Intl.NumberFormat(n,{style:`currency`,currency:r}).format(e);case`percent`:return new Intl.NumberFormat(n,{style:`percent`,maximumFractionDigits:2}).format(e/100);case`years`:{let t=new Intl.NumberFormat(n,{maximumFractionDigits:2}).format(e);return i.bare(u(`cards.years`,e),{n:t})}case`count`:return new Intl.NumberFormat(n).format(e)}}function WM({locale:e,currency:t}){return new Intl.NumberFormat(e,{style:`currency`,currency:t}).formatToParts(0).find(e=>e.type===`currency`)?.value??``}function GM(e,t,n,r,i=mt){let a=[e];for(let[e,o]of Object.entries(t.fields))a.push(`${i.bare(o.label)}: ${UM(n[e],o.format,r,i)}`);a.push(``);for(let e of t.results(n))a.push(`${i.bare(e.label)}: ${UM(e.value,e.format,r,i)}`);return a.join(`
|
|
172
|
-
`)}var KM=2500;function qM({data:e}){return BM(e)?L(JM,{wire:e}):L(Wk,{variant:`invalid`,render:`calculator`,data:e})}function JM({wire:e}){let t=R(),n=zM(e.calculator),r=(0,B.useMemo)(()=>({locale:HM(),currency:e.currency}),[e.currency]),[i,a]=(0,B.useState)(()=>({...e.inputs})),[o,s]=(0,B.useState)(null),c=e.title?.trim()||t(n.defaultTitle),l=n.results(i),u=t(`cards.copied`);return(0,B.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>s(null),KM);return()=>clearTimeout(e)},[o]),z(`article`,{className:`render-guide render-calc`,"aria-label":c,children:[z(`header`,{className:`render-calc__header`,children:[L(`h3`,{className:`render-guide__title`,children:c}),L(`button`,{type:`button`,className:`render-guide__icon`,onClick:()=>{sM(GM(c,n,i,r,t)).then(()=>s(u),e=>s(t(`cards.copyFailed`,{error:e instanceof Error?e.message:String(e)})))},"aria-label":t(`cards.copy`),title:t(`cards.copy`),children:L(o===u?Yr:Ti,{size:15})})]}),L(`p`,{className:`render-guide__notice`,role:`status`,children:o}),L(`div`,{className:`render-calc__fields`,children:Object.entries(n.fields).map(([e,t])=>L(YM,{field:t,value:i[e],money:r,onChange:t=>a(n=>({...n,[e]:t}))},e))}),L(`dl`,{className:`render-calc__results`,"aria-live":`polite`,children:l.map(e=>z(`div`,{className:`render-calc__result${e.primary?` is-primary`:``}`,children:[L(`dt`,{children:t(e.label)}),L(`dd`,{children:UM(e.value,e.format,r,t)})]},e.label))})]})}function YM({field:e,value:t,money:n,onChange:r}){let i=R(),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1),l=Math.min(e.max,Math.max(e.sliderMax??e.max,t)),u=e.format===`currency`?WM(n):``,d=e.format===`percent`?`%`:e.format===`years`?i.bare(`cards.yearsShort`):``,f=i(e.label),p=t=>{o(t);let n=Number(t);t.trim()===``||!Number.isFinite(n)||n<e.min||n>e.max||(!e.integer||Number.isInteger(n))&&r(n)};return z(`div`,{className:`render-calc__field`,children:[z(`label`,{className:`render-calc__label`,children:[L(`span`,{children:f}),z(`span`,{className:`render-calc__box`,children:[u&&L(`span`,{className:`render-calc__affix`,children:u}),L(`input`,{type:s?`number`:`text`,inputMode:`decimal`,min:e.min,max:e.max,step:e.step,value:a??(s?String(t):new Intl.NumberFormat(n.locale,{maximumFractionDigits:10}).format(t)),"aria-label":f,onChange:e=>p(e.target.value),onFocus:()=>c(!0),onBlur:()=>{c(!1),o(null)}}),d&&L(`span`,{className:`render-calc__affix`,children:d})]})]}),L(`input`,{type:`range`,className:`render-calc__slider`,min:e.min,max:l,step:e.step,value:t,"aria-label":i(`cards.slider`,{name:f}),"aria-valuetext":UM(t,e.format,n,i),onChange:e=>{o(null),r(Number(e.target.value))}})]})}var XM={table:Xk,key_value:Qk,list:eA,image:aA,audio:cA,diff:mA,needs_confirmation:_A,needs_input:zA,connect_account:ej,guide:PM,calculator:qM},ZM=class extends B.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?L(`div`,{role:`alert`,className:`render-card-error`,children:`Card failed to render`}):this.props.children}};function QM({render:e,data:t}){let n=XM[e];return L(`div`,{className:`render-card`,children:n?L(ZM,{children:L(n,{data:t})}):L(Wk,{variant:`unknown`,render:e,data:t})})}var $M=/(^|\n)[ \t]*```[^\n]*\n([\s\S]*?)(?:(?:(?<=\n)|\n)[ \t]*```[ \t]*(?=\n|$)|$)/g;function eN(e){let t=[];return e.replace(/`([^`\n]+)`/g,(e,n)=>`\u0000${t.push(n)-1}\u0000`).replace(/\\([\\`*_{}[\]()#+\-.!|~>])/g,(e,n)=>`\u0000${t.push(n)-1}\u0000`).replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\[([^\]]+)\]\(([^)]*)\)/g,(e,t,n)=>t===n||!n?t:`${t} (${n})`).replace(/^[ \t]*([-*_][ \t]*){3,}$/gm,``).replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm,``).replace(/^([ \t]*)>[ \t]?/gm,`$1`).replace(/^([ \t]*)[-*+][ \t]+/gm,`$1• `).replace(/^[ \t]*\|?[ \t:|-]+\|[ \t:|-]*\n?/gm,``).replace(/^[ \t]*\|(.*?)\|?[ \t]*$/gm,(e,t)=>t.split(`|`).map(e=>e.trim()).join(` `)).replace(/(\*\*|\*|~~)(\S(?:[^\n]*?\S)?)\1/g,`$2`).replace(/(?<!\w)(__|_)(\S(?:[^\n]*?\S)?)\1(?!\w)/g,`$2`).replace(/\u0000(\d+)\u0000/g,(e,n)=>t[Number(n)])}function tN(e){let t=``,n=0;for(let r of e.matchAll($M)){let i=r.index??0;t+=eN(e.slice(n,i))+r[1]+r[2],n=i+r[0].length}return t+=eN(e.slice(n)),t.replace(/\n{3,}/g,`
|
|
173
|
-
|
|
174
|
-
`).trim()}function nN(e){return!e||e===`Thinking...`||e.startsWith(`Reading `)||/— retrying (now|in \d+s)/.test(e)}var rN=/failed to fetch|networkerror|load failed/i;function iN(e){return e instanceof TypeError&&rN.test(e.message)}function aN(e){return iN(e)?We(`request.gaiaUnreachable`):e instanceof Vn?/\blocal only is on\b/i.test(e.detail)?We(`settings.privacy.localOnlyBlocked`):e.detail||e.message:e instanceof Error?e.message:String(e)}function oN(e,t=Ut()){let n=aN(e);return typeof n==`object`?t(n.ref,n.params):String(n)}var sN=new Map;function cN(e){let t=sN.get(e);return t||(t={byMessage:new Map,checked:new Set,inFlight:null,listeners:new Set},sN.set(e,t)),t}function lN(e){let t=cN(e);return t.inFlight||=Promise.resolve().then(()=>xt(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 uN(e){return lN(e)}function dN(e,t){let[n,r]=(0,B.useState)(()=>sN.get(e)?.byMessage.get(t)??null),[i,a]=(0,B.useState)(null);return(0,B.useEffect)(()=>{if(t<=0)return;let n=cN(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),lN(e).then(()=>a(null),e=>{n.checked.delete(t),a(aN(e))})):i(),()=>{n.listeners.delete(i)}},[e,t]),{turn:n,error:i,refresh:(0,B.useCallback)(()=>lN(e),[e])}}var fN=`gaia:changes-undone`;function pN(e){window.dispatchEvent(new CustomEvent(fN,{detail:e}))}function mN(e,t){let n=(0,B.useRef)(t);n.current=t,(0,B.useEffect)(()=>{let t=t=>{t.detail===e&&n.current()};return window.addEventListener(fN,t),()=>window.removeEventListener(fN,t)},[e])}var hN={shell:{count:`untracked.count.shell`,one:`untracked.one.shell`,bare:`untracked.bare.shell`,many:`untracked.many.shell`},run_python:{count:`untracked.count.python`,one:`untracked.one.python`,bare:`untracked.bare.python`,many:`untracked.many.python`},execute_python_file:{count:`untracked.count.script`,one:`untracked.one.script`,bare:`untracked.bare.script`,many:`untracked.many.script`},mcp:{count:`untracked.count.mcp`,one:`untracked.one.mcp`,bare:`untracked.bare.mcp`,many:`untracked.many.mcp`},install_cli:{count:`untracked.count.install`,one:`untracked.one.install`,bare:`untracked.bare.install`,many:`untracked.many.install`},late_write:{count:`untracked.count.lateWrite`,one:`untracked.one.lateWrite`,bare:`untracked.bare.lateWrite`,many:`untracked.many.lateWrite`}},gN=120;function _N(e){let t=e.replace(/\s+/g,` `).trim();return t.length>gN?`${t.slice(0,119).trimEnd()}…`:t}function vN(e,t,n){let r=hN[e];return r?n.plural(r.count,t):`${t} ${e}`}function yN(e,t,n,r){let i=hN[e];if(n.length!==1)return`${i?r(i.many):e} ×${t}`;let a=n[0],o;return o=i?a.label?r(i.one,{label:a.label}):r(i.bare):a.label?`${e}: ${a.label}`:e,a.count>1?`${o} ×${a.count}`:o}function bN(e,t=mt){let n=new Map;for(let t of e){let e=n.get(t.kind);e||(e={kind:t.kind,count:0,entries:new Map},n.set(t.kind,e)),e.count+=1;let r=(t.detail??``).trim(),i=e.entries.get(r);i?i.count+=1:e.entries.set(r,{label:_N(r),detail:r,count:1})}return[...n.values()].map(({kind:e,count:n,entries:r})=>{let i=[...r.values()];return{kind:e,title:yN(e,n,i,t),count:n,entries:i}})}function xN(e,t=mt){let n=bN(e,t).map(e=>vN(e.kind,e.count,t));return n.length===0?t(`untracked.work`):n.length===1?n[0]:t(`untracked.and`,{list:n.slice(0,-1).join(t(`untracked.sep`)),last:n[n.length-1]})}function SN(e,{also:t=!1,inChat:n=!1}={},r=mt){let i=n?`untracked.warningChat`:t?`untracked.warningAlso`:`untracked.warning`;return r.plural(i,e.length,{work:xN(e,r)})}var CN={edited:`Edited`,created:`Created`,deleted:`Deleted`};function wN(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 TN({sessionId:e,turn:t,onClose:n}){let[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null);ut(!0,n);let s=(0,B.useRef)(null);return un(s,!0),(0,B.useEffect)(()=>{let n=!0;return tt(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,hM.createPortal)(L(`div`,{ref:s,className:`modal-overlay`,onClick:n,role:`dialog`,"aria-modal":`true`,"aria-label":`Review changes`,children:z(`div`,{className:`modal-panel changes-review`,onClick:e=>e.stopPropagation(),children:[z(`div`,{className:`modal-header`,children:[L(`h3`,{children:`Changes in this turn`}),L(`button`,{type:`button`,className:`btn-icon`,onClick:n,"aria-label":`Close`,children:L(nc,{size:18})})]}),z(`div`,{className:`modal-body changes-review-body`,children:[a&&z(`p`,{className:`settings-error`,role:`alert`,children:[`Could not load the changes: `,a]}),!r&&!a&&z(`p`,{className:`changes-review-loading`,children:[L(Za,{size:13,className:`spin`}),` Loading changes…`]}),r?.map(e=>L(`section`,{className:`changes-review-file`,children:L(mA,{data:{path:e.path,badge:CN[e.change],note:wN(e),unified:e.binary||e.too_large?``:e.unified}})},e.path)),t.restored_at&&L(`p`,{className:`settings-hint`,children:`This turn was undone; these are the changes it had made.`})]})]})}),document.body)}function EN(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function DN({sessionId:e,messageId:t}){let n=R(),{turn:r,error:i,refresh:a}=dN(e,t),[o,s]=(0,B.useState)(`idle`),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(!1),f=(0,B.useCallback)(async t=>{if(r){s(`working`),l(null);try{let n=await x(e,r.turn_id,t),i=[];n.restored.length&&i.push(`restored ${EN(n.restored.length,`file`)}`),n.removed.length&&i.push(`removed ${EN(n.removed.length,`new file`)}`);let o=`Undone: ${i.join(`, `)||`no files needed changing`}.`;n.kept_folders.length&&(o+=` Kept ${EN(n.kept_folders.length,`folder`)} it created, because they now hold other files.`),l(o),s(`done`),pN(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 z(`div`,{className:`turn-changes is-error`,role:`note`,children:[L(Ws,{size:12,"aria-hidden":`true`}),L(`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=bN(r.untracked,n);return z(`div`,{className:`turn-changes`,"aria-label":`File changes from this turn`,children:[p>0&&z(`div`,{className:`turn-changes-row`,children:[z(`span`,{className:`turn-changes-summary`,children:[`Changed `,EN(p,`file`),m&&` · undone`]}),z(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>d(!0),children:[L(Yi,{size:12,"aria-hidden":`true`}),` Review changes`]}),!m&&o!==`confirm`&&o!==`conflict`&&z(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>s(`confirm`),disabled:o===`working`,children:[L(Ks,{size:12,"aria-hidden":`true`}),` `,o===`working`?`Undoing…`:`Undo this turn`]}),o===`confirm`&&z(`span`,{className:`turn-changes-confirm`,role:`group`,"aria-label":`Confirm undo`,children:[`Put `,EN(p,`file`),` back the way `,p===1?`it was`:`they were`,` before this turn?`,L(`button`,{type:`button`,className:`turn-changes-btn is-primary`,onClick:()=>void f(!1),children:`Undo`}),L(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>s(`idle`),children:`Cancel`})]})]}),r.incomplete&&z(`div`,{className:`turn-changes-warning`,role:`note`,children:[L(Ws,{size:12,"aria-hidden":`true`}),z(`span`,{children:[SN(r.untracked,{also:p>0},n),h.length>0&&L(`ul`,{children:h.map(e=>L(`li`,{children:e.entries.length===1?L(`span`,{title:e.entries[0].detail||void 0,children:e.title}):z(`details`,{children:[L(`summary`,{children:e.title}),L(`ul`,{children:e.entries.map(e=>z(`li`,{title:e.detail||void 0,children:[e.label||n(`untracked.noDescription`),e.count>1&&` ×${e.count}`]},e.detail))})]})},e.kind))})]})]}),c&&z(`div`,{className:`turn-changes-message${o===`done`?` is-ok`:` is-error`}`,role:o===`done`?`status`:`alert`,children:[c,o===`conflict`&&z(`span`,{className:`turn-changes-confirm`,children:[L(`button`,{type:`button`,className:`turn-changes-btn is-danger`,onClick:()=>void f(!0),children:`Undo anyway and lose those changes`}),L(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>{s(`idle`),l(null)},children:`Keep them`})]})]}),u&&L(TN,{sessionId:e,turn:r,onClose:()=>d(!1)})]})}async function ON(){return Ct(`GET`,`/speech/settings`)}async function kN(e){return Ct(`PUT`,`/speech/settings`,e)}async function AN(){return Ct(`GET`,`/speech/model`)}var jN=1e3;async function MN(e,t={}){let n=`${Hn()}/speech`,r=F.api.time();F.api.info(`POST ${n}`,{chars:e.length,voice:t.voice});let i=await fetch(n,{method:`POST`,headers:{...qt,"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(()=>``);F.api.error(`POST ${n} - HTTP ${i.status}`,{errorText:e});let t=xn(e);throw new Vn(C(i.status,t),i.status,t,sn(e))}let a=await i.blob();return F.api.timed(`POST ${n} -> ${i.status} (${a.size} bytes)`,r),a}function NN(e){return e.replace(/```[\s\S]*?(```|$)/g,`
|
|
175
|
-
`).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(`
|
|
176
|
-
`).map(e=>e.trim()).filter(Boolean).join(`
|
|
177
|
-
`).trim()}function PN(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 FN(e,t=1e3){let n=NN(e);if(!n)return[];let r=n.split(/(?<=[.!?…؟])\s+|\n+/).flatMap((e,n)=>PN(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 IN=class extends Error{};function LN(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 IN||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 RN=null;function zN(e){e.abort.abort(),e.audio&&(e.audio.pause(),e.audio.src=``),e.urls.forEach(e=>URL.revokeObjectURL(e)),e.urls=[]}function BN(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 IN(a.error?.message||`media error ${a.error?.code??``}`.trim())),e.abort.signal.addEventListener(`abort`,o),a.play().catch(r)})}var VN=Pt((e,t)=>({messageId:null,status:null,error:null,settings:null,voiceReady:!1,downloadGb:null,setSettings:t=>e({settings:t}),stop:()=>{RN&&zN(RN),RN=null,e({messageId:null,status:null,downloadGb:null})},clearError:()=>e({error:null}),read:async(n,r)=>{t().stop();let i=FN(r,jN);if(i.length===0){e({error:{messageId:n,kind:`nothing`,detail:``}});return}let a={abort:new AbortController,audio:null,urls:[]};RN=a,e({messageId:n,status:`loading`,error:null});let o=e=>{let t=MN(e,{signal:a.abort.signal});return t.catch(()=>void 0),t};try{if(!t().voiceReady){let t=await AN();if(RN!==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(RN!==a||(t+1<i.length&&(n=o(i[t+1])),e({status:`playing`,voiceReady:!0,downloadGb:null}),await BN(a,r),RN!==a))return}}catch(t){if(RN!==a||a.abort.signal.aborted)return;F.ui.error(`Read aloud failed`,t),e({error:LN(n,t)})}RN===a&&(zN(a),RN=null,e({messageId:null,status:null,downloadGb:null}))}}));function HN({messageId:e,content:t}){let n=R(),r=VN(t=>t.messageId===e),i=VN(t=>t.messageId===e?t.status:null),a=VN(e=>e.read),o=VN(e=>e.stop),s=n(r?`readAloud.stop`:`readAloud.read`);return L(`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`?L(Za,{size:12,className:`spin`}):L(r?Is:Xs,{size:12})})}function UN({messageId:e}){let t=R(),n=VN(t=>t.messageId===e&&t.status===`downloading`),r=VN(e=>e.downloadGb);return n?z(`p`,{className:`msg-read-aloud-note`,role:`status`,children:[t(`readAloud.downloading`),r!=null&&z(P.Fragment,{children:[` `,z(`bdi`,{dir:`ltr`,children:[`(~`,r,` GB)`]})]})]}):null}function WN({messageId:e}){let t=R(),n=VN(t=>t.error?.messageId===e?t.error:null),r=VN(e=>e.clearError);return n?z(`p`,{className:`msg-read-aloud-error`,role:`alert`,children:[z(`span`,{children:[t(`readAloud.error.${n.kind}`),n.detail&&L(`span`,{className:`msg-read-aloud-detail`,children:L(`bdi`,{children:n.detail})})]}),L(`button`,{type:`button`,className:`msg-action-btn`,onClick:r,"aria-label":t(`readAloud.dismiss`),title:t(`readAloud.dismiss`),children:L(nc,{size:12})})]}):null}var GN=[0,3e3,1e4],KN=`The answer to your last message was lost: its run stopped before it finished, most often because GAIA restarted. Send the message again.`;function qN(e){return e.name===`StreamStalledError`||e.name===`StreamDroppedError`}function JN(e){return e.name===`StreamDroppedError`&&e.unreachable===!0}function YN(e){return JN(e)?!1:qN(e)||e instanceof Mn}function XN(e,t=Ut()){if(JN(e))return t(`chatError.gaiaStopped`);if(qN(e))return t(`chatError.liveViewLost`,{n:4});if(e instanceof Mn)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?xn(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 ZN=/context (window|size|length|limit)|exceeds the available context|maximum context|too many tokens/i,QN=/lemonade|\bLLM\b|could not get response/i,$N=/failed to fetch|networkerror|\bfetch\b/i,eP=/timed out|timeout/i,tP=/\bGF-\d{8}-\d{6}-[0-9a-f]{4}\b/;function nP(e){return tP.exec(e)?.[0]??null}function rP(e,t=Ut()){let n=iP(e,t),r=nP(e.message||``);return r?{...n,text:`${n.text}\n\n${t(`chatError.savedReport`,{id:r})}`}:n}function iP(e,t){let n=XN(e,t);if(n)return{kind:`stream`,text:n};let r=e.message||``;return ZN.test(r)?{kind:`context`,text:t(`chatError.context`)}:QN.test(r)?{kind:`model_server`,text:t(`chatError.modelServer`)}:e instanceof TypeError||$N.test(r)?{kind:`connection`,text:t(`chatError.connection`)}:eP.test(r)?{kind:`timeout`,text:t(`chatError.timeout`)}:{kind:`unknown`,text:t(`chatError.unknown`)}}function aP(e){return nP(e)!==null}function oP(e){return e instanceof Error?e.message:String(e)}function sP({classes:e,note:t}){let n=R(),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(null),l=(0,B.useCallback)(async()=>{i(!0),c(null),o(null);try{let e=await or(),t=await ee(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:oP(e)}))}finally{i(!1)}},[n]);return z(`div`,{className:e.root,children:[z(`button`,{type:`button`,className:e.button,onClick:()=>void l(),disabled:r,children:[r?L(Za,{size:13,className:`spin`,"aria-hidden":`true`}):L(Zi,{size:13,"aria-hidden":`true`}),L(`span`,{children:n(`setup.logs.report`)})]}),t&&L(`span`,{className:e.hint,children:t}),a&&z(`p`,{className:e.hint,role:`status`,children:[n(`setup.logs.reportSaved`,{size:Dk(a.size_bytes)}),` `,L(`bdi`,{dir:`ltr`,children:a.path})]}),s&&L(`p`,{className:e.error,role:`alert`,children:s})]})}function cP(e){let t=Uint8Array.from(atob(e.crop),e=>e.charCodeAt(0));return new File([t],`picked-${e.ref}.png`,{type:`image/png`})}function lP(e){let{crop:t,outerHTML:n,styles:r,...i}=e.element;return{...i,outerHTML:e.include.html?n:null,styles:e.include.styles?r:null,cropUrl:e.include.screenshot?e.cropUrl:null}}var uP=Pt((e,t)=>{let n=(t,n)=>e(e=>({chips:e.chips.map(e=>e.element.ref===t?{...e,...n}:e)})),r=e=>{Ge(cP(e)).then(t=>n(e.ref,{uploading:!1,cropUrl:t.url})).catch(t=>{F.chat.error(`Could not upload the picture of picked element ${e.ref}`,t),n(e.ref,{uploading:!1,error:t instanceof Error?t.message:String(t)})})};return{chips:[],dismissed:[],applyPick:({run:n,elements:i})=>{let a=new Map(t().chips.map(e=>[e.element.ref,e])),o=[],s=i.filter(e=>!t().dismissed.includes(e.ref)).map(e=>{let t=a.get(e.ref);return t?{...t,element:e,run:n}:(o.push(e),{element:e,run:n,include:{html:!0,styles:!0,screenshot:!1},cropUrl:null,uploading:e.crop!==null,error:null})});e(e=>({chips:[...e.chips.filter(e=>e.run!==n),...s]})),o.filter(e=>e.crop!==null).forEach(r)},toggle:(t,n)=>e(e=>({chips:e.chips.map(e=>e.element.ref===t?{...e,include:{...e.include,[n]:!e.include[n]}}:e)})),remove:t=>e(e=>({chips:e.chips.filter(e=>e.element.ref!==t),dismissed:[...e.dismissed,t]})),take:()=>{let{chips:n}=t();if(n.length!==0)return e({chips:[]}),n.map(lP)}}});function dP(e){let t=e.name.length>40?`${e.name.slice(0,39)}…`:e.name;return t?`${e.label} "${t}"`:e.label}var fP=[{part:`html`,label:`browserPane.chip.part.html`,send:`browserPane.chip.send.html`,leaveOut:`browserPane.chip.leaveOut.html`},{part:`styles`,label:`browserPane.chip.part.styles`,send:`browserPane.chip.send.styles`,leaveOut:`browserPane.chip.leaveOut.styles`},{part:`screenshot`,label:`browserPane.chip.part.screenshot`,send:`browserPane.chip.send.screenshot`,leaveOut:`browserPane.chip.leaveOut.screenshot`}];function pP({chip:e}){let{element:t}=e,n=uP(e=>e.toggle),r=uP(e=>e.remove),i=R(),a=dP(t);return z(`li`,{className:`element-chip${e.error?` has-error`:``}`,"data-ref":t.ref,children:[t.crop?L(`img`,{className:`element-chip-thumb`,src:`data:image/png;base64,${t.crop}`,alt:``}):L(bo,{size:14,"aria-hidden":`true`}),z(`span`,{className:`element-chip-text`,title:`${t.ref}: ${t.selector}\n${t.url}`,children:[L(`span`,{className:`element-chip-label`,children:a}),t.component&&z(`span`,{className:`element-chip-component`,children:[`<`,t.component.name,`>`]})]}),L(`span`,{className:`element-chip-parts`,role:`group`,"aria-label":i(`browserPane.chip.whatToSend`,{label:a}),children:fP.map(({part:r,label:a,send:o,leaveOut:s})=>{let c=r===`screenshot`&&(t.crop===null||e.error!==null);return L(`button`,{type:`button`,className:`element-chip-part`,"aria-pressed":e.include[r]&&!c,disabled:c,title:i(c?`browserPane.chip.noScreenshot`:e.include[r]?s:o),onClick:()=>n(t.ref,r),children:i(a)},r)})}),e.uploading&&L(`span`,{className:`element-chip-state`,children:i(`browserPane.chip.uploading`)}),e.error&&L(`span`,{className:`element-chip-state`,role:`alert`,children:i(`browserPane.chip.uploadFailed`)}),L(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>r(t.ref),"aria-label":i(`browserPane.chip.remove`,{label:a}),children:L(nc,{size:12})})]})}function mP(){let e=uP(e=>e.chips),t=R();return e.length===0?null:z(P.Fragment,{children:[L(`ul`,{className:`element-chips`,"aria-label":t(`browserPane.chip.list`),children:e.map(e=>L(pP,{chip:e},e.element.ref))}),e.length>8&&L(`p`,{className:`composer-limit-error`,role:`alert`,children:t(`browserPane.chip.tooMany`,{max:8,n:e.length-8})})]})}function hP(e){let t=R(),n=uP(t=>t.chips.length===0?null:t.chips.length>8?`browserPane.block.tooMany`:t.chips.some(e=>e.uploading)?`browserPane.block.uploading`:e?`browserPane.block.streaming`:null);return n===null?null:t(n,{max:8})}function gP({elements:e}){let t=R();return L(`ul`,{className:`element-chips is-sent`,"aria-label":t(`browserPane.chip.list`),children:e.map(e=>z(`li`,{className:`element-chip`,"data-ref":e.ref,title:`${e.ref}: ${e.selector}\n${e.url}`,children:[L(bo,{size:14,"aria-hidden":`true`}),z(`span`,{className:`element-chip-text`,children:[L(`span`,{className:`element-chip-label`,children:dP(e)}),e.component&&z(`span`,{className:`element-chip-component`,children:[`<`,e.component.name,`>`]})]})]},e.ref))})}var _P=10,vP=.6;function yP(e){let t=e.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[],n=new Set;for(let e=1;e<t.length;e++)n.add(`${t[e-1]} ${t[e]}`);return n}function bP(e,t){if(e.size<_P||t.size<_P)return!1;let n=0;for(let r of e)t.has(r)&&n++;return n/e.size>=vP}function xP(e,t){let n=e.map((e,t)=>({step:e,index:t})).filter(({step:e})=>e.type===`commentary`&&e.detail?.trim());if(n.length===0)return e;let r=n.map(({step:e})=>yP(e.detail??``)),i=yP(t),a=new Set;return n.forEach(({index:e},t)=>{[...r.slice(t+1),i].some(e=>bP(r[t],e))&&a.add(e)}),a.size===0?e:e.filter((e,t)=>!a.has(t))}var SP=[{re:/Settings\s*(?:>|›|→)\s*Advanced\s*(?:>|›|→)\s*Custom model ID/i,section:`advanced`,target:`[data-settings-target="custom-model"]`}],CP=`Failed to start the query run:`,wP=/^(?:[A-Za-z_.]*(?:Error|Exception):|Failed to (?:preload|load|auto-download)\b)|Traceback \(most recent/,TP=1500,EP=/\brun:\s|re-run your|`gaia [a-z]/i,DP=/no model called|doesn't list (?:it|this model)|must include the .?user.? namespace|isn't installed on the local LLM server|\bmodel\b[^\n]{0,80}\bwas not found\b/i,OP=/\bmodel\b[^\n]{0,40}\b(?:couldn't|didn't|failed to) (?:pre)?load|failed to (?:pre)?load (?:lemonade )?model/i,kP=/context (?:window|size|length|limit)|exceeds the available context|maximum context|too many tokens/i,AP={general:`general`,setup:`setup`,"agent & model":`model`,model:`model`,permissions:`permissions`,skills:`skills`,connectors:`connectors`,messaging:`messaging`,automations:`automations`,memory:`memory`,privacy:`privacy`,notifications:`notifications`,"read aloud":`voice`,advanced:`advanced`,about:`about`},jP=/Settings\s*(?:>|›|→)\s*(General|Setup|Agent & model|Model|Permissions|Skills|Connectors|Messaging|Automations|Memory|Privacy|Notifications|Read aloud|Advanced|About)\b/g;function MP(e){return DP.test(e)?`modelUnavailable`:OP.test(e)?`modelLoad`:kP.test(e)?`context`:`unknown`}function NP(e){let t=PP(e),n=MP(t),r=wP.test(t)||t.length<TP&&EP.test(t),i=n===`modelUnavailable`||n===`modelLoad`?[`model`]:[];for(let e of t.matchAll(jP)){let t=AP[e[1].toLowerCase()];i.includes(t)||i.push(t)}let a={};for(let e of SP)i.includes(e.section)&&e.re.test(t)&&(a[e.section]=e.target);return{kind:n,raw:r,sections:i,targets:a}}function PP(e){let t=e.trim();return t.startsWith(CP)?t.slice(30).trim():t}var FP=/^!\[([^\]]*)\]\((\/api\/files\/uploads\/[^)\s]+)\)$/;function IP(e){try{return decodeURIComponent(e)}catch{return e}}function LP(e){let t=[],n=[],r=!1;for(let i of e.split(`
|
|
178
|
-
`)){i.trim().startsWith("```")&&(r=!r);let e=r?null:FP.exec(i.trim()),a=e?Nv(e[2]):``;e&&a?t.push({src:a,name:e[1]||IP(e[2].split(`/`).pop()||``)}):n.push(i)}return t.length===0?{text:e,images:t}:{text:n.join(`
|
|
179
|
-
`).replace(/\n{3,}/g,`
|
|
180
|
-
|
|
181
|
-
`).trim(),images:t}}function RP({images:e,index:t,onIndex:n,onClose:r}){let i=R(),a=(0,B.useRef)(null),o=(0,B.useRef)(null),s=e.length>1,c=e[t];ut(!0,r),un(a,!0),(0,B.useEffect)(()=>{o.current?.focus()},[]);let l=(0,B.useCallback)(r=>{n((t+r+e.length)%e.length)},[t,e.length,n]);return(0,B.useEffect)(()=>{if(!s)return;let e=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=a.current?getComputedStyle(a.current).direction===`rtl`:!1;e.preventDefault(),l(e.key===`ArrowRight`===t?-1:1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[s,l]),c?(0,hM.createPortal)(L(`div`,{ref:a,className:`image-viewer`,role:`dialog`,"aria-modal":`true`,"aria-label":i(`imageViewer.dialog`),onClick:e=>{e.target===e.currentTarget&&r()},children:z(`div`,{className:`image-viewer-stage`,onClick:e=>{e.target===e.currentTarget&&r()},children:[L(`button`,{ref:o,type:`button`,className:`image-viewer-btn image-viewer-close`,onClick:r,"aria-label":i(`imageViewer.close`),children:L(nc,{size:18,"aria-hidden":`true`})}),s&&L(`button`,{type:`button`,className:`image-viewer-btn image-viewer-prev`,onClick:()=>l(-1),"aria-label":i(`imageViewer.prev`),children:L(ti,{size:20,"aria-hidden":`true`})}),L(`img`,{className:`image-viewer-img`,src:c.src,alt:c.name}),s&&L(`button`,{type:`button`,className:`image-viewer-btn image-viewer-next`,onClick:()=>l(1),"aria-label":i(`imageViewer.next`),children:L(ri,{size:20,"aria-hidden":`true`})}),z(`p`,{className:`image-viewer-caption`,dir:`auto`,children:[L(`bdi`,{children:c.name}),s&&z(P.Fragment,{children:[` · `,L(`bdi`,{dir:`ltr`,children:i(`imageViewer.count`,{n:t+1,total:e.length})})]})]})]})}),document.body):null}function zP({images:e}){let t=R(),[n,r]=(0,B.useState)(null),i=(0,B.useRef)([]),a=(0,B.useCallback)(()=>{let e=n;r(null),e!==null&&requestAnimationFrame(()=>i.current[e]?.focus())},[n]);return e.length===0?null:z(P.Fragment,{children:[L(`ul`,{className:`image-thumbs`,"aria-label":t(`msg.images`),children:e.map((e,n)=>L(`li`,{children:L(`button`,{type:`button`,ref:e=>{i.current[n]=e},className:`image-thumb`,onClick:()=>r(n),"aria-label":t(`msg.imageOpen`,{name:e.name}),title:e.name,children:L(`img`,{src:e.src,alt:``,loading:`lazy`})})},`${e.src}-${n}`))}),n!==null&&L(RP,{images:e,index:n,onIndex:r,onClose:a})]})}var BP=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),VP=String.raw`[^\s*?"<>|,;)}\]\\/]+[\\/]`,HP=String.raw`(?:(?:[A-Za-z]:[\\/]|(?<![\p{L}\p{N}_.\-\\/])/)(?:${VP})*)?`,UP=String.raw`(?<![\p{L}\p{N}_.\-])`,WP=String.raw`(?![\p{L}\p{N}_\-]|\.[\p{L}\p{N}])`,GP=e=>e.trim().replace(/\\/g,`/`).toLowerCase(),KP=e=>e.trim().split(/[\\/]/).pop()??``,qP=e=>e.split(/[\\/]/).slice(0,-1).filter(Boolean);function JP(e){let t=new Map;for(let n of e)t.set(n.filename.toLowerCase(),[...t.get(n.filename.toLowerCase())??[],n]);let n=new Map;for(let e of t.values()){let t=Math.max(...e.map(e=>qP(e.filepath??``).length)),r=null;for(let n=1;e.length>1&&n<=t&&!r;n++){let t=e.map(e=>[...qP(e.filepath??``).slice(-n),e.filename].join(`/`));new Set(t.map(e=>e.toLowerCase())).size===e.length&&(r=t)}e.forEach((e,t)=>n.set(e,r?r[t]:e.filename))}return n}function YP(e){let t=e.filter(e=>e.filename),n=JP(t),r=new Map,i=new Map;for(let e of t){let t={id:e.id,filename:e.filename,label:n.get(e)},a=new Set([e.filename.toLowerCase()]);e.filepath&&(a.add(KP(e.filepath).toLowerCase()),i.set(GP(e.filepath),t));for(let n of a){let i=r.get(n);r.set(n,i===void 0||i?.id===e.id?t:null)}}if(r.size===0)return{re:null,byName:r,byPath:i};let a=[...r.keys()].sort((e,t)=>t.length-e.length).map(BP).join(`|`);return{re:RegExp(`${HP}${UP}(${a})${WP}`,`giu`),byName:r,byPath:i}}function XP(e,t){return e.byPath.get(GP(t))??e.byName.get(KP(t).toLowerCase())??null}function ZP(e,t){if(!e.re)return[];let n=[];for(let r of t.matchAll(e.re)){let i=r.index+r[0].length,a=QP(e,t,i,KP(r[0]).toLowerCase()),o=a&&a.start<=r.index?null:XP(e,r[0]);o?n.push({start:r.index,end:i,doc:o}):a&&n.push({start:a.start,end:i,doc:a.doc})}return n}function QP(e,t,n,r){let i=t.slice(0,n).replace(/\\/g,`/`).toLowerCase(),a=null;for(let[t,o]of e.byPath)KP(t)===r&&i.endsWith(t)&&(!a||n-t.length<a.start)&&(a={start:n-t.length,doc:o});return a}var $P=`[0-9\\u0660-\\u0669\\u06F0-\\u06F9]+`,eF=`pages?|pp?\\.|[وبفل]?(?:الصفحات|الصفحتان|الصفحتين|الصفحة|صفحات|صفحتي|صفحة)|ص\\.?`,tF=String.raw`\s*(?:,|،|&|and|to|و|إلى|[-–—])\s*`,nF=new RegExp(String.raw`(?<!\p{L})(?:${eF})(?!\p{L})\s*(${$P}(?:${tF}${$P})*)`,`iu`);function rF(e){return Number(e.replace(/[٠-٩۰-۹]/g,e=>String(e.charCodeAt(0)&15)))}function iF(e){let t=nF.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($P,`g`))){let t=rF(e[0]);t>0&&r.push({start:n+e.index,end:n+e.index+e[0].length,page:t})}return r}function aF({active:e,label:t,awaitingUser:n=!1}){let r=R(),i=n?r(`activity.waiting`):t?$D(r,t):r(`msg.thinking`),a=sF(e,i),o=e&&!n&&nN(t),s=sF(o),c=qc();return e?z(`span`,{className:`thinking-indicator${n?``:` is-live`}`,children:[L(`span`,{className:`thinking-indicator-text`,children:i}),!n&&a>=oF&&z(`span`,{className:`thinking-indicator-elapsed`,children:[` · `,z(`bdi`,{dir:`ltr`,children:[a,`s`]})]}),o&&s>=45&&L(`span`,{className:`thinking-indicator-hint`,role:`status`,children:r(c?.remote===!1?`live.localModelWaitHint`:`live.modelWaitHint`)})]}):null}var oF=3;function sF(e,t){let[n,r]=(0,B.useState)(0);return(0,B.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 cF=/^The model (?:call failed|stopped responding) at step \d+, so this request is unfinished\./;function lF(e){return cF.test(e.trimStart())}var uF=/[\\/]agents[\\/][^\\/\s]+[\\/]logs\b/;function dF(e){return uF.test(e)}var fF={root:`msg-report`,button:`msg-try-again`,hint:`msg-report-hint`,error:`msg-report-error`};function pF(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 mF=e=>e.replace(/\s+/g,` `).trim();function hF(e,t){let n=mF(t);if(!n)return{steps:e,echoed:!1,endedBy:null};let r=t.trimEnd(),i=e[e.length-1],a=!1,o=null;return{steps:e.filter(e=>e.type!==`error`||!e.detail?.trim()?!0:mF(e.detail)===n?(a=!0,!1):e!==i||!r.endsWith(`\n\n${e.detail.trim()}`)||(o=e.detail.trim(),!1)),echoed:a,endedBy:o}}var gF=/\s*\{\s*"?tool"?\s*:\s*"[^"]+"\s*,\s*"?tool_args"?\s*:\s*\{[^}]*\}\s*\}/g,_F=new Set([`thought`,`answer`,`tool`,`tool_args`,`goal`]),vF=/^\{\s*"(thought|answer|tool|tool_args|goal)"\s*:/;function yF(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 bF(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,`
|
|
182
|
-
`).replace(/\\\\/g,`\\`)}function xF(e){let t;try{t=JSON.parse(e)}catch{let t=bF(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=>_F.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 SF(e,t){let n=``,r=0;for(;r<e.length;){let i=e.indexOf(`{`,r);if(i===-1){n+=e.slice(r);break}if(!vF.test(e.slice(i,i+40))){n+=e.slice(r,i+1),r=i+1;continue}let a=yF(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=xF(o);s.action===`answer`?n+=s.text:s.action===`keep`&&(n+=o),r=a+1}return n}var CF=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`.split(`.`));function wF(e){return e.replace(/```(\w*)[ \t]*\n([\s\S]*?)```/g,(e,t,n)=>{let r=t.toLowerCase();return r.length>0&&r.length<=2&&!CF.has(r)?n.trim():e})}var TF=/\n{1,2}Verification: unverified[^\n]*\s*$/;function EF(e){let t=e;for(;;){let e=t.replace(TF,``);if(e===t)return t;t=e}}function DF(e,t=!1){if(!e)return e;e=EF(e);let n=e;n=n.replace(gF,``),n=SF(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,`
|
|
183
|
-
`),n=n.replace(/\\"/g,`"`)),n=wF(n).trim(),OF(n)}function OF(e){let t=!1;return e.split(`
|
|
184
|
-
`).map(e=>(/^\s*(```|~~~)/.test(e)&&(t=!t),t?e:e.replace(/^(\s*\d+)\.(\s*)$/,`$1\\.$2`))).join(`
|
|
185
|
-
`)}function kF(e,t){return e?new Date(e).toLocaleString(On(t),{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,hour12:!0}):``}function AF(e,t,n=new Date){if(!e)return``;let r=new Date(e),i=On(t),a=r.toLocaleTimeString(i,{hour:`numeric`,minute:`2-digit`}),o=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),s=Math.round((o(n)-o(r))/864e5);return s===0?a:s===1?t(`msg.yesterdayAt`,{time:a}):r.toLocaleString(i,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,...r.getFullYear()===n.getFullYear()?{}:{year:`numeric`}})}var jF=`Cancelled.`,MF=[[`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`],[`This run was stopped because its schedule was deleted.`,`msg.cutOff.scheduleDeleted`],[`This run was stopped because its schedule was paused.`,`msg.cutOff.schedulePaused`]],NF=/(?:^|\n\n)Before it stopped, it had started these tools: (.+)\.$/;function PF(e){let t=e.trim(),n=MF.find(([e])=>t.endsWith(e));if(!n)return null;t=t.slice(0,-n[0].length).trimEnd();let r=NF.exec(t);return r&&(t=t.slice(0,r.index).trimEnd()),{body:t,notice:n[1],tools:r?r[1]:null}}function FF(e,t,n=!1){return t?`stopped`:PF(e)?`interrupted`:n?`failed`:void 0}var IF=320;function LF({original:e,draft:t,onDraft:n,onSend:r,onCancel:i,confirming:a=!1}){let o=R(),{text:s,links:c}=(0,B.useMemo)(()=>jv(e),[e]),[l,u]=(0,B.useState)(()=>t==null?s:jv(t).text),d=(0,B.useRef)(null),f=l.trim()!==``&&l!==s,p=()=>r(Mv(l,c));return(0,B.useLayoutEffect)(()=>{let e=d.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},[]),(0,B.useLayoutEffect)(()=>{let e=d.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,IF)}px`)},[l]),z(`div`,{className:`msg-edit`,children:[L(`textarea`,{ref:d,className:`msg-edit-input`,value:l,onChange:e=>{u(e.target.value),n?.(e.target.value)},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),i()):e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),f&&!a&&p())},"aria-label":o(`msg.editLabel`),readOnly:a,rows:1,dir:`auto`,...Nt}),c.length>0&&L(`ul`,{className:`msg-edit-attachments`,"aria-label":o(`composer.attached`),children:c.map((e,t)=>z(`li`,{className:`msg-edit-attachment`,children:[L(sa,{size:14,"aria-hidden":`true`}),L(`span`,{className:`msg-edit-attachment-name`,title:e.name,dir:`auto`,children:e.name})]},t))}),!a&&z(`div`,{className:`msg-edit-actions`,children:[L(`button`,{type:`button`,className:`btn-secondary msg-edit-btn`,onClick:i,children:o(`msg.editCancel`)}),L(`button`,{type:`button`,className:`btn-primary msg-edit-btn`,onClick:p,disabled:!f,children:o(`msg.editSend`)})]})]})}var RF=/^\[schedule-run\] Run #(\d+) \u00b7 (.+)$/;function zF({message:e,isStreaming:t,agentSteps:n,agentStepsActive:r,cards:i,onDelete:a,onResend:o,extraActions:s,onTryAgain:c,onContinue:l,onRegenerate:u,onEditStart:d,editing:f=!1,editDraft:p=null,onEditDraft:m,onEdit:h,onEditCancel:g,laterCount:_=0,latest:v=!1,latencyMs:y,liveStatus:b,toolStatus:x,awaitingUser:S}){let C=R();Vc();let w=(0,B.useMemo)(()=>{if(e.role!==`assistant`||!n)return{steps:n,echoed:!1,endedBy:null};let r=xP(n,e.content);return t?{steps:r,echoed:!1,endedBy:null}:hF(r,e.content)},[n,e.content,e.role,t]),T=e.role===`assistant`&&(w.echoed||e.failed===!0||pF(e.content)),E=qc(),D=hc(e=>e.show),O=N(e=>e.openSettings),ee=N(e=>e.jumpToSetting),te=(0,B.useMemo)(()=>T&&!t?NP(e.content):null,[T,t,e.content]),ne=e.role===`assistant`?e.stopState??(e.content.trim()===jF?`stopped`:void 0):void 0,re=(0,B.useMemo)(()=>e.role===`assistant`&&!t?PF(e.content):null,[e.content,e.role,t]),k=re?null:w.endedBy,ie=(0,B.useMemo)(()=>e.role===`user`?LP(e.content):null,[e.content,e.role]),ae=(0,B.useMemo)(()=>ie?dd(ie.text):DF(re?re.body:k?e.content.trimEnd().slice(0,-k.length):e.content,!!t),[e.content,ie,t,re,k]),A=!!ae.trim()&&!(ne&&ae.trim()===jF),oe=e.turnSummary?.files,se=(0,B.useMemo)(()=>oe?.map(e=>e.path)??[],[oe]),ce=`${e.session_id}:${e.id}`,[le,ue]=(0,B.useState)(!1),[de,fe]=(0,B.useState)(!1),pe=e.role===`user`&&BD(e.content),me=(0,B.useMemo)(()=>pe?HD(e.content):null,[pe,e.content]),[j,he]=(0,B.useState)(!1),M=(0,B.useId)(),ge=(0,B.useRef)(null),_e=(0,B.useRef)(!1),ve=(0,B.useCallback)(()=>{j&&(_e.current=!0),he(!j)},[j]);(0,B.useEffect)(()=>{!j&&_e.current&&(_e.current=!1,ge.current?.scrollIntoView?.({block:`nearest`}))},[j]);let ye=(0,B.useRef)(null),be=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{ye.current&&clearTimeout(ye.current),be.current&&clearTimeout(be.current)},[]);let xe=(0,B.useCallback)(()=>{let t=e.role===`assistant`?tN(ae):e.content;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)}ue(!0),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>ue(!1),2e3)},[ae,e.content,e.role]),Se=(0,B.useCallback)(()=>{de?(fe(!1),be.current&&clearTimeout(be.current),a?.(e.id)):(fe(!0),be.current&&clearTimeout(be.current),be.current=setTimeout(()=>fe(!1),3e3))},[de,e.id,a]),[Ce,we]=(0,B.useState)(null),Te=(0,B.useCallback)(e=>{_>0?we(()=>e):e()},[_]),Ee=(0,B.useCallback)(()=>{Te(()=>o?.(e))},[e,o,Te]),De=e.created_at?C(e.role===`user`?`msg.sent`:`msg.replied`,{time:kF(e.created_at,C)}):void 0,Oe=e.role===`system`?RF.exec(e.content):null;return Oe?L(`div`,{className:`msg-run-divider`,role:`separator`,children:C(`msg.scheduledRun`,{n:Oe[1],time:Oe[2]})}):L(`div`,{className:`msg msg-${e.role} ${T?`msg-error`:``}${v?` msg-latest`:``}`,title:De,children:z(`div`,{className:`msg-inner`,children:[z(`div`,{className:`msg-header`,children:[L(`div`,{className:`msg-header-left`}),!t&&!f&&z(`div`,{className:`msg-actions`,children:[e.role===`user`&&d&&h&&L(`button`,{type:`button`,className:`msg-action-btn`,onClick:()=>d(e),title:C(`msg.edit`),"aria-label":C(`msg.edit`),children:L(Io,{size:12})}),e.role===`user`&&o&&L(`button`,{className:`msg-action-btn`,onClick:Ee,title:C(`msg.resend`),"aria-label":C(`msg.resend`),children:L(Qo,{size:12})}),e.role===`assistant`&&u&&L(`button`,{type:`button`,className:`msg-action-btn`,onClick:u,title:C(`msg.tryAgain`),"aria-label":C(`msg.tryAgain`),children:L(is,{size:12})}),s,e.role===`assistant`&&!T&&A&&L(HN,{messageId:ce,content:ae}),A&&L(`button`,{className:`msg-copy ${le?`copied`:``}`,onClick:xe,title:C(le?`msg.copied`:`msg.copy`),"aria-label":C(le?`msg.copiedAria`:`msg.copy`),children:L(le?Yr:Ti,{size:12})}),a&&L(`button`,{className:`msg-action-btn msg-delete ${de?`confirm`:``}`,onClick:Se,title:C(de?`msg.confirmDelete`:`msg.delete`),"aria-label":C(de?`msg.confirmDeleteAria`:`msg.delete`),children:L(Hs,{size:12})})]})]}),z(`div`,{className:`msg-body`,children:[e.role===`assistant`&&(w.steps&&w.steps.length>0||t)&&L(FO,{steps:w.steps??[],isActive:r??!1,running:!!t,awaitingUser:S,toolStatus:t?x:null,answer:t?void 0:ae,liveLine:t&&L(aF,{active:!!r||!ae,label:b,awaitingUser:S})}),T&&z(`div`,{className:`error-banner`,children:[L(Ws,{size:14}),L(`span`,{children:C(te&&te.kind!==`unknown`?`failedTurn.${te.kind}.title`:`msg.error`)})]}),(e.cards??i)?.map((e,t)=>L(QM,{render:e.render,data:e.data},t)),e.page_elements&&e.page_elements.length>0&&L(gP,{elements:e.page_elements}),f&&h?L(LF,{original:e.content,draft:p,onDraft:m,onSend:t=>Te(()=>h(e,t)),onCancel:()=>{we(null),g?.()},confirming:Ce!==null&&!t}):pe?z(P.Fragment,{children:[!j&&me?z(`div`,{ref:ge,id:M,className:`msg-excerpt md-content`,children:[L(`div`,{className:`msg-excerpt-lines`,dir:`auto`,children:me.head}),L(`div`,{className:`msg-excerpt-gap`,children:C.plural(`msg.moreLines`,me.hidden)}),L(`div`,{className:`msg-excerpt-lines`,dir:`auto`,children:me.tail})]}):L(`div`,{ref:ge,id:M,className:`msg-collapsible${j?``:` is-collapsed`}`,children:L(lI,{content:ae})}),L(WD,{expanded:j,onToggle:ve,controls:M,collapsedLabel:C.hint(C(`msg.showAll`),UD(C,e.content)),expandedLabel:C(`msg.showLess`),className:`msg-expand-toggle`})]}):te?.raw?z(P.Fragment,{children:[L(`p`,{className:`msg-failed-lead`,children:C(`failedTurn.${te.kind}.body`)}),z(`details`,{className:`msg-failed-details`,children:[L(`summary`,{children:C(`failedTurn.details`)}),L(lI,{content:PP(ae)})]})]}):!(ne&&ae.trim()===jF)&&L(lI,{content:ae,showCursor:t&&!!ae&&!r,isStreaming:t,writtenFiles:se}),!f&&ie&&L(zP,{images:ie.images}),Ce&&!t&&z(`div`,{className:`msg-drop-confirm`,role:`alertdialog`,"aria-labelledby":`${M}-drop`,children:[L(`span`,{id:`${M}-drop`,children:C.plural(`msg.dropLater`,_)}),z(`div`,{className:`msg-edit-actions`,children:[L(`button`,{type:`button`,className:`btn-secondary msg-edit-btn`,onClick:()=>we(null),autoFocus:!0,children:C(`msg.editCancel`)}),L(`button`,{type:`button`,className:`btn-primary msg-edit-btn`,onClick:()=>{we(null),Ce()},children:C(`msg.dropLaterGo`)})]})]}),ne&&z(`div`,{className:`msg-stopped${ne===`unconfirmed`||e.stopError?` is-unconfirmed`:``}`,role:`note`,children:[L(Is,{size:9,fill:`currentColor`,"aria-hidden":`true`}),L(`span`,{children:ne===`unconfirmed`?C(`msg.stoppedUnconfirmed`):e.stopError?C(`msg.stoppedError`,{error:e.stopError}):C(`msg.stopped`)})]}),re&&L(`p`,{className:`msg-cut-off`,role:`note`,children:C.compose(e=>re.tools?`${e(`msg.cutOff.toolsRan`,{tools:re.tools})} ${e(re.notice)}`:e(re.notice))}),k&&L(`p`,{className:`msg-cut-off`,role:`note`,dir:`auto`,children:k}),l&&ne&&!t&&ae.trim()&&ae.trim()!==jF&&z(`button`,{type:`button`,className:`msg-try-again`,onClick:l,children:[L(Ho,{size:12,"aria-hidden":`true`}),C(`msg.continue`)]}),c&&!t&&z(`button`,{type:`button`,className:`msg-try-again`,onClick:c,children:[L(is,{size:12,"aria-hidden":`true`}),C(`msg.tryAgain`)]}),te?.sections.map(e=>z(`button`,{type:`button`,className:`msg-try-again`,onClick:()=>{let t=te?.targets[e];t?ee({section:e,target:t}):O(e)},children:[L(ms,{size:12,"aria-hidden":`true`}),C.compose(t=>t(`failedTurn.openSettings`,{tab:t(`settings.section.${e}`)}))]},e)),(T||k)&&!t&&dF(k??e.content)?z(`button`,{type:`button`,className:`msg-try-again`,onClick:()=>D(`agent`),children:[L(cs,{size:12,"aria-hidden":`true`}),C(`logs.agentLog`)]}):(T||e.role===`assistant`&&lF(e.content))&&!t&&E?.remote===!1&&z(`button`,{type:`button`,className:`msg-try-again`,onClick:()=>D(`model_server`),children:[L(cs,{size:12,"aria-hidden":`true`}),C(`logs.serverLog`)]}),e.role===`assistant`&&!t&&(aP(e.content)||aP(e.failureText??``))&&L(sP,{classes:fF,note:C(`msg.reportNote`)}),e.role===`assistant`&&!t&&Fk(ae)&&L(Hk,{content:ae}),e.role===`assistant`&&!t&&(e.stats||y!=null||e.created_at)&&z(`div`,{className:`msg-stats`,"aria-label":C(`msg.about`),children:[e.created_at&&L(`span`,{className:`msg-stats-ts`,title:kF(e.created_at,C),children:AF(e.created_at,C)}),e.stats?.retried&&e.stats.model&&L(`span`,{title:`This answer was kept from Retry with… (${e.stats.model})`,children:Uc(e.stats.model)}),!e.stats?.retried&&e.stats?.route?.model&&L(`span`,{className:`msg-stats-route`,title:C(`msg.route`,{reason:e.stats.route.reason??``}),children:Uc(e.stats.route.model)}),L(AA,{latencyMs:y,stats:e.stats,ended:FF(e.content,ne,T||!!k)})]}),e.role===`assistant`&&!t&&e.stats?.route?.degraded&&e.stats.route.notice&&L(`div`,{className:`msg-route-notice`,role:`status`,children:e.stats.route.notice}),e.role===`assistant`&&!t&&e.id>0&&e.session_id&&L(DN,{sessionId:e.session_id,messageId:e.id}),e.role===`assistant`&&L(UN,{messageId:ce}),e.role===`assistant`&&L(WN,{messageId:ce})]})]})})}var BF=(0,B.createContext)(!1);function VF({lang:e,code:t}){let n=R(),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(!1),s=(0,B.useContext)(BF),c=(0,B.useId)(),l=zD(t),u=l>(s?20:25),d=u&&!a,f=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let p=(0,B.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 z(`div`,{className:`code-block${d?` is-collapsed`:``}`,dir:`ltr`,children:[z(`div`,{className:`code-header`,children:[L(`span`,{className:`code-lang`,children:e||`code`}),z(`button`,{className:`code-copy ${r?`copied`:``}`,onClick:p,title:n(r?`msg.copied`:`code.copy`),"aria-label":n(r?`msg.copiedAria`:`code.copyAria`),children:[L(r?Yr:Ti,{size:13}),L(`span`,{children:n(r?`code.copied`:`code.copy`)})]})]}),L(`pre`,{id:c,children:L(`code`,{children:t})}),u&&L(WD,{expanded:a,onToggle:()=>o(e=>!e),controls:c,collapsedLabel:n(`code.expand`,{size:RD(n,l)}),expandedLabel:n(`code.collapse`),className:`code-expand-toggle`})]})}var HF=/(?<=["\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,UF=/[.:!']+$/,WF=RegExp(`^(?:${HF.source})$`,`i`),GF=(0,B.createContext)([]);function KF(e,t){if(typeof t!=`string`||e.length===0)return null;let n=t.trim();if(!n)return null;if(e.includes(n))return n;if(/[\\/]/.test(n))return null;let r=n.toLowerCase(),i=e.filter(e=>(e.split(/[\\/]/).pop()??``).toLowerCase()===r);return i.length===1?i[0]:null}function qF(e){if(typeof e!=`string`)return null;let t=e.trim();return WF.test(t)?t:null}function JF({path:e,label:t}){let n=t=>{t.preventDefault(),Ft(e).catch(e=>{F.ui.error(`Failed to open path`,e)})};return z(`span`,{className:`file-path-link`,dir:`ltr`,onClick:n,title:`Open in file explorer: ${V(e)}`,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e))},children:[L(da,{size:12,className:`file-path-icon`}),V(t??e)]})}function YF(e){return[...e.matchAll(new RegExp(HF.source,`gi`))].map(t=>{let n=t.index+t[0].length,r=`"“`.includes(e[t.index-1]??`
|
|
186
|
-
`)&&`"”`.includes(e[n]??`
|
|
187
|
-
`);return{start:t.index,path:r?t[0]:t[0].replace(UF,``)}})}function XF(e){let t=[],n=0;for(let{start:r,path:i}of YF(e))r>n&&t.push(e.slice(n,r)),t.push(L(JF,{path:i},r)),n=r+i.length;return t.length===0?e:(n<e.length&&t.push(e.slice(n)),L(P.Fragment,{children:t}))}var ZF=(0,B.createContext)(YP([]));function QF({doc:e,page:t,t:n}){return z(`a`,{className:`citation-link`,href:Ie(e.id,t),target:`_blank`,rel:`noopener noreferrer`,dir:`ltr`,title:t?n(`citation.openPage`,{page:t}):n(`citation.open`,{name:V(e.label)}),"data-doc-id":e.id,"data-page":t,children:[L(sa,{size:12,className:`citation-icon`,"aria-hidden":`true`}),V(e.label)]})}function $F({doc:e,page:t,label:n,t:r}){return L(`a`,{className:`citation-page`,href:Ie(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 eI(e,t){let n=ZP(e,t)[0];return iF(n?t.slice(0,n.start):t)}function tI(e,t,n,r){let i=YF(e),a=ZP(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:L($F,{doc:t,page:a.page,label:e.slice(r,s),t:n},`p${r}`)})}};if(r&&s(r,iF(e.slice(0,a[0]?.start??e.length)),0),a.forEach((t,r)=>{let i=iF(e.slice(t.end,a[r+1]?.start??e.length));o.push({start:t.start,end:t.end,node:L(QF,{doc:t.doc,page:i[0]?.page,t:n},`c${t.start}`)}),s(t.doc,i,t.end)}),o.length===0)return XF(e);o.sort((e,t)=>e.start-t.start);let c=[],l=0;for(let t of o)t.start>l&&c.push(L(B.Fragment,{children:XF(e.slice(l,t.start))},`t${l}`)),c.push(t.node),l=t.end;return l<e.length&&c.push(L(B.Fragment,{children:XF(e.slice(l))},`t${l}`)),L(P.Fragment,{children:c})}function nI(e,t){return typeof t==`string`?XP(e,t):null}function rI({children:e}){let t=(0,B.useContext)(ZF),n=R(),r=B.Children.toArray(e),i=null,a=r.map((e,a)=>{if(typeof e==`string`){let r=tI(e,t,n,i);return i=null,L(B.Fragment,{children:r},`s${a}`)}if(i=null,B.isValidElement(e)&&e.type===aI){let o=nI(t,e.props.children);if(o){let e=r[a+1],s=typeof e==`string`?eI(t,e):[];return i=o,L(QF,{doc:o,page:s[0]?.page,t:n},`k${a}`)}}return e});return L(P.Fragment,{children:a})}function iI({tex:e,display:t}){let n=(0,B.useMemo)(()=>zE.renderToString(e,{displayMode:t,throwOnError:!1,errorColor:`var(--danger)`}),[e,t]),r=(0,B.useRef)(null),[i,a]=(0,B.useState)(!1);return(0,B.useLayoutEffect)(()=>{let e=r.current;if(t||!e)return;let n=()=>{let t=e.firstElementChild,n=e.parentElement;for(;n&&n.clientWidth===0;)n=n.parentElement;t&&n&&a(t.getBoundingClientRect().width>n.clientWidth)};n();let i=e.closest(`.md-content`);if(!i||typeof ResizeObserver>`u`)return;let o=new ResizeObserver(n);return o.observe(i),()=>o.disconnect()},[n,t]),L(t?`div`:`span`,{ref:r,className:t?`md-math md-math-display`:i?`md-math md-math-wide`:`md-math`,dir:`ltr`,dangerouslySetInnerHTML:{__html:n}})}function aI({className:e,children:t,node:n,...r}){let i=(0,B.useContext)(ZF),a=(0,B.useContext)(GF),o=R();if(e?.includes(`math-inline`))return L(iI,{tex:String(t),display:!1});let s=nI(i,t);if(s)return L(QF,{doc:s,t:o});let c=qF(t);if(c)return L(JF,{path:c});let l=KF(a,t);return l?L(JF,{path:l,label:String(t).trim()}):L(`code`,{className:`inline-code`,dir:`ltr`,...r,children:t})}var oI={code:aI,pre({children:e}){let t=B.Children.toArray(e)[0];if(B.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$/,``);if(n.includes(`math-display`))return L(iI,{tex:i,display:!0});let a=r?.[1]||``;return L(VF,{lang:a,code:i})}return L(`pre`,{dir:`ltr`,children:e})},table({children:e}){return L(`div`,{className:`md-table-wrap`,children:L(`table`,{className:`md-table`,dir:`auto`,children:e})})},a({href:e,children:t}){return L(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`md-link`,children:t})},p({children:e}){return L(`p`,{className:`md-p`,dir:`auto`,children:L(rI,{children:e})})},h1({children:e}){return L(`h2`,{className:`md-h2`,dir:`auto`,children:L(rI,{children:e})})},h2({children:e}){return L(`h3`,{className:`md-h3`,dir:`auto`,children:L(rI,{children:e})})},h3({children:e}){return L(`h4`,{className:`md-h4`,dir:`auto`,children:L(rI,{children:e})})},h4({children:e}){return L(`h5`,{className:`md-h4`,dir:`auto`,children:L(rI,{children:e})})},ul({children:e}){return L(`ul`,{className:`md-ul`,dir:`auto`,children:e})},ol({children:e,start:t}){return L(`ol`,{className:`md-ol`,start:t,dir:`auto`,children:e})},li({children:e,className:t}){return L(`li`,{className:t?`md-li ${t}`:`md-li`,dir:`auto`,children:L(rI,{children:e})})},blockquote({children:e}){return L(`blockquote`,{className:`md-blockquote`,dir:`auto`,children:L(rI,{children:e})})},hr(){return L(`hr`,{className:`md-hr`})},td({children:e,className:t,style:n}){return L(`td`,{className:t,style:n,children:L(rI,{children:e})})},th({children:e,className:t,style:n}){return L(`th`,{className:t,style:n,children:L(rI,{children:e})})}},sI=[],cI=[Gx,{singleDollarTextMath:!1}];function lI({content:e,showCursor:t,isStreaming:n=!1,writtenFiles:r=sI}){let i=N(e=>e.documents),a=(0,B.useMemo)(()=>YP(i),[i]),o=(0,B.useMemo)(()=>$E(e),[e]);return!e&&!t?null:!e&&t?L(`span`,{className:`cursor`}):L(BF.Provider,{value:n,children:L(ZF.Provider,{value:a,children:L(GF.Provider,{value:r,children:z(`div`,{className:`md-content`,children:[L(bv,{remarkPlugins:[Nx,cI,aD,WE,KE],disallowedElements:[...Tv],urlTransform:Nv,components:oI,children:o}),t&&L(`span`,{className:`cursor`})]})})})})}var uI=()=>[...N.getState().messages].reverse().find(e=>e.role===`assistant`)?.id;function dI({busy:e}){let t=R(),[n,r]=(0,B.useState)({n:0,text:``}),i=(0,B.useRef)(uI());return(0,B.useEffect)(()=>{e&&(i.current=uI())},[e]),Pd(e,()=>{let e=N.getState().messages,n=e[e.length-1];if(n?.role!==`assistant`||n.id===i.current||n.stopState===`stopped`&&!n.stopError)return;let a=n.failed===!0||pF(n.content);r(e=>({n:e.n+1,text:t(a?`live.replyFailed`:`live.replyReady`)}))}),L(`div`,{className:`turn-announcer`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:L(`span`,{children:n.text},n.n)})}function fI(e){return e.type===`status`&&e.status===`working`&&!e.phase&&(e.message??``).startsWith(`Model is processing`)}function pI(e){return e.phase===`loading_tools`?Ut()(`chat.loadingTools`):e.phase===`model_queue`&&e.queue?mI(e.queue):(e.message||``).trim()}function mI(e){let t=Ut(),n=String(Math.floor(e.waited_s??0));if(e.event===`granted`)return t(`chat.modelQueue.granted`,{seconds:n});let r=e.queue_length??1;return r>1&&e.position!=null?t(`chat.modelQueue.waitingInLine`,{position:String(e.position),length:String(r),seconds:n}):!e.holder&&e.scope!==`process`?t(`chat.modelQueue.priority`,{seconds:n}):t(`chat.modelQueue.waiting`,{seconds:n})}function hI(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 gI=`speech_model_downloaded`,_I=new Set([`tool`,`waiting`]);function vI(e){return e.livePhase&&!_I.has(e.livePhase)?e.liveStatus:null}function yI(e,t){let n=N.getState(),r=e.status,i=pI(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===gI&&i){let e={label:i,active:!1,success:!0,kept:!0},r=n.agentSteps[n.agentSteps.length-1];r&&r.type===`status`&&r.active?n.updateLastAgentStep({...e,detail:void 0}):n.addStepBeforeRunningCall({id:++t.current,type:`status`,timestamp:Date.now(),...e}),n.setLiveStatus(null);return}if(e.phase&&i&&n.setLiveStatus(i,e.phase),e.phase===`waiting`||fI(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&&r!==`warning`){n.updateLastAgentStep({label:i||`Working`,detail:i});return}if(a&&a.type===`thinking`&&a.active){n.updateLastAgentStep({label:i||`Thinking`});return}let o=hI({...e,message:i},t);o&&n.addAgentStep(o)}var bI=/\s*\{\s*"?(?:tool|thought|goal)"?\s*:\s*"[^"]*"[^}]*(?:"?tool_args"?\s*:\s*\{[^}]*\})?\s*\}/g;function xI(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,`
|
|
188
|
-
`).replace(/\\\\/g,`\\`)}function SI(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 CI(e){let t=(e||[]).filter(e=>typeof e.render==`string`&&e.render.length>0).reduce((e,t)=>w(e,{render:t.render,data:t.data}),[]);return t.length>0?t:void 0}function wI(e){return(e||[]).map(e=>{let t=e.agentSteps||e.agent_steps||void 0;return{...e,agentSteps:t,cards:e.cards||CI(t),stats:e.stats||e.inference_stats||void 0,turnSummary:e.turnSummary||e.turn_summary||void 0,libraryNotices:e.libraryNotices||e.library_notices||void 0,stopState:e.stopState??(e.stopped?`stopped`:void 0)}})}function TI(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 EI(e,t){return!!e&&e.role===`assistant`&&!!t.failureText&&e.content.trim()===t.failureText.trim()}function DI(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||EI(r[0],n))}function OI(e,t,n){let r=new Set(t.map(e=>e.id)),i=new Set(e.map(e=>e.id)),a=e.filter(e=>!r.has(e.id));for(let e of t){if(i.has(e.id)||n.has(e.id))continue;let t=a.findIndex(t=>t.role===e.role&&t.content.trim()===e.content.trim());if(t<0)continue;let[r]=a.splice(t,1);n.set(e.id,n.get(r.id)??r.id)}}function kI(e,t){let n=e[e.length-1],r=t[t.length-1];if(!n?.failed||!EI(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 AI(e){return`policy-receipt-${encodeURIComponent(e)}`}function jI(e){let t=e.content.trim();return!t||e.stopState||e.failed||e.failure||pF(t)||FN(t,1e3).length===0?!1:!hF(e.agentSteps??[],t).echoed}function MI(){(0,B.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await ON();e&&t&&VN.getState().setSettings(t)}catch(e){F.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 NI=[`download`,`decode`,`transcribe`,`voices`,`prepare`,`analyze`],PI=0,FI=5;function II(e,t){return e==null?``:e<60?t(`recording.leftUnderMinute`):t(`recording.leftMinutes`,{minutes:Math.ceil(e/60)})}function LI(e){return NI.map((e,t)=>t).filter(t=>t!==PI&&t!==FI||t in e)}function RI({state:e}){return e===1?L(Yr,{size:14,"aria-hidden":`true`}):e===2?L(mo,{size:14,"aria-hidden":`true`}):L(`span`,{className:`recording-progress-dot`,"aria-hidden":`true`})}function zI({index:e,stage:t}){let n=R(),r=n(`recording.stage.${NI[e]}`),i=t?.state===0,a=t?.percent,o=i?II(t?.etaSeconds,n):``,s=t?.state===2?n(`recording.skipped`):o;return z(`li`,{className:`recording-progress-row${i?` is-running`:``}${t?``:` is-waiting`}${t?.state===1?` is-done`:``}`,children:[L(`span`,{className:`recording-progress-mark`,children:L(RI,{state:t?.state})}),L(`span`,{className:`recording-progress-label`,children:r}),i&&a!=null&&z(`bdi`,{className:`recording-progress-percent`,dir:`ltr`,children:[a,`%`]}),s&&L(`span`,{className:`recording-progress-left`,children:s}),i&&L(`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:L(`div`,{className:`recording-progress-fill`,style:a==null?void 0:{inlineSize:`${a}%`}})})]})}var BI=120;function VI(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)<BI);return r||t.push({title:n,seconds:e.seconds}),!r});return{...e,items:n}})}function HI({sections:e}){let t=R(),n=VI(e),r=n[0]?.sections??0;return z(`section`,{className:`recording-found`,"aria-label":t(`recording.found.title`),children:[z(`h4`,{className:`recording-found-title`,children:[t(`recording.found.title`),L(`span`,{className:`recording-found-count`,children:t(`recording.found.count`,{done:n.length,total:r})})]}),n.map(e=>z(`div`,{className:`recording-found-section`,children:[z(`p`,{className:`recording-found-span`,children:[z(`bdi`,{dir:`ltr`,className:`recording-found-time`,children:[e.start,`–`,e.end]}),e.summary&&L(`span`,{dir:`auto`,children:e.summary})]}),e.items.length>0&&L(`ul`,{className:`recording-found-items`,children:e.items.map(e=>z(`li`,{children:[L(`bdi`,{dir:`ltr`,className:`recording-found-time`,children:e.start}),L(`span`,{dir:`auto`,children:e.title})]},`${e.seconds}-${e.title}`))})]},e.section))]})}function UI(){let e=R(),t=N(e=>e.recordingStages),n=N(e=>e.recordingSections);return t?z(`section`,{className:`recording-progress`,"aria-label":e(`recording.title`),children:[L(`ol`,{className:`recording-progress-list`,children:LI(t).map(e=>L(zI,{index:e,stage:t[e]},e))}),n&&L(HI,{sections:n})]}):null}function WI(e,t){let n=e.tool||``,r=e.tool_label||n,{addNotification:i,notifications:a}=Bl.getState(),o=e.confirm_id?a.find(t=>t.id===e.confirm_id):void 0;if(o){!o.response&&o.dismissed&&Bl.setState(e=>({notifications:e.notifications.map(e=>e.id===o.id?{...e,dismissed:!1}:e)}));return}let s=n===El,c=s&&Ll(a,t,e.args);i({id:e.confirm_id??`perm-${Date.now()}`,type:`permission_request`,agentId:t,sessionId:t,agentName:`GAIA`,title:s?kl(e.args,c):n===`trust_project_folder`?`Trust this folder's instructions and skills?`:`Allow ${r}?`,message:s?Ol(e.args,c):n===`trust_project_folder`?`GAIA would put this folder's CLAUDE.md, AGENTS.md and skills in the model's prompt, now and every time you work in it.`:`GAIA needs your OK before ${r}.`,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,tool:n,toolArgs:e.args,confirmId:e.confirm_id,alwaysScope:typeof e.always_scope==`string`?e.always_scope:void 0,alwaysLabel:typeof e.always_label==`string`&&e.always_label?e.always_label:void 0,toolLabel:e.tool_label||void 0,risk:typeof e.risk==`string`?e.risk:void 0,summary:typeof e.summary==`string`&&e.summary?e.summary:void 0,pathFollowUp:c||void 0,timeoutSeconds:e.timeout_seconds,expiresAt:typeof e.expires_at==`number`?e.expires_at*1e3:void 0})}function GI(e,t,n){let r=e.tool||`unknown tool`,i=e.reason||e.message||e.content||`Tool execution was blocked by governance policy.`;return{id:e.receipt_id??n,type:`policy_alert`,agentId:t,agentName:`GAIA`,title:`Blocked: ${r} is restricted by policy.`,message:i,timestamp:Date.now(),read:!1,dismissed:!1,priority:`critical`,tool:r,decision:e.decision||`BLOCK`,reason:i,ruleIds:e.rule_ids??[],policyVersion:e.policy_version,receiptId:e.receipt_id}}function KI(e){let t=e.data&&typeof e.data==`object`?e.data:{};return(e.status??t.status)===`denied`?e.timed_out===!0||t.timed_out===!0?`timedOut`:(e.denied_by??t.denied_by)===`policy`?`refused`:(e.declined_by??t.declined_by)===`agent`?`autoDeclined`:`declined`:null}function qI(e){let t={result:e.summary||e.title||`Done`,active:!1,success:e.success!==!1,latencyMs:e.latency_ms},n=KI(e);n&&(t[n]=!0),e.command_output&&(t.commandOutput={command:e.command_output.command,stdout:e.command_output.stdout,stderr:e.command_output.stderr,returnCode:e.command_output.return_code,expectedExit:e.command_output.expected_exit,cwd:e.command_output.cwd,durationSeconds:e.command_output.duration_seconds,truncated:e.command_output.truncated}),e.mcp_output?.text&&(t.mcpOutput=e.mcp_output),e.result_data?.chunks&&e.result_data.chunks.length>0&&(t.retrievalChunks=e.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}))),e.result_data?.type===`file_list`&&e.result_data.files?.length>0&&(t.fileList={files:e.result_data.files,total:e.result_data.total??e.result_data.files.length});let r=e.data&&typeof e.data==`object`?e.data.needs_model:void 0;return(e.needs_model??r)===`vision`&&(t.needsModel=`vision`),t}var JI=5e3,YI=2e3,XI=3e4,ZI=6e4;function QI(e){return e?.init_state===`initializing`?!e.init_tasks||e.init_tasks.some(e=>e.status===`pending`||e.status===`running`):!1}function $I(e){return e.lemonade_running?`up`:e.lemonade_error?`unresponsive`:`down`}function eL(e){return e.kind===`slow`||e.kind===`error`||e.kind===`ok`&&$I(e.status)===`unresponsive`}function tL(e){let t=e.kind===`ok`?e.status.download_progress?.state:void 0;return t===`downloading`||t===`starting`}function nL(e){let t=null,n=0,r=!1,i=null,a=null,o=!1,s=!1,c=()=>{o||!s||a||(a=setTimeout(()=>{a=null,f()},p()))},l=0,u=null,d=async()=>{let e={controller:new AbortController,cancelled:!1};u=e;let{controller:t}=e,n=setTimeout(()=>t.abort(),ZI);try{return{kind:`ok`,status:await se(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),u===e&&(u=null)}},f=()=>{if(t)return t;let i=d().then(t=>{if(t!==null){n=eL(t)?n+1:0,r=tL(t),t.kind===`ok`?s=QI(t.status):t.kind===`unreachable`&&(s=!1),c();try{e(t)}catch(e){F.system.error(`Could not apply the system status; the next poll will try again`,e)}}}).finally(()=>{t===i&&(t=null)});return t=i,i},p=()=>Math.min((r?YI:JI)*2**n,XI),m=e=>{f().finally(()=>{e===l&&(i=setTimeout(()=>m(e),p()))})};return{check:f,start:()=>{let e=++l;return o=!0,a&&clearTimeout(a),a=null,m(e),()=>{e===l&&(l++,o=!1,c(),i&&clearTimeout(i),i=null,u&&(u.cancelled=!0,u.controller.abort(),u=null,t=null))}}}}var rL=1e3,iL=15e3,aL=null,oL=null,sL=rL,cL=0,lL=null;function uL(){if(aL)return aL;let e=Date.now();return aL=Kt().then(t=>N.getState().setActiveRuns(t,e)).catch(e=>{F.api.warn(`Could not read which chats are running`,e),iN(e)&&N.getState().loseActiveRuns()}).finally(()=>{aL=null}),aL}function dL(){let e=N.getState();return e.isStreaming||e.runningSessionIds.length>0}function fL(){return dL()?(sL=rL,rL):(sL=Math.min(sL*2,iL),sL)}function pL(e){uL().then(()=>{e===cL&&(oL=setTimeout(()=>pL(e),fL()))})}function mL(){lL&&(oL&&clearTimeout(oL),oL=null,sL=rL,pL(++cL))}function hL(){lL?.();let e=N.subscribe((e,t)=>{e.isStreaming&&!t.isStreaming&&mL()}),t=()=>mL();window.addEventListener(`focus`,t);let n=()=>{cL++,oL&&clearTimeout(oL),oL=null,e(),window.removeEventListener(`focus`,t),lL===n&&(lL=null)};return lL=n,sL=rL,pL(++cL),n}var gL=3e3,_L=new Set,vL=new Map,yL=new Set,bL=null;function xL(e,t=Date.now()){vL.set(e,t)}function SL(e){let t=N.getState();return t.activeRunsAt>0&&t.activeRunsAt>=(vL.get(e)??0)&&!t.runningSessionIds.includes(e)&&!t.queuedSessionIds.includes(e)}function CL(e){return yL.add(e),()=>{yL.delete(e),bL?.()}}function wL(e){return e instanceof Error?XN(e)??(e.message||`Unknown error`):String(e)}function TL(e){let t=e?.httpStatus;return typeof t==`number`?t:void 0}function EL(e){let t=TL(e);return t===409||t===429}function DL(e){F.chat.warn(`Chat ${e} no longer exists; dropping its queued messages`),N.getState().updateQueue(e,()=>[])}function OL(e){N.getState().setQueueHold(e,!0),setTimeout(()=>N.getState().setQueueHold(e,!1),gL)}function kL(e,t,n){return TL(n)===409&&(F.chat.info(`Chat ${e} was busy; queueing the message to try again`),N.getState().updateQueue(e,e=>Qn(e,t,`queued`)),OL(e),!0)}async function AL(e,t,n){let r=N.getState;if(_L.has(e)||r().queueHolds[e])return;let i=r().messageQueues[e]??[];if(i.some(e=>e.state===`sending`))return;let a=Yn(i);if(a||Le(i)){_L.add(e);try{if(a){let t;try{t=await Fn(e)}catch(t){if(TL(t)===409){F.chat.info(`Chat ${e} is answering again; its queue waits for that turn to end`);return}if(TL(t)===404){DL(e);return}F.chat.error(`Could not learn what chat ${e}'s last reply did with the messages added to it`,t),r().updateQueue(e,e=>Pe(e,`GAIA could not say whether it read this message: ${wL(t)}`));return}r().updateQueue(e,e=>ye(e,t))}let i=Le(r().messageQueues[e]??[]);if(!i||!n())return;r().updateQueue(e,e=>m(e,i.id,`queued`,`starting`));let o;try{o=await t(e,i.text)}catch(e){o={kind:`failed`,error:wL(e)}}if(o.kind===`accepted`){xL(e),r().updateQueue(e,e=>Zt(e,i.id)),mL();return}if(o.kind===`busy`){F.chat.info(`Queued message found chat ${e} busy; holding it`),r().updateQueue(e,e=>_(e,i.id)),OL(e);return}if(o.kind===`gone`){DL(e);return}F.chat.error(`Queued message for chat ${e} was not sent: ${o.error}`),r().updateQueue(e,e=>_(e,i.id,o.error))}finally{_L.delete(e)}}}function jL(e){return e.type!==`status`||e.phase!==`waiting`}var ML=(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`});F.chat.info(`Sending queued message for chat ${e} in the background`),i=v(e,t,{onChunk:s,onAgentEvent:e=>{jL(e)&&s()},onDone:s,onError:e=>{qN(e)?s():EL(e)?o({kind:`busy`}):TL(e)===404?o({kind:`gone`}):o({kind:`failed`,error:wL(e)})}}),a&&i.abort()});function NL(e=ML){let t=()=>{let t=N.getState();if(!QI(t.systemStatus))for(let n of Object.keys(t.messageQueues))!yL.has(n)&&SL(n)&&AL(n,e,()=>!yL.has(n))},n=N.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 bL=t,t(),()=>{n(),bL===t&&(bL=null)}}var PL=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`]),FL=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 IL(e){let t=e.lastIndexOf(`.`);return t<0?``:e.slice(t).toLowerCase()}function LL(e){return PL.has(IL(e))}function RL(e){let t=IL(e);return PL.has(t)||FL.has(t)}function zL(e,t){return e===`model_server_down`?t(`docs.serverDown`):e===`model_server_busy`?t(`docs.serverBusy`):null}function BL(e){return e===`model_server_down`}function VL(e){return e===`model_server_busy`}function HL(e,t,n){return e===`model_server_down`?n(`docs.notAddedServer`,{name:t}):e===`model_server_busy`?n(`docs.notAddedServerBusy`,{name:t}):null}var UL=`https://github.com/amd/gaia/issues/new`,WL=[{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:PL,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:FL,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 GL(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;for(let e of WL)if(e.extensions.has(t))return e;return null}var KL=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 qL(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;return KL.has(t)}function JL(){let e=navigator.userAgent;return`**Environment:**\n- GAIA Version: 0.27.0rc8\n- Platform: ${navigator.platform||`unknown`}\n- User Agent: ${e}\n- Interface: Agent UI (Web)`}function YL(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?_`,``,`---`,JL(),``,`_Submitted from GAIA Agent UI_`].join(`
|
|
189
|
-
`);return`${UL}?${new URLSearchParams({title:`[Feature] ${e}`,body:n,labels:`enhancement,agent-ui`}).toString()}`}function XL(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?_`,``,`---`,JL(),``,`_Submitted from GAIA Agent UI_`].join(`
|
|
190
|
-
`);return`${UL}?${new URLSearchParams({title:`[Bug] ${e}`,body:n,labels:`bug,agent-ui`}).toString()}`}var ZL={corrupted:`The file looks damaged. Re-download or re-export it, then add the new copy.`,encrypted:`The PDF needs a password to open. Save a copy without the password, then add that.`,empty:`The PDF has no readable text, which usually means it is a scan. Run OCR on it, then add it again.`,empty_file:`This file is empty. Add content to it, then add 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 add that.`};function QL(e,t){if(!e.startsWith(t))return e;let n=e.slice(t.length).trim();return n.charAt(0).toUpperCase()+n.slice(1)}function $L({filename:e,error:t,status:n,kind:r,onDismiss:i,timeout:a=15e3}){let o=R(),s=(0,B.useRef)(null);(0,B.useEffect)(()=>(a>0&&(s.current=setTimeout(i,a)),()=>{s.current&&clearTimeout(s.current)}),[i,a]);let c=e.includes(`.`)?`.`+e.split(`.`).pop()?.toLowerCase():``,l=c?GL(c):null,u=t.toLowerCase().includes(`unsupported file type`)||t.toLowerCase().includes(`not supported for indexing`)||t.toLowerCase().includes(`file type not allowed`)||l!==null,d=t.toLowerCase().includes(`fetch`)||t.toLowerCase().includes(`network`)||t.toLowerCase().includes(`connect`),f,p,m,h=di,g=r?ZL[r]:void 0;return g?(f=`"${e}" can't be read`,p=g,m=null,h=Ws):zL(r,o)?(f=HL(r,e,o)??o(`docs.notAddedServer`,{name:e}),p=zL(r,o)??t,m=null,h=Ws):r===`too_large`?(f=o(`docs.tooLarge`,{name:e}),p=t,m=null,h=Ws):n===404?(f=o(`docs.notFound`,{name:e}),p=o(`docs.notFoundDetail`),m=null,h=Ws):n===403?(f=`GAIA can't read files in that location`,p=`${t} Or drop the file here instead (up to 20 MB) and GAIA keeps its own copy.`,m=null,h=Ws):u&&l?(f=`${l.label} files not supported`,p=l.message,m=YL(l.featureTitle),h=Ws):u&&!c?(f=`"${e}" has no file extension`,p=QL(t,`File type not allowed:`),m=null,h=Ws):u?(f=`File type not supported: ${c}`,p=`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.`,m=YL(`Support ${c} file indexing`),h=Ws):d?(f=`Connection error`,p=`Could not reach the GAIA server. Make sure the backend is running.`,m=XL(`Upload connection error for ${e}`),h=di):(f=`Failed to index "${e}"`,p=t||`An unexpected error occurred during indexing.`,m=XL(`Indexing error: ${t.slice(0,80)}`),h=zr),z(`div`,{className:`upload-error-toast`,role:`alert`,children:[L(h,{size:16}),z(`div`,{className:`upload-error-content`,children:[L(`div`,{className:`upload-error-title`,children:f}),z(`div`,{className:`upload-error-detail`,children:[p,m&&` `,m===null?null:u?L(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,children:`Request this feature →`}):L(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,children:`Report this issue →`})]})]}),L(`button`,{className:`upload-error-dismiss`,onClick:i,"aria-label":`Dismiss`,children:L(nc,{size:14})})]})}function eR(e,t,n=[],r=[],i={}){let a=tR(t,r,i);if(n.length>0)return n.some(a);let o=Ik(e);return o===`google`?a(`google`):o===`microsoft`?a(`microsoft`):a(`google`)||a(`microsoft`)}function tR(e,t,n){return r=>hk(e.find(e=>e.id===r),t.find(e=>e.id===r),n[r])}function nR(e,t,n=[],r=[],i={}){let a=tR(t,r,i),o=n.find(a);if(o){let e=t.find(e=>e.id===o&&!(`error`in e));return e&&!(`error`in e)?e.display_name:o}let s=Ik(e);return s===`google`?`Google`:s===`microsoft`?`Microsoft`:a(`google`)?`Google`:a(`microsoft`)?`Microsoft`:`Google`}function rR({content:e,providers:t=[],accounts:n,onRetry:r}){let i=R(),[a,o]=(0,B.useState)([]),[s,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(!1),f=(0,B.useCallback)(()=>{c().then(e=>{let t=e.connectors||[];o(t),l(e=>e??t)}).catch(e=>F.ui.warn(`ConnectorRetryBanner: connector fetch failed`,e))},[]),p=s!==null&&eR(e,a,t,s,n);if((0,B.useEffect)(()=>{f();let e=()=>f();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[f]),HA(!p,f),!p||u)return null;let m=nR(e,a,t,s??[],n);return z(`div`,{className:`connector-retry-banner`,role:`status`,children:[L(li,{size:14,className:`connector-retry-banner__icon`}),L(`span`,{className:`connector-retry-banner__text`,children:i(`retryBanner.connected`,{name:m})}),z(`button`,{type:`button`,className:`connector-retry-banner__btn`,onClick:()=>{d(!0),r()},children:[L(Qo,{size:12}),L(`span`,{children:i(`retryBanner.askAgain`)})]}),L(`button`,{type:`button`,className:`connector-retry-banner__dismiss`,onClick:()=>d(!0),"aria-label":i(`retryBanner.dismiss`),children:`×`})]})}function iR(e,t=32){let n=Array.from(e);if(n.length<=t)return e;let r=Array.from(/\.[^.\s]{1,8}$/.exec(e)?.[0]??``).length,i=Math.min(Math.max(Math.ceil(t*.45),r+4),t-2);return`${n.slice(0,t-i-1).join(``)}…${n.slice(-i).join(``)}`}function aR(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 oR(e){return e.replace(/-/g,``).slice(0,7)}function sR(e,t){let n=t.replace(/^#/,``).toLowerCase();if(!n||n.length<4)return null;let r=e.find(e=>e.id.replace(/-/g,``).toLowerCase().startsWith(n));return r?r.id:null}function cR(e,t){return e.key===`ArrowUp`&&!e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.nativeEvent?.isComposing&&t===``}function lR(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`user`)return e[t]}function uR(e,t){for(let n=t+1;n<e.length;n++)if(e[n].role===`user`)return e.length-n;return 0}var dR=/^\/[a-z0-9-]*$/i;function fR(e){let t=dR.test(e),[n,r]=(0,B.useState)([]),[i,a]=(0,B.useState)(`loading`),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(0),[u,d]=(0,B.useState)(null);(0,B.useEffect)(()=>{if(!t)return;let e=!0;return a(e=>e===`ready`?e:`loading`),Pn().then(t=>{bn(t.skills.map(e=>e.name)),e&&(r(t.skills),a(`ready`),s(null))},t=>{e&&(a(`error`),s(t instanceof Error?t.message:String(t)))}),()=>{e=!1}},[t]),(0,B.useEffect)(()=>{l(0)},[e]);let f=e.toLowerCase(),p=t?n.filter(e=>`/${e.name}`.startsWith(f)):[],m=t&&u!==e&&(i!==`ready`||p.length>0),h=(0,B.useCallback)(e=>l(e),[]),g=(0,B.useCallback)(()=>d(e),[e]);return{open:m,status:i,error:o,matches:p,selected:Math.min(c,Math.max(p.length-1,0)),select:h,dismiss:g}}var pR=`composer-skill-menu`;function mR(e){return`${pR}-${e}`}function hR(e){let t=e.replace(/\s+/g,` `).trim(),n=t.indexOf(`. `);return n>=0?t.slice(0,n+1):t}var gR=320,_R=6,vR=8;function yR(e,t,n){let r=Math.max(0,e.top-_R-vR),i=Math.max(0,t-e.bottom-_R-vR),a=r<Math.min(gR,n)&&i>r;return{below:a,maxHeight:Math.floor(Math.min(gR,a?i:r))}}function bR({menu:e,onPick:t}){let n=R(),r=(0,B.useRef)(null),[i,a]=(0,B.useState)(null),o=e.open&&e.status===`ready`?e.matches.length:-1;if((0,B.useLayoutEffect)(()=>{let e=r.current,t=e?.parentElement;if(!e||!t){a(null);return}let n=()=>{let n=yR(t.getBoundingClientRect(),window.innerHeight,e.scrollHeight);a(e=>e&&e.below===n.below&&e.maxHeight===n.maxHeight?e:n)};n(),window.addEventListener(`resize`,n);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return i?.observe(t),()=>{window.removeEventListener(`resize`,n),i?.disconnect()}},[e.open,e.status,o]),(0,B.useEffect)(()=>{o>0&&document.getElementById(mR(e.selected))?.scrollIntoView?.({block:`nearest`})},[e.selected,o]),!e.open)return null;let s=`skill-menu${i?.below?` is-below`:``}`,c=i?{maxHeight:i.maxHeight}:void 0;return e.status===`ready`?z(`div`,{ref:r,className:s,style:c,children:[L(`p`,{className:`skill-menu-title`,children:n(`composer.skillsTitle`)}),L(`ul`,{id:pR,role:`listbox`,"aria-label":n(`composer.skillsTitle`),children:e.matches.map((n,r)=>z(`li`,{id:mR(r),role:`option`,"aria-selected":r===e.selected,className:`skill-menu-row${r===e.selected?` is-selected`:``}`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>e.select(r),onClick:()=>t(n.name),children:[z(`span`,{className:`skill-menu-name`,dir:`ltr`,children:[`/`,n.name]}),L(`span`,{className:`skill-menu-desc`,dir:`auto`,children:hR(n.description)})]},n.name))})]}):L(`div`,{ref:r,className:s,style:c,role:e.status===`error`?`alert`:`status`,children:L(`p`,{className:`skill-menu-note`,children:e.status===`error`?n(`composer.skillsFailed`,{error:e.error??``}):n(`composer.skillsLoading`)})})}function xR(e){return e.isMedia?LL(e.name)?aa:$i:sa}var SR=240,CR=1e5;function wR({value:e,onChange:t,onSubmit:n,onStop:r,streaming:i=!1,stopping:a=!1,queueWhileStreaming:o=!1,answering:s=!1,disabledReason:c,attachments:l,placeholder:u,autoFocus:d,inputRef:f,leftControls:p,rightControls:m,onEditLast:h}){let g=R(),_=(0,B.useRef)(null),v=f??_,y=(0,B.useRef)(null),b=!!c,x=e.trim().length>0||l.hasUploaded,S=l.compose(e.trim()).length,C=S>CR,w=hP(i),T=l.attachments.filter(e=>e.error).map(e=>e.name).join(`, `),E=!b&&(!i||o)&&!l.uploading&&x&&!C&&!T&&!w,D=c||u||g(`composer.placeholder`),O=fR(b?``:e),ee=(0,B.useCallback)(e=>{t(`/${e} `),v.current?.focus()},[t,v]);(0,B.useLayoutEffect)(()=>{let e=v.current;if(!e)return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,SR)}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,D,v]);let te=(0,B.useCallback)(t=>{if(O.open&&!t.nativeEvent.isComposing){let{matches:n,selected:r}=O;if(t.key===`Escape`){t.preventDefault(),O.dismiss();return}if(n.length>0&&(t.key===`ArrowDown`||t.key===`ArrowUp`)){t.preventDefault();let e=t.key===`ArrowDown`?1:-1;O.select((r+e+n.length)%n.length);return}let i=n[r]?.name,a=i!==void 0&&e.toLowerCase()===`/${i}`;if(i&&(t.key===`Tab`||t.key===`Enter`&&!t.shiftKey&&!a)){t.preventDefault(),ee(i);return}}h&&cR(t,e)?(t.preventDefault(),h()):t.key===`Enter`&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),E&&n())},[E,n,h,e,O,ee]),ne=(0,B.useCallback)(e=>{e.dataTransfer?.files?.length&&(e.preventDefault(),e.stopPropagation(),l.addFiles(Array.from(e.dataTransfer.files)))},[l]);return z(`div`,{className:`composer${b?` composer-disabled`:``}`,onDrop:ne,onDragOver:e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault()},children:[L(mP,{}),l.attachments.length>0&&L(`ul`,{className:`composer-attachments`,"aria-label":g(`composer.attached`),children:l.attachments.map(e=>{let t=xR(e);return z(`li`,{title:e.isImage&&e.url?e.name:void 0,className:`composer-attachment${e.error?` has-error`:``}${e.isMedia?` is-media`:``}${e.isImage&&e.url?` is-image`:``}`,children:[e.isImage&&e.url?L(`img`,{src:e.url,alt:``,className:`composer-attachment-thumb`}):L(t,{size:14,"aria-hidden":`true`}),L(`span`,{className:`composer-attachment-name`,title:e.name,dir:`ltr`,children:iR(e.name)}),e.uploading&&L(`span`,{className:`composer-attachment-state`,children:e.progress===void 0?g(`composer.uploading`):g(`composer.uploadingPercent`,{percent:e.progress})}),e.uploaded&&e.isMedia&&L(`span`,{className:`composer-attachment-state`,children:g(`composer.mediaReady`)}),e.error&&L(`span`,{className:`composer-attachment-state`,role:`alert`,title:e.error,children:e.error}),L(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>l.remove(e.id),"aria-label":g(`composer.remove`,{name:e.name}),children:L(nc,{size:12})})]},e.id)})}),L(bR,{menu:O,onPick:ee}),L(`textarea`,{ref:v,className:`composer-input`,value:e,onChange:e=>t(e.target.value),onKeyDown:te,onPaste:e=>{l.handlePaste(e)},placeholder:D,rows:1,disabled:b,autoFocus:d,"aria-label":g(`composer.message`),"aria-autocomplete":`list`,"aria-expanded":O.open&&O.matches.length>0,"aria-controls":O.open&&O.matches.length>0?pR:void 0,"aria-activedescendant":O.open&&O.matches.length>0?mR(O.selected):void 0,dir:`auto`}),C&&z(`p`,{className:`composer-limit-error`,role:`alert`,children:[g(`composer.tooLong`,{sent:S.toLocaleString(),max:1e5.toLocaleString()}),` `,g(`composer.tooLongHint`)]}),T&&x&&L(`p`,{className:`composer-limit-error`,role:`alert`,children:g(`composer.removeRefused`,{names:T})}),z(`div`,{className:`composer-row`,children:[z(`div`,{className:`composer-row-left`,children:[L(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>y.current?.click(),disabled:b,"aria-label":g(`composer.attach`),title:g(`composer.attach`),children:L(Ko,{size:16})}),L(`input`,{ref:y,type:`file`,multiple:!0,hidden:!0,onChange:e=>{e.target.files&&l.addFiles(Array.from(e.target.files)),e.target.value=``}}),p]}),z(`div`,{className:`composer-row-right`,children:[m,i&&o&&x&&L(`button`,{type:`button`,className:`composer-send`,onClick:n,disabled:!E,"aria-label":g(s?`composer.sendAnswer`:`composer.queue`),title:s?g(`composer.sendAnswerTitle`):w??g(`composer.queueTitle`),children:L(Dr,{size:16})}),i?L(`button`,{type:`button`,className:`composer-send is-stop`,onClick:r,disabled:a,"aria-label":g(`composer.stop`),title:a?g(`composer.stopping`):g.hint(g(`composer.stop`),`Esc`),children:L(Is,{size:12,fill:`currentColor`})}):L(`button`,{type:`button`,className:`composer-send`,onClick:n,disabled:!E,"aria-label":g(`composer.send`),title:w??g.hint(g(`composer.send`),`Enter`),children:L(Dr,{size:16})})]})]})]})}var TR=8,ER=8;function DR({label:e,warning:t,children:n,id:r,pinned:i=!1,onUnpin:a,tabIndex:o}){let s=(0,B.useId)(),c=r??s,l=(0,B.useRef)(null),u=(0,B.useRef)(null),[d,f]=(0,B.useState)(!1),p=d||i,[m,h]=(0,B.useState)(null);return(0,B.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+TR+t.width<=r-ER?(a=n.right+TR,o=e.top+e.height/2-t.height/2):n.left-TR-t.width>=ER?(a=n.left-TR-t.width,o=e.top+e.height/2-t.height/2):(a=Math.min(Math.max(ER,e.right-t.width),r-ER-t.width),o=e.top-TR-t.height>=ER?e.top-TR-t.height:e.bottom+TR),o=Math.min(Math.max(ER,o),i-ER-t.height),h({left:a,top:o})},[p]),(0,B.useEffect)(()=>{if(!p)return;let e=()=>{f(!1),a?.()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[p,a]),z(P.Fragment,{children:[L(`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:L(Na,{size:13,"aria-hidden":`true`})}),p&&(0,hM.createPortal)(L(`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 OR(e){return e<.1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function kR(e,t=mt){return e?t(`settings.price.perMillion`,{input:OR(e.input_per_million),output:OR(e.output_per_million)}):t(`settings.price.unknown`)}function AR(e){return`$${e.toFixed(2)}`}function jR(e,t,n,r=!1){return!fe(t)||mt(t)!==n?n:r?e.bare(t):e(t)}function MR(e,t){return jR(e,`providers.${t.id}.name`,t.name,!0)}function NR(e,t){return jR(e,`providers.${t.id}.notice`,t.privacy_notice)}var PR=2e3,FR=`waiting_for_os_permission`,IR=`store_locked`,LR=5;function RR(e,t){let n=e.rank?`#${e.rank} ${e.note??``}`.trim():null;return t?[n,kR(e.price)].filter(e=>!!e):[el(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 zR(e,t){return!Hc(t,e.id)&&(il(e)||rl(e)===`not_downloaded`)}function BR(e,t,n){let r=e=>e.provider.id===t?0:1;return[...e].sort((e,t)=>r(e)-r(t)).map(e=>e.provider.remote?e:{...e,models:[...e.models].sort((e,t)=>Number(zR(e,n))-Number(zR(t,n)))})}function VR({m:e,onDownload:t,busy:n}){let r=R();if(il(e)){let t=Math.round(e.download_progress?.percent??0);return z(`span`,{className:`model-state is-downloading`,title:`Downloading, ${t}%`,children:[L(Za,{size:12,className:`spin`,"aria-hidden":`true`}),` `,t,`%`]})}let i=rl(e);return i===`not_downloaded`?L(`button`,{type:`button`,className:`model-state-btn`,onClick:e=>{e.stopPropagation(),t()},disabled:n,"aria-label":r(`modelMenu.downloadModel`,{name:e.display_name??e.id}),title:e.size_gb?`${$c.not_downloaded} (${e.size_gb} GB)`:$c.not_downloaded,tabIndex:-1,children:L(Ni,{size:13,"aria-hidden":`true`})}):i===`loaded`?L(`span`,{className:`model-state is-loaded`,role:`img`,"aria-label":$c.loaded,title:$c.loaded}):L(`span`,{className:`model-state is-ready`,title:$c.downloaded,children:r(`modelMenu.ready`)})}function HR(){let e=R(),t=zc(e=>e.active),n=zc(e=>e.select),r=zc(e=>e.queued),i=r??t?.model,a=zc(e=>e.queue),o=zc(e=>e.queueError),s=zc(e=>e.rememberNames);zc(e=>e.names);let c=qc(),l=N(e=>Jc(t,e.sessions,e.currentSessionId)),u=N(e=>e.isStreaming),d=N(e=>e.openSettings),f=(0,B.useRef)(null),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)(0),[S,C]=(0,B.useState)(null),[w,T]=(0,B.useState)(null),[E,D]=(0,B.useState)(null),[O,ee]=(0,B.useState)(null),[te,ne]=(0,B.useState)(null),[re,k]=(0,B.useState)(null),[ie,ae]=(0,B.useState)(0),[A,oe]=(0,B.useState)(null),se=(0,B.useRef)(0),ce=(0,B.useRef)(null),le=(0,B.useId)(),ue=(0,B.useRef)(null),de=(0,B.useRef)(null),[fe,pe]=(0,B.useState)(null),[me,j]=(0,B.useState)(null),he=(0,B.useCallback)(()=>j(null),[]),M=(0,B.useCallback)(()=>h(!1),[]),ge=(0,B.useRef)(!1),_e=(0,B.useRef)(null),ve=(0,B.useCallback)(async(t=!1)=>{t||(ge.current=!1,C(null),_(null));try{let{providers:n,lemonade_error:r}=await gt();if(r)throw Error(r);let i=n.filter(e=>!e.remote||e.models_discovered||e.id===`fireworks`||e.registered),a=await Promise.all(i.map(async t=>{if(t.blocked)return{provider:t,models:[],error:e(`settings.privacy.localOnlyBlocked`)};if(t.remote&&!t.models_discovered)return{provider:t,models:[]};try{let n=await Gt(t.id);return{provider:t,models:n.models,error:n.blocked?e(`settings.privacy.localOnlyBlocked`):void 0}}catch(e){return{provider:t,models:[],error:oN(e)}}}));s(a.flatMap(e=>e.models)),x(a.flatMap(e=>e.models).filter(e=>e.available===!1).length),t||(ge.current=!0),_(a.map(e=>({...e,models:e.models.filter(e=>e.available!==!1)})))}catch(e){C(oN(e))}},[s,e]),ye=(0,B.useCallback)(async()=>{try{await Fe()}catch(e){C(oN(e));return}await ve(!0)},[ve]);(0,B.useEffect)(()=>{m&&(T(null),D(null),y(!1),pe(null),j(null),ve())},[m,ve]),(0,B.useEffect)(()=>{if(!m||!g||!ge.current)return;let e=ue.current?.querySelector(`[role="option"][tabindex="0"]`);e&&(ge.current=!1,e.focus(),e.scrollIntoView?.({block:`nearest`}))},[m,g]),(0,B.useEffect)(()=>{let e=_e.current;if(!m||!g||!e||!v)return;let t=g.find(t=>t.provider.id===e)?.models.find(e=>e.rank===null&&!Hc(i,e.id));if(!t)return;let n=Array.from(ue.current?.querySelectorAll(`[role="option"]`)??[]).find(e=>e.dataset.row===t.id);n&&(_e.current=null,pe(t.id),n.focus(),n.scrollIntoView?.({block:`nearest`}))},[m,g,v,i]),(0,B.useEffect)(()=>{(w||E)&&de.current?.scrollIntoView?.({block:`nearest`})},[w,E]);let be=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=Array.from(ue.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(),j(t=>e.key===`i`&&t===r?null:r);return}case`ArrowLeft`:e.preventDefault(),j(null);return;default:return}e.preventDefault(),t[r].focus(),t[r].scrollIntoView?.({block:`nearest`})},xe=!!g?.some(e=>e.models.some(il)),Se=!!g?.some(e=>e.provider.key_state===FR);(0,B.useEffect)(()=>{if(!(m||re)||!(xe||re||Se))return;let e=setInterval(()=>{ve(!0)},PR);return()=>clearInterval(e)},[m,xe,re,Se,ve]);let Ce=(0,B.useCallback)(async e=>{ne(e),ae(e=>e+1),C(null);try{await p(e),await ve(!0)}catch(t){k(t=>t?.model===e?null:t),C(oN(t))}finally{ne(null),ae(e=>e-1)}},[ve]),we=(0,B.useCallback)((e,t,n)=>{D(null),n&&(se.current=0,oe(null),k({model:e,provider:t})),Ce(e)},[Ce]),Te=(0,B.useCallback)(async(e,r)=>{if(r.remote&&!t?.remote&&w?.model!==e)return T({model:e,provider:r}),null;if(T(null),u)return a(e===t?.model?null:e),h(!1),null;ee(e),C(null);try{return await n(e),oe(null),h(!1),null}catch(e){let t=oN(e);return C(t),t}finally{ee(null)}},[t?.model,t?.remote,w,a,n,u]);(0,B.useEffect)(()=>{if(!re||!g||ie>0)return;let{model:e,provider:t}=re,n=()=>(ce.current!==g&&(ce.current=g,se.current+=1),se.current>=LR),r=g.flatMap(e=>e.models).find(t=>t.id===e);if(!r){if(!n())return;k(null),oe(`${Uc(e)} is no longer in the model list, so it wasn't switched to.`);return}if(il(r)){se.current=0;return}let i=r.download_progress;if(i?.state===`error`)k(null),oe(`Downloading ${Uc(e)} failed: ${i.message??`no reason given`}`);else if(i?.state!==`complete`&&rl(r)===`not_downloaded`){if(!n())return;k(null),oe(`The download of ${Uc(e)} never started. Try the download button again.`)}else k(null),Te(e,t).then(t=>{t&&oe(`${Uc(e)} downloaded, but switching to it failed: ${t}`)})},[g,re,ie,Te]);let Ee=(e,t)=>e.id===`fireworks`&&!v&&t.some(e=>e.rank!==null),De=(e,t)=>Ee(e,t)?t.filter(e=>e.rank!==null||Hc(i,e.id)):t,Oe=(e,t)=>Ee(e,t)&&t.some(e=>e.rank===null&&!Hc(i,e.id)),ke=g?.flatMap(({provider:e,models:t})=>[...e.remote&&!e.models_discovered?[`key:${e.id}`]:[],...De(e,t).filter(e=>O===null&&!il(e)).map(e=>e.id),...Oe(e,t)?[`showall:${e.id}`]:[]])??[],Ae=fe&&ke.includes(fe)?fe:i&&ke.includes(i)?i:ke[0],je=e=>({role:`option`,tabIndex:e===Ae?0:-1,"data-row":e,onFocus:()=>pe(e),onBlur:()=>j(null)}),Me=c?.remote?xi:c?ki:pi,Ne=l?Uc(l):`Model`,Pe=`${Ne}${c?` · ${c.label}`:``}`,Ie=Object.fromEntries((g??[]).map(e=>[e.provider.id,Zc(e.models)])),Le=g&&BR(g,t?.provider,i),Re=t?.downloaded===!1&&l===t.model,ze=A||o||(r?`${Uc(r)} is used from your next message.`:t?.config_error?t.config_error:Re?`${Ne} isn't downloaded yet. Open the list to download it.`:c?c.description?.replace(/`/g,``)??(c.remote?e(`modelStatus.runsRemote`,{name:c.label}):e(`modelStatus.runsHere`)):Kc);return z(`div`,{className:`composer-chip-wrap`,children:[z(`button`,{ref:f,type:`button`,className:`composer-chip${Re||o||A?` is-warning`:``}`,onClick:()=>h(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":m,title:ze,children:[L(Me,{size:13,"aria-hidden":`true`}),L(`span`,{className:`composer-chip-label`,dir:`auto`,children:Pe}),r&&z(`span`,{className:`composer-chip-next`,children:[`→ `,Uc(r),` next`]}),Re&&L(Ni,{size:12,"aria-label":`Not downloaded`}),A&&L(di,{size:12,"aria-label":`Model switch failed`}),L($r,{size:12,"aria-hidden":`true`})]}),z(pc,{open:m,onClose:M,anchor:f,label:e(`modelMenu.label`),align:`end`,className:`model-menu`,children:[u&&L(`div`,{className:`popover-message`,role:`status`,children:l?e(`modelMenu.keepsModel`,{model:Uc(l)}):e(`modelMenu.keepsItsModel`)}),A&&L(`div`,{className:`popover-message is-error`,role:`alert`,children:A}),o&&L(`div`,{className:`popover-message is-error`,role:`alert`,children:o}),S&&L(`div`,{className:`popover-message is-error`,role:`alert`,children:S}),!g&&!S&&z(`div`,{className:`popover-message`,children:[L(Za,{size:13,className:`spin`}),` `,e(`modelMenu.loading`)]}),g&&L(`div`,{ref:ue,role:`listbox`,"aria-label":e(`modelMenu.models`),onKeyDown:be,children:Le.map(({provider:n,models:a,error:o})=>z(`div`,{role:`group`,"aria-labelledby":`${le}-${n.id}`,children:[L(`div`,{className:`popover-heading`,id:`${le}-${n.id}`,children:MR(e,n)}),o&&L(`div`,{className:`popover-message is-error`,children:o}),n.key_state===FR?z(`div`,{className:`popover-message`,role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,n.key_message]}):n.key_state===IR?z(`button`,{type:`button`,className:`popover-item`,...je(`unlock:${n.id}`),"aria-selected":!1,onClick:()=>void ye(),children:[L(`span`,{className:`popover-item-check`,children:L(Fa,{size:13,"aria-hidden":`true`})}),z(`span`,{className:`popover-item-body`,children:[L(`span`,{className:`popover-item-title`,children:e(`settings.key.unlockAgain`)}),L(`span`,{className:`popover-item-note`,children:e(`settings.key.storeLocked`)})]})]}):n.remote&&!n.models_discovered&&z(`button`,{type:`button`,className:`popover-item`,...je(`key:${n.id}`),"aria-selected":!1,onClick:()=>{h(!1),d(`model`,n.id)},children:[L(`span`,{className:`popover-item-check`,children:L(Fa,{size:13,"aria-hidden":`true`})}),z(`span`,{className:`popover-item-body`,children:[L(`span`,{className:`popover-item-title`,children:e(`modelMenu.addKey`)}),L(`span`,{className:`popover-item-note`,children:e(`modelMenu.connectInSettings`,{provider:n.name})})]})]}),!o&&a.length===0&&n.models_discovered!==!1&&L(`div`,{className:`popover-message`,children:e(`modelMenu.noModels`)}),De(n,a).map((a,o,s)=>{let c=!n.remote&&zR(a,i)&&o===s.findIndex(e=>zR(e,i)),l=Hc(r??t?.model,a.id),u=!n.remote&&rl(a)===`not_downloaded`,d=Ie[n.id][a.id],f=RR(a,n.remote),p=`${le}-info-${n.id}-${a.id}`;return z(B.Fragment,{children:[c&&L(`div`,{className:`popover-subheading`,children:e(`modelMenu.availableToDownload`)}),z(`div`,{className:`popover-row`,children:[z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{u?(T(null),D({model:a.id,provider:n,pick:!0})):(k(null),D(null),Te(a.id,n))},disabled:O!==null||il(a),...je(a.id),"aria-selected":l,"aria-describedby":me===a.id?p:void 0,children:[L(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:O===a.id?L(Za,{size:13,className:`spin`}):l?L(Yr,{size:13}):null}),z(`span`,{className:`popover-item-body is-inline`,children:[L(`span`,{className:`popover-item-title is-model`,children:d}),!n.remote&&a.size_gb?L(`span`,{className:`popover-item-meta`,children:z(`bdi`,{dir:`ltr`,children:[a.size_gb,` GB`]})}):null]})]}),z(DR,{label:`About ${d}`,warning:!!a.placement?.warning,id:p,pinned:me===a.id,onUnpin:he,tabIndex:-1,children:[L(`div`,{className:`info-bubble-title`,children:d}),f.length>0&&L(`ul`,{className:`info-bubble-lines`,children:f.map(e=>L(`li`,{children:e},e))}),a.placement?.warning&&L(`ul`,{className:`info-bubble-lines`,children:L(`li`,{className:`is-warning`,children:a.placement.warning})}),L(`div`,{className:`info-bubble-id`,children:a.id})]}),L(`span`,{className:`popover-row-state`,children:!n.remote&&L(VR,{m:a,busy:te!==null,onDownload:()=>{T(null),D({model:a.id,provider:n,pick:!1})}})})]}),E?.model===a.id&&E.provider.id===n.id&&z(`div`,{ref:de,className:`popover-message model-download-confirm`,role:`alert`,children:[z(`span`,{children:[L(cl,{text:a.size_gb?e(`modelMenu.downloadConfirm`,{name:al(d),size:al(`${a.size_gb} GB`)}):e(`modelMenu.downloadConfirmNoSize`,{name:al(d)})}),E.pick&&` ${e(`modelMenu.switchWhenDone`)}`]}),z(`span`,{className:`model-download-confirm-actions`,children:[L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>we(a.id,n,E.pick),children:e(`modelMenu.download`)}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>D(null),children:e(`modelMenu.cancel`)})]})]}),w?.model===a.id&&w.provider.id===n.id&&z(`div`,{ref:de,className:`popover-message`,role:`alert`,children:[NR(e,w.provider),` `,L(`button`,{type:`button`,className:`link-btn`,onClick:()=>Te(w.model,w.provider),children:e(`modelMenu.useModel`,{name:Uc(w.model)})})]})]},a.id)}),Oe(n,a)&&z(`button`,{type:`button`,className:`popover-item`,...je(`showall:${n.id}`),"aria-selected":!1,onClick:()=>{_e.current=n.id,y(!0)},children:[L(`span`,{className:`popover-item-check`}),L(`span`,{className:`popover-item-body`,children:L(`span`,{className:`popover-item-title`,children:e(`settings.model.showAll`)})})]})]},n.id))}),b>0&&z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{h(!1),d(`model`)},children:[L(`span`,{className:`popover-item-check`}),L(`span`,{className:`popover-item-body`,children:L(`span`,{className:`popover-item-note`,children:e.plural(`modelMenu.unavailable`,b)})})]}),L(`div`,{className:`popover-divider`}),z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{h(!1),d(`model`)},children:[L(`span`,{className:`popover-item-check`,children:L(qa,{size:13,"aria-hidden":`true`})}),z(`span`,{className:`popover-item-body`,children:[L(`span`,{className:`popover-item-title`,children:e(`modelMenu.addFromLink`)}),L(`span`,{className:`popover-item-note`,children:e(`modelMenu.addFromLinkNote`)})]})]}),z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{h(!1),d(`model`)},children:[L(`span`,{className:`popover-item-check`}),L(`span`,{className:`popover-item-body`,children:L(`span`,{className:`popover-item-title`,children:e(`modelMenu.providers`)})})]})]})]})}function UR(e,t,n){if(e==null||!t(e))throw Error(`the server sent no ${n}`);return e}var WR=e=>e.startsWith(`.`);function GR({onPick:e,onClose:t}){let n=R(),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(!1);ut(!0,t);let p=(0,B.useRef)(null);un(p,!0);let m=(0,B.useCallback)(e=>{u(!0),c(null),Promise.resolve().then(()=>Ot(e)).then(e=>{let t=UR(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,B.useEffect)(()=>m(),[m]);let h=r?.entries.filter(e=>e.type===`folder`)??[],g=d?h:h.filter(e=>!WR(e.name));return L(`div`,{className:`modal-overlay`,onClick:t,children:z(`div`,{ref:p,className:`modal-panel sp-picker`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`pick.label`),onClick:e=>e.stopPropagation(),children:[z(`div`,{className:`modal-header`,children:[L(`h3`,{children:n(`pick.title`)}),L(`button`,{type:`button`,className:`btn-icon`,onClick:t,"aria-label":n(`sp.closeShort`),children:L(nc,{size:18})})]}),z(`div`,{className:`modal-body sp-picker-body`,children:[L(`p`,{className:`sp-meta`,children:n(`pick.note`)}),z(`form`,{className:`sp-picker-path`,onSubmit:e=>{e.preventDefault(),a.trim()&&m(a.trim())},children:[L(`input`,{value:a,onChange:e=>o(e.target.value),"aria-label":n(`pick.path`),spellCheck:!1,dir:`ltr`}),L(`button`,{type:`submit`,className:`sp-action`,children:n(`pick.go`)})]}),r&&z(`div`,{className:`sp-picker-quick`,children:[r.quick_links.map(e=>L(`button`,{type:`button`,className:`sp-action`,onClick:()=>m(e.path),children:e.name},e.path)),z(`label`,{className:`sp-picker-hidden`,children:[L(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),n(`pick.showHidden`)]})]}),z(`ul`,{className:`sp-picker-list`,"aria-busy":l,children:[r?.parent_path&&L(`li`,{children:z(`button`,{type:`button`,onClick:()=>m(r.parent_path??void 0),children:[L(Dr,{size:13,"aria-hidden":`true`}),` `,n(`pick.up`)]})}),g.map(e=>L(`li`,{children:z(`button`,{type:`button`,onClick:()=>m(e.path),children:[L(_a,{size:13,"aria-hidden":`true`}),` `,e.name]})},e.path)),r&&g.length===0&&L(`li`,{className:`sp-meta`,children:n(h.length>0?`pick.onlyHidden`:`pick.none`)}),l&&z(`li`,{className:`sp-meta`,children:[L(Za,{size:12,className:`spin`,"aria-hidden":`true`}),` `,n(`pick.loading`)]})]}),s&&L(`p`,{className:`sp-error`,role:`alert`,children:s}),r?.folder_refusal&&L(`p`,{className:`sp-meta`,role:`status`,children:r.folder_refusal})]}),z(`div`,{className:`sp-picker-actions`,children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:t,children:n(`sp.cancel`)}),L(`button`,{type:`button`,className:`btn-primary`,disabled:!r||!!r.folder_refusal,onClick:()=>r&&e(r.current_path),children:n(`pick.use`)})]})]})})}var KR=e=>e instanceof Vn?e.detail||e.message:e instanceof Error?e.message:String(e);function qR(e){let t=R(),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(null);return{open:n=>{a(null);let i=window.gaiaAPI?.dialog;i?i.pickFolder(n).then(async n=>{if(!n)return;let r;try{({refusal:r}=await Ye(n))}catch(e){a(t(`pick.checkFailed`,{error:KR(e)}));return}r?a(r):e(n)},e=>a(t(`pick.openFailed`,{error:KR(e)}))):r(!0)},picker:n?L(GR,{onPick:t=>{r(!1),e(t)},onClose:()=>r(!1)}):null,error:i}}var JR=new Map;function YR(e){let t=JR.get(e);return t||(t={env:null,error:null,inFlight:null,version:0,listeners:new Set},JR.set(e,t)),t}function XR(e,t,n){let r=YR(e);r.env=t??r.env,r.error=n,r.listeners.forEach(e=>e())}function ZR(e){let t=YR(e);if(t.inFlight)return t.inFlight;let n=t.version;return t.inFlight=Promise.resolve().then(()=>A(e)).then(r=>{let i=UR(r,e=>Array.isArray(e.folders),`chat's environment`);t.version===n&&XR(e,i,null)}).catch(t=>XR(e,null,t instanceof Error?t.message:String(t))).finally(()=>{t.inFlight=null}),t.inFlight}function QR(e){let[,t]=(0,B.useState)(0);(0,B.useEffect)(()=>{let n=YR(e),r=()=>t(e=>e+1);return n.listeners.add(r),!n.env&&!n.inFlight&&ZR(e),()=>{n.listeners.delete(r)}},[e]);let n=(0,B.useCallback)(()=>ZR(e),[e]),r=(0,B.useCallback)(async t=>{let n=await t();return YR(e).version+=1,XR(e,n,null),n},[e]),i=YR(e);return{env:i.env,error:i.error,refresh:n,change:r}}var $R=e=>e.split(/[\\/]/).filter(Boolean).pop()??e;function ez({folder:e,disabled:t}){let n=R(),r=N(e=>e.draftFolder),i=N(e=>e.setDraftFolder),{open:a,picker:o,error:s}=qR(i),c=e.gaia_folder?n(`folderChip.worksInOwn`,{path:e.path}):n(`folderChip.worksIn`,{path:e.path}),l=!e.gaia_folder&&z(`span`,{className:`new-chat-folder`,title:c,children:[L(_a,{size:13,"aria-hidden":`true`}),L(`span`,{className:`new-chat-folder-name`,dir:`auto`,children:e.name})]});return e.choosable?z(P.Fragment,{children:[l,r?z(`span`,{className:`new-chat-folder is-on`,title:n(`folderChip.picked`,{path:r}),children:[L(_a,{size:13,"aria-hidden":`true`}),L(`span`,{className:`new-chat-folder-name`,dir:`auto`,children:$R(r)}),L(`button`,{type:`button`,className:`new-chat-folder-clear`,onClick:()=>i(null),disabled:t,"aria-label":n(`folderChip.remove`,{name:$R(r)}),title:n(`folderChip.remove`,{name:$R(r)}),children:L(nc,{size:12,"aria-hidden":`true`})})]}):z(`button`,{type:`button`,className:`new-chat-folder is-button`,onClick:()=>a(e.path),disabled:t,"aria-haspopup":`dialog`,title:`${c} ${n(`folderChip.addHint`)}`,children:[L(Ko,{size:13,"aria-hidden":`true`}),L(`span`,{className:`new-chat-folder-name`,children:n(`folderChip.add`)})]}),s&&L(`span`,{className:`new-chat-folder-error`,role:`alert`,children:s}),o]}):l||z(`span`,{className:`new-chat-folder`,title:`${c} ${n(`folderChip.ownFixedHint`)}`,children:[L(_a,{size:13,"aria-hidden":`true`}),L(`span`,{className:`new-chat-folder-name`,children:n(`folderChip.gaiaFolder`)})]})}function tz({sessionId:e,onOpen:t}){let{env:n}=QR(e),r=n?.folders.find(e=>e.source===`working_folder`);if(!r)return null;let i=$R(r.path);return z(`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:[L(_a,{size:13,"aria-hidden":`true`}),L(`span`,{className:`composer-chip-label`,dir:`auto`,children:i})]})}var nz=`gaia:permission-mode`;function rz(e,t){window.dispatchEvent(new CustomEvent(nz,{detail:{sessionId:e,mode:t}}))}function iz(e,t){let n=(0,B.useRef)(t);n.current=t,(0,B.useEffect)(()=>{if(!e)return;let t=t=>{let r=t.detail;r?.sessionId===e&&n.current(r.mode)};return window.addEventListener(nz,t),()=>window.removeEventListener(nz,t)},[e])}var az=[{mode:`ask`,label:`perm.ask`,note:`perm.askNote`},{mode:`full_access`,label:`perm.full`,note:`perm.fullNote`}];function oz({sessionId:e,disabled:t}){let n=R(),r=N(e=>e.draftPermissionMode),i=N(e=>e.setDraftPermissionMode),[a,o]=(0,B.useState)(e?`ask`:r),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(null),p=(0,B.useRef)(null),m=Bl(t=>e!==null&&Wl(e)(t)!==null);(0,B.useEffect)(()=>{if(!e){o(r);return}let t=!1;return St(e).then(e=>{t||o(e.mode)}).catch(e=>{t||f(oN(e))}),()=>{t=!0}},[e,r]),iz(e,o);let h=(0,B.useCallback)(async t=>{if(t===`full_access`&&!l)u(!0);else{f(null);try{if(e){let n=(await Vt(e,t)).mode;o(n),rz(e,n),n===`full_access`&&m||c(!1)}else i(t),o(t),c(!1)}catch(t){f(oN(t)),e&&St(e).then(e=>o(e.mode)).catch(e=>f(t=>`${t??``} Couldn't re-read the saved mode: ${oN(e)}`.trim()))}finally{u(!1)}}},[l,m,e,i]),g=a===`full_access`,_=g?bs:vs;return z(`div`,{className:`composer-chip-wrap`,children:[z(`button`,{ref:p,type:`button`,className:`composer-chip${g?` is-warning`:``}`,onClick:()=>{u(!1),c(e=>!e)},disabled:t,"aria-haspopup":`dialog`,"aria-expanded":s,"aria-label":n(`perm.chipAria`,{mode:We(g?`perm.fullLower`:`perm.askLower`)}),children:[L(_,{size:13,"aria-hidden":`true`}),L(`span`,{className:`composer-chip-label`,dir:`auto`,children:n(g?`perm.full`:`env.ask`)}),L($r,{size:12,"aria-hidden":`true`})]}),z(pc,{open:s,onClose:()=>c(!1),anchor:p,label:n(`env.permission`),children:[az.map(e=>z(`button`,{type:`button`,className:`popover-item`,onClick:()=>h(e.mode),"aria-pressed":a===e.mode,children:[L(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:a===e.mode&&L(Yr,{size:13})}),z(`span`,{className:`popover-item-body`,children:[L(`span`,{className:`popover-item-title`,children:n(e.label)}),L(`span`,{className:`popover-item-note`,children:n(e.note)})]})]},e.mode)),l&&z(`div`,{className:`popover-message`,role:`alert`,children:[n(`env.fullAccessWarn`),` `,L(`button`,{type:`button`,className:`link-btn`,onClick:()=>h(`full_access`),children:n(`env.turnOn`)})]}),g&&m&&!l&&L(`div`,{className:`popover-message`,role:`status`,children:n(`perm.fullPendingNote`)}),d&&L(`div`,{className:`popover-message is-error`,role:`alert`,children:d})]})]})}function sz(e){return N(t=>tr(t,e))}function cz(e,t){return on(e,tr(N.getState(),t))}function lz({sessionId:e,disabled:t,compact:n=!1}){let r=R(),i=sz(e),a=N(e=>e.setResearch),o=t=>a(e,t);return(0,B.useEffect)(()=>{if(!i)return;let e=!0;return Pn().then(t=>{e&&bn(t.skills.map(e=>e.name))},e=>F.chat.warn(`Research mode could not read the installed skills; /<skill> commands will be researched`,e)),()=>{e=!1}},[i]),z(`button`,{type:`button`,className:`composer-chip composer-chip-research${i?` is-on`:``}`,onClick:()=>o(!i),disabled:t,"aria-pressed":i,"aria-label":r(`composer.research`),title:r(i?`composer.researchOnTitle`:`composer.researchOffTitle`),children:[L(Rs,{size:13,"aria-hidden":`true`}),!n&&L(`span`,{className:`composer-chip-label`,dir:`auto`,children:r(`composer.research`)})]})}function uz({text:e}){return L(`div`,{className:`history-notice`,role:`note`,children:e})}function dz({notices:e}){return L(`div`,{className:`library-notices`,role:`note`,children:e.map((e,t)=>L(`div`,{dir:`auto`,children:e},`${t}-${e}`))})}var fz={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 pz(e,t){return e?fz.queued:t?`GAIA is still busy in this chat. Trying again in a few seconds.`:`Sending next.`}function mz({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:L(`ul`,{className:`queued-messages`,"aria-label":`Messages waiting to send`,"aria-live":`polite`,children:o.map(e=>z(`li`,{className:`queued-message is-${e.state}`,children:[e.state===`failed`?L(di,{size:12,"aria-hidden":`true`}):e.state===`queued`?L(yi,{size:12,"aria-hidden":`true`}):L(Di,{size:12,"aria-hidden":`true`}),L(`span`,{className:`queued-message-text`,title:e.text,children:e.text}),L(`span`,{className:`queued-message-state`,title:e.error,children:e.state===`failed`?`Not sent. ${e.error??``}`.trim():e.state===`queued`?i&&e.note||pz(i,a):fz[e.state]}),e.state===`failed`&&z(`button`,{type:`button`,className:`queued-message-steer`,onClick:()=>r(e.id),"aria-label":`Send again: ${e.text}`,children:[L(is,{size:11,"aria-hidden":`true`}),` Send again`]}),e.state===`queued`&&n&&L(`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`)&&L(`button`,{type:`button`,className:`queued-message-remove`,onClick:()=>t(e.id),"aria-label":`Remove queued message: ${e.text}`,title:`Remove`,children:L(nc,{size:12})})]},e.id))})}var hz=e=>e.toLocaleString(`en-US`);function gz({n:e,window:t=!1}){let n=R();if(e==null)return L(`span`,{className:`cp-unknown`,children:n(`ctx.unknown`)});let r=t?nl(e):e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}K`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`;return L(`span`,{title:n(`ctx.tokens`,{n:hz(e)}),dir:`ltr`,children:r})}function _z({s:e}){let t=R();if(e==null)return L(`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 L(`span`,{title:`${(e*1e3).toFixed(0)} ms`,dir:`ltr`,children:n})}function vz({r:e}){let t=R();return e==null?L(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)}):L(`span`,{title:t(`ctx.rateTitle`,{n:e}),children:t(`ctx.rate`,{n:Math.round(e).toLocaleString(`en-US`)})})}var yz=(e,t)=>t>0?Math.round(e/t*100):0,bz=(e,t)=>{let n=yz(e,t);return n===0&&e>0?`<1`:String(n)},xz=(e,t)=>t&&e!=null?Math.floor(e/t*100):null,Sz=256;function Cz(e,t=mt){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:Qc(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 wz({label:e,children:t,hint:n}){return z(`div`,{className:`cp-row`,title:n,children:[L(`dt`,{children:e}),L(`dd`,{children:t})]})}function Tz({t:e}){let t=R();if(e.model_seconds==null||e.gaia_seconds==null)return z(wz,{label:t(`ctx.took`),children:[L(_z,{s:e.wall_seconds}),` · `,t.bare(`ctx.split`),` `,L(`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 z(P.Fragment,{children:[L(wz,{label:t(`ctx.took`),hint:t(`ctx.tookHint`),children:L(_z,{s:e.wall_seconds})}),L(`div`,{className:`cp-stack`,"aria-hidden":`true`,children:n.map(t=>L(`span`,{className:`cp-time-${t.key}`,style:{width:`${yz(t.s,e.wall_seconds)}%`}},t.key))}),z(`dl`,{className:`cp-rows cp-indent`,children:[L(wz,{label:t(`ctx.inModel`),children:L(_z,{s:e.model_seconds})}),L(wz,{label:t(`ctx.inGaia`),hint:t(`ctx.inGaiaHint`),children:L(_z,{s:e.gaia_seconds})}),n.slice(1).filter(e=>e.s>0).map(e=>z(wz,{label:`· ${e.label}`,children:[L(`span`,{className:`swatch cp-time-${e.key}`,"aria-hidden":`true`}),` `,L(_z,{s:e.s})]},e.key))]})]})}function Ez({why:e}){let t=R();return L(`span`,{className:`cp-unknown`,title:e,children:t(`ctx.unknown`)})}var Dz={server:`ctx.src.server`,client:`ctx.src.client`};function Oz(e,t){return e?t(Dz[e]):void 0}function kz({turn:e}){let t=R(),n=xz(e.tokens_cached,e.tokens_in),r=e.unknown??{},i=e.tools.map(e=>`${e.name??t(`ctx.toolOutside`)}: ${e.seconds??`?`} s`).join(`
|
|
191
|
-
`);return z(P.Fragment,{children:[L(Tz,{t:e.time}),z(`dl`,{className:`cp-rows`,children:[L(wz,{label:t(`ctx.firstWord`),hint:Oz(e.first_token_source,t),children:e.first_token_seconds==null?L(Ez,{why:r.first_token_seconds}):z(P.Fragment,{children:[t.bare(`ctx.in`),` `,L(_z,{s:e.first_token_seconds})]})}),L(wz,{label:t(`ctx.readingPrompt`),hint:t(`ctx.readingHint`),children:e.tokens_new!=null&&e.tokens_new<Sz?L(`span`,{title:t(`ctx.tooFewTitle`),children:t(`ctx.onlyNew`,{n:e.tokens_new})}):e.prefill_tokens_per_second==null?L(Ez,{why:r.prefill_tokens_per_second}):z(P.Fragment,{children:[L(vz,{r:e.prefill_tokens_per_second}),e.prefill_source===`client`&&L(`span`,{className:`cp-chip`,title:t(`ctx.approxTitle`),children:t(`ctx.approx`)})]})}),L(wz,{label:t(`ctx.writing`),hint:Oz(e.generation_source,t)??t(`ctx.writingHint`),children:e.generation_tokens_per_second==null?L(Ez,{why:r.generation_tokens_per_second}):L(vz,{r:e.generation_tokens_per_second})}),L(wz,{label:t(`ctx.tokensInOut`),hint:r.tokens,children:z(`span`,{dir:`ltr`,children:[L(gz,{n:e.tokens_in}),` → `,L(gz,{n:e.tokens_out})]})}),L(wz,{label:t(`ctx.cache`),hint:t(`ctx.cacheHint`),children:e.tokens_cached==null?L(Ez,{why:r.tokens_cached}):z(P.Fragment,{children:[L(gz,{n:e.tokens_cached}),n!=null&&` (${n}%)`]})}),L(wz,{label:t(`ctx.modelCalls`),children:e.model_calls}),L(wz,{label:t(`ctx.toolCalls`),hint:i||void 0,children:e.tool_calls===0&&!e.tool_seconds_total?t(`ctx.none`):z(P.Fragment,{children:[e.tool_calls,` · `,L(_z,{s:e.tool_seconds_total??0})]})}),L(wz,{label:t(`ctx.loads`),children:e.loads.length===0?t(`ctx.none`):z(`span`,{title:e.loads.map(e=>`${e.model}${e.replaced?.length?` replaced ${e.replaced.join(`, `)}`:``}: ${e.seconds} s`).join(`
|
|
192
|
-
`),children:[e.loads.length,` · `,L(_z,{s:e.loads.reduce((e,t)=>e+t.seconds,0)})]})}),L(wz,{label:t(`rail.cost`),children:L(Az,{cost:e.cost})})]})]})}function Az({cost:e}){let t=R();return e.kind===`local`?L(`span`,{title:t(`ctx.costLocalTitle`),children:t(`ctx.costLocal`)}):e.kind===`no_reply`?L(`span`,{children:t(`rail.costNoReply`)}):e.kind===`unreported`?L(`span`,{className:`cp-unknown`,children:t(`ctx.costUnreported`)}):e.kind===`estimate`&&e.usd!=null?L(`span`,{title:t(`ctx.listPriceTitle`,{usd:e.usd}),children:t(`ctx.about`,{usd:e.usd<.01?e.usd.toFixed(4):e.usd.toFixed(2)})}):L(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)})}function jz({totals:e}){let t=R(),n=xz(e.tokens_cached,e.tokens_in),r=L(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)});return z(`dl`,{className:`cp-rows`,children:[L(wz,{label:t(`ctx.turns`),children:e.turns}),L(wz,{label:t(`ctx.totalTime`),children:L(_z,{s:e.wall_seconds})}),L(wz,{label:t(`ctx.inModel`),children:L(_z,{s:e.model_seconds})}),L(wz,{label:t(`ctx.inGaia`),children:L(_z,{s:e.gaia_seconds})}),L(wz,{label:t(`ctx.tokensInOut`),children:z(`span`,{dir:`ltr`,children:[L(gz,{n:e.tokens_in}),` → `,L(gz,{n:e.tokens_out})]})}),L(wz,{label:t(`ctx.cache`),children:e.tokens_cached==null?r:z(P.Fragment,{children:[L(gz,{n:e.tokens_cached}),n!=null&&` (${n}%)`]})}),L(wz,{label:t(`ctx.toolCalls`),children:e.tool_calls??r}),L(wz,{label:t(`ctx.loads`),children:e.loads===0?t(`ctx.none`):z(P.Fragment,{children:[e.loads,` · `,L(_z,{s:e.load_seconds})]})}),L(wz,{label:t(`rail.cost`),children:e.usd==null?r:e.unpriced_turns>0?L(`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 Mz({usage:e}){let t=R(),n=e.context_state?.put_away,r=e.context_state?.summarized;return z(`div`,{className:`cp-full`,children:[z(`dl`,{className:`cp-rows`,children:[L(wz,{label:t(`ctx.live`),children:L(gz,{n:e.used})}),n&&n.results>0&&z(wz,{label:t(`ctx.putAway`),hint:t(`ctx.putAwayHint`),children:[t.plural(`ctx.results`,n.results),` · `,L(gz,{n:n.tokens})]}),r&&r.turns>0&&z(wz,{label:t(`ctx.summarized`),hint:t(`ctx.summarizedHint`),children:[t.plural(`ctx.earlier`,r.turns),` · `,L(gz,{n:r.tokens}),` → `,L(gz,{n:r.summary_tokens})]})]}),r&&r.turns>0&&L(`p`,{className:`cp-note cp-summarized`,children:t(`ctx.summarizedNote`)}),e.at_risk.length>0&&L(`p`,{className:`cp-warning`,role:`status`,children:t(`ctx.filling`)})]})}function Nz({sessionId:e,busy:t,onUsage:n}){let r=R(),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)(`turn`),g=(0,B.useRef)(n);g.current=n;let _=(0,B.useCallback)(()=>{let t=!1,n=(n,r)=>i=>{t||(F.chat.error(`Could not read the ${n} for session=${e}`,i),r(i instanceof Error?i.message:String(i)))};return _n(e).then(e=>{t||(e.available?(a(e),s(null),g.current?.(e)):(a(null),s(e.reason)),d(null))}).catch(n(`context usage`,d)),_t(e).then(e=>{t||(l(e),p(null))}).catch(n(`performance`,p)),()=>{t=!0}},[e]);(0,B.useEffect)(()=>_(),[_]);let v=(0,B.useRef)(t);(0,B.useEffect)(()=>{let e=v.current&&!t;return v.current=t,e?_():void 0},[t,_]);let y=c?.turns[c.turns.length-1]??null,b=y&&y.message_id===c?.latest_message_id?y:null,x=i?Math.max(0,i.window-i.used):0;return z(P.Fragment,{children:[z(`section`,{"aria-labelledby":`cp-context`,children:[L(`h3`,{id:`cp-context`,children:r(`ctx.context`)}),u&&L(`p`,{className:`cp-error`,role:`alert`,children:u}),!i&&!u&&L(`p`,{className:`cp-note`,children:o??r(`ctx.measuring`)}),i&&z(P.Fragment,{children:[z(`p`,{className:`cp-lead`,children:[L(`strong`,{children:r(`ctx.used`,{pct:yz(i.used,i.window)})}),` · `,L(gz,{n:i.used}),` `,r.bare(`ctx.of`),` `,L(gz,{n:i.window,window:!0}),` `,r.bare(`ctx.tokensWord`),i.model&&z(P.Fragment,{children:[` · `,L(`span`,{className:`cp-model`,dir:`ltr`,children:i.model})]}),i.model_window!=null&&i.model_window>i.window&&z(`span`,{className:`cp-window-note`,title:r(`ctx.windowTitle`),children:[` `,`· `,r.bare(`ctx.gaiaUses`),` `,L(gz,{n:i.window,window:!0}),` `,r.bare(`ctx.ofModel`),` `,L(gz,{n:i.model_window,window:!0})]}),i.tokenizer&&!i.tokenizer.exact&&L(`span`,{className:`cp-chip`,title:i.tokenizer.reason,children:r(`ctx.approx`)})]}),L(`div`,{className:`cp-stack`,"aria-hidden":`true`,children:(i.categories??[]).map(e=>L(`span`,{className:`cp-cat-${e.key}`,style:{width:`${e.tokens/i.window*100}%`}},e.key))}),z(`dl`,{className:`cp-rows`,children:[(i.categories??[]).map(e=>z(`div`,{className:`cp-row`,children:[z(`dt`,{children:[L(`span`,{className:`swatch cp-cat-${e.key}`,"aria-hidden":`true`}),e.label]}),z(`dd`,{children:[L(gz,{n:e.tokens}),` `,z(`span`,{className:`cp-pct`,children:[bz(e.tokens,i.window),`%`]})]})]},e.key)),z(`div`,{className:`cp-row is-quiet`,children:[z(`dt`,{children:[L(`span`,{className:`swatch cp-cat-free`,"aria-hidden":`true`}),r(`ctx.freeRow`)]}),z(`dd`,{children:[L(gz,{n:x}),` `,z(`span`,{className:`cp-pct`,children:[yz(x,i.window),`%`]})]})]}),z(`div`,{className:`cp-row is-quiet cp-indent`,children:[L(`dt`,{children:r(`ctx.reserve`)}),L(`dd`,{children:L(gz,{n:Math.min(x,i.reply_reserve)})})]})]}),z(`p`,{className:`cp-note`,children:[i.tokenizer?.exact?r(`ctx.exactTokenizer`,{model:i.tokenizer.model}):r(`ctx.estimated`,{reason:i.tokenizer?.reason??We(`ctx.sharedTokenizer`)}),b?.last_prompt_tokens!=null&&z(P.Fragment,{children:[` `,r(`ctx.lastRequest`,{n:hz(b.last_prompt_tokens)})]})]}),i.tool_loading&&i.tool_loading.on_demand.length>0&&z(`details`,{className:`cp-details`,children:[L(`summary`,{children:r(`ctx.onDemand`,{n:i.tool_loading.on_demand.length})}),L(`p`,{className:`cp-note`,children:r(`ctx.sentNow`,{n:i.tool_loading.loaded.length})}),L(`ul`,{className:`cp-tools`,children:i.tool_loading.on_demand.map(e=>L(`li`,{children:e},e))})]}),L(Mz,{usage:i})]})]}),z(`section`,{"aria-labelledby":`cp-hood`,children:[z(`div`,{className:`cp-section-head`,children:[L(`h3`,{id:`cp-hood`,children:r(`ctx.hood`)}),z(`div`,{className:`cp-toggle`,role:`group`,"aria-label":r(`ctx.show`),children:[L(`button`,{type:`button`,"aria-pressed":m===`turn`,onClick:()=>h(`turn`),children:r(`ctx.lastTurn`)}),L(`button`,{type:`button`,"aria-pressed":m===`chat`,onClick:()=>h(`chat`),children:r(`sp.title`)})]})]}),c&&z(`dl`,{className:`cp-rows`,children:[L(wz,{label:r(`env.runsOn`),hint:c.now.error??void 0,children:Cz(c.now,r)}),c.now.provider===`local`&&z(wz,{label:r(`ctx.memory`),hint:r(`ctx.memoryHint`),children:[c.now.weights_gb==null?L(`span`,{className:`cp-unknown`,children:r(`ctx.unknown`)}):z(P.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?L(`span`,{className:`cp-unknown`,children:r(`ctx.freeUnknown`)}):r(`env.free`,{gb:c.now.free_gb.toFixed(1)})]})]}),f&&L(`p`,{className:`cp-error`,role:`alert`,children:f}),!c&&!f&&L(`p`,{className:`cp-note`,children:r(`ctx.measuring`)}),c&&m===`turn`&&(b?L(kz,{turn:b}):L(`p`,{className:`cp-note`,children:c.latest_message_id==null?r(`ctx.afterNext`):z(P.Fragment,{children:[r.bare(`ctx.latestAnswer`),` `,L(`span`,{className:`cp-unknown`,children:r(`ctx.unknown`)}),`. `,r.bare(`ctx.notMeasured`)]})})),c&&m===`chat`&&L(jz,{totals:c.totals})]})]})}function Pz({sessionId:e,busy:t,onClose:n,onUsage:r}){let i=R(),a=(0,B.useRef)(null),o=(0,B.useRef)(n);o.current=n,(0,B.useEffect)(()=>{a.current?.focus()},[]);let s=(0,B.useCallback)(()=>o.current(),[]);ut(!0,s);let c=(0,B.useRef)(null);return un(c,!0),L(`div`,{className:`cp-overlay`,onClick:n,children:z(`aside`,{ref:c,className:`cp-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":i(`ctx.sheetAria`),onClick:e=>e.stopPropagation(),children:[z(`header`,{className:`cp-header`,children:[L(`h2`,{children:i(`sp.section.context`)}),L(`button`,{ref:a,type:`button`,className:`cp-icon`,onClick:n,"aria-label":i(`sp.closeShort`),children:L(nc,{size:16})})]}),L(`div`,{className:`cp-body`,children:L(Nz,{sessionId:e,busy:t,onUsage:r})})]})})}function Fz(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}K`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`}var Iz=[{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 Lz({usage:e,unavailable:t,sessionId:n,busy:r=!1,onUsage:i,onDetails:a}){let o=R(),s=(0,B.useRef)(null),[c,l]=(0,B.useState)(!1),[d,f]=(0,B.useState)(!1),p=d&&n?L(Pz,{sessionId:n,busy:r,onUsage:i,onClose:()=>f(!1)}):null;if(!e)return t?z(`span`,{className:`context-meter is-empty`,title:t,"aria-label":`${o(`ctx.context`)}: ${t}`,children:[L(`span`,{className:`context-meter-label`,children:o(`ctx.context`)}),L(`span`,{"aria-hidden":`true`,children:`–`})]}):null;let m=Math.min(100,Math.round(e.used/e.window*100)),h=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:nl(e.window),model:nl(_)}:null,y=e.system+e.tools,b=e.used>0&&y/e.used>=.6?o(`ctx.meter.mostlySetup`,{setup:Fz(y),chat:Fz(e.history+e.query+e.documents)}):null;return z(`div`,{className:`composer-chip-wrap context-meter-wrap`,children:[z(`button`,{ref:s,type:`button`,className:`context-meter${h?` is-warning`:``}`,onClick:()=>l(e=>!e),"aria-expanded":c,"aria-label":o.compose(t=>{let n=t(`ctx.meter.aria`,{pct:m,used:Fz(e.used),window:nl(e.window)});return v?`${n} (${t(`ctx.meter.capNote`,v)})`:n}),title:[v?o(`ctx.meter.titleCapped`,v):o(`ctx.meter.title`),b].filter(Boolean).join(`
|
|
193
|
-
`),children:[L(`span`,{className:`context-meter-bar`,"aria-hidden":`true`,children:L(`span`,{style:{width:`${m}%`}})}),L(`span`,{className:`context-meter-label`,children:z(`bdi`,{dir:`ltr`,children:[m,`%`]})})]}),L(pc,{open:c,onClose:()=>l(!1),anchor:s,label:o(`ctx.meter.window`),align:`end`,children:z(`div`,{className:`context-meter-panel`,children:[z(`div`,{className:`context-meter-head`,children:[L(`strong`,{children:L(`bdi`,{dir:`ltr`,children:Fz(e.used)})}),` `,o.bare(`ctx.of`),` `,L(`bdi`,{dir:`ltr`,children:nl(e.window)}),` `,o.bare(`ctx.tokensWord`),v&&z(`span`,{className:`context-meter-cap`,title:o(`ctx.windowTitle`),children:[` · `,o.bare(`ctx.gaiaUses`),` `,L(`bdi`,{dir:`ltr`,children:v.gaia}),` `,o.bare(`ctx.ofModel`),` `,L(`bdi`,{dir:`ltr`,children:v.model})]})]}),b&&L(`p`,{className:`context-meter-note is-setup`,children:b}),L(`div`,{className:`context-meter-stack`,"aria-hidden":`true`,children:Iz.map(({key:t})=>L(`span`,{className:`part-${t}`,style:{width:`${e[t]/e.window*100}%`}},t))}),z(`dl`,{className:`context-meter-rows`,children:[Iz.filter(({key:t})=>t!==`query`||e.query>0).map(({key:t,label:n})=>z(`div`,{className:`context-meter-row`,children:[z(`dt`,{children:[L(`span`,{className:`swatch part-${t}`,"aria-hidden":`true`}),o(n)]}),L(`dd`,{children:L(`bdi`,{dir:`ltr`,children:Fz(e[t])})})]},t)),z(`div`,{className:`context-meter-row is-quiet`,children:[L(`dt`,{children:o(`ctx.meter.reserve`)}),L(`dd`,{children:L(`bdi`,{dir:`ltr`,children:Fz(e.reply_reserve)})})]}),z(`div`,{className:`context-meter-row is-quiet`,children:[L(`dt`,{children:o(`ctx.freeRow`)}),L(`dd`,{children:L(`bdi`,{dir:`ltr`,children:Fz(g)})})]})]}),L(`p`,{className:`context-meter-note`,children:o.compose(t=>[t(u(`ctx.meter.inView`,e.turns_in_view),{n:e.turns_in_view}),e.turns_hidden>0?t(u(`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&&L(`button`,{type:`button`,className:`context-meter-details`,onClick:()=>{l(!1),a?a():f(!0)},children:o(`ctx.meter.details`)})]})}),p]})}function Rz({usage:e}){let t=R(),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(null);if(!e||e.at_risk.length===0)return null;let o=e.at_risk.join(`
|
|
194
|
-
`);if(i===o)return null;let s=e.at_risk.length;return z(`div`,{className:`context-warning`,role:`status`,children:[L(Ws,{size:13,"aria-hidden":`true`}),z(`div`,{className:`context-warning-body`,children:[L(`span`,{children:t(`ctx.warning.short`)}),` `,L(`button`,{type:`button`,className:`link-btn`,"aria-expanded":n,onClick:()=>r(e=>!e),children:t(n?`ctx.warning.hideDetails`:`ctx.warning.details`)}),n&&z(`p`,{className:`context-warning-details`,children:[t.plural(`ctx.meter.warning`,s),` `,e.at_risk.map((e,t)=>z(`span`,{children:[t>0&&`, `,L(`q`,{children:e})]},t)),`. `,t(`ctx.meter.warningSaved`)]})]}),L(`button`,{type:`button`,className:`btn-icon-sm context-warning-close`,onClick:()=>{a(o),r(!1)},"aria-label":t(`ctx.warning.dismiss`),title:t(`ctx.warning.dismiss`),children:L(nc,{size:12,"aria-hidden":`true`})})]})}function zz(...e){return e.some(e=>e>0&&e<.01)?4:2}function Bz(e,t=zz(e)){return`$${e.toFixed(t)}`}function Vz(e=new Date){let t=new Date(e);return t.setHours(0,0,0,0),t.toISOString()}function Hz({sessionId:e,busy:t}){let n=R(),r=zc(e=>e.active),i=N(e=>Jc(r,e.sessions,e.currentSessionId)),a=N(e=>e.openSettings),o=(0,B.useRef)(null),[s,c]=(0,B.useState)(!1),[u,d]=(0,B.useState)(null),f=(0,B.useCallback)(()=>c(!1),[]),p=(0,B.useCallback)(()=>{let t=!1;return(async()=>{try{let n=await l(e,Vz(),i??null);t||d(n??null)}catch(n){t||F.chat.error(`Could not read cloud spending for session=${e}`,n)}})(),()=>{t=!0}},[e,i]);(0,B.useEffect)(()=>p(),[p]);let m=(0,B.useRef)(t);if((0,B.useEffect)(()=>{let e=m.current&&!t;return m.current=t,e?p():void 0},[t,p]),(0,B.useEffect)(()=>s?p():void 0,[s,p]),(0,B.useEffect)(()=>{let e,t=()=>{e?.(),e=p()};return window.addEventListener(`focus`,t),()=>{window.removeEventListener(`focus`,t),e?.()}},[p]),!u?.paid||u.model!==(i??null))return null;let{chat:h,today:g}=u,_=zz(h.usd,g.usd),v=e=>`${e.unpriced_answers>0?`≥ `:``}${Bz(e.usd,_)}`,y=h.unpriced_answers+g.unpriced_answers>0,b=[...h.items].reverse(),x=e=>new Date(e).toLocaleTimeString(On(n),{hour:`numeric`,minute:`2-digit`});return z(`div`,{className:`composer-chip-wrap spend-meter-wrap`,children:[z(`button`,{ref:o,type:`button`,className:`context-meter spend-meter`,onClick:()=>c(e=>!e),"aria-expanded":s,"aria-label":n(`spend.aria`,{chat:v(h),today:v(g)}),title:n(y?`spend.titleExcluded`:`spend.title`),children:[L(`bdi`,{dir:`ltr`,children:v(h)}),z(`span`,{className:`spend-meter-today`,children:[`· `,n.bare(`spend.today`),` `,L(`bdi`,{dir:`ltr`,children:v(g)})]})]}),L(pc,{open:s,onClose:f,anchor:o,label:n(`spend.window`),align:`end`,children:z(`div`,{className:`context-meter-panel spend-meter-panel`,children:[z(`dl`,{className:`context-meter-rows`,children:[z(`div`,{className:`context-meter-row`,children:[L(`dt`,{children:n(`spend.thisChat`)}),L(`dd`,{children:L(`bdi`,{dir:`ltr`,children:v(h)})})]}),z(`div`,{className:`context-meter-row`,children:[L(`dt`,{children:n.plural(`spend.todayChats`,g.chats)}),L(`dd`,{children:L(`bdi`,{dir:`ltr`,children:v(g)})})]})]}),y&&L(`p`,{className:`context-meter-note spend-meter-excluded`,role:`note`,children:n(`spend.excluded`,{chat:h.unpriced_answers,today:g.unpriced_answers})}),b.length>0&&z(P.Fragment,{children:[L(`div`,{className:`spend-meter-heading`,children:n(`spend.perAnswer`)}),L(`dl`,{className:`context-meter-rows spend-meter-answers`,children:b.map(e=>z(`div`,{className:`context-meter-row`,children:[L(`dt`,{children:L(`bdi`,{dir:`ltr`,children:x(e.created_at)})}),L(`dd`,{children:e.kind===`estimate`&&e.usd!=null?L(`bdi`,{dir:`ltr`,children:Bz(e.usd)}):L(`span`,{className:`spend-meter-unknown`,children:n(e.kind===`unreported`?`ctx.costUnreported`:`ctx.unknown`)})})]},e.message_id))})]}),L(`p`,{className:`context-meter-note`,children:n(`spend.note`)}),L(`button`,{type:`button`,className:`context-meter-details`,onClick:()=>{c(!1),a(`model`)},children:n(`spend.month`)})]})})]})}function Uz(e){return{id:e.id,name:e.display_name??Uc(e.id),sizeGb:e.size_gb??null}}async function Wz(e){let{providers:t,lemonade_error:n}=await gt();if(n)throw Error(n);let r=t.filter(e=>!e.remote).map(e=>Gt(e.id)),i=e?t.find(t=>t.remote&&t.id===e):void 0,[a,...o]=await Promise.all([i?Gt(i.id):Promise.resolve(null),...r]);return{cloud:a&&!a.blocked?a.models.filter(e=>e.available!==!1).map(e=>({...Uz(e),sizeGb:null})):[],local:o.flatMap(e=>e.models.filter(e=>e.downloaded).map(Uz))}}function Gz({answeredBy:e,onPick:t}){let n=(0,B.useRef)(null),r=R(),i=zc(e=>e.active),a=i?.remote?i.provider_name??null:null,o=i?.remote?i.provider:null,[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(null),p=(0,B.useCallback)(async()=>{u(null),f(null);try{u(await Wz(o))}catch(e){f(e instanceof Error?e.message:String(e))}},[o]);(0,B.useEffect)(()=>{s&&p()},[s,p]);let m=l?.cloud.filter(t=>t.id!==e)??[],h=l?.local.filter(t=>t.id!==e)??[],g=(e,n)=>z(`button`,{type:`button`,className:`retry-menu-item`,title:e.id,onClick:()=>{c(!1),t(e.id)},children:[L(`span`,{className:`retry-menu-name`,children:e.name}),L(`span`,{className:`retry-menu-meta`,children:e.sizeGb?z(`bdi`,{dir:`ltr`,children:[e.sizeGb,` GB`]}):n})]},e.id);return z(P.Fragment,{children:[L(`button`,{ref:n,type:`button`,className:`msg-action-btn`,onClick:()=>c(e=>!e),title:r(`retry.button`),"aria-label":r(`retry.button`),"aria-expanded":s,children:L(ws,{size:12})}),L(pc,{open:s,onClose:()=>c(!1),anchor:n,label:`Retry with`,placement:`below`,align:`end`,children:z(`div`,{className:`retry-menu`,children:[L(`div`,{className:`retry-menu-head`,children:r(`retry.head`)}),d&&L(`div`,{className:`retry-menu-error`,role:`alert`,children:d}),!d&&l===null&&z(`div`,{className:`retry-menu-empty`,children:[L(Za,{size:12,className:`spin`,"aria-hidden":`true`}),` `,r(`retry.loading`)]}),m.length>0&&a&&L(`div`,{className:`retry-menu-note`,children:r(`retry.onProvider`,{provider:a})}),m.map(e=>g(e,r(`retry.cloudHint`))),h.length>0&&a&&L(`div`,{className:`retry-menu-note`,children:r(`retry.onThisPc`,{provider:a})}),h.map(e=>g(e,r(`retry.localHint`))),l!==null&&m.length===0&&h.length===0&&L(`div`,{className:`retry-menu-empty`,children:r(`retry.none`)})]})})]})}function Kz(e,t){return al(e(`answer.duration.sec`,{n:t.toFixed(1)}))}function qz(e,t){return t?al(e(`compare.rate`,{n:t})):null}function Jz({parts:e}){let t=e.filter(e=>!!e);return t.length?L(`div`,{className:`compare-meta`,children:t.map((e,t)=>z(`span`,{children:[t>0&&` · `,L(cl,{text:e})]},t))}):null}function Yz({original:e,originalModel:t,originalLatencyMs:n,state:r,keeping:i,onKeep:a,onClose:o}){Vc();let s=R(),c=r.status===`ready`?r.result.model:r.model,l=e.stats?.tokens_per_second;return z(`section`,{className:`answer-compare`,"aria-label":s(`compare.title`),children:[z(`header`,{className:`answer-compare-head`,children:[L(`span`,{children:s(`compare.title`)}),L(`button`,{type:`button`,className:`msg-action-btn`,onClick:o,"aria-label":s(`compare.close`),disabled:!!i,children:L(nc,{size:12})})]}),z(`div`,{className:`answer-compare-cols`,children:[z(`article`,{className:`compare-col`,"aria-label":s(`compare.answerFrom`,{model:t??We(`compare.originalModel`)}),children:[L(`h4`,{children:t?Uc(t):s(`compare.original`)}),L(Jz,{parts:[n!=null&&n>0?Kz(s,n/1e3):null,qz(s,l)]}),L(`div`,{className:`compare-body`,children:L(lI,{content:e.content})}),L(`button`,{type:`button`,className:`compare-keep`,onClick:()=>a(`original`),disabled:!!i||r.status===`running`,children:s(i===`original`?`compare.keeping`:`compare.keep`)})]}),z(`article`,{className:`compare-col`,"aria-label":s(`compare.answerFrom`,{model:c}),children:[L(`h4`,{children:Uc(c)}),r.status===`running`&&z(`div`,{className:`compare-wait`,children:[L(Za,{size:14,className:`spin`,"aria-hidden":`true`}),L(`span`,{children:s(`compare.loading`,{model:Uc(c)})})]}),r.status===`failed`&&L(`div`,{className:`compare-error`,role:`alert`,children:r.error}),r.status===`ready`&&z(P.Fragment,{children:[L(Jz,{parts:[Kz(s,r.result.stats.seconds),r.result.stats.load_seconds>=1?s.compose(e=>e(`compare.loadTime`,{time:al(e(`answer.duration.sec`,{n:r.result.stats.load_seconds.toFixed(1)}))})):null,qz(s,r.result.stats.tokens_per_second)]}),L(`div`,{className:`compare-body`,children:L(lI,{content:r.result.content})}),L(`button`,{type:`button`,className:`compare-keep`,onClick:()=>a(`retry`),disabled:!!i,children:s(i===`retry`?`compare.keeping`:`compare.keep`)})]})]})]})]})}var Xz=`gaia.sessionPanel.open`,Zz=`gaia.sessionPanel.width`,Qz=`gaia.sessionPanel.sections`,$z={slide:!0,answer:!0,environment:!0,context:!1,outputs:!0,changes:!0,skills:!0,tools:!1,session:!1,plan:!0,schedule:!0,documents:!0,commands:!0};function eB(e,t,n){try{let r=window.localStorage.getItem(e);return r==null?n:t(r)}catch(t){return F.ui.warn(`Session panel setting ${e} unavailable; using the default`,t),n}}function tB(e,t){try{window.localStorage.setItem(e,t)}catch(t){F.ui.warn(`Could not remember session panel setting ${e}`,t)}}function nB(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 rB(){return{open:eB(Xz,e=>e!==`0`,!0),width:nB(eB(Zz,e=>Number(e)||320,320)),sections:{...$z,...eB(Qz,e=>JSON.parse(e),{})}}}var iB=Pt((e,t)=>({...rB(),overlayOpen:!1,focus:null,signals:{},setSignals:(t,n)=>e(e=>({signals:{...e.signals,[t]:{...e.signals[t],...n}}})),setOpen:t=>{tB(Xz,t?`1`:`0`),e({open:t})},setOverlayOpen:t=>e({overlayOpen:t}),setWidth:t=>{let n=nB(t);tB(Zz,String(n)),e({width:n})},setSection:(n,r)=>{let i={...t().sections,[n]:r};tB(Qz,JSON.stringify(i)),e({sections:i})},reveal:n=>{let r={...t().sections,[n]:!0};tB(Qz,JSON.stringify(r)),tB(Xz,`1`),e({sections:r,open:!0,overlayOpen:!0,focus:{section:n,nonce:Date.now()}})},reload:()=>e({...rB(),overlayOpen:!1,focus:null,signals:{}})}));function aB(e){return e!==null&&Date.now()-e.nonce<2e3}var oB=16;function sB({width:e,setWidth:t,clamp:n,min:r,max:i,defaultWidth:a}){let[o,s]=(0,B.useState)(null),c=(0,B.useCallback)(r=>{if(r.button!==0)return;r.preventDefault();let i=r.clientX,a=e,o=r.currentTarget;o.setPointerCapture?.(r.pointerId);let c=getComputedStyle(o).direction===`rtl`?-1:1,l=a,u=e=>{l=n(a+c*(i-e.clientX)),s(l)},d=()=>{o.removeEventListener(`pointermove`,u),o.removeEventListener(`pointerup`,d),o.removeEventListener(`pointercancel`,d),s(null),t(l)};o.addEventListener(`pointermove`,u),o.addEventListener(`pointerup`,d),o.addEventListener(`pointercancel`,d)},[n,t,e]),l=(0,B.useCallback)(n=>{let a=getComputedStyle(n.currentTarget).direction===`rtl`?-16:oB,o={ArrowLeft:e+a,ArrowRight:e-a,Home:r,End:i}[n.key];o!==void 0&&(n.preventDefault(),t(o))},[i,r,t,e]),u=o??e;return{width:u,dragging:o!==null,separatorProps:{role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":r,"aria-valuemax":i,"aria-valuenow":u,tabIndex:0,onPointerDown:c,onKeyDown:l,onDoubleClick:()=>t(a)}}}function cB(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 lB(e){let t=e.live_data?.attempted??0;return t>0&&(e.live_data?.failed??0)>=t}function uB(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}function dB(e,t,n){let r=[];return t&&t.length>0&&r.push(e(u(`rail.pages`,t.length),{list:t.join(`, `)})),r.push(e(u(`rail.passages`,n),{n})),r.join(` · `)}function fB(e,t=mt,n=!1){let{cost:r}=e;return r.kind===`local`?t(`rail.costLocal`):r.kind===`no_reply`?t(`rail.costNoReply`):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 pB(e){return e instanceof Vn?e.detail||e.message:e instanceof Error?e.message:String(e)}function mB({messages:e,busy:t=!1}){let n=R(),r=cB(e,t);if(!r)return null;let i=r.kind===`turn`?r.turn.turnSummary??null:null;if(!i)return null;let a=lB(i);return z(`div`,{className:`side-rail-body`,children:[a&&z(`div`,{className:`side-rail-warn`,role:`status`,children:[L(Ws,{size:14,"aria-hidden":`true`}),z(`div`,{children:[L(`strong`,{children:n(`rail.noLive`)}),L(`span`,{children:n(`rail.noLiveWhy`)})]})]}),i&&(i.error?L(`p`,{className:`side-rail-error`,role:`alert`,children:n(`rail.error`,{error:i.error})}):z(P.Fragment,{children:[L(gB,{summary:i}),L(yB,{summary:i}),L(xB,{summary:i,stopped:r.kind===`turn`&&!!r.turn.stopState,alone:(i.pages??[]).length===0&&(i.documents??[]).length===0&&(i.files??[]).length===0})]}))]})}function hB({title:e,children:t}){return z(`section`,{className:`side-rail-section`,children:[L(`h4`,{className:`side-rail-section-head`,children:e}),L(`div`,{className:`side-rail-section-body`,children:t})]})}function gB({summary:e}){let t=R(),n=e.pages??[],r=e.documents??[];return n.length===0&&r.length===0?null:L(hB,{title:t(`rail.sources`),children:z(`ul`,{className:`side-rail-list`,children:[n.map(e=>z(`li`,{className:`side-rail-item`,children:[L(Da,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`side-rail-item-text`,children:[z(`a`,{href:Nv(e.url)||void 0,target:`_blank`,rel:`noopener noreferrer`,className:`side-rail-link`,title:e.url,children:[L(`span`,{className:`side-rail-link-text`,children:e.title||uB(e.url)}),L(Ui,{size:10,"aria-hidden":`true`,className:`side-rail-link-icon`})]}),z(`span`,{className:`side-rail-meta`,children:[uB(e.url),e.kind===`search_result`?` · ${t(`rail.searchResult`)}`:``]})]})]},e.url)),r.map(e=>{let n=e.passages??0;return z(`li`,{className:`side-rail-item`,children:[L(sa,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`side-rail-item-text`,children:[L(`span`,{className:`side-rail-name`,title:V(e.name),dir:`ltr`,children:V(e.name)}),L(`span`,{className:`side-rail-meta`,children:t.compose(t=>dB(t,e.pages,n))})]})]},e.path)})]})})}var _B=4e3;function vB(e){let t=e.join(`
|
|
195
|
-
`),[n,r]=(0,B.useState)(()=>new Map),[i,a]=(0,B.useState)(null);return(0,B.useEffect)(()=>{if(!t)return;let e=t.split(`
|
|
196
|
-
`),n=!1,i=()=>{document.visibilityState!==`hidden`&&Te(e).then(e=>{n||(r(new Map(e.files.map(e=>[e.path,e]))),a(null))},e=>{n||(F.ui.warn(`Could not re-check the files this turn wrote`,e),a(pB(e)))})};i();let o=window.setInterval(i,_B);return window.addEventListener(`focus`,i),()=>{n=!0,window.clearInterval(o),window.removeEventListener(`focus`,i)}},[t]),{status:n,error:i}}function yB({summary:e}){let t=R(),n=e.files??[],[r,i]=(0,B.useState)(null),{status:a,error:o}=vB(n.map(e=>e.path));if(n.length===0)return null;let s=(e,n)=>{i(null),e.catch(e=>{F.ui.error(`Failed to open ${n}`,e),i(t(`sp.couldntOpen`,{name:n,error:pB(e)}))})};return z(hB,{title:t(`rail.files`),children:[L(`ul`,{className:`side-rail-list`,children:n.map(e=>{let n=a.get(e.path);if(n?.exists===!1)return z(`li`,{className:`side-rail-item side-rail-item-gone`,children:[L(sa,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`side-rail-item-text`,children:[L(`span`,{className:`side-rail-name`,title:V(e.path),children:V(e.name)}),L(`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 z(`li`,{className:`side-rail-item`,children:[L(sa,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`side-rail-item-text`,children:[L(`span`,{className:`side-rail-name`,title:V(e.path),children:V(e.name)}),r&&L(`span`,{className:`side-rail-meta`,children:t(`rail.changedSince`)}),z(`span`,{className:`side-rail-actions`,children:[e.openable&&L(`button`,{type:`button`,className:`side-rail-action`,onClick:()=>s(Et(e.path),V(e.name)),children:t(`sp.open`)}),z(`button`,{type:`button`,className:`side-rail-action`,onClick:()=>s(Ft(e.path,!0),V(e.name)),children:[L(da,{size:11,"aria-hidden":`true`}),t(`sp.showInFolder`)]})]})]})]},e.path)})}),r&&L(`p`,{className:`side-rail-error`,role:`alert`,children:r}),o&&L(`p`,{className:`side-rail-error`,children:t(`rail.checkFailed`,{error:o})})]})}function bB(e){return!!e.error||lB(e)||(e.pages??[]).length>0||(e.documents??[]).length>0||(e.files??[]).length>0||(e.sites??[]).length>0||e.model?.remote!==!1||e.cost.kind!==`local`}function xB({summary:e,stopped:t,alone:n}){let r=R();Vc();let{model:i}=e,a=e.sites??[],o=(e.documents??[]).length>0,s=i?.remote===!0,c=e.cost.kind!==`local`;if(i&&!s&&!o&&a.length===0&&!c)return null;let l=z(`dl`,{className:`side-rail-facts`,children:[s&&z(P.Fragment,{children:[L(`dt`,{children:r(`rail.model`)}),z(`dd`,{children:[z(`span`,{className:`side-rail-where remote`,children:[L(xi,{size:12,"aria-hidden":`true`}),r(`rail.cloudModel`,{name:i.provider_name})]}),i.name&&L(`span`,{className:`side-rail-meta`,title:i.name,dir:`ltr`,children:Uc(i.name)})]})]}),!i&&z(P.Fragment,{children:[L(`dt`,{children:r(`rail.model`)}),L(`dd`,{children:L(`span`,{className:`side-rail-where`,children:r(`rail.notReported`)})})]}),o&&z(P.Fragment,{children:[L(`dt`,{children:r(`rail.documents`)}),L(`dd`,{children:s?r(`rail.docsSent`,{provider:i.provider_name}):r(i?`rail.docsLocal`:`rail.docsSearched`)})]}),a.length>0&&z(P.Fragment,{children:[L(`dt`,{children:r(`rail.websites`)}),L(`dd`,{children:L(`span`,{dir:`ltr`,children:a.join(`, `)})})]}),c&&z(P.Fragment,{children:[L(`dt`,{children:r(`rail.cost`)}),L(`dd`,{children:fB(e,r,t)})]})]});return n?l:L(hB,{title:r(`rail.thisTurn`),children:l})}var SB=`(prefers-reduced-motion: reduce)`;function CB(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 wB(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(SB).matches}function TB(){return wB()?`auto`:`smooth`}var EB=(0,B.createContext)(!1);function DB(e){let[t,n]=(0,B.useState)(null);return(0,B.useEffect)(()=>{let t=window.setTimeout(()=>n(e),900);return()=>window.clearTimeout(t)},[e]),t===e}function OB(){let e=(0,B.useContext)(EB);return(0,B.useRef)(e).current?` sp-appear`:``}function kB({id:e,title:t,summary:n,children:r}){let i=iB(t=>t.sections[e]),a=iB(e=>e.setSection),o=iB(e=>e.focus),s=(0,B.useRef)(null),c=`sp-section-${e}`,l=OB();return(0,B.useEffect)(()=>{o?.section===e&&aB(o)&&s.current?.scrollIntoView?.({block:`start`,behavior:TB()})},[o,e]),z(`section`,{ref:s,className:`sp-section${l}`,"data-section":e,"aria-labelledby":`${c}-title`,children:[L(`h3`,{className:`sp-section-heading`,children:z(`button`,{type:`button`,id:`${c}-title`,className:`sp-section-head`,"aria-expanded":i,"aria-controls":c,onClick:()=>a(e,!i),children:[L(ri,{size:13,className:`sp-chevron${i?` is-open`:``}`,"aria-hidden":`true`}),L(`span`,{className:`sp-section-title`,children:t}),n!=null&&L(`span`,{className:`sp-section-summary`,children:n})]})}),i&&L(`div`,{id:c,className:`sp-section-body`,children:r})]})}var AB=e=>[...e.querySelectorAll(`[role="radio"]`)].filter(t=>t.closest(`[role="radiogroup"]`)===e),jB=e=>!e.matches(`:disabled`)&&e.getAttribute(`aria-disabled`)!==`true`;function MB({children:e,...t}){let n=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{let e=AB(n.current),t=e.find(e=>e.getAttribute(`aria-checked`)===`true`&&jB(e))??e.find(jB);for(let n of e)n.tabIndex=n===t?0:-1}),L(`div`,{ref:n,role:`radiogroup`,onKeyDown:e=>{let t=AB(e.currentTarget).filter(jB),n=t.indexOf(document.activeElement);if(n<0)return;let r=getComputedStyle(e.currentTarget).direction===`rtl`?`ArrowRight`:`ArrowLeft`,i=e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowUp`||e.key===r?n-1:e.key===`ArrowDown`||e.key===`ArrowRight`||e.key===`ArrowLeft`?n+1:null;if(i===null)return;e.preventDefault();let a=t[(i+t.length)%t.length];a.focus(),a.getAttribute(`aria-checked`)!==`true`&&a.click()},...t,children:e})}var NB=`gaia:mobile-access-request`,PB=`gaia:mobile-access-state`;function FB(e){window.dispatchEvent(new CustomEvent(NB,{detail:e}))}function IB(e){window.dispatchEvent(new CustomEvent(PB,{detail:e}))}function LB(e,t){let n=(0,B.useRef)(t);n.current=t,(0,B.useEffect)(()=>{let t=e=>n.current(!!e.detail);return window.addEventListener(e,t),()=>window.removeEventListener(e,t)},[e])}var RB=e=>LB(NB,e),zB=e=>LB(PB,e);function BB({checked:e,onChange:t,label:n,text:r,disabled:i}){return z(`span`,{className:`sp-switch-wrap`,children:[L(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,className:`sp-switch${e?` is-on`:``}`,onClick:()=>t(!e),disabled:i,children:L(`span`,{className:`sp-switch-knob`,"aria-hidden":`true`})}),r&&L(`span`,{className:`sp-state-text`,children:r})]})}var VB={warming:`modelStatus.state.warming`,idle:`modelStatus.state.idle`,stopped:`modelStatus.state.stopped`},HB=3e3,UB={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`},WB=new Set([`gaia_documents`,`scratch`]),GB=3,KB=14;function qB(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function JB({sessionId:e,busy:t,usage:n,hideDocuments:r=!1}){let i=R(),{env:a,refresh:o}=QR(e);Pd(t,()=>{o()});let s=a&&!a.internet?i(`env.offline`):null;return L(kB,{id:`environment`,title:i(`env.title`),summary:s,children:z(`div`,{className:`sp-rows`,children:[L(nV,{sessionId:e,busy:t,usage:n??null}),L(YB,{usage:n??null}),L(ZB,{sessionId:e}),L($B,{sessionId:e,busy:t}),L(rV,{sessionId:e,hideDocuments:r}),L(oV,{sessionId:e}),L(iV,{sessionId:e}),L(aV,{})]})})}function YB({usage:e}){let t=R(),n=iB(e=>e.reveal),r=OB();if(!e||e.window<=0)return null;let i=Math.min(100,Math.round(e.used/e.window*100)),a=i>=80?` is-high`:``;return L(`div`,{className:`sp-row${r}`,children:z(`button`,{type:`button`,className:`sp-row-line sp-row-button`,onClick:()=>n(`context`),title:t(`env.contextTitle`),children:[L(`span`,{className:`sp-row-icon`,"aria-hidden":`true`,children:L(ya,{size:KB})}),L(`span`,{className:`sp-row-label`,children:t(`env.context`)}),z(`span`,{className:`sp-row-end`,children:[z(`bdi`,{className:`sp-quiet`,dir:`ltr`,children:[i,`%`]}),L(`span`,{className:`sp-meter${a}`,"aria-hidden":`true`,children:L(`span`,{style:{width:`${i}%`}})})]})]})})}var XB={google:`env.mailbox.google`,microsoft:`env.mailbox.microsoft`};function ZB({sessionId:e}){let t=R(),n=N(t=>{let n=t.sessions.find(t=>t.id===e);return n?.agent_type===`email`?n.mail_provider??null:null}),r=n?XB[n]:void 0;return r?L(eV,{icon:L(ro,{size:KB}),label:t(r),title:t(`env.mailboxTitle`)}):null}var QB=qB;function $B({sessionId:e,busy:t}){let n=R(),r=iB(t=>t.signals[e]?.changedFiles??0),[i,a]=(0,B.useState)(null),o=OB(),s=(0,B.useRef)(0),c=(0,B.useCallback)(()=>{let t=++s.current;r===0?a(null):Promise.resolve().then(()=>st(e)).then(e=>{t===s.current&&a(UR(e,e=>Array.isArray(e.repos),`git state`))}).catch(n=>{F.ui.warn(`Could not read the git state of session=${e}`,n),t===s.current&&a(null)})},[r,e]);return(0,B.useEffect)(()=>(c(),()=>{s.current+=1}),[c]),Pd(t,c),!i||i.repos.length===0?null:L(P.Fragment,{children:i.repos.map(e=>L(`div`,{className:`sp-row${o}`,children:z(`div`,{className:`sp-row-line`,title:n(`env.branchTitle`),children:[L(`span`,{className:`sp-row-icon`,"aria-hidden":`true`,children:L(xa,{size:KB})}),z(`span`,{className:`sp-row-label`,dir:`ltr`,children:[QB(e.root),` `,L(`span`,{className:`sp-quiet`,children:e.branch})]}),e.uncommitted.length>0&&L(`span`,{className:`sp-row-end sp-quiet`,children:n.plural(`env.uncommitted`,e.uncommitted.length,{n:e.uncommitted.length})})]})},e.root))})}function eV({icon:e,label:t,title:n,children:r,info:i,below:a,className:o}){let[s,c]=(0,B.useState)(!1);return z(`div`,{className:`sp-row${o?` ${o}`:``}`,children:[z(`div`,{className:`sp-row-line`,children:[L(`span`,{className:`sp-row-icon`,"aria-hidden":`true`,children:e}),L(`span`,{className:`sp-row-label`,title:n,children:t}),i&&L(`button`,{type:`button`,className:`btn-icon-sm sp-info`,onClick:()=>c(e=>!e),"aria-expanded":s,"aria-label":i.label,title:i.label,children:L(Na,{size:13})}),r!=null&&L(`span`,{className:`sp-row-end`,children:r})]}),i&&s&&L(`span`,{className:`sp-note`,children:i.text}),a]})}function tV(e,t){let n=e=>e.toLowerCase().replace(/^user\./,``);return n(e)===n(t)}function nV({sessionId:e,busy:t,usage:n}){let r=R(),i=qc(),a=zc(e=>e.active),o=N(t=>Jc(a,t.sessions,e)),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null),d=i?.remote===!0,f=n&&n.window>0?n.window:s?.ctx_size??null,p=(0,B.useCallback)(()=>{d||Promise.resolve().then(()=>j()).then(e=>{c(UR(e,e=>typeof e.state==`string`,`model status`)),u(null)}).catch(e=>{F.ui.warn(`Could not read where the local model runs`,e),u(oN(e))})},[d]);(0,B.useEffect)(p,[p]),Pd(t,p);let m=s?.state===`warming`;if((0,B.useEffect)(()=>{if(!m)return;let e=setInterval(p,HB);return()=>clearInterval(e)},[m,p]),d)return z(P.Fragment,{children:[L(eV,{className:`is-remote`,icon:L(xi,{size:KB}),label:r(`env.cloudPlace`,{name:i?.label??``}),info:i?.description?{text:i.description,label:r(`env.aboutCloud`)}:void 0}),o&&L(eV,{icon:L(ki,{size:KB}),label:L(`span`,{dir:`ltr`,children:Uc(o)}),title:o})]});if(!i)return L(eV,{icon:L(vo,{size:KB}),label:L(`span`,{className:`sp-quiet`,children:r(`env.notKnownYet`)}),title:Kc});let h=!!(s?.model&&o&&!tV(s.model,o)),g=h?null:s?.memory,_=s?.display_name??(s&&s.state!==`loaded`&&o?Uc(o):null),v=g?.model_gb==null?s?.state===`loaded`||s?.state===`warming`?r(`env.inUseUnknown`):null:r(`env.inUse`,{gb:g.model_gb.toFixed(1)}),y=g?.free_gb==null?null:r(`env.free`,{gb:g.free_gb.toFixed(1)}),b=g&&[v,y].filter(Boolean).join(` · `)||void 0;return z(P.Fragment,{children:[L(eV,{icon:L(vo,{size:KB}),label:`${r(`env.thisPc`)}${!h&&s?.placement?.label?` · ${s.placement.label}`:``}`,below:l?L(`span`,{className:`sp-error`,children:l}):s?.error&&L(`span`,{className:`sp-error`,children:L(ll,{status:s})})}),h&&L(eV,{icon:L(ki,{size:KB}),label:L(`span`,{className:`sp-quiet`,children:r(`env.notLoaded`,{model:Uc(o)})})}),!h&&s&&_&&L(eV,{icon:L(ki,{size:KB}),label:z(P.Fragment,{children:[L(`bdi`,{dir:`ltr`,children:_}),s.state===`loaded`?``:` · ${r(VB[s.state])}`]}),title:b,children:f!=null&&L(`span`,{className:`sp-quiet`,title:r(`modelStatus.context`),children:r(`settings.ctx.tokens`,{size:nl(f)})})})]})}function rV({sessionId:e,hideDocuments:t}){let n=R(),{env:r,error:i,change:a}=QR(e),o=N(t=>t.sessions.find(t=>t.id===e)?.agent_type===`gaia`),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(!1),_=async(e,t)=>{u(e),c(null);try{await t()}catch(e){c(oN(e))}finally{u(null)}},v=t=>_(t.path,()=>a(()=>De(e,t.path))),{open:y,picker:b,error:x}=qR(t=>{_(t,()=>a(()=>Ve(e,t)))}),S=(r?.folders??[]).filter(e=>!(t&&e.kind===`file`&&e.source===`document`)),C=S.filter(e=>WB.has(e.source)),w=S.filter(e=>e.kind===`folder`&&!WB.has(e.source)),T=S.filter(e=>e.kind===`file`&&!WB.has(e.source)),E=d?T:T.slice(0,GB),D=!r||!r.enforced,O=e=>z(`li`,{className:`sp-scope-item sp-row-line`,children:[L(`span`,{className:`sp-row-icon`,"aria-hidden":`true`,children:e.kind===`folder`?L(_a,{size:KB}):L(la,{size:KB})}),L(`span`,{className:`sp-item-name`,dir:`ltr`,title:V(e.path),children:V(e.name||qB(e.path))}),e.kind===`folder`?L(`span`,{className:`sp-item-path sp-quiet`,dir:`ltr`,title:n(UB[e.source]),children:V(e.path)}):L(`span`,{className:`sp-item-source sp-quiet`,title:V(e.path),children:n(UB[e.source])}),e.removable&&!D&&L(`button`,{type:`button`,className:`btn-icon-sm sp-info sp-item-remove`,onClick:()=>void v(e),disabled:l!==null,"aria-label":n(`env.remove`,{path:V(e.path)}),title:n(`env.removeShort`),children:L(nc,{size:12})})]},e.path),ee=r&&!r.enforced?n(o?`env.flagshipScope`:`env.agentScope`):null,te=!!r&&!D;return z(`div`,{className:`sp-row`,children:[!r&&!i&&L(`span`,{className:`sp-quiet`,children:n(`sp.checking`)}),i&&L(`span`,{className:`sp-error`,children:n(`env.foldersError`,{error:i})}),r&&z(P.Fragment,{children:[w.length+E.length>0&&z(`ul`,{className:`sp-list`,"aria-label":r.enforced?n(`env.readWrite`):n(`env.reach`),children:[w.map(O),E.map(O)]}),T.length>GB&&L(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>f(e=>!e),children:d?n(`env.fewerFiles`):n(`env.allFiles`,{n:T.length})}),(te||ee||r.folders.length===0)&&z(`div`,{className:`sp-row-line`,children:[te?z(`button`,{type:`button`,className:`sp-row-button`,onClick:()=>y(),disabled:l!==null,children:[L(`span`,{className:`sp-row-icon`,"aria-hidden":`true`,children:L(pa,{size:KB})}),n(`env.addFolder`)]}):L(`span`,{className:`sp-row-label sp-quiet`,children:r.folders.length===0?n(`env.nothing`):n(`env.reach`)}),ee&&L(`button`,{type:`button`,className:`btn-icon-sm sp-info`,onClick:()=>m(e=>!e),"aria-expanded":p,"aria-label":n(`env.aboutFolders`),title:n(`env.aboutFolders`),children:L(Na,{size:13})})]}),ee&&p&&L(`span`,{className:`sp-note`,children:ee}),C.length>0&&z(`button`,{type:`button`,className:`sp-row-line sp-row-button`,onClick:()=>g(e=>!e),"aria-expanded":h,title:n(`env.ownFoldersTitle`),children:[L(`span`,{className:`sp-row-icon`,"aria-hidden":`true`,children:L(ri,{size:KB,className:`sp-chevron${h?` is-open`:``}`})}),L(`span`,{className:`sp-row-label`,children:n(`env.ownFolders`)}),L(`bdi`,{className:`sp-row-end sp-quiet`,dir:`ltr`,children:C.length})]}),h&&C.length>0&&L(`ul`,{className:`sp-list sp-row-sub`,"aria-label":n(`env.ownFolders`),children:C.map(O)}),r.removed.length>0&&L(`span`,{className:`sp-quiet`,children:n(`env.removed`,{names:r.removed.map(qB).join(`, `)})})]}),(s??x)&&L(`span`,{className:`sp-error`,role:`alert`,children:s??x}),b]})}function iV({sessionId:e}){let t=R(),{env:n,change:r,refresh:a}=QR(e),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(!1);if(!n)return null;let u=async t=>{l(!0),s(null);try{await r(()=>i(e,t))}catch(e){s(oN(e)),a()}finally{l(!1)}},d=L(Da,{size:KB});return n.internet_enforced?L(eV,{icon:d,label:t(`env.internet`),title:n.internet?void 0:t(`env.blocked`),below:o&&L(`span`,{className:`sp-error`,role:`alert`,children:o}),children:L(BB,{checked:n.internet,onChange:e=>void u(e),disabled:c,label:t(`env.internetFor`),text:n.internet?t(`env.on`):t(`env.off`)})}):L(eV,{icon:d,label:t(`env.internet`),children:L(`span`,{className:`sp-quiet`,children:n.internet?t(`env.on`):t(`env.off`)})})}function aV(){let e=R(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(null),s=(0,B.useCallback)(()=>{Promise.resolve().then(()=>at()).then(e=>{n(UR(e,e=>typeof e.active==`boolean`,`phone access status`)),o(null)}).catch(e=>o(oN(e)))},[]);(0,B.useEffect)(s,[s]),zB(()=>{i(!1),s()});let c=t?.active===!0;return L(eV,{icon:L(Es,{size:KB}),label:e(`env.phone`),below:z(P.Fragment,{children:[c&&z(`span`,{className:`sp-row-line sp-row-sub`,children:[L(`span`,{className:`sp-row-label sp-quiet`,children:t?.device?e(`env.phoneConnected`,{name:t.device.name}):e(`env.noPhone`)}),L(`button`,{type:`button`,className:`sp-action`,onClick:()=>FB(!0),children:e(`env.qr`)})]}),(a||c&&t?.error)&&L(`span`,{className:`sp-error`,children:a??t?.error})]}),children:L(BB,{checked:c,onChange:e=>{i(!0),FB(e)},disabled:r,label:e(`env.phone`),text:e(r?c?`env.stopping`:`env.starting`:c?`env.on`:`env.off`)})})}function oV({sessionId:e}){let t=R(),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(null),c=Bl(t=>Wl(e)(t)!==null);(0,B.useEffect)(()=>{let t=!0;return Promise.resolve().then(()=>St(e)).then(e=>{t&&r(UR(e,e=>typeof e.mode==`string`,`permission mode`).mode)}).catch(e=>{t&&s(oN(e))}),()=>{t=!1}},[e]),iz(e,r);let l=async t=>{a(!1),s(null);try{let n=(await Vt(e,t)).mode;r(n),rz(e,n)}catch(e){s(oN(e))}},u=az.find(e=>e.mode===n)?.note;return L(eV,{icon:L(n===`full_access`?bs:vs,{size:KB}),label:t(`env.permissionShort`),info:u?{text:t(u),label:t(`env.aboutPermission`)}:void 0,below:z(P.Fragment,{children:[n===`full_access`&&c&&L(`span`,{className:`sp-quiet`,role:`status`,children:t(`perm.fullPendingNote`)}),i&&z(`span`,{className:`sp-confirm`,role:`alert`,children:[t(`env.fullAccessWarn`),z(`span`,{className:`sp-actions-row`,children:[L(`button`,{type:`button`,className:`sp-action is-warning`,onClick:()=>void l(`full_access`),children:t(`env.turnOn`)}),L(`button`,{type:`button`,className:`sp-action`,onClick:()=>a(!1),children:t(`sp.cancel`)})]})]}),o&&L(`span`,{className:`sp-error`,role:`alert`,children:o})]}),children:L(MB,{className:`sp-segmented`,"aria-label":t(`env.permission`),children:az.map(e=>L(`button`,{type:`button`,role:`radio`,"aria-checked":n===e.mode,className:`${n===e.mode?`is-selected`:``}${e.mode===`full_access`?` is-risky`:``}`,onClick:()=>e.mode===`full_access`?a(!0):void l(e.mode),children:e.mode===`ask`?t(`env.ask`):t(e.label)},e.mode))})})}function sV(){let e=(0,B.useRef)(0),t=(0,B.useRef)(0),n=(0,B.useRef)(!0);return(0,B.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]),(0,B.useCallback)(()=>{let r=++e.current;return()=>!n.current||r<t.current?!1:(t.current=r,!0)},[])}var cV={file:{label:`out.kind.file`,Icon:sa},export:{label:`out.kind.export`,Icon:ta},image:{label:`out.kind.image`,Icon:ja},audio:{label:`out.kind.audio`,Icon:Li},document:{label:`out.kind.document`,Icon:Va},memory:{label:`out.kind.memory`,Icon:Lr},schedule:{label:`out.kind.schedule`,Icon:Ur}},lV={created:`out.change.created`,edited:`out.change.edited`,deleted:`out.change.deleted`};function uV(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 dV(e){return e.state===`undone`?`out.undone`:e.state===`gone`?`sp.gone`:null}function fV({sessionId:e,busy:t,onJumpToMessage:n}){let r=R(),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(null),c=sV(),l=(0,B.useCallback)(()=>{let t=c();Promise.resolve().then(()=>rt(e)).then(e=>{t()&&(a(UR(e,e=>Array.isArray(e.items),`list of outputs`).items),s(null))}).catch(n=>{t()&&(F.ui.warn(`Could not list what session=${e} produced`,n),s(aN(n)))})},[c,e]);return(0,B.useEffect)(()=>{l()},[l]),Pd(t,l),mN(e,l),!o&&(!i||i.length===0)?null:L(kB,{id:`outputs`,title:r(`out.title`),summary:i&&i.length>0?String(i.length):null,children:o?L(`p`,{className:`sp-error`,children:r(`out.listError`,{error:o})}):L(pV,{items:i??[],onJumpToMessage:n})})}function pV({items:e,onJumpToMessage:t}){let n=R(),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(!1),s=(e,t)=>{i(null),e.catch(e=>i(n(`sp.couldntOpen`,{name:t,error:aN(e)})))},c=a?e:e.slice(0,5);return z(P.Fragment,{children:[L(`ul`,{className:`sp-list`,"aria-label":n(`out.listLabel`),children:c.map(e=>{let{label:r,Icon:a}=cV[e.kind],o=dV(e),c=e.change&&e.kind!==`document`?lV[e.change]:void 0,l=uV(e.created_at,Date.now(),On(n)),u=n.compose(e=>[c?e(`out.kindChanged`,{kind:We(r),change:We(c)}):e(r),l==null?``:typeof l==`string`?l:e(l.key,l.params),o?e(o):``].filter(Boolean).join(` · `));return z(`li`,{className:`sp-output${e.state===`present`?``:` is-inactive`}`,children:[L(a,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`sp-item-text`,children:[L(`span`,{className:`sp-item-name`,dir:`ltr`,title:V(e.path??e.name),children:V(e.name)}),L(`span`,{className:`sp-meta`,children:u}),z(`span`,{className:`sp-item-actions`,children:[e.message_id!=null&&z(`button`,{type:`button`,className:`sp-action`,onClick:()=>{t(e.message_id)||i(n(`out.notLoaded`))},"aria-label":n(`out.goToAria`,{name:V(e.name)}),children:[L(Di,{size:11,"aria-hidden":`true`}),` `,n(`sp.goToTurn`)]}),e.openable&&e.path&&L(`button`,{type:`button`,className:`sp-action`,onClick:()=>s(Et(e.path),V(e.name)),children:n(`sp.open`)}),e.revealable&&e.path&&z(`button`,{type:`button`,className:`sp-action`,onClick:()=>s(Ft(e.path,!0),V(e.name)),children:[L(da,{size:11,"aria-hidden":`true`}),` `,n(`sp.showInFolder`)]})]})]})]},e.id)})}),e.length>5&&L(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>o(e=>!e),children:a?n(`out.fewer`):n(`out.more`,{n:e.length-5})}),r&&L(`p`,{className:`sp-error`,role:`alert`,children:r})]})}async function mV(){return Ct(`GET`,`/schedules`)}function hV(){return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}async function gV(e,t,n){return Ct(`POST`,`/schedules`,{name:e,interval:t,prompt:n,timezone:hV()})}async function _V(e,t,n){return Ct(`PATCH`,`/schedules/${encodeURIComponent(e)}`,{interval:t,prompt:n,timezone:hV()})}async function vV(e,t){return Ct(`PUT`,`/schedules/${encodeURIComponent(e)}`,{status:t})}async function yV(e){return Ct(`POST`,`/schedules/${encodeURIComponent(e)}/run`)}async function bV(e){return Ct(`DELETE`,`/schedules/${encodeURIComponent(e)}`)}async function xV(e,t=20){return Ct(`GET`,`/schedules/${encodeURIComponent(e)}/results?limit=${t}`)}async function SV(e){return Ct(`POST`,`/schedules/parse`,{input:e,timezone:hV()})}function CV(e){return e.replace(/^\s*(```|~~~).*$/gm,``).replace(/!?\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/\*\*(.+?)\*\*/g,`$1`).replace(/(^|[^\w])__(?=\S)(.+?\S)__(?![\w.])/g,`$1$2`).replace(/(^|[^\w*])\*(?!\s)(.*?\S)\*(?!\w)/g,`$1$2`).replace(/(^|[^\w])_(?![\s_])(.+?)_(?!\w)/g,`$1$2`).replace(/^\s{0,3}(#{1,6}\s+|>\s?|[-*+]\s+)/gm,``).replace(/\s+/g,` `).trim()}function wV(e,t){if(!(e instanceof Error))return t;let n=e.message,r=n.match(/API \d+: (.+)/);if(r)try{let e=JSON.parse(r[1]);if(e.detail)return e.detail}catch{}return n}var TV=`gaia-schedule-announced-errors`;function EV(){let e;try{e=localStorage.getItem(TV)}catch(e){return F.system.warn(`Announced schedule failures unreadable; failures from before launch may be announced again. localStorage is blocked -- check private-browsing or site-data settings.`,e),{}}if(!e)return{};try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return Object.fromEntries(Object.entries(t).filter(([,e])=>typeof e==`number`));F.system.warn(`Ignored malformed "${TV}"; failures from before launch may be announced again.`)}catch(e){F.system.warn(`"${TV}" is corrupt; failures from before launch may be announced again.`,e)}return{}}function DV(e){try{localStorage.setItem(TV,JSON.stringify(e))}catch(e){F.system.warn(`Announced schedule failures not saved; they may be announced again on the next launch. localStorage is blocked -- check private-browsing or site-data settings.`,e)}}function OV(e,t){let{addNotification:n}=Bl.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:Ut()(`schedules.failed`,{name:r.name}),message:r.last_error,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,...r.session_id?{sessionId:r.session_id}:{}})}function kV(e){return e.run_count-+!!e.running}function AV(e,t,n){let{addNotification:r}=Bl.getState();for(let i of n){let n=kV(i);n<=(t[i.id]??0)||i.error_count>(e[i.id]??0)||r({id:`schedule-done-${i.id}-${n}`,type:`info`,agentId:`scheduler`,agentName:`GAIA`,title:Ut()(`schedules.finished`,{name:i.name}),message:CV(i.last_result??``),timestamp:Date.now(),read:!1,dismissed:!1,priority:`medium`,...i.session_id?{sessionId:i.session_id}:{}})}}var jV=Pt((e,t)=>({schedules:[],loading:!1,error:null,actionError:null,selectedSchedule:null,results:[],resultsLoading:!1,errorCounts:null,finishedCounts:{},draft:null,setDraft:t=>e({draft:t}),loadSchedules:async()=>{t().schedules.length===0&&!t().error&&e({loading:!0}),e({error:null});try{let n=(await mV()).schedules||[],r=t().errorCounts,i=t().finishedCounts,a=r??EV();OV(a,n),r&&AV(a,i,n);let o=Object.fromEntries(n.map(e=>[e.id,e.error_count]));DV(o),e({schedules:n,loading:!1,errorCounts:o,finishedCounts:Object.fromEntries(n.map(e=>[e.id,Math.max(kV(e),i[e.id]??0)]))})}catch(t){F.api.error(`Failed to load schedules`,t),e({error:`Failed to load schedules`,loading:!1})}},createSchedule:async(t,n,r)=>{try{let i=await gV(t,n,r);e(e=>({schedules:[...e.schedules,i],actionError:null}))}catch(e){throw F.api.error(`Failed to create schedule`,e),e}},editSchedule:async(t,n,r)=>{try{let i=await _V(t,n,r);e(e=>({schedules:e.schedules.map(e=>e.name===t?i:e),actionError:null}))}catch(e){throw F.api.error(`Failed to edit schedule "${t}"`,e),e}},updateScheduleStatus:async(t,n)=>{try{let r=await vV(t,n);e(e=>({schedules:e.schedules.map(e=>e.name===t?r:e),actionError:null}))}catch(n){F.api.error(`Failed to update schedule "${t}"`,n),e({actionError:wV(n,`Failed to update schedule`)})}},runScheduleNow:async t=>{try{let n=await yV(t);e(e=>({schedules:e.schedules.map(e=>e.name===t?n:e),actionError:null}))}catch(n){F.api.error(`Failed to run schedule "${t}" now`,n),e({actionError:wV(n,`Could not run the schedule now`)})}},deleteSchedule:async t=>{try{await bV(t),e(e=>({schedules:e.schedules.filter(e=>e.name!==t),selectedSchedule:e.selectedSchedule===t?null:e.selectedSchedule,actionError:null}))}catch(n){F.api.error(`Failed to delete schedule "${t}"`,n),e({actionError:wV(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 xV(n);if(t().selectedSchedule!==n)return;e({results:r.results||[],resultsLoading:!1})}catch(r){if(F.api.error(`Failed to load results for "${n}"`,r),t().selectedSchedule!==n)return;e({results:[],resultsLoading:!1})}},dismissActionError:()=>e({actionError:null})})),MV=/^(coding|code|git|github)/i;function NV(e,t){let n=e=>e.replace(/\\/g,`/`).toLowerCase();return n(e)===n(t)}function PV(e,t){let n=xO(e,t);for(let e=n.length-1;e>=0;e--){let t=n[e];if(t.type===`plan`&&t.planSteps&&t.planSteps.length!==0)return{steps:t.planNarrations?.length===t.planSteps.length?t.planNarrations:t.planSteps,statuses:t.planStatuses??t.planSteps.map(()=>`pending`)}}return null}function FV(e){return PV(e,!0)}function IV(e){let t=e[e.length-1];if(!t||t.role!==`assistant`)return null;let n=PV(t.agentSteps??[],!1);return n?{...n,finished:!0}:null}function LV(e){let t=new Set;for(let n of e)for(let e of n.turnSummary?.sites??[])t.add(e);return t.size}function RV(e,t,n){let r=N(t=>t.sessions.find(t=>t.id===e)),i=N(e=>e.documents),a=N(e=>e.agentSteps),o=jV(e=>e.schedules),s=iB(t=>t.signals[e]),{env:c}=QR(e);return(0,B.useMemo)(()=>{let l=(c?.folders??[]).filter(e=>e.kind===`file`&&e.source===`document`).map(e=>({entry:e,doc:i.find(t=>NV(t.filepath,e.path))??null})),u=o.filter(t=>t.session_id===e&&t.status!==`cancelled`),d=(n?FV(a):null)??IV(t),f=WV(t,n?a:[]),p=cB(t,n),m=p?.kind===`turn`&&!!p.turn.turnSummary&&bB(p.turn.turnSummary),h=s?.changedFiles??0,g=(s?.changedCode??0)>0||(s?.skills??[]).some(e=>MV.test(e))||f.some(e=>YV(e.command)),_=LV(t),v=[];return r?.agent_type===`email`&&v.push({kind:`email`,section:`environment`}),(u.length>0||r?.kind===`scheduled`)&&v.push({kind:`scheduled`,section:u.length>0?`schedule`:void 0}),g&&v.push({kind:`coding`,count:h||void 0,section:h>0?`changes`:f.length>0?`commands`:void 0}),f.length>0&&v.push({kind:`commands`,count:f.length,section:`commands`}),l.length>0&&v.push({kind:`documents`,count:l.length,section:`documents`}),_>0&&v.push({kind:`web`,count:_,section:m?`answer`:void 0}),d&&!d.finished&&v.push({kind:`plan`,section:`plan`}),v.length===0&&v.push({kind:`chat`}),{facets:v,documents:l,schedules:u,plan:d,commands:f,coding:g,showAnswer:m}},[o,n,c,i,t,r?.agent_type,r?.kind,e,s,a])}var zV=`run_shell_command`,BV=/(?:^|,[ \t]*|\n)[ \t]*command:[ \t]?/,VV=/(?:,[ \t]*|\n)[ \t]*(?:working_directory:[ \t]|timeout:[ \t]?\d+[ \t]*(?:,|\n|$))/;function HV(e){if(e.commandOutput?.command)return e.commandOutput.command;let t=e.detail??``,n=BV.exec(t);if(!n)return null;let r=t.slice(n.index+n[0].length),i=VV.exec(r);return(i?r.slice(0,i.index):r).trim()||null}function UV(e){if(e.declined||e.timedOut)return`declined`;if(e.active)return`running`;let t=e.commandOutput;return typeof t?.returnCode==`number`?t.returnCode===0||t.expectedExit?`ok`:`failed`:typeof t?.return_code==`number`?t.return_code===0||e.success===!0?`ok`:`failed`:e.success===!1?`failed`:e.success===!0||e.result?`ok`:`stopped`}function WV(e,t){let n=[],r=(e,t)=>{for(let r of e??[]){if(r.type!==`tool`||r.tool!==zV)continue;let e=HV(r);e&&n.push({key:`${t??`live`}-${r.id}`,command:e,state:UV(r),messageId:t})}};for(let t of e)t.role===`assistant`&&r(t.agentSteps,t.id);return r(t,null),n}var GV=/\.(py|pyi|ipynb|ts|tsx|js|jsx|mjs|cjs|go|rs|c|cc|cpp|cxx|h|hpp|cs|java|kt|kts|swift|rb|php|lua|r|scala|sh|bash|zsh|ps1|psm1|bat|cmd|sql|html|htm|css|scss|vue|svelte|json|jsonc|yaml|yml|toml|ini|cfg|xml|gradle|cmake|mk|lock)$/i,KV=/^(makefile|dockerfile|cmakelists\.txt|requirements[\w.-]*\.txt|\.gitignore|\.env\.example)$/i;function qV(e){let t=e.split(/[\\/]/).pop()??``;return GV.test(t)||KV.test(t)}var JV=/^(git|gh|npm|npx|pnpm|yarn|node|python3?|py|pip3?|uv|pytest|cargo|go|make|cmake|dotnet|mvn|gradle|tsc|docker)$/i;function YV(e){let t=/^\s*(?:"([^"]+)"|'([^']+)'|(\S+))/.exec(e),n=(t?.[1]??t?.[2]??t?.[3]??``).split(/[\\/]/).pop()??``;return JV.test(n.replace(/\.(exe|cmd|bat)$/i,``))}function XV(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function ZV(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}var QV=e=>We(e===1?`chg.files.one`:`chg.files.other`,{n:e});function $V(e,t=mt){let{files:n,additions:r,deletions:i}=e.totals;return t(`chg.total`,{files:QV(n),add:r,del:i})}var eH={edited:`Edited`,created:`Created`,deleted:`Deleted`},tH={edited:`chg.edited`,created:`chg.created`,deleted:`chg.deleted`};function nH({sessionId:e,busy:t,onJumpToMessage:n}){let r=R(),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),u=(0,B.useCallback)(()=>{Promise.resolve().then(()=>$e(e)).then(t=>{let n=UR(t,e=>Array.isArray(e.files),`list of this chat's changes`);a(n),iB.getState().setSignals(e,{changedFiles:n.files.length,changedCode:n.files.filter(e=>qV(e.path)).length}),s(null)}).catch(t=>{F.ui.warn(`Could not total what session=${e} changed`,t),s(aN(t))})},[e]);(0,B.useEffect)(u,[u]),Pd(t,()=>{l(null),u()}),mN(e,u);let d=!i||i.files.length===0;return!o&&d&&!c?null:z(kB,{id:`changes`,title:r(`chg.title`),summary:i&&!d?r(`chg.summary`,{files:QV(i.totals.files),add:i.totals.additions,del:i.totals.deletions}):null,children:[o&&L(`p`,{className:`sp-error`,children:r(`chg.error`,{error:o})}),i&&!d&&L(rH,{sessionId:e,busy:t,changes:i,onChanged:u,onUndone:l,onJumpToMessage:n}),d&&c&&L(`p`,{className:`sp-ok`,role:`status`,children:c})]})}function rH({sessionId:e,busy:t,changes:n,onChanged:r,onUndone:i,onJumpToMessage:a}){let o=R(),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(`idle`),[d,f]=(0,B.useState)(null),p=n.files.length,m=async t=>{u(`working`),f(null);try{let n=await jt(e,t),r=[];n.restored.length&&r.push(`restored ${XV(n.restored.length,`file`)}`),n.removed.length&&r.push(`removed ${XV(n.removed.length,`new file`)}`);let a=`Undone: ${r.join(`, `)||`no files needed changing`}.`;n.kept_folders.length&&(a+=` Kept ${XV(n.kept_folders.length,`folder`)} the chat created, because they now hold other files.`),f(a),u(`done`),i(a),pN(e),await uN(e)}catch(e){let t=e?.reason===`conflict`;f(oN(e)),u(t?`conflict`:`idle`)}};return z(`div`,{className:`sp-changes`,children:[z(`p`,{className:`sp-changes-total`,"aria-live":`polite`,children:[L(`strong`,{children:$V(n,o)}),n.totals.uncounted>0&&z(`span`,{className:`sp-meta`,children:[` · `,o.plural(`chg.uncounted`,n.totals.uncounted)]})]}),n.pending&&L(`p`,{className:`sp-meta`,children:o(`chg.pending`)}),L(`ul`,{className:`sp-list`,children:n.files.map(e=>{let t=e.message_ids[e.message_ids.length-1];return z(`li`,{className:`sp-change`,children:[z(`div`,{className:`sp-item-text`,children:[L(`span`,{className:`sp-item-name`,dir:`ltr`,title:V(e.path),children:V(ZV(e.path))}),z(`span`,{className:`sp-meta`,children:[o(tH[e.change]),e.additions!=null&&z(P.Fragment,{children:[` · `,z(`span`,{className:`sp-add`,children:[`+`,e.additions]}),` `,z(`span`,{className:`sp-del`,children:[`−`,e.deletions]})]}),e.message_ids.length>1&&` · ${o(`chg.turns`,{n:e.message_ids.length})}`]}),e.changed_since&&z(`span`,{className:`sp-warn-text`,children:[L(Ws,{size:11,"aria-hidden":`true`}),` `,o(`chg.outside`,{when:e.changed_since})]})]}),t!=null&&L(`button`,{type:`button`,className:`btn-icon-sm`,onClick:()=>a(t),"aria-label":o(`chg.goToLast`,{name:V(ZV(e.path))}),title:o(`sp.goToTurn`),children:L(Di,{size:12})})]},e.path)})}),n.incomplete&&z(`p`,{className:`sp-warn-text`,role:`note`,children:[L(Ws,{size:11,"aria-hidden":`true`}),` `,SN(n.untracked,{inChat:!0},o)]}),z(`div`,{className:`sp-actions-row`,children:[z(`button`,{type:`button`,className:`sp-action`,onClick:()=>c(!0),children:[L(Yi,{size:12,"aria-hidden":`true`}),` `,o(`chg.review`)]}),l!==`confirm`&&l!==`conflict`&&z(`button`,{type:`button`,className:`sp-action`,onClick:()=>u(`confirm`),disabled:l===`working`||t,title:t?o(`chg.wait`):void 0,children:[L(Ks,{size:12,"aria-hidden":`true`}),` `,o(l===`working`?`chg.undoing`:`chg.undoAll`)]})]}),l===`confirm`&&z(`div`,{className:`sp-confirm`,role:`group`,"aria-label":o(`chg.confirmLabel`),children:[o(p===1?`chg.confirm.one`:`chg.confirm.other`,{files:QV(p)}),z(`span`,{className:`sp-actions-row`,children:[L(`button`,{type:`button`,className:`sp-action is-danger`,onClick:()=>void m(!1),children:o(`chg.undoAll`)}),L(`button`,{type:`button`,className:`sp-action`,onClick:()=>u(`idle`),children:o(`sp.cancel`)})]})]}),d&&z(`div`,{className:l===`done`?`sp-ok`:`sp-error`,role:l===`done`?`status`:`alert`,children:[d,l===`conflict`&&z(`span`,{className:`sp-actions-row`,children:[L(`button`,{type:`button`,className:`sp-action is-danger`,onClick:()=>void m(!0),children:o(`chg.undoAnyway`)}),L(`button`,{type:`button`,className:`sp-action`,onClick:()=>{u(`idle`),f(null)},children:o(`chg.keep`)})]})]}),L(oH,{sessionId:e,busy:t,onCommitted:r}),s&&L(aH,{changes:n,onClose:()=>c(!1)})]})}function iH(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 aH({changes:e,onClose:t}){ut(!0,t);let n=(0,B.useRef)(null);return un(n,!0),L(`div`,{ref:n,className:`modal-overlay`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Review this chat's changes`,children:z(`div`,{className:`modal-panel changes-review`,onClick:e=>e.stopPropagation(),children:[z(`div`,{className:`modal-header`,children:[z(`h3`,{children:[`Changes in this chat · `,$V(e)]}),L(`button`,{type:`button`,className:`btn-icon`,onClick:t,"aria-label":`Close`,children:L(nc,{size:18})})]}),L(`div`,{className:`modal-body changes-review-body`,children:e.files.map(e=>L(`section`,{className:`changes-review-file`,children:L(mA,{data:{path:e.path,badge:eH[e.change],note:iH(e),unified:e.binary||e.too_large?``:e.unified}})},e.path))})]})})}function oH({sessionId:e,busy:t,onCommitted:n}){let r=R(),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(null),f=(0,B.useCallback)(()=>{Promise.resolve().then(()=>st(e)).then(e=>{a(UR(e,e=>Array.isArray(e.repos),`list of git repositories`)),s(null)}).catch(e=>s(aN(e)))},[e]);return(0,B.useEffect)(f,[f]),Pd(t,f),mN(e,f),o?L(`p`,{className:`sp-error`,children:r(`chg.gitError`,{error:o})}):!i||!i.available||i.repos.length===0?null:z(`div`,{className:`sp-git`,children:[i.repos.map(e=>z(`div`,{className:`sp-git-repo`,children:[z(`span`,{className:`sp-meta`,title:V(e.root),children:[L(xa,{size:12,"aria-hidden":`true`}),` `,V(ZV(e.root)),` · `,V(e.branch),e.uncommitted.length===0&&e.files.length>0&&` · committed`]}),z(`span`,{className:`sp-actions-row`,children:[z(`button`,{type:`button`,className:`sp-action`,disabled:t||e.uncommitted.length===0,onClick:()=>{d(null),l({kind:`commit`,repo:e})},children:[L(Ca,{size:12,"aria-hidden":`true`}),` Commit…`]}),z(`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:[L(Ta,{size:12,"aria-hidden":`true`}),` Create PR…`]})]}),e.pr_blocked&&L(`span`,{className:`sp-meta`,children:e.pr_blocked})]},e.root)),u&&L(`p`,{className:`sp-ok`,role:`status`,children:u}),c&&L(sH,{sessionId:e,kind:c.kind,repo:c.repo,onClose:()=>l(null),onDone:e=>{l(null),d(e),f(),n()}})]})}function sH({sessionId:e,kind:t,repo:n,onClose:r,onDone:i}){let[a,o]=(0,B.useState)(n.draft.title),[s,c]=(0,B.useState)(n.draft.body),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(null);ut(!0,r,!l);let p=(0,B.useRef)(null);un(p,!0);let m=async()=>{u(!0),f(null);try{if(t===`commit`){let t=await T(e,n.root,`${a.trim()}\n\n${s.trim()}`.trim());i(`Committed ${XV(t.files.length,`file`)} as ${t.commit}.`)}else i(`Opened ${(await le(e,n.root,a,s)).url}`)}catch(e){f(oN(e)),u(!1)}},h=t===`commit`?n.uncommitted:n.files;return L(`div`,{className:`modal-overlay`,onClick:l?void 0:r,children:z(`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:[z(`div`,{className:`modal-header`,children:[L(`h3`,{children:t===`commit`?`Commit this chat’s changes`:`Create a pull request`}),L(`button`,{type:`button`,className:`btn-icon`,onClick:r,disabled:l,"aria-label":`Close`,children:L(nc,{size:18})})]}),z(`div`,{className:`modal-body sp-git-body`,children:[L(`p`,{className:`sp-meta`,children:t===`commit`?`In ${V(n.root)} on ${V(n.branch)}. Only the files below are committed; anything else you changed stays as it is.`:`Pushes ${V(n.branch)} to ${n.remote} (never forced), then opens a pull request with GitHub's gh tool.`}),z(`label`,{className:`sp-field`,children:[L(`span`,{children:t===`commit`?`Summary`:`Title`}),L(`input`,{value:a,onChange:e=>o(e.target.value),disabled:l})]}),z(`label`,{className:`sp-field`,children:[L(`span`,{children:t===`commit`?`Details`:`Description`}),L(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:7,disabled:l})]}),z(`div`,{className:`sp-meta`,children:[XV(h.length,`file`),`: `,h.join(`, `)]}),t===`commit`&&n.ignored.length>0&&z(`div`,{className:`sp-meta`,children:[`Left out, because git ignores `,n.ignored.length===1?`it`:`them`,`: `,n.ignored.join(`, `)]}),d&&L(`p`,{className:`sp-error`,role:`alert`,children:d})]}),z(`div`,{className:`sp-picker-actions`,children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:r,disabled:l,children:`Cancel`}),z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void m(),disabled:l||!a.trim(),children:[l&&L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),t===`commit`?`Commit ${XV(h.length,`file`)}`:`Push and open PR`]})]})]})})}RegExp(`\\\\(${Object.keys({rightarrow:`→`,to:`→`,longrightarrow:`→`,Rightarrow:`⇒`,leftarrow:`←`,uparrow:`↑`,downarrow:`↓`,Uparrow:`⇑`,Downarrow:`⇓`,times:`×`,le:`≤`,leq:`≤`,ge:`≥`,geq:`≥`,approx:`≈`,pm:`±`,cdot:`·`}).sort((e,t)=>t.length-e.length).join(`|`)})(?![A-Za-z])`,`g`),"`".repeat(3);var cH=`slide-decks`;`${cH}`,`${cH}`;var lH=e=>!e||e.status===`done`||e.status===`failed`,uH=Pt(e=>({drafts:{},update:(t,n)=>e(e=>{let r=e.drafts[t],i=lH(r)?{status:`preparing`,markdown:``,previous:r?.markdown||void 0}:r;return{drafts:{...e.drafts,[t]:{...i,...n}}}})}));function dH(e){let t=uH.getState().drafts[e];lH(t)||uH.getState().update(e,{status:`failed`})}var fH=1200,pH=`gaia.browserPane.openChats`,mH=`gaia.browserPane.width`;function hH(){return typeof window>`u`?void 0:window.gaiaBrowserPane}function gH(e){try{return window.localStorage.getItem(e)}catch(t){return F.ui.warn(`Browser pane setting ${e} unavailable; using the default`,t),null}}function _H(e,t){try{window.localStorage.setItem(e,t)}catch(t){F.ui.warn(`Could not remember browser pane setting ${e}`,t)}}function vH(e){let t=typeof document<`u`?window.innerWidth-yH()-560:fH;return Math.round(Math.max(360,Math.min(e,fH,t)))}function yH(){return document.querySelector(`.main-content`)?.getBoundingClientRect().left??0}function bH(){let e=gH(pH);if(e===null)return[];try{let t=JSON.parse(e);if(!Array.isArray(t)||!t.every(e=>typeof e==`string`))throw Error(`expected a list of chat ids`);return t.slice(0,200)}catch(e){return F.ui.warn(`Ignoring unreadable ${pH}; every chat's browser pane starts closed`,e),[]}}function xH(e,t){return t===null?e.draftOpen:e.openChats.includes(t)}var SH=()=>N.getState().currentSessionId,CH=Pt((e,t)=>{let n=t=>{let n=t.slice(0,200);_H(pH,JSON.stringify(n)),e({openChats:n})};return{pane:null,openChats:hH()===void 0?[]:bH(),draftOpen:!1,width:vH(Number(gH(mH))||520),setOpen:r=>{let i=SH();i===null?e({draftOpen:r}):n([...r?[i]:[],...t().openChats.filter(e=>e!==i)]),r&&iB.getState().open&&iB.getState().setOpen(!1)},toggle:()=>t().setOpen(!xH(t(),SH())),claimDraft:r=>{t().draftOpen&&(e({draftOpen:!1}),n([r,...t().openChats.filter(e=>e!==r)])),hH()?.claimDraft(r)},forgetChat:e=>{t().openChats.includes(e)&&n(t().openChats.filter(t=>t!==e)),hH()?.forgetChat(e)},setWidth:t=>{let n=vH(t);_H(mH,String(n)),e({width:n})}}});function wH(){let e=N(e=>e.currentSessionId);return CH(t=>xH(t,e))}Kn(e=>CH.getState().forgetChat(e)),N.subscribe((e,t)=>{e.currentSessionId!==t.currentSessionId&&xH(CH.getState(),e.currentSessionId)&&iB.getState().open&&iB.getState().setOpen(!1)}),iB.subscribe((e,t)=>{e.open&&!t.open&&xH(CH.getState(),SH())&&CH.getState().setOpen(!1)});function TH(e){let t=!0,n=!1,r=e.onState(e=>{n=!0,CH.setState({pane:e})});return e.getState().then(e=>{t&&!n&&CH.setState({pane:e})}).catch(e=>F.ui.error(`Could not read the browser pane state`,e)),()=>{t=!1,r()}}function EH(){return(0,B.useSyncExternalStore)(zt,()=>an()>0)}function DH(e){let t=e.toLowerCase().replace(/\.$/,``);return t===`localhost`||t.endsWith(`.localhost`)||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t)||t===`[::1]`}var OH=/^[a-z][a-z0-9+.-]*:(?!\d)/i;function kH(e){let t=e.trim();if(!t||/\s/.test(t))return null;if(OH.test(t))return t;let n;try{n=new URL(`http://${t}`)}catch{return null}return DH(n.hostname)?n.href:n.hostname.includes(`.`)||n.port!==``?(n.protocol=`https:`,n.href):null}var AH={starting:`browserPane.devServer.starting`,ready:`browserPane.devServer.ready`,failed:`browserPane.devServer.failed`,exited:`browserPane.devServer.exited`,stopped:`browserPane.devServer.stopped`},jH=e=>e.status===`starting`||e.status===`ready`;function MH(e,t){t.catch(t=>F.ui.error(`Browser pane: ${e} failed`,t))}function NH(e){let t=e.chats[0],n=N(e=>e.currentSessionId),r=N(e=>e.sessions.find(e=>e.id===t)?.title),i=R();return t===n?i(`browserPane.startedHere`):r===void 0?null:i(`browserPane.startedIn`,{title:r})}function PH({server:e}){let t=NH(e);return t===null?null:L(`div`,{className:`bp-devserver-chat`,children:t})}function FH({api:e,servers:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useRef)(null),a=()=>r(!1),o=t.filter(jH).length,s=R();return z(`div`,{className:`bp-menu`,children:[L(`button`,{ref:i,type:`button`,className:`btn-icon-sm${n||o?` active`:``}`,"aria-label":s(`browserPane.devServers`),"aria-expanded":n,title:o?s(`browserPane.devServersRunning`,{n:o}):s(`browserPane.devServers`),onClick:()=>r(e=>!e),children:L(fs,{size:15})}),z(pc,{open:n,onClose:a,anchor:i,label:s(`browserPane.devServers`),placement:`below`,align:`end`,children:[L(`div`,{className:`popover-heading`,children:s(`browserPane.devServers`)}),t.length===0&&L(`p`,{className:`bp-devservers-empty`,children:s(`browserPane.devServersEmpty`)}),t.map(t=>z(`div`,{className:`bp-devserver`,role:`group`,"aria-label":s(`browserPane.devServerNamed`,{name:t.name}),children:[z(`div`,{className:`bp-devserver-head`,children:[L(`span`,{className:`bp-devserver-name`,children:t.name}),L(`span`,{className:`bp-devserver-status is-${t.status}`,children:s(AH[t.status])}),z(`span`,{className:`bp-devserver-port`,dir:`ltr`,children:[`:`,t.port]})]}),L(PH,{server:t}),L(`div`,{className:`bp-devserver-cmd`,title:t.cwd,dir:`ltr`,children:t.argv.join(` `)}),z(`div`,{className:`bp-devserver-actions`,children:[z(`button`,{type:`button`,className:`bp-chip`,disabled:t.status!==`ready`,onClick:()=>{a(),MH(`open dev server`,e.openTab(t.url))},children:[L(Ao,{size:12,"aria-hidden":`true`}),` `,s(`browserPane.openInPane`)]}),z(`button`,{type:`button`,className:`bp-chip`,disabled:!jH(t),onClick:()=>MH(`stop dev server`,e.stopDevServer(t.key)),children:[L(hi,{size:12,"aria-hidden":`true`}),` `,s(`browserPane.stopServer`)]})]})]},t.key))]})]})}var IH=`Mod+Shift+B`,LH=`Mod+Shift+S`;function RH(e,t){t.catch(t=>F.ui.error(`Browser pane: ${e} failed`,t))}function zH({pane:e,api:t,onClosePane:n,addressRef:r}){let i=e.tabs.find(t=>t.id===e.activeTabId),a=i.url!==null,o=R();return z(`div`,{className:`bp-toolbar`,children:[z(`div`,{className:`bp-tabs`,role:`tablist`,"aria-label":o(`browserPane.tabs`),children:[e.tabs.map(n=>{let r=n.id===e.activeTabId;return z(`div`,{className:`bp-tab${r?` is-active`:``}`,children:[z(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:`bp-tab-title`,title:n.url??n.title,onClick:()=>RH(`select tab`,t.selectTab(n.id)),children:[n.loading&&L(`span`,{className:`bp-tab-spinner`,"aria-hidden":`true`}),n.control===`private`&&L(to,{size:11,"aria-label":o(`browserPane.private`)}),L(`span`,{children:n.title||n.url||o(`browserPane.newTab`)})]}),L(`button`,{type:`button`,className:`bp-tab-close`,"aria-label":o(`browserPane.closeTabNamed`,{name:n.title}),title:o(`browserPane.closeTab`),onClick:()=>RH(`close tab`,t.closeTab(n.id)),children:L(nc,{size:12})})]},n.id)}),L(`button`,{type:`button`,className:`btn-icon-sm bp-new-tab`,"aria-label":o(`browserPane.newTab`),title:o(`browserPane.newTab`),onClick:()=>RH(`open tab`,t.openTab(null)),children:L(Ko,{size:14})})]}),z(`div`,{className:`bp-nav`,children:[L(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.back`),title:o(`browserPane.back`),disabled:!i.canGoBack,onClick:()=>RH(`back`,t.history(i.id,`back`)),children:L(xr,{size:15})}),L(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.forward`),title:o(`browserPane.forward`),disabled:!i.canGoForward,onClick:()=>RH(`forward`,t.history(i.id,`forward`)),children:L(Cr,{size:15})}),i.loading?L(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.stopLoading`),title:o(`browserPane.stopLoading`),onClick:()=>RH(`stop`,t.history(i.id,`stop`)),children:L(nc,{size:15})}):L(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.reload`),title:o(`browserPane.reload`),disabled:!a,onClick:()=>RH(`reload`,t.history(i.id,`reload`)),children:L(is,{size:15})}),L(BH,{tab:i,inputRef:r,onSubmit:e=>RH(`navigate`,t.navigate(i.id,e))},i.id),L(`button`,{type:`button`,className:`btn-icon-sm${e.picking?` active`:``}`,"aria-label":o(`browserPane.select`),"aria-pressed":e.picking,title:o.hint(o(e.picking?`browserPane.selectStop`:`browserPane.selectStart`),vu(LH)),disabled:!a,onClick:()=>RH(`select element`,t.togglePicking()),children:L(Ms,{size:15})}),L(`button`,{type:`button`,className:`btn-icon-sm${i.devToolsOpen?` active`:``}`,"aria-label":o(`browserPane.devTools`),"aria-pressed":i.devToolsOpen,title:o(i.devToolsOpen?`browserPane.devToolsHide`:`browserPane.devToolsShow`),disabled:!a,onClick:()=>RH(`developer tools`,t.toggleDevTools(i.id)),children:L(As,{size:15})}),L(KH,{api:t,tab:i}),L(FH,{api:t,servers:e.devServers}),L(VH,{api:t,tab:i}),L(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.close`),title:o.hint(o(`browserPane.close`),vu(IH)),onClick:n,children:L(Eo,{size:15})})]})]})}function BH({tab:e,inputRef:t,onSubmit:n}){let[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(!1),s=R();return(0,B.useEffect)(()=>{i(null),o(!1)},[e.url]),L(`form`,{className:`bp-address`,onSubmit:a=>{a.preventDefault();let s=kH(r??e.url??``);s===null?o(!0):(i(null),o(!1),n(s),t.current?.blur())},role:`search`,children:L(`input`,{ref:t,type:`text`,className:`bp-address-input${a?` is-invalid`:``}`,"aria-label":s(`browserPane.address`),"aria-invalid":a,title:a?s(`browserPane.addressInvalid`):void 0,placeholder:s(`browserPane.addressPlaceholder`),dir:`ltr`,spellCheck:!1,autoComplete:`off`,value:r??e.url??``,onChange:e=>{i(e.target.value),o(!1)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(null),o(!1),e.currentTarget.blur())},...Nt})})}function VH({api:e,tab:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useRef)(null),a=()=>r(!1),o=R();return z(`div`,{className:`bp-menu`,children:[L(`button`,{ref:i,type:`button`,className:`btn-icon-sm${n?` active`:``}`,"aria-label":o(`browserPane.moreActions`),"aria-expanded":n,title:o(`browserPane.more`),onClick:()=>r(e=>!e),children:L(zi,{size:15})}),z(pc,{open:n,onClose:a,anchor:i,label:o(`browserPane.actions`),placement:`below`,align:`end`,children:[z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{a(),RH(`tab privacy`,e.setControl(t.id,t.control===`private`?`shared`:`private`))},children:[t.control===`private`?L($a,{size:14,"aria-hidden":`true`}):L(to,{size:14,"aria-hidden":`true`}),z(`span`,{className:`popover-item-body`,children:[L(`span`,{className:`popover-item-title`,children:o(t.control===`private`?`browserPane.shareTab`:`browserPane.privateTab`)}),L(`span`,{className:`popover-item-note`,children:o(t.control===`private`?`browserPane.shareTabNote`:`browserPane.privateTabNote`)})]})]}),z(`button`,{type:`button`,className:`popover-item`,disabled:t.url===null,onClick:()=>{a(),RH(`open in system browser`,e.openExternal(t.id))},children:[L(Ui,{size:14,"aria-hidden":`true`}),L(`span`,{className:`popover-item-body`,children:L(`span`,{className:`popover-item-title`,children:o(`browserPane.openExternal`)})})]}),z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{a(),RH(`clear browsing data`,e.clearBrowsingData())},children:[L(Vi,{size:14,"aria-hidden":`true`}),z(`span`,{className:`popover-item-body`,children:[L(`span`,{className:`popover-item-title`,children:o(`browserPane.clearData`)}),L(`span`,{className:`popover-item-note`,children:o(`browserPane.clearDataNote`)})]})]})]})]})}var HH=[{name:`iPhone SE`,width:375,height:667,mobile:!0},{name:`iPhone 15`,width:393,height:852,mobile:!0},{name:`Pixel 8`,width:412,height:915,mobile:!0},{name:`iPad mini`,width:768,height:1024,mobile:!0},{name:`iPad Air`,width:820,height:1180,mobile:!0},{name:`Laptop`,width:1280,height:800,mobile:!1,label:`browserPane.laptop`}],UH=[{label:`browserPane.scheme.system`,value:null},{label:`browserPane.scheme.light`,value:`light`},{label:`browserPane.scheme.dark`,value:`dark`}],WH=200,GH=4e3;function KH({api:e,tab:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useCallback)(()=>r(!1),[]),a=(0,B.useRef)(null),o=t.viewport,s=o?.size??null,c=o?.colorScheme??null,[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(``),p=R();(0,B.useEffect)(()=>{u(s?String(s.width):``),f(s?String(s.height):``)},[s?.width,s?.height]);let m=n=>{let r=n.size===null&&n.colorScheme===null;RH(`responsive`,e.setViewport(t.id,r?null:n))},h=e=>{let t=Number(e);return Number.isInteger(t)&&t>=WH&&t<=GH?t:null},g=h(l),_=h(d);return z(`div`,{className:`bp-menu`,children:[L(`button`,{ref:a,type:`button`,className:`btn-icon-sm${o?` active`:``}`,"aria-label":p(`browserPane.responsive`),"aria-expanded":n,"aria-pressed":o!==null,title:s?p(`browserPane.responsiveSize`,{width:s.width,height:s.height}):p(`browserPane.responsive`),disabled:t.url===null,onClick:()=>r(e=>!e),children:L(go,{size:15})}),L(pc,{open:n,onClose:i,anchor:a,label:p(`browserPane.responsive`),placement:`below`,align:`end`,children:z(`div`,{className:`bp-responsive`,children:[o?.source===`agent`&&L(`p`,{className:`bp-responsive-note`,children:p(`browserPane.agentChose`)}),z(`div`,{className:`bp-responsive-presets`,role:`group`,"aria-label":p(`browserPane.screenSize`),children:[L(`button`,{type:`button`,className:`bp-chip${s===null?` is-on`:``}`,"aria-pressed":s===null,onClick:()=>m({size:null,colorScheme:c}),children:p(`browserPane.fillPane`)}),HH.map(e=>{let t=s!==null&&s.width===e.width&&s.height===e.height;return L(`button`,{type:`button`,className:`bp-chip${t?` is-on`:``}`,"aria-pressed":t,title:`${e.width}×${e.height}`,onClick:()=>m({size:{width:e.width,height:e.height,mobile:e.mobile},colorScheme:c}),children:e.label?p(e.label):e.name},e.name)})]}),z(`form`,{className:`bp-responsive-size`,onSubmit:e=>{e.preventDefault(),g!==null&&_!==null&&m({size:{width:g,height:_,mobile:g<768},colorScheme:c})},children:[L(`input`,{"aria-label":p(`browserPane.width`),inputMode:`numeric`,value:l,placeholder:p(`browserPane.width`),onChange:e=>u(e.target.value)}),L(`span`,{"aria-hidden":`true`,children:`×`}),L(`input`,{"aria-label":p(`browserPane.height`),inputMode:`numeric`,value:d,placeholder:p(`browserPane.height`),onChange:e=>f(e.target.value)}),L(`button`,{type:`submit`,className:`bp-chip`,disabled:g===null||_===null,children:p(`browserPane.setSize`)}),L(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":p(`browserPane.rotate`),title:p(`browserPane.rotate`),disabled:s===null,onClick:()=>s&&m({size:{...s,width:s.height,height:s.width},colorScheme:c}),children:L(es,{size:15})})]}),L(`div`,{className:`bp-responsive-presets`,role:`group`,"aria-label":p(`browserPane.colorScheme`),children:UH.map(e=>L(`button`,{type:`button`,className:`bp-chip${c===e.value?` is-on`:``}`,"aria-pressed":c===e.value,onClick:()=>m({size:s,colorScheme:e.value}),children:p(e.label)},e.label))})]})})]})}function qH({api:e}){let t=R();return z(`div`,{className:`bp-agent-strip is-picking`,role:`status`,children:[L(`span`,{children:t(`browserPane.pickHelp`)}),L(`button`,{type:`button`,className:`bp-chip`,onClick:()=>RH(`stop selecting`,e.togglePicking()),children:t(`browserPane.done`)})]})}function JH({tab:e,api:t}){let n=R();return e.control===`private`?L(`div`,{className:`bp-agent-strip is-private`,role:`status`,children:L(`span`,{children:n(`browserPane.privateStrip`)})}):e.control===`user`?z(`div`,{className:`bp-agent-strip is-paused`,role:`status`,children:[L(`span`,{children:n(`browserPane.paused`)}),L(`button`,{type:`button`,className:`bp-chip`,onClick:()=>RH(`resume`,t.setControl(e.id,`shared`)),children:n(`browserPane.resume`)})]}):!e.agentActing&&!e.agentBusy?null:z(`div`,{className:`bp-agent-strip`,role:`status`,children:[L(`span`,{children:n(e.agentActing?`browserPane.agentUsing`:`browserPane.agentReading`)}),L(`button`,{type:`button`,className:`bp-chip`,onClick:()=>RH(`pause`,t.setControl(e.id,`user`)),children:n(`browserPane.pause`)})]})}var YH={alert:{ok:`browserPane.dialog.ok`,cancel:null},confirm:{ok:`browserPane.dialog.ok`,cancel:`browserPane.dialog.cancel`},prompt:{ok:`browserPane.dialog.ok`,cancel:`browserPane.dialog.cancel`},beforeunload:{ok:`browserPane.dialog.leave`,cancel:`browserPane.dialog.stay`}};function XH(e){try{return new URL(e).host||e}catch{return e}}function ZH({tab:e,api:t}){let n=e.dialog,r=R(),[i,a]=(0,B.useState)(n?.defaultText??``);if((0,B.useEffect)(()=>a(n?.defaultText??``),[n]),!n)return null;let{ok:o,cancel:s}=YH[n.type],c=r=>{t.answerDialog(e.id,r,n.type===`prompt`&&r?i:null).catch(e=>F.ui.error(`Browser pane: answering the page box failed`,e))};return z(`form`,{className:`bp-dialog`,role:`alertdialog`,"aria-label":r(`browserPane.dialog.says`,{host:XH(n.url)}),onSubmit:e=>{e.preventDefault(),c(!0)},children:[L(`span`,{className:`bp-dialog-from`,children:r(`browserPane.dialog.says`,{host:XH(n.url)})}),L(`span`,{className:`bp-dialog-message`,children:n.message}),n.type===`prompt`&&L(`input`,{className:`bp-dialog-input`,"aria-label":r(`browserPane.dialog.answer`),value:i,onChange:e=>a(e.target.value),autoFocus:!0}),z(`span`,{className:`bp-dialog-actions`,children:[s&&L(`button`,{type:`button`,className:`bp-chip`,onClick:()=>c(!1),children:r(s)}),L(`button`,{type:`submit`,className:`bp-chip is-on`,children:r(o)})]})]})}function QH(e,t){return(e.ctrlKey||e.metaKey)&&e.shiftKey&&!e.altKey&&e.key.toLowerCase()===t}function $H({api:e}){let t=N(e=>e.currentSessionId),n=wH(),r=CH(e=>e.pane);(0,B.useEffect)(()=>TH(e),[e]),(0,B.useEffect)(()=>{e.setView(t,n)},[e,t,n]),(0,B.useEffect)(()=>()=>e.setView(N.getState().currentSessionId,!1),[e]),(0,B.useEffect)(()=>e.onPicked(e=>uP.getState().applyPick(e)),[e]),(0,B.useEffect)(()=>{let t=t=>{QH(t,`b`)?(t.preventDefault(),CH.getState().toggle()):QH(t,`s`)&&(t.preventDefault(),CH.getState().setOpen(!0),e.togglePicking().catch(e=>F.ui.warn(`Could not start selecting an element`,e)))};window.addEventListener(`keydown`,t);let n=e.onCommand(e=>{e.kind===`toggle`?CH.getState().toggle():e.chat===N.getState().currentSessionId&&CH.getState().setOpen(!0)});return()=>{window.removeEventListener(`keydown`,t),n()}},[e]);let i=r&&r.chat===t?r.tabs.find(e=>e.id===r.activeTabId):void 0;return!n||!r||!i?null:L(eU,{api:e,pane:r,active:i})}function eU({api:e,pane:t,active:n}){let r=CH(e=>e.width),i=CH(e=>e.setWidth),a=CH(e=>e.setOpen),o=EH(),s=(0,B.useRef)(null),c=(0,B.useRef)(null),[l,u]=(0,B.useState)(null),d=R(),f=sB({width:r,setWidth:i,clamp:vH,min:360,max:fH,defaultWidth:520});return(0,B.useLayoutEffect)(()=>{let t=s.current;if(!t)return;let n=()=>{let n=t.getBoundingClientRect();e.setBounds({x:n.x,y:n.y,width:n.width,height:n.height})};n();let r=new ResizeObserver(n);return r.observe(t),window.addEventListener(`resize`,n),()=>{r.disconnect(),window.removeEventListener(`resize`,n)}},[e]),(0,B.useEffect)(()=>{let t=!0;return e.setOccluded(o).then(e=>{t&&u(o?e:null)}).catch(e=>F.ui.error(`Could not hide the browser page under an overlay`,e)),()=>{t=!1}},[e,o]),(0,B.useEffect)(()=>{let e=document.documentElement;return e.style.setProperty(`--browser-pane-inset`,`${f.width}px`),()=>{e.style.removeProperty(`--browser-pane-inset`)}},[f.width]),(0,B.useEffect)(()=>{n.url===null&&c.current?.focus()},[n.id,n.url]),z(`aside`,{className:`browser-pane`,style:{width:f.width},"aria-label":d(`browserPane.label`),children:[L(`div`,{className:`bp-resize${f.dragging?` is-dragging`:``}`,"aria-label":d(`browserPane.resize`),...f.separatorProps}),L(zH,{pane:t,api:e,onClosePane:()=>a(!1),addressRef:c}),t.picking?L(qH,{api:e}):L(JH,{tab:n,api:e}),n.dialog&&L(ZH,{tab:n,api:e}),n.notice&&L(rU,{notice:n.notice,t:d}),z(`div`,{ref:s,className:`bp-viewport`,children:[l&&L(`img`,{className:`bp-frozen`,src:l,alt:``,"aria-hidden":`true`}),n.url===null&&!l&&L(iU,{pane:t,onOpen:t=>{e.navigate(n.id,t).catch(e=>F.ui.error(`Browser pane: navigate failed`,e))}})]})]})}var tU={media:`browserPane.permission.media`,geolocation:`browserPane.permission.geolocation`,notifications:`browserPane.permission.notifications`};function nU(e,t){switch(e.kind){case`blocked`:return e.message;case`load-failed`:return t(`browserPane.notice.loadFailed`,{url:e.url,message:e.message});case`permission-denied`:{let n=tU[e.permission];return t(`browserPane.notice.permissionDenied`,{what:n?{ref:n}:e.permission,origin:e.origin||{ref:`browserPane.notice.thisPage`}})}}}function rU({notice:e,t}){return L(`div`,{className:`bp-notice is-${e.kind}`,role:e.kind===`load-failed`?`alert`:`status`,children:nU(e,t)})}function iU({pane:e,onOpen:t}){let n=R();return z(`div`,{className:`bp-newtab`,children:[L(`h2`,{className:`bp-newtab-title`,children:n(`browserPane.newTab`)}),e.recent.length===0?L(`p`,{className:`bp-newtab-empty`,children:n(`browserPane.newTabEmpty`)}):L(`ul`,{className:`bp-recent`,"aria-label":n(`browserPane.recent`),children:e.recent.map(e=>L(`li`,{children:z(`button`,{type:`button`,className:`bp-recent-item`,onClick:()=>t(e.url),title:e.url,children:[L(`span`,{className:`bp-recent-title`,children:e.title}),L(`span`,{className:`bp-recent-url`,dir:`ltr`,children:e.url})]})},e.url))})]})}function aU(){let e=wH(),t=CH(e=>e.toggle),n=R();if(!hH())return null;let r=n(e?`browserPane.hide`:`browserPane.show`),i=n.hint(r,vu(IH));return L(`button`,{type:`button`,className:`btn-icon-sm bp-toggle${e?` active`:``}`,onClick:t,"aria-label":r,"aria-pressed":e,title:i,children:L(Da,{size:15})})}var oU={mcp:`tools.cat.mcp`,skill:`tools.cat.skill`,agent:`tools.cat.agent`};function sU(e,t){let n=oU[e];return n?t(n):e.replace(/_/g,` `)}function cU(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 lU(e){return e.split(`
|
|
197
|
-
`,1)[0].trim()}function uU({sessionId:e,busy:t}){let n=R();return L(kB,{id:`tools`,title:n(`tools.title`),children:L(dU,{sessionId:e,busy:t})})}function dU({sessionId:e,busy:t}){let n=R(),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null),s=(0,B.useCallback)(()=>{let t=!0;return Promise.resolve().then(()=>Tn(e)).then(e=>{t&&(i(UR(e,e=>Array.isArray(e.tools),`list of tools`).tools),o(null))}).catch(n=>{if(!t)return;let r=n.httpStatus,a=n.detail;F.ui.warn(`Could not list the tools of session=${e}`,n),i(null),o({notRunning:r===409,text:a||aN(n)})}),()=>{t=!1}},[e]);return(0,B.useEffect)(s,[s]),Pd(t,s),Id(t,a?.notRunning===!0,s),a?.notRunning?L(`p`,{className:`sp-meta`,role:`status`,children:n(`tools.notRunning`)}):a?L(`p`,{className:`sp-error`,role:`alert`,children:n(`tools.listError`,{error:a.text})}):r?r.length===0?L(`p`,{className:`sp-meta`,children:n(`tools.empty`)}):L(`div`,{className:`sp-tools`,"aria-label":n(`tools.listLabel`),role:`group`,children:cU(r).map(([e,t])=>{let r=sU(e,n);return z(`section`,{className:`sp-tool-group`,"aria-label":r,children:[z(`h4`,{className:`sp-tool-group-title`,children:[r,` `,L(`span`,{className:`sp-meta`,children:t.length})]}),L(`ul`,{className:`sp-list`,children:t.map(e=>z(`li`,{className:`sp-tool`,children:[L(`code`,{className:`sp-item-name`,dir:`ltr`,children:e.name}),e.description&&L(`span`,{className:`sp-meta`,title:e.description,children:lU(e.description)})]},e.name))})]},e)})}):L(`p`,{className:`sp-meta`,children:n(`sp.checking`)})}var fU={model:`skills.how.model`,user:`skills.how.user`,auto:`skills.how.auto`,always:`skills.how.always`};function pU({sessionId:e,busy:t}){let n=R(),r=N(e=>e.skillUses),[i,a]=(0,B.useState)(void 0),[o,s]=(0,B.useState)(null),c=sV(),l=(0,B.useCallback)(()=>{let t=c();Promise.resolve().then(()=>Tn(e)).then(n=>{if(!t())return;let r=UR(n,e=>e.skills===null||Array.isArray(e.skills),`list of skills`);iB.getState().setSignals(e,{skills:(r.skills??[]).map(e=>e.name)}),a(r.skills??null),s(null)}).catch(n=>{if(!t())return;let r=n.httpStatus,i=n.detail;F.ui.warn(`Could not list the skills of session=${e}`,n),a(void 0),iB.getState().setSignals(e,{skills:[]}),s({notRunning:r===409,text:i||(n instanceof Error?n.message:String(n))})})},[c,e]);(0,B.useEffect)(()=>{l()},[l,r]),Pd(t,l),Id(t,o?.notRunning===!0,l);let u=o&&!o.notRunning?o:null;return!u&&(!i||i.length===0)?null:L(kB,{id:`skills`,title:n(`skills.title`),children:u?L(`p`,{className:`sp-error`,children:n(`skills.listError`,{error:u.text})}):L(`ul`,{className:`sp-list`,"aria-label":n(`skills.listLabel`),children:(i??[]).map(e=>z(`li`,{className:`sp-row-line`,title:n(fU[e.how]??`skills.how.always`),children:[L(`span`,{className:`sp-row-icon sp-skill-icon`,"aria-hidden":`true`,children:L(Os,{size:14})}),L(`code`,{className:`sp-item-name`,dir:`ltr`,children:e.name})]},e.name))})})}function mU({label:e,children:t}){return L(`div`,{className:`sp-row`,children:z(`div`,{className:`sp-row-line`,children:[L(`span`,{className:`sp-row-label sp-quiet`,children:e}),L(`span`,{className:`sp-row-end`,children:t})]})})}function hU({sessionId:e}){let t=R();return L(kB,{id:`session`,title:t(`sp.section.session`),children:L(gU,{sessionId:e})})}function gU({sessionId:e}){let t=R(),n=N(t=>t.sessions.find(t=>t.id===e)),r=N(e=>e.systemStatus),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(null),c=()=>{s(null),Promise.resolve().then(()=>navigator.clipboard.writeText(e)).then(()=>a(!0)).catch(n=>{F.ui.warn(`Could not copy the id of session=${e}`,n),a(!1),s(t(`session.copyFailed`,{error:oN(n)}))})},l=n?.created_at?new Date(n.created_at):null,u=l&&!Number.isNaN(l.getTime())?l.toLocaleString(On(t),{dateStyle:`medium`,timeStyle:`short`}):null;return z(`div`,{className:`sp-rows`,children:[z(mU,{label:t(`session.id`),children:[L(`code`,{className:`sp-mono`,dir:`ltr`,title:e,children:e}),L(`button`,{type:`button`,className:`btn-icon-sm sp-info`,onClick:c,"aria-label":t(`session.copyId`),title:t(i?`code.copied`:`session.copyId`),children:L(i?Yr:Ti,{size:13})})]}),o&&L(`span`,{className:`sp-error`,role:`alert`,children:o}),u&&L(mU,{label:t(`session.started`),children:L(`span`,{children:u})}),n?.agent_type&&L(mU,{label:t(`session.agent`),children:L(`code`,{className:`sp-mono`,dir:`ltr`,children:n.agent_type})}),r?.version&&L(mU,{label:t(`session.gaia`),children:L(`span`,{dir:`ltr`,children:r.version})}),r?.lemonade_version&&L(mU,{label:t(`session.lemonade`),children:L(`span`,{dir:`ltr`,children:r.lemonade_version})})]})}function _U(e,t,n,r){if(!e)return t(`schedules.time.never`);let i=new Date(e),a=(n||new Date).getTime()-i.getTime(),o=Math.floor(a/1e3);if(o<0){let e=Math.abs(o);if(e<60)return t(`schedules.time.inSeconds`,{n:e});let n=Math.floor(e/60);if(n<60)return t(`schedules.time.inMinutes`,{n});let r=Math.floor(n/60);return r<24?t(`schedules.time.inHours`,{n:r}):t(`schedules.time.inDays`,{n:Math.floor(r/24)})}if(o<60)return t(`time.justNow`);let s=Math.floor(o/60);if(s<60)return t(`time.minutesAgo`,{n:s});let c=Math.floor(s/60);return c<24?t(`time.hoursAgo`,{n:c}):i.toLocaleDateString(r,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function vU(e,t,n=mt.bare,r){if(!e)return n(`schedules.time.never`);let i=_U(e,n,t,r),a=new Date(e);return a.getTime()<=(t||new Date).getTime()?i:n(`schedules.time.clockIn`,{clock:a.toLocaleString(r,{weekday:`short`,hour:`numeric`,minute:`2-digit`}),relative:i})}function yU(e){if(!e)return!1;let t=new Date(e).getTime()-Date.now();return t>0&&t<6e4}function bU(e,t,n=0){let r=new Date(2e3,0,1,t,n);return new Intl.DateTimeFormat(On(e),{hour:`numeric`,minute:`2-digit`}).format(r)}function xU(e,t){let[n,r]=e.split(`:`).map(Number);return bU(t,n,r)}function SU(e,t,n){let r=`${e}.${new Intl.PluralRules(n.locale).select(t)}`;return fe(r)?r:null}var CU=e=>e.length===5&&e.every(e=>e<5),wU=e=>e.length===2&&e.includes(5)&&e.includes(6);function TU(e,t,n){if(CU(e))return n(`schedules.desc.days.weekdays`);if(wU(e))return n(`schedules.desc.days.weekends`);if(e.length===7)return n(`schedules.desc.days.every`);let r=SU(`schedules.desc.dayList`,e.length,t);return r?n(r,{days:e.map(e=>n(`schedules.dayName.${e}`)).join(n(`schedules.desc.dayJoin`))}):null}function EU(e,t,n,r){let{kind:i,count:a,unit:o,days:s,time:c,start_hour:l,end_hour:u}=e,d=e=>c?n(`schedules.desc.at`,{when:e,time:xU(c,r)}):e;if(i===`every`||i===`window`){let e=a&&o?SU(`schedules.span.${o}`,a,t):null,c=s?TU(s,t,n):void 0;if(!e||c===null)return null;let d=n(e,{n:a});if(i===`every`)return c?n(`schedules.desc.everyOn`,{span:d,days:c}):n(`schedules.desc.every`,{span:d});if(l==null||u==null)return null;let f=n(`schedules.hours`,{start:bU(r,l),end:bU(r,u)});return c?n(`schedules.desc.windowOn`,{span:d,hours:f,days:c}):n(`schedules.desc.window`,{span:d,hours:f})}if(i===`daily`)return c?d(n(`schedules.desc.daily`)):null;if(i!==`days`||!s?.length)return null;if(s.length===7)return d(n(`schedules.desc.daily`));if(CU(s))return d(n(`schedules.desc.weekdays`));if(wU(s))return d(n(`schedules.desc.weekends`));let f=TU(s,t,n);return f&&d(n(`schedules.desc.onDays`,{days:f}))}function DU(e,t){return!e||EU(e,t,t.bare,t)===null?null:t.compose((n,r)=>EU(e,t,n,mn(r))??``)}var OU=14,kU={chat:{label:`focus.chat`,Icon:fo},coding:{label:`focus.coding`,Icon:Ci},commands:{label:`focus.commands`,Icon:Bs},documents:{label:`focus.documents`,Icon:sa},scheduled:{label:`focus.scheduled`,Icon:Ur},plan:{label:`focus.plan`,Icon:Ya},web:{label:`focus.web`,Icon:Da},email:{label:`focus.email`,Icon:ro}};function AU({facets:e}){let t=R(),n=iB(e=>e.reveal);return L(`ul`,{className:`sp-focus`,"aria-label":t(`focus.label`),children:e.map(e=>L(jU,{facet:e,onGo:n},e.kind))})}function jU({facet:e,onGo:t}){let n=R(),r=OB(),{label:i,Icon:a}=kU[e.kind],o=z(P.Fragment,{children:[L(a,{size:12,"aria-hidden":`true`}),n(i),e.count!=null&&L(`bdi`,{className:`sp-focus-count`,dir:`ltr`,children:e.count})]});return L(`li`,{className:`sp-focus-item${r}`,children:e.section?L(`button`,{type:`button`,className:`sp-chip is-${e.kind}`,onClick:()=>t(e.section),children:o}):L(`span`,{className:`sp-chip is-${e.kind}`,children:o})})}var MU={done:{label:`activity.planStatus.done`,Icon:Yr},running:{label:`activity.planStatus.running`,Icon:Za},failed:{label:`activity.planStatus.failed`,Icon:nc},stopped:{label:`activity.planStatus.stopped`,Icon:jr},pending:{label:`activity.planStatus.pending`,Icon:_i}};function NU({plan:e}){let t=R();if(!e)return null;let n=e.steps.length,r=e.statuses.filter(e=>e===`done`).length;return z(kB,{id:`plan`,title:t(`plan.title`),summary:t(`plan.progress`,{done:r,total:n}),children:[L(`div`,{className:`sp-progress`,role:`progressbar`,"aria-label":t(`plan.title`),"aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":r,children:L(`span`,{style:{width:`${r/n*100}%`}})}),L(`ol`,{className:`sp-list sp-plan${e.finished?``:` is-live`}`,"aria-label":t(`plan.listLabel`),children:e.steps.map((n,r)=>{let i=e.statuses[r]??`pending`,{label:a,Icon:o}=MU[i];return z(`li`,{className:`sp-row-line sp-plan-step is-${i}`,"aria-current":i===`running`?`step`:void 0,children:[L(`span`,{className:`sp-row-icon`,title:t(a),children:L(o,{size:OU,className:i===`running`?`spin`:i===`done`?`plan-icon-done`:void 0,"aria-label":t(a)})}),L(`span`,{className:`sp-plan-text`,children:L(`bdi`,{children:n})})]},`${r}-${n}`)})})]})}function PU({schedules:e}){let t=R(),n=N(e=>e.setShowSchedules),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(!1);return e.length===0?null:z(kB,{id:`schedule`,title:t(`sched.title`),children:[L(`ul`,{className:`sp-list`,"aria-label":t(`sched.listLabel`),children:e.map(e=>L(FU,{schedule:e,working:a,onWorking:o,onSettled:i},e.id))}),r&&L(`span`,{className:`sp-error`,role:`alert`,children:r}),L(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>n(!0),children:t(`sched.manage`)})]})}function FU({schedule:e,working:t,onWorking:n,onSettled:r}){let i=R(),a=jV(e=>e.updateScheduleStatus),o=jV(e=>e.runScheduleNow),s=e.status===`paused`,c=e=>{n(!0),e.finally(()=>{n(!1),r(jV.getState().actionError)})},l=DU(e.description_parts,i)??e.description,u=i.compose((t,n)=>t(`schedules.card.next`,{when:s?t(`schedules.status.paused`):vU(e.next_run_at,void 0,t,On(mn(n)))}));return z(`li`,{className:`sp-row`,children:[z(`div`,{className:`sp-row-line`,children:[L(`span`,{className:`sp-row-icon`,"aria-hidden":`true`,children:L(Ur,{size:OU})}),L(`span`,{className:`sp-row-label`,title:e.prompt,children:L(`bdi`,{children:e.name})}),z(`span`,{className:`sp-row-end`,children:[L(`button`,{type:`button`,className:`btn-icon-sm sp-info`,onClick:()=>c(a(e.name,s?`active`:`paused`)),disabled:t,"aria-label":i(s?`schedules.card.resume`:`schedules.card.pause`),title:i(s?`schedules.card.resume`:`schedules.card.pause`),children:L(s?Ho:Mo,{size:13})}),L(`button`,{type:`button`,className:`btn-icon-sm sp-info`,onClick:()=>c(o(e.name)),disabled:t||e.running===!0,"aria-label":i(`schedules.card.runNow`),title:i(`schedules.card.runNowTitle`),children:e.running?L(Za,{size:13,className:`spin`}):L(ic,{size:13})})]})]}),L(`span`,{className:`sp-row-sub sp-quiet`,children:l}),z(`span`,{className:`sp-row-sub sp-quiet`,children:[e.running?i(`schedules.card.running`):u,` · `,i(`schedules.card.runs`,{n:e.run_count})]}),e.last_error&&L(`span`,{className:`sp-row-sub sp-error`,children:i(`schedules.card.lastFailed`,{error:e.last_error})})]})}var IU={ok:{label:`cmd.ok`,Icon:Yr},failed:{label:`cmd.failed`,Icon:nc},declined:{label:`cmd.declined`,Icon:jr},stopped:{label:`activity.planStatus.stopped`,Icon:Is},running:{label:`cmd.running`,Icon:Za}};function LU({commands:e,onJumpToMessage:t}){let n=R(),[r,i]=(0,B.useState)(!1);if(e.length===0)return null;let a=[...e].reverse(),o=r?a:a.slice(0,5),s=e.filter(e=>e.state===`failed`).length;return z(kB,{id:`commands`,title:n(`cmd.title`),summary:s>0?n.plural(`cmd.failedCount`,s,{n:s}):L(`bdi`,{dir:`ltr`,children:e.length}),children:[L(`ul`,{className:`sp-list`,"aria-label":n(`cmd.listLabel`),children:o.map(e=>{let{label:r,Icon:i}=IU[e.state],a=z(P.Fragment,{children:[L(`span`,{className:`sp-row-icon sp-cmd-icon is-${e.state}`,title:n(r),children:L(i,{size:OU,className:e.state===`running`?`spin`:void 0,"aria-label":n(r)})}),L(`code`,{className:`sp-row-label sp-mono`,dir:`ltr`,title:e.command,children:e.command})]});return L(`li`,{children:e.messageId==null?L(`div`,{className:`sp-row-line`,children:a}):L(`button`,{type:`button`,className:`sp-row-line sp-row-button`,onClick:()=>t(e.messageId),children:a})},e.key)})}),e.length>5&&L(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>i(e=>!e),children:r?n(`out.fewer`):n(`out.more`,{n:e.length-5})})]})}function RU(e,t){let n=e[e.length-1];return(n?.role===`assistant`?n.turnSummary?.documents??[]:[]).find(e=>NV(e.path,t))?.passages??0}function zU({documents:e,messages:t}){let n=R();return e.length===0?null:L(kB,{id:`documents`,title:n(`docsp.title`),summary:L(`bdi`,{dir:`ltr`,children:e.length}),children:L(`ul`,{className:`sp-list`,"aria-label":n(`docsp.listLabel`),children:e.map(({entry:e,doc:r})=>{let i=e.name||r?.filename||e.path.split(/[\\/]/).pop()||e.path,a=r?.indexing_status,o=a===`indexing`||a===`pending`,s=a===`failed`||a===`missing`,c=RU(t,e.path);return z(`li`,{className:`sp-row`,children:[z(`div`,{className:`sp-row-line`,children:[L(`span`,{className:`sp-row-icon`,"aria-hidden":`true`,children:o?L(Za,{size:OU,className:`spin`}):L(sa,{size:OU})}),L(`span`,{className:`sp-row-label`,dir:`ltr`,title:e.path,children:i}),z(`span`,{className:`sp-row-end`,children:[c>0&&L(`span`,{className:`sp-badge`,title:n(`docsp.usedTitle`),children:n.plural(`docsp.used`,c,{n:c})}),o&&L(`span`,{className:`sp-quiet`,children:n(`docs.indexingLabel`)}),s&&L(`span`,{className:`sp-error`,children:n(`docs.failed`)}),!o&&!s&&r&&r.chunk_count>0&&c===0&&L(`span`,{className:`sp-quiet`,title:n(`docsp.passagesTitle`),children:n.plural(`docsp.passages`,r.chunk_count,{n:r.chunk_count})})]})]}),s&&r?.last_error&&L(`span`,{className:`sp-row-sub sp-error`,children:r.last_error})]},e.path)})})})}var BU=`(max-width: 1099px)`;function VU({sessionId:e,messages:t,busy:n,usage:r,onUsage:i,onJumpToMessage:a}){let o=R(),s=Ou(BU),c=iB(e=>s?e.overlayOpen:e.open),l=iB(e=>e.width),u=iB(e=>e.setWidth),d=iB(e=>e.setOpen),f=iB(e=>e.setOverlayOpen),p=iB(e=>e.focus),m=(0,B.useRef)(null),h=sB({width:l,setWidth:u,clamp:nB,min:280,max:640,defaultWidth:320}),g=(0,B.useCallback)(()=>{s?f(!1):d(!1)},[s,d,f]);ut(c&&s,g);let _=(0,B.useRef)(null);return un(_,c&&s),(0,B.useEffect)(()=>{c&&s&&m.current?.focus()},[c,s]),(0,B.useEffect)(()=>{s&&aB(p)&&f(!0)},[p,s,f]),c?z(P.Fragment,{children:[s&&L(`div`,{className:`sp-backdrop`,onClick:g,"aria-hidden":`true`}),z(`aside`,{ref:_,className:`session-panel ${s?`is-overlay`:`is-docked`}`,style:s?void 0:{width:h.width},"aria-label":o(`sp.label`),role:s?`dialog`:`complementary`,"aria-modal":s?!0:void 0,children:[!s&&L(`div`,{className:`sp-resize${h.dragging?` is-dragging`:``}`,"aria-label":o(`sp.resize`),...h.separatorProps}),z(`header`,{className:`sp-header`,children:[L(`h2`,{className:`sp-title`,children:o(`sp.title`)}),L(`button`,{ref:m,type:`button`,className:`btn-icon-sm`,onClick:g,"aria-label":o(`sp.close`),title:o(`sp.closeShort`),children:L(s?nc:Eo,{size:14})})]}),L(HU,{sessionId:e,messages:t,busy:n,usage:r,onUsage:i,onJumpToMessage:a})]})]}):null}function HU({sessionId:e,messages:t,busy:n,usage:r,onUsage:i,onJumpToMessage:a}){let o=R(),s=RV(e,t,n),c=DB(e);return L(EB.Provider,{value:c,children:z(`div`,{className:`sp-body`,children:[L(AU,{facets:s.facets}),!1,L(JB,{sessionId:e,busy:n,usage:r,hideDocuments:!0}),L(NU,{plan:s.plan}),L(PU,{schedules:s.schedules}),s.coding&&L(nH,{sessionId:e,busy:n,onJumpToMessage:a},`changes`),L(LU,{commands:s.commands,onJumpToMessage:a}),L(zU,{documents:s.documents,messages:t}),s.showAnswer&&L(kB,{id:`answer`,title:o(`sp.section.answer`),children:L(mB,{messages:t,busy:n})}),L(fV,{sessionId:e,busy:n,onJumpToMessage:a}),!s.coding&&L(nH,{sessionId:e,busy:n,onJumpToMessage:a},`changes`),L(pU,{sessionId:e,busy:n}),L(`h3`,{className:`sp-group-title`,children:o(`sp.details`)}),L(kB,{id:`context`,title:o(`sp.section.context`),children:L(`div`,{className:`sp-context`,children:L(Nz,{sessionId:e,busy:n,onUsage:i})})}),L(uU,{sessionId:e,busy:n}),L(hU,{sessionId:e})]})})}function UU({messages:e,busy:t}){let n=R(),r=Ou(BU),i=iB(e=>r?e.overlayOpen:e.open),a=iB(e=>e.setOpen),o=iB(e=>e.setOverlayOpen),s=cB(e,t),c=!i&&s?.kind===`turn`&&s.turn.turnSummary?lB(s.turn.turnSummary):!1,l=n(i?`sp.hide`:c?`sp.showWarn`:`sp.show`);return z(P.Fragment,{children:[L(aU,{}),L(`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:L(c?Ws:i?Eo:Oo,{size:15})})]})}function WU({isPrivate:e,onToggle:t}){let n=R();return L(`button`,{className:`btn-icon-sm task-header-private`,onClick:t,title:n(e?`chat.privateOffTitle`:`composer.privateOnTitle`),"aria-label":n(e?`composer.privateOff`:`composer.privateOn`),"data-private":e?`true`:void 0,children:L(e?Gi:qi,{size:15})})}function GU(e){let t=0,n=0;for(let r of e){if(n>=1e4)return`size`;if(t>=100)return`files`;if(n+=r.chunk_count,t+=1,n>1e4&&t>1)return`size`}return null}function KU({sessionId:e,onDetachFailed:t}){let n=N(t=>t.sessions.find(t=>t.id===e)),r=N(e=>e.documents),i=N(e=>e.setShowDocLibrary),a=N(e=>e.updateSessionInList),[o,s]=(0,B.useState)(!1),c=R(),l=new Set(n?.document_ids??[]),d=r.filter(e=>l.has(e.id)),f=(0,B.useCallback)(async(n,i)=>{n.stopPropagation();let o=r.find(e=>e.id===i);F.doc.info(`Detaching document from session: ${o?.filename||i}`);try{await bt(e,i);let t=(N.getState().sessions.find(t=>t.id===e)?.document_ids??[]).filter(e=>e!==i);a(e,{document_ids:t}),t.length<=3&&s(!1),F.doc.info(`Detached document from session: ${o?.filename||i}`)}catch(e){F.doc.error(`Failed to detach document: ${o?.filename||i}`,e),t(o?.filename?V(o.filename):i,e)}},[r,e,a,t]);if(d.length===0)return null;let p=[...d].sort((e,t)=>{let n=e.last_accessed_at||e.indexed_at||``;return(t.last_accessed_at||t.indexed_at||``).localeCompare(n)}),m=o?p:p.slice(0,3),h=p.length-3,g=d.filter(e=>e.indexing_status===`failed`),_=g.length,v=g.filter(e=>BL(e.error_kind)).length,y=g.filter(e=>VL(e.error_kind)).length,b=_-v-y,x=d.length-_,S=new Map(d.map(e=>[e.id,e])),C=GU((n?.document_ids??[]).flatMap(e=>{let t=S.get(e);return t&&t.indexing_status!==`failed`?[t]:[]})),w=c.compose(e=>[x>0?e(u(`docsBar.count`,x),{n:x}):null,b>0?e(u(`docsBar.failed`,b),{n:b}):null,v>0?e(u(`docsBar.serverWaiting`,v),{n:v}):null,y>0?e(u(`docsBar.needsRetry`,y),{n:y}):null].filter(Boolean).join(` · `));return z(`div`,{className:`doc-context-bar${o?` doc-context-expanded`:``}`,"aria-label":_>0?w:c.plural(`docsBar.aria`,x),children:[_>0?L(di,{size:12,className:`doc-context-icon doc-context-icon-failed`,"aria-hidden":`true`}):L(li,{size:12,className:`doc-context-icon`,"aria-hidden":`true`}),L(`button`,{type:`button`,className:`doc-context-label`,onClick:()=>i(!0),title:c(`docsBar.manage`),children:w}),z(`div`,{className:`doc-context-pills${o?` doc-context-pills-expanded`:``}`,children:[m.map(e=>{let t=e.indexing_status===`failed`,n=BL(e.error_kind)?`docsBar.serverTitle`:VL(e.error_kind)?`docsBar.busyTitle`:`docsBar.failedTitle`;return z(`span`,{className:`doc-pill${t?` doc-pill-failed`:``}`,title:t?c(n,{name:V(e.filename)}):V(e.filepath||e.filename),children:[L(t?di:sa,{size:9,className:`doc-pill-icon`,"aria-hidden":`true`}),L(`span`,{className:`doc-pill-name`,dir:`ltr`,children:iR(V(e.filename),24)}),L(`button`,{className:`doc-pill-remove`,onClick:t=>f(t,e.id),"aria-label":c(`docsBar.remove`,{name:V(e.filename)}),children:L(nc,{size:10})})]},e.id)}),!o&&h>0&&L(`button`,{className:`doc-pill-more`,onClick:e=>{e.stopPropagation(),s(!0)},children:c(`docsBar.more`,{n:h})})]}),o&&h>0&&L(`button`,{className:`doc-pill-collapse`,onClick:e=>{e.stopPropagation(),s(!1)},children:c(`docsBar.less`)}),C&&z(`p`,{className:`doc-context-past-cap`,role:`status`,children:[L(di,{size:12,className:`doc-context-icon doc-context-icon-warn`,"aria-hidden":`true`}),L(`span`,{className:`doc-context-past-cap-text`,children:C===`size`?c(`docsBar.pastSize`,{passages:1e4.toLocaleString(),n:x}):c(`docsBar.pastCap`,{limit:100,n:x})})]})]})}var qU=5e3;function JU(e){let[t,n]=(0,B.useState)({usage:null,error:null});return(0,B.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 Ze(r.signal);if(i)return;n({usage:e,error:null}),a(e.interval_ms)}catch(e){if(i||r.signal.aborted)return;F.ui.warn(`Could not read resource usage`,e),n(t=>({usage:t.usage,error:e instanceof Error?e.message:String(e)})),a(qU)}}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 YU=1024**3;function XU(e){return(e/YU).toFixed(1)}function ZU(e){return`${Math.round(e)}%`}var QU=[[1e9,`Gbps`],[1e6,`Mbps`],[1e3,`Kbps`]];function $U(e){return QU.find(([t])=>e>=t)??QU[QU.length-1]}function eW(e,[t]){let n=e/t;return n<.05?`0`:n>=100?n.toFixed(0):n.toFixed(1)}function tW(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 nW(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 rW(e){return e.map(([e,t],n)=>`${n?`L`:`M`}${e.toFixed(2)} ${t.toFixed(2)}`).join(` `)}function iW({values:e,max:t=100,dashed:n}){let r=nW(e,t),i=rW(r),a=r.length>1?`${i} L100 100 L${r[0][0].toFixed(2)} 100 Z`:``,o=n?nW(n,t):[];return z(`svg`,{className:`resource-spark`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[L(`path`,{className:`resource-spark-grid`,d:`M0 25H100M0 50H100M0 75H100M25 0V100M50 0V100M75 0V100`,vectorEffect:`non-scaling-stroke`}),a&&L(`path`,{className:`resource-spark-area`,d:a}),r.length>1&&L(`path`,{className:`resource-spark-line`,d:i,vectorEffect:`non-scaling-stroke`}),o.length>1&&L(`path`,{className:`resource-spark-line is-dashed`,d:rW(o),vectorEffect:`non-scaling-stroke`})]})}var aW={gpu:`resources.gpu`,npu:`resources.npu`,ethernet:`resources.ethernet`,wifi:`resources.wifi`,network:`resources.network`};function oW(e,t,n){let r=e(aW[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 sW(e){let t=$U(e);return`${eW(e,t)} ${t[1]}`}function cW(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 lW(e){return[e.send_bps,e.recv_bps,...e.send_history,...e.recv_history].every(e=>e===0)}function uW(e){let t=e.filter(e=>!lW(e));return t.length>0?t:e.slice(0,1)}function dW(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:ZU(t.cpu.percent),detail:r,title:[e(`resources.cpu`),ZU(t.cpu.percent),r].filter(Boolean).join(` · `),history:t.cpu.history})}if(t.memory){let r=t.memory,i=`${XU(r.used_bytes)}/${XU(r.total_bytes)} GB`;n.push({key:`memory`,tone:`memory`,label:e(`resources.memory`),value:ZU(r.percent),detail:i,title:`${e(`resources.memory`)} · ${i} (${ZU(r.percent)})`,history:r.history})}let r=t.devices??[];for(let t of r){let i=t.memory_used_bytes==null?void 0:`${XU(t.memory_used_bytes)} GB`;n.push({key:t.id,tone:t.kind,label:oW(e,t,r),value:ZU(t.percent),detail:i,name:t.name,title:[t.name,ZU(t.percent),i&&e(`resources.inUse`,{size:i})].filter(Boolean).join(` · `),history:t.history})}t.devices_error&&n.push(cW(e,`gpu`,e(`resources.gpu`),t.devices_error)),t.npus_error&&n.push(cW(e,`npu`,e(`resources.npu`),t.npus_error));let i=uW(t.networks??[]);for(let t of i){let r=$U(Math.max(t.send_bps,t.recv_bps)),a=eW(t.send_bps,r),o=eW(t.recv_bps,r);n.push({key:t.id,tone:`network`,label:oW(e,t,i),value:``,detail:e(`resources.sendRecv`,{send:a,recv:o,unit:r[1]}),name:t.name,title:[t.name,t.description,e(`resources.send`,{rate:sW(t.send_bps)}),e(`resources.receive`,{rate:sW(t.recv_bps)})].join(` · `),history:t.recv_history,dashed:t.send_history,max:tW([...t.recv_history,...t.send_history])})}return t.networks_error&&n.push(cW(e,`network`,e(`resources.network`),t.networks_error)),n}function fW({onClose:e}){let t=R(),{usage:n,error:r}=JU(!0),i=n?.ready?dW(t,n):[];return z(`section`,{className:`resource-strip`,"aria-label":t(`resources.region`),children:[i.length>0?L(`ul`,{className:`resource-tiles${r?` is-stale`:``}`,children:i.map(e=>z(`li`,{className:`resource-tile tone-${e.tone}`,title:e.title,children:[L(iW,{values:e.history,max:e.max,dashed:e.dashed}),z(`span`,{className:`resource-text`,children:[z(`span`,{className:`resource-label`,children:[L(`bdi`,{children:e.label}),e.name&&L(`span`,{className:`resource-sr-only`,children:` (${e.name})`})]}),z(`span`,{className:`resource-reading`,children:[e.value&&L(`bdi`,{dir:`ltr`,className:`resource-value`,children:e.value}),e.detail&&L(`bdi`,{dir:`ltr`,className:`resource-detail`,children:e.detail})]})]})]},e.key))}):L(`p`,{className:`resource-status`,role:`status`,children:t(r?`resources.error`:`resources.reading`)}),r&&i.length>0&&L(`p`,{className:`resource-status is-error`,role:`status`,title:r,children:t(`resources.error`)}),L(`button`,{type:`button`,className:`btn-icon-sm resource-close`,onClick:e,"aria-label":t(`resources.hide`),title:t(`resources.hide`),children:L(nc,{size:14,"aria-hidden":`true`})})]})}function pW({sessionId:e}){let t=R(),{env:n,change:r}=QR(e),[a,o]=(0,B.useState)(null);return!n||n.internet?null:z(`div`,{className:`offline-notice`,role:`status`,children:[L(Qs,{size:13,"aria-hidden":`true`}),z(`span`,{children:[t(`offline.text`),a&&z(`span`,{className:`offline-notice-error`,children:[` `,t(`offline.error`,{error:a})]})]}),L(`button`,{type:`button`,className:`link-btn`,onClick:()=>{o(null),r(()=>i(e,!0)).catch(e=>{o(e instanceof Vn?e.detail||e.message:String(e))})},children:t(`offline.turnOn`)})]})}function mW({message:e,onDismiss:t,dismissLabel:n}){return e?z(`div`,{className:`export-error-bar`,role:`alert`,children:[L(`span`,{children:e}),L(`button`,{type:`button`,className:`btn-icon-sm`,onClick:t,"aria-label":n,children:L(nc,{size:13})})]}):null}var hW=`gaia.resourceMonitor.visible`;function gW(){try{return window.localStorage.getItem(hW)!==`0`}catch(e){return F.ui.warn(`Resource usage setting unavailable; showing it`,e),!0}}var _W=Pt(e=>({visible:gW(),setVisible:t=>{try{window.localStorage.setItem(hW,t?`1`:`0`)}catch(e){F.ui.warn(`Could not remember the resource usage setting`,e)}e({visible:t})},reload:()=>e({visible:gW()})})),vW={".doc":`.docx`,".xls":`.xlsx`,".ppt":`.pptx`};function yW(e,t){if(!(e instanceof Vn))return e instanceof Error?e.message:t(`composer.uploadFailed`);let{extension:n,size_mb:r,max_mb:i}=e.body??{};switch(e.reason){case`no_extension`:return t(`composer.upload.noExtension`);case`unsupported_type`:{let e=vW[String(n)];return e?t(`composer.upload.legacyOffice`,{ext:String(n),modern:e}):t(`composer.upload.unsupported`,{ext:String(n)})}case`empty_file`:return t(`composer.upload.empty`);case`too_large`:return t(`composer.upload.tooLarge`,{size:String(r),max:String(i)});default:return e.message}}function bW(){return`screenshot-${new Date().toISOString().slice(0,19).replace(/[T:]/g,`-`)}.png`}function xW(){let e=R(),[t,n]=(0,B.useState)([]),r=(0,B.useRef)(!0),i=(0,B.useRef)([]);i.current=t;let a=(0,B.useRef)(new Map);(0,B.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]);let o=(0,B.useCallback)(async t=>{let i=new AbortController;a.current.set(t.id,i);try{let e=t.isMedia?await O(t.file,e=>{r.current&&n(n=>n.map(n=>n.id===t.id?{...n,progress:e}:n))},i.signal):await Ge(t.file);if(!r.current)return;n(n=>n.map(n=>n.id===t.id?{...n,uploading:!1,uploaded:!0,serverUrl:e.url}:n))}catch(a){if(i.signal.aborted||(F.chat.error(`Upload failed: ${t.name}`,a),!r.current))return;let o=yW(a,e);n(e=>e.map(e=>e.id===t.id?{...e,uploading:!1,error:o}:e))}finally{a.current.delete(t.id)}},[e]),s=(0,B.useCallback)(e=>{let t=[...i.current];for(let r of e){if(t.some(e=>!e.error&&e.file.name===r.name&&e.file.size===r.size&&e.file.lastModified===r.lastModified))continue;let e=r.type.startsWith(`image/`),i={id:`attach-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,file:r,name:r.name||(e?bW():`file`),url:e?URL.createObjectURL(r):``,uploading:!0,uploaded:!1,isImage:e,isMedia:RL(r.name)};t.push(i),n(e=>[...e,i]),o(i)}},[o]),c=(0,B.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(),s(t),!0)},[s]),l=(0,B.useCallback)(e=>{a.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)})},[]),u=(0,B.useCallback)(()=>{n(e=>(e.forEach(e=>{e.url&&URL.revokeObjectURL(e.url)}),[]))},[]),d=(0,B.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})`}).join(`
|
|
198
|
-
`);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:s,handlePaste:c,remove:l,clear:u,hasUploaded:t.some(e=>e.uploaded),hasImage:t.some(e=>e.uploaded&&e.isImage),uploading:t.some(e=>e.uploading),compose:d,takeElements:uP.getState().take}}function SW({sessionId:e,isStreaming:t,isStale:n,setMessages:r,refreshContext:i}){let[a,o]=(0,B.useState)(null),s=a?.state.status===`running`,c=(0,B.useRef)(!1);c.current=s;let l=(0,B.useRef)(a);l.current=a,(0,B.useEffect)(()=>{o(null)},[e]);let u=(0,B.useCallback)((r,i)=>{t||c.current||(F.chat.info(`Retrying message ${r.id} with ${i}`),o({messageId:r.id,state:{status:`running`,model:i},keeping:null}),Dt(e,r.id,i).then(e=>{n()||o(t=>t&&t.messageId===r.id?{...t,state:{status:`ready`,result:e}}:t)}).catch(e=>{F.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]),d=(0,B.useCallback)(async t=>{if(!a)return;let{messageId:s}=a;o({...a,keeping:t});try{let a=await pn(e,s,t);if(n())return;if(a.kept===`retry`){let e=a.stats;r(N.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(F.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:d,handleCloseComparison:(0,B.useCallback)(()=>{a?.state.status===`ready`?d(`original`):o(null)},[a,d]),closeForNewTurn:(0,B.useCallback)(()=>{let t=l.current;t&&(t.state.status===`ready`&&pn(e,t.messageId,`original`).catch(e=>F.chat.error(`Could not close the answer comparison`,e)),o(null))},[e])}}function CW(e,t){let[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(null);(0,B.useEffect)(()=>{r(null),a(null)},[e]);let o=(0,B.useCallback)(()=>{_n(e).then(e=>{t()||(e.available?(r(e),a(null)):(r(null),a(e.reason)))}).catch(t=>F.chat.error(`Could not measure the context for session=${e}`,t))},[e,t]);return(0,B.useEffect)(()=>{o()},[o]),{contextUsage:n,contextUnavailable:i,refreshContext:o,showContextUsage:(0,B.useCallback)(e=>{r(e),a(null)},[])}}function wW(e,t){return(0,B.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:TB()}),r.classList.add(`msg-jump-target`),window.setTimeout(()=>r.classList.remove(`msg-jump-target`),1600),!0},[e,t])}var TW=1,EW=80,DW=500,OW=new Set([`PageUp`,`ArrowUp`,`Home`]),kW=new Set([`PageDown`,`ArrowDown`,`End`]);function AW(e,t,n){let r=(0,B.useRef)(0),i=(0,B.useRef)(0),a=(0,B.useRef)(0),o=(0,B.useRef)(!1),s=(0,B.useCallback)(()=>o.current||Date.now()-a.current<DW,[]),c=(0,B.useCallback)(()=>{a.current=Date.now()},[]),l=(0,B.useCallback)(()=>{a.current=0},[]),u=(0,B.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<=TW?t.current=!0:l?t.current=!1:o<=EW&&o<c&&(t.current=!0),n(o)},[e,t,n,s]),d=(0,B.useCallback)(e=>{e.deltaY<0?c():e.deltaY>0&&l()},[c,l]),f=(0,B.useCallback)(e=>{e.target===e.currentTarget&&(o.current=!0)},[]);return(0,B.useEffect)(()=>{let n=e.current;if(!n||typeof ResizeObserver>`u`)return;let r=n.clientHeight,i=new ResizeObserver(()=>{let e=n.clientHeight<r;r=n.clientHeight,e&&t.current&&!s()&&(n.scrollTop=n.scrollHeight)});return i.observe(n),()=>i.disconnect()},[e,t,s]),(0,B.useEffect)(()=>{let e=()=>{o.current=!1},t=e=>{let t=e.target;t instanceof Element&&t.closest(`input, textarea, select, [contenteditable="true"]`)||(OW.has(e.key)||e.key===` `&&e.shiftKey?c():(kW.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]),(0,B.useEffect)(()=>{let n=e.current;if(!n||typeof ResizeObserver>`u`)return;let r=n.clientHeight,i=new ResizeObserver(()=>{let e=n.clientHeight<r;r=n.clientHeight,e&&t.current&&!s()&&(n.scrollTop=n.scrollHeight)});return i.observe(n),()=>i.disconnect()},[e,t,s]),{userScrolling:s,clearUserScroll:l,listProps:{onScroll:u,onWheel:d,onTouchMove:c,onPointerDown:f}}}function jW(e,t){let[n,r]=(0,B.useState)(null);(0,B.useEffect)(()=>{r(null)},[e]);let i=(0,B.useCallback)(()=>r(null),[]);return{exportChat:(0,B.useCallback)(async()=>{r(null);try{let n=await Zn(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){F.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 MW=5200;function NW(e=MW){let[t,n]=(0,B.useState)(null),r=(0,B.useRef)(null),i=(0,B.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null)},[]),a=(0,B.useCallback)(()=>{i(),n(null)},[i]),o=(0,B.useCallback)(t=>{i(),n(t),r.current=setTimeout(()=>{r.current=null,n(null)},e)},[i,e]);return(0,B.useEffect)(()=>i,[i]),{policyToast:t,showPolicyToast:o,dismissPolicyToast:a}}var PW=new Set([``,`new chat`,`new task`,`untitled`,`untitled session`,`chat`]);function FW(e){return PW.has((e??``).trim().toLowerCase())}function IW(e){return dd(e??``)}function LW(e,t){let n=N.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 RW(e,t){if(t.length===0)return;let n=N.getState(),r=new Set(t.map(e=>e.id));n.setDocuments([...t,...n.documents.filter(e=>!r.has(e.id))]),LW(e,t.map(e=>e.id))}async function zW(e,t){let n=[];for(let r of t){F.doc.info(`Dropped on chat view: ${r.name}`);try{let t=await ar(r);if(t?.indexing_status===`failed`){let e=BL(t.error_kind)?`server`:VL(t.error_kind)?`busy`:`unreadable`;F.doc.warn(`"${r.name}" couldn't be added (${t.error_kind??`unreadable`}); not attaching it`),n.push({name:r.name,stage:e,error:t.last_error??null})}else if(e&&t?.id)try{await rn(e,t.id),LW(e,[t.id]),F.doc.info(`Auto-attached "${r.name}" to session ${e}`)}catch(e){F.doc.warn(`Could not attach dropped document to session: ${e}`),n.push({name:r.name,stage:`attach`,error:e})}}catch(e){F.doc.error(`Upload failed: ${r.name}`,e),n.push({name:r.name,stage:`upload`,error:e})}}try{let e=await fn();N.getState().setDocuments(e.documents||[])}catch(e){F.doc.error(`Could not refresh the document list after a drop`,e)}return n}function BW(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 VW(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 HW=2e3,UW=9e4;function WW(){let e=R(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(`idle`),[s,c]=(0,B.useState)(null),l=(0,B.useRef)(!0),u=(0,B.useCallback)(async()=>{try{let e=await j();return l.current&&n(e),e}catch(e){return l.current&&c(e instanceof Error?e.message:String(e)),null}},[]);(0,B.useEffect)(()=>(l.current=!0,u(),ie().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,B.useCallback)(async()=>{c(null);let e=await u();e&&o(e.state===`stopped`?`still_down`:`back`)},[u]),f=(0,B.useCallback)(async()=>{o(`starting`),c(null);try{await $n(!1)}catch(e){if(!l.current)return;c(e instanceof Error?e.message:String(e)),o(`idle`);return}let e=Date.now()+UW;for(;l.current&&Date.now()<e;){await new Promise(e=>setTimeout(e,HW));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,B.useCallback)(async()=>{o(`switching`),c(null);try{let e=await be({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`?L(`div`,{className:`server-down-notice server-down-notice--ok`,role:`status`,children:L(`p`,{children:e(`serverDown.back`)})}):z(`div`,{className:`server-down-notice`,role:`alert`,children:[z(`strong`,{className:`server-down-notice__title`,children:[L(Ws,{size:14,"aria-hidden":`true`}),` `,e(`serverDown.title`)]}),L(`p`,{children:e(`serverDown.body`)}),t&&!h&&!g&&L(`p`,{children:e(`serverDown.notOurs`)}),a===`still_down`&&L(`p`,{children:e(`serverDown.stillDown`)}),s&&L(`p`,{children:L(`bdi`,{dir:`ltr`,className:`server-down-notice__raw`,children:s})}),z(`div`,{className:`server-down-notice__actions`,children:[h&&L(`button`,{type:`button`,className:`btn-primary`,disabled:m,onClick:()=>void f(),children:a===`starting`?z(P.Fragment,{children:[L(Za,{size:13,className:`btn-spinner`,"aria-hidden":`true`}),` `,e(`serverDown.starting`)]}):e(`serverDown.start`)}),g&&L(`button`,{type:`button`,className:`btn-primary`,disabled:m,onClick:()=>void p(),children:a===`switching`?z(P.Fragment,{children:[L(Za,{size:13,className:`btn-spinner`,"aria-hidden":`true`}),` `,e(`serverDown.switching`)]}):e(`serverDown.useOwn`)}),L(`button`,{type:`button`,className:`btn-secondary`,disabled:m,onClick:()=>void d(),children:e(`settings.key.checkAgain`)})]})]})}function GW(e,t=``){let[n,r]=(0,B.useState)(()=>e&&hn(e)||t),i=(0,B.useRef)(e);return(0,B.useEffect)(()=>{i.current!==e&&(i.current=e,r(e?hn(e):``))},[e]),(0,B.useEffect)(()=>{e&&i.current===e&&Nn(e,n)},[e,n]),[n,r]}function KW(e,t){return GW(t?null:Wt(e))}var qW=-2,JW=`opening`;function YW(e,t,n){return!t||e.some(e=>e.role===`user`&&e.content.trim()===t)?e:[...e,{id:qW,session_id:n,role:`user`,content:t,created_at:``,rag_sources:null}]}function XW({sessionId:e,pendingPrompt:t,messages:n,messageCount:r,isLoadingMessages:i,initializing:a,mountedRef:o,send:s}){let c=(0,B.useRef)(!1),[l,u]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=t?.text;if(!e||t.sending||N.getState().isLoadingMessages||a)return;let n={...t,sending:!0};N.getState().setPendingPrompt(n),c.current=!0,u(e.trim()),setTimeout(()=>{c.current=!1;let t=N.getState();t.pendingPrompt===n?o.current?(t.setPendingPrompt(null),s.current(e,{opening:!0}).finally(()=>{o.current&&u(null)})):t.setPendingPrompt({sessionId:n.sessionId,text:n.text}):o.current&&u(null)},0)},[t,i,a]);let d=!a&&r===0?t?.text.trim()||l:null,f=(0,B.useRef)(null);d&&!f.current&&(f.current=d);let p=f.current?n.find(e=>e.role===`user`&&e.content.trim()===f.current):void 0;return{openingRef:c,openingShown:d,rows:YW(n,d,e),isUnsent:e=>e.id===qW,openingKey:e=>e.id===qW||e===p?JW:void 0}}var ZW=new Set([`tool_start`,`tool_end`,`tool_result`]),QW=`Connection lost. Reconnecting`,$W=15e3,eG=[],tG=[],nG=[],rG=new Map,iG=12e3;function aG({sessionId:e}){let t=R(),n=sz(e),{sessions:r,messages:i,setMessages:a,addMessage:s,removeMessage:c,removeMessagesFrom:l,updateSessionInList:u,isStreaming:d,streamingContent:f,setStreaming:p,setStreamContent:h,clearStreamContent:g,agentSteps:_,addAgentStep:y,updateLastAgentStep:b,appendThinkingContent:x,updateLastToolStep:S,clearAgentSteps:C,cards:w,appendCard:T,clearCards:E,setDocuments:O,setShowFileBrowser:ee,isLoadingMessages:ne,setLoadingMessages:k,systemStatus:ie}=N(),ae=Bl(e=>e.addNotification),A=Bl(e=>e.showPanel),oe=Bl(e=>e.setShowPanel),ce=Bl(e=>e.setTypeFilter),le=N(t=>t.pendingPrompt?.sessionId===e?t.pendingPrompt:null),ue=N(e=>e.liveStatus),de=N(vI),fe=N(e=>e.awaitingUser),pe=N(t=>Object.values(t.liveQuestions).some(t=>t.sessionId===e)),me=N(t=>LA(t.liveQuestions,e)),j=Bl(t=>Wl(e)(t)!==null),M=r.find(t=>t.id===e),[ge,_e]=KW(e,M?.private),[ve,ye]=(0,B.useState)(!1),[be,xe]=(0,B.useState)(``),[Se,we]=(0,B.useState)(!1),[Te,Ee]=(0,B.useState)(!1),De=xW(),[Oe,ke]=(0,B.useState)(null),{policyToast:Ae,showPolicyToast:je,dismissPolicyToast:Me}=NW(),[Ne,Pe]=(0,B.useState)(null),{exportChat:Fe,exportError:Ie,clearExportError:Le}=jW(e,M?.title),[Re,ze]=(0,B.useState)(null);(0,B.useEffect)(()=>ze(null),[e]);let Be=(0,B.useCallback)((e,n)=>{ze(t(`chat.detachFailed`,{name:e,error:aN(n)}))},[t]),Ve=M?.agent_type&&M.agent_type!==`gaia`?M.agent_type:null,[He,Ue]=(0,B.useState)(null),We=(0,B.useRef)(new Map),Ge=(0,B.useRef)(new Set);MI(),(0,B.useEffect)(()=>()=>VN.getState().stop(),[]);let Ke=(0,B.useRef)(null),Je=(0,B.useRef)(null),Ye=(0,B.useRef)(null),Xe=(0,B.useRef)(null),Ze=(0,B.useRef)(0),Qe=(0,B.useRef)(!1),$e=(0,B.useRef)(0),et=(0,B.useRef)(null),[tt,nt]=(0,B.useState)(!1),rt=(0,B.useRef)(!1),it=(0,B.useRef)(null),at=(0,B.useRef)(null),ot=(0,B.useRef)(0),st=(0,B.useRef)(!1),ct=(0,B.useRef)(async()=>!1),lt=(0,B.useRef)(!1),ut=N(t=>t.messageQueues[e]??eG),dt=(0,B.useCallback)(t=>N.getState().updateQueue(e,t),[e]),ft=(0,B.useRef)(!1),[mt,gt]=(0,B.useState)(!1),_t=(0,B.useRef)(!1),vt=(0,B.useRef)(!1),yt=(0,B.useRef)(d);yt.current=d;let bt=N(t=>!!t.queueHolds[e]),xt=zc(e=>!!e.queued),St=(0,B.useRef)(``),Ct=(0,B.useRef)(null),wt=(0,B.useRef)(null),Tt=(0,B.useRef)(0),Et=(0,B.useRef)(!0),{userScrolling:Dt,clearUserScroll:Ot,listProps:kt}=AW(Je,Et,e=>Ee(e>200)),At=(0,B.useCallback)(()=>N.getState().currentSessionId!==e,[e]),jt=(0,B.useCallback)(()=>{Ct.current=null,At()||St.current&&h(St.current)},[h,At]),Mt=(0,B.useRef)(0),Pt=(0,B.useRef)(0);(0,B.useEffect)(()=>{F.chat.info(`ChatView mounted for session=${e}, loading messages...`);let t=F.chat.time();k(!0);let n=!1,r=!1,i=async(i=!1)=>{if(n||r)return;r=!0;let o=Pt.current;try{if(!i){if(N.getState().isStreaming)return;let t=await qe(e);if(n||t===Mt.current||N.getState().isStreaming)return}let r=await te(e);if(n)return;let s=wI(r.messages);if(i&&Pt.current!==o)Mt.current=s.length;else if(i)a(s),Mt.current=s.length,F.chat.timed(`Loaded ${s.length} message(s) for session=${e}`,t);else if(s.length!==Mt.current&&!N.getState().isStreaming){F.chat.info(`Messages changed externally: ${Mt.current} -> ${s.length}`);let e=N.getState().messages;OI(e,s,We.current),a(kI(e,s)),Mt.current=s.length}}catch(t){if(n)return;i&&(F.chat.error(`Failed to load messages for session=${e}`,t),a([]))}finally{r=!1,!n&&i&&k(!1)}};i(!0);let o=BW(()=>i(!1),3e3);return()=>{n=!0,o()}},[e,a,k]),(0,B.useEffect)(()=>{fn().then(e=>O(e.documents||[])).catch(e=>F.doc.error(`Could not load the document list`,e))},[O]);let Ft=(0,B.useRef)(!0),It=QI(ie);(0,B.useEffect)(()=>(Ft.current=!0,()=>{Ft.current=!1}),[]);let{openingRef:Lt,openingShown:Rt,rows:zt,isUnsent:I,openingKey:Bt}=XW({sessionId:e,pendingPrompt:le,messages:i,messageCount:M?.message_count??0,isLoadingMessages:ne,initializing:It,mountedRef:Ft,send:ct});(0,B.useEffect)(()=>{if(!Et.current)return;let e=Date.now()-Tt.current,t=()=>{Et.current&&!Dt()&&(Tt.current=Date.now(),Ke.current?.scrollIntoView({behavior:`instant`}))};e>=100&&t(),wt.current&&clearTimeout(wt.current),wt.current=setTimeout(t,100)},[i,f,_]),(0,B.useEffect)(()=>{Ye.current?.focus()},[e]),(0,B.useEffect)(()=>{ft.current=!1},[e]);let{contextUsage:Vt,contextUnavailable:Ht,refreshContext:Gt,showContextUsage:Kt}=CW(e,At),{comparison:qt,comparing:Yt,comparingRef:Xt,handleRetryWith:Qt,handleKeepAnswer:$t,handleCloseComparison:en,closeForNewTurn:tn}=SW({sessionId:e,isStreaming:d,isStale:At,setMessages:a,refreshContext:Gt});(0,B.useEffect)(()=>()=>{yt.current&&xL(e),Xe.current&&!vt.current&&Xe.current.abort(),Xe.current&&=null,it.current&&=(clearTimeout(it.current),null),rt.current=!1,at.current=null,nt(!1),Ct.current!==null&&(cancelAnimationFrame(Ct.current),Ct.current=null),wt.current&&=(clearTimeout(wt.current),null),et.current&&=(clearTimeout(et.current),null),Me(),St.current=``,N.getState().resetStreaming()},[e]),(0,B.useEffect)(()=>{Ne&&A&&(document.getElementById(AI(Ne))?.scrollIntoView({behavior:TB(),block:`center`}),Pe(null))},[Ne,A]);let nn=iB(e=>e.width),rn=iB(e=>e.reveal),an=_W(e=>e.visible),on=_W(e=>e.setVisible),sn=(0,B.useRef)(null),[cn,ln]=(0,B.useState)(!1),un=(0,B.useCallback)(()=>{on(!1),ln(!0),sn.current?.focus()},[on]);(0,B.useEffect)(()=>{if(!cn)return;if(an){ln(!1);return}let e=window.setTimeout(()=>ln(!1),iG);return()=>window.clearTimeout(e)},[cn,an]);let dn=wW(Je,Et),pn=(0,B.useCallback)(()=>{Et.current=!0,Ot(),Ke.current?.scrollIntoView({behavior:TB()})},[Ot]),mn=(0,B.useCallback)(()=>{rt.current||(rt.current=!0,ft.current=!0,nt(!0),Bl.getState().dismissSessionPrompts(e),N.getState().closeSessionQuestions(e),F.stream.warn(`User stopped generation; waiting for the server to close the turn`),Bn(e).catch(e=>{F.stream.error(`Stop request failed; waiting for the stream to close`,e)}),et.current?(clearTimeout(et.current),et.current=null,at.current?.()):it.current=setTimeout(()=>{F.stream.error(`No closing event ${$W}ms after Stop; closing the turn locally (session=${e})`),at.current?.()},$W))},[e]);(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&d&&!yn(e)&&(e.preventDefault(),mn())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d,mn]);let hn=(0,B.useCallback)(async(t,n)=>{let r=n?.attach===!0,i=n?.queued===!0,l=r?n?.reconnect??0:0,f=!r&&t===void 0,m=(f?ge:t??``).trim(),_=f&&De.hasUploaded,w=f&&De.hasImage,O=()=>{if(!f)return m;let t=De.compose(cz(m,e));return _e(``),De.clear(),Ye.current?.focus(),t};Et.current=!0;let ee=QI(N.getState().systemStatus),ne=e=>{i&&n?.onQueuedOutcome?.(e)};if(!r&&Ve)return F.chat.warn(`Send blocked: chat ${e} belongs to the retired "${Ve}" agent`),ne({kind:`failed`,error:`This chat's "${Ve}" agent was retired, so it cannot take new messages.`}),!1;let re=!n?.opening&&(N.getState().messageQueues[e]??eG).length>0;if(r){if(d&&!l)return!1}else if(!i&&(m||_)&&!ee&&(d||Xt.current||re)){if(w&&!yc(`vision`)&&!await Sc(`vision`))return!1;let e=O();return dt(t=>Qn(t,e,`queued`)),!0}else if(!m&&!_||d||ee)return ne({kind:`busy`}),!m&&!_&&F.chat.debug(`Send blocked: empty message`),d&&F.chat.debug(`Send blocked: already streaming`),ee&&F.chat.debug(`Send blocked: system initializing`),!1;if(!r&&!i&&(!yc(`chat`)||w&&!yc(`vision`))){if(lt.current)return!1;lt.current=!0;try{if(!await Sc(`chat`)||w&&!await Sc(`vision`))return!1}finally{lt.current=!1}if(At()){let t=O();return f&&!M?.private&&ht(Wt(e)),dt(e=>Qn(e,t,`queued`)),!0}}let k=m,ie=null,A=r||i?void 0:De.takeElements();if(r)F.chat.info(`Re-attaching to background run for session=${e}${l?` (reconnect ${l})`:``}`);else{k=O(),F.chat.info(`Sending message to session=${e}`,{length:k.length,preview:k.slice(0,80)}),tn();let t={id:Date.now(),session_id:e,role:`user`,content:k,created_at:new Date().toISOString(),rag_sources:null,page_elements:A};s(t),ie=t,Pt.current+=1}l||($e.current=0),p(!0),g(),C(),E(),ot.current=0,st.current=!1,l&&N.getState().setLiveStatus(`${QW} (attempt ${l} of 3)…`),F.stream.info(`Starting agent stream...`);let oe=F.stream.time(),se=``,ce;Ue(null);let le=!1;_t.current=!1,r||gt(!1);let ue=null,de=!i;vt.current=i;let fe=e=>{de||(de=!0,vt.current=!1,n?.onQueuedOutcome?.(e),e.kind===`accepted`&&At()&&ue?.abort())},pe=r||!!M&&!FW(M.title),me=()=>{fe({kind:`accepted`}),pe||(pe=!0,D(e).then(t=>u(e,{title:t.title})).catch(e=>F.chat.warn(`Could not refresh the chat title`,e)))};St.current=``,rt.current=!1,nt(!1);let j=()=>{it.current&&=(clearTimeout(it.current),null),rt.current=!1,at.current=null,nt(!1)},ve=()=>{let{agentSteps:e,cards:t}=N.getState();return{steps:e.map(e=>({...e,active:!1})),cards:[...t]}};at.current=()=>{if(le)return;le=!0,Qe.current=!0,Ze.current=Date.now(),j(),fe({kind:`failed`,error:`Stopped before GAIA confirmed it got this message.`}),Xe.current?.abort(),Xe.current=null,Ct.current!==null&&(cancelAnimationFrame(Ct.current),Ct.current=null);let t=St.current||N.getState().streamingContent;if(St.current=``,At())return;let{steps:n,cards:r}=ve();s({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),g(),C(),E()};let ye={onConnected:()=>{if(At())return;let e=N.getState();(e.liveStatus===`Waiting for GAIA to start this answer…`||e.liveStatus?.startsWith(QW))&&e.setLiveStatus(null)},onChunk:t=>{if(me(),At())return;N.getState().awaitingUser&&N.getState().setAwaitingUser(!1);let n=t.content||``;if(n&&Bl.getState().dismissSessionPrompts(e),n){if(t.type===`answer`)se=n;else{st.current&&=(se.length>0&&(se+=`
|
|
199
|
-
|
|
200
|
-
`),!1),se+=n;let e=N.getState().agentSteps,t=e[e.length-1];t?.type===`thinking`&&t.active&&b({active:!1,latencyMs:Date.now()-t.timestamp})}let e=se.replace(bI,``).trim();if(e=xI(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())}}St.current=e,Ct.current===null&&(Ct.current=requestAnimationFrame(jt))}},onAgentEvent:t=>{if((t.type!==`status`||t.phase!==`waiting`)&&me(),t.type===`draft`)return;if(t.type===`followup_taken`&&t.text){let n=t.text;if(dt(e=>he(e,n)),At())return;s({id:Date.now(),session_id:e,role:`user`,content:n,created_at:new Date().toISOString(),rag_sources:null});return}if(t.type===`followup_unavailable`){At()||gt(!0);return}if(t.type===`followup_returned`){let e=t.texts??[];dt(t=>o(t,e));return}if(At())return;if(t.type===`context_usage`){Kt(t);return}let n=t.type===`permission_request`||t.type===`needs_input`;if(N.getState().awaitingUser!==n&&N.getState().setAwaitingUser(n),ZW.has(t.type)&&Bl.getState().dismissSessionPrompts(e),t.type===`permission_request`){WI(t,e);return}if(t.type===`needs_confirmation`){T({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}N.getState().openQuestion(t.request_id,e,typeof t.timeout_seconds==`number`?t.timeout_seconds:null,{options:Array.isArray(t.options)?t.options:[],allowFreeText:t.allow_free_text!==!1,sensitive:!!t.sensitive}),T({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=GI(t,e,`policy-${Date.now()}-${ot.current+1}`);ae(n);let r=hI(t,ot);r&&y(r),je({tool:n.tool,receiptId:t.receipt_id});return}if((t.type===`tool_end`||t.type===`tool_result`)&&N.getState().livePhase===`tool`&&N.getState().setLiveStatus(null),t.type===`tool_end`){S({active:!1,success:t.success!==!1});return}if(t.type===`tool_result`){typeof t.render==`string`&&t.render.length>0&&T({render:t.render,data:t.data}),S(qI(t));return}if(t.type===`tool_args`){let e=!!t.args&&Object.keys(t.args).length>0,n=t.detail||(e?JSON.stringify(t.args):``);S({...n?{detail:n}:{},...t.narration?{narration:t.narration}:{}});let r=N.getState(),i=[...r.agentSteps].reverse().find(e=>e.type===`tool`);t.narration&&i?.active&&r.livePhase===`tool`&&r.setLiveStatus(lO(i,Ut()),`tool`);return}if(t.type===`skill_use`){N.getState().addSkillStep(t.how===`model`?null:hI(t,ot));return}if(t.type===`commentary`){se=``,st.current=!1,St.current=``,h(``);let e=hI(t,ot);e&&y(e);return}if(t.retracts_answer&&(se=``,st.current=!1,St.current=``,h(``),t.type===`status`)){let e=hI({type:`status`,status:`warning`,message:Ut()(`live.answerRestarted`)},ot);e&&y(e);return}if(t.type===`thinking`){let e=N.getState().agentSteps,n=e[e.length-1];if(n&&n.type===`thinking`){x(t.content||``);return}let r=hI(t,ot);r&&y(r);return}if(t.type===`status`){if(t.status===`history_cut`){ce=(t.message||``).trim()||void 0,Ue(ce??null);return}yI(t,ot);return}if(t.type===`step`||t.type===`agent_error`&&SI(t,N.getState().agentSteps))return;let r=hI(t,ot);r&&(y(r),t.type===`tool_start`&&(st.current=!0,N.getState().setLiveStatus(lO(r,Ut()),`tool`),t.tool===`load_skill`&&N.getState().addSkillStep(null)))},onDone:t=>{if(me(),dH(e),Bl.getState().dismissSessionPrompts(e),N.getState().closeSessionQuestions(e),le)return;le=!0;let n=t.cancelled===!0?`stopped`:rt.current&&t.message_id==null?`unconfirmed`:void 0;if(j(),Ct.current!==null&&(cancelAnimationFrame(Ct.current),Ct.current=null),St.current=``,RW(e,t.documents_added??[]),At())return;Ze.current=Date.now(),_t.current=!0;let i=N.getState();i.setRunningSessions(i.runningSessionIds.filter(t=>t!==e));let o=t.content||se;F.chat.timed(`Agent response complete: ${o.length} chars${n?` (${n})`:``}`,oe);let{steps:c,cards:l}=ve(),u=c.some(e=>e.type===`policy_alert`);if(o||u||n){Mt.current=N.getState().messages.length+1;let r={id:t.message_id||Date.now()+1,session_id:e,role:`assistant`,content:o,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:ce,libraryNotices:t.library_notices,failure:t.failed?t.failure:void 0};ce&&rG.set(r.id,ce),Ge.current.add(r.id),s(r);let i=VN.getState();i.settings?.auto&&jI(r)&&i.read(`${e}:${r.id}`,DF(o))}p(!1),g(),C(),E(),Ye.current&&Ye.current.focus(),setTimeout(()=>{te(e).then(t=>{if(At()||N.getState().isStreaming)return;let n=N.getState().messages,i=n.filter(e=>e.cards&&e.cards.length>0),c=wI(t.messages).map(e=>{let t=i.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}});OI(n,c,We.current),a(c),Mt.current=c.length,r&&!o&&c[c.length-1]?.role===`user`&&s({id:Date.now()+2,session_id:e,role:`assistant`,content:KN,created_at:new Date().toISOString(),rag_sources:null})}).catch(t=>F.chat.error(`Could not refresh messages for session=${e}`,t))},300)},onError:t=>{let n=qN(t);n||dH(e);let i=de&&!r&&!n&&!!ie&&kL(e,k,t);if(!de||i){if(n)me();else{if(fe(EL(t)?{kind:`busy`}:{kind:`failed`,error:rP(t).text}),Ze.current=Date.now(),j(),Ct.current!==null&&(cancelAnimationFrame(Ct.current),Ct.current=null),St.current=``,At())return;F.chat.info(`Queued message for session=${e} not taken: ${t.message}`),ie&&c(ie.id),_t.current=!0,p(!1),g(),C(),E();return}}if(n&&rt.current&&!le){F.chat.warn(`Stream for session=${e} was lost while stopping; closing the turn locally`),at.current?.();return}if(n&&!Ft.current)return;if(n&&!le&&!At()&&$e.current<3){let n=++$e.current,r=GN[n-1]??0;F.chat.warn(`Stream for session=${e} lost (${t.name}); reconnecting in ${r}ms (${n}/3)`),N.getState().setLiveStatus(`${QW} (attempt ${n} of 3)…`);let i=()=>{et.current=null,!Ft.current||At()||rt.current||ct.current(void 0,{attach:!0,reconnect:n})};r>0?et.current=setTimeout(i,r):i();return}Ze.current=Date.now(),Bl.getState().dismissSessionPrompts(e),N.getState().closeSessionQuestions(e);let a=rt.current;if(j(),Ct.current!==null&&(cancelAnimationFrame(Ct.current),Ct.current=null),St.current=``,At())return;if(n||(_t.current=!0),F.chat.error(`Chat error for session=${e}`,t),a){let{steps:n,cards:r}=ve();s({id:Date.now()+2,session_id:e,role:`assistant`,content:se,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`}),Mt.current=N.getState().messages.length,p(!1),g(),C(),E();return}let{kind:o,text:l}=rP(t),u=o===`stream`?l:l+`
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
*Unexpected error?* [Report it on GitHub](${XL((t.message||``).slice(0,80))})`,d={id:Date.now()+2,session_id:e,role:`assistant`,content:u,created_at:new Date().toISOString(),rag_sources:null,failed:!YN(t),failureText:t.message||void 0};s(d),p(!1),g(),C(),E()}},be=r?Gn(e,ye):v(e,k,{...ye,pageElements:A});return ue=be,Xe.current=be,!0},[ge,De,d,e,M,Ve,s,c,a,p,jt,g,u,y,b,x,S,C,T,E,ae,At]);ct.current=hn;let gn=N(t=>t.runningSessionIds.includes(e)),_n=N(e=>e.activeRunsAt>Ze.current);(0,B.useEffect)(()=>{uL()},[e]),(0,B.useEffect)(()=>{gn?!_n||d||Qe.current||(F.chat.info(`Resuming live view of background run for session=${e}`),ct.current(void 0,{attach:!0})):Qe.current=!1},[e,gn,_n,d]),(0,B.useEffect)(()=>{let e=e=>{let t=e.detail?.text;typeof t==`string`&&t.trim()&&ct.current(t)};return window.addEventListener(`gaia:send-message`,e),()=>window.removeEventListener(`gaia:send-message`,e)},[]),(0,B.useEffect)(()=>{!d&&Ye.current&&Ye.current.focus()},[d]);let vn=(0,B.useCallback)(async t=>{d||(F.chat.info(`Deleting message ${t} from session=${e}`),ke(t),setTimeout(async()=>{c(t),ke(null);try{await pt(e,t)}catch(n){F.chat.error(`Failed to delete message ${t}`,n),te(e).then(e=>{At()||a(wI(e.messages))}).catch(t=>F.chat.error(`Could not reload messages for session=${e}`,t))}},250))},[e,d,c,a,At]),bn=(0,B.useRef)(!1),xn=(0,B.useCallback)(async(n,r,i)=>{if(d||n.role!==`user`||bn.current)return!1;bn.current=!0;let o=i??n.content;F.chat.info(`Resending message ${n.id} from session=${e}`,{preview:o.slice(0,80)});let s=n=>ae({id:`resend-failed-${e}-${Date.now()}`,type:`error`,agentId:e,agentName:`GAIA`,title:t(`chatError.resendFailed`),message:n,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,sessionId:e});try{if(QI(N.getState().systemStatus)){let e=await se();if(N.getState().setSystemStatus(e),QI(e))return s(t(`chatError.resendStarting`)),!1}if(!yc(`chat`)&&!await Sc(`chat`))return!1;let i=await te(e);if(At())return!1;let c=wI(i.messages),l=TI(c,N.getState().messages,n);if(l&&r&&!DI(c,l,r))return F.chat.info(`Message ${n.id} was answered since it failed; not resending`),a(c),Mt.current=c.length,!1;if(l&&await Jn(e,l.id),At()){let{sessions:t,pendingDeleteIds:n}=N.getState();return t.some(t=>t.id===e)&&!n.includes(e)&&dt(e=>Qn(e,o,`queued`)),!0}}catch(r){F.chat.error(`Could not resend message ${n.id} in session=${e}`,r);let i=r instanceof Error?rP(r):null;return s(i?.kind===`connection`||i?.kind===`timeout`?i.text:t(`chatError.resendStale`)),!1}finally{bn.current=!1}l(n.id);let c=!1;try{c=await ct.current(o)}catch(t){F.chat.error(`Could not resend message ${n.id} in session=${e}; queued it`,t)}return c||dt(e=>Qn(e,o,`queued`)),!0},[e,d,l,a,dt,At,ae,t]);(0,B.useEffect)(()=>CL(e),[e]);let Cn=N(()=>SL(e)),wn=(0,B.useCallback)((e,t)=>new Promise(e=>{ct.current(t,{queued:!0,onQueuedOutcome:e})}),[]),Tn=d||Yt;(0,B.useEffect)(()=>{if(!Tn){if(ft.current){ft.current=!1;let e=ut.map(e=>e.text);e.length&&(dt(()=>[]),_e(t=>[t.trim(),...e].filter(Boolean).join(`
|
|
204
|
-
|
|
205
|
-
`)))}else ut.length===0||bt||xt||ne||le||Lt.current||Ve||It||At()||!_t.current&&!Cn||AL(e,wn,()=>Ft.current&&!At()&&!N.getState().isStreaming&&!Xt.current)}},[Tn,ut,bt,xt,Cn,ne,le,Ve,It,e,wn,At]);let En=(0,B.useRef)(!1);(0,B.useEffect)(()=>{En.current&&!Tn&&Gt(),En.current=Tn},[Tn,Gt]);let Dn=(0,B.useCallback)(t=>{let n=ut.find(e=>e.id===t&&e.state===`queued`);n&&d&&(dt(e=>m(e,t,`queued`,`sending`)),Sn(e,n.text).then(()=>dt(e=>m(e,t,`sending`,`delivered`))).catch(e=>{F.chat.info(`Follow-up not taken by the running reply; it stays queued: ${e instanceof Error?e.message:e}`),dt(e=>Jt(e,t))}))},[ut,d,e,dt]),On=(0,B.useCallback)(async()=>{let n=me?N.getState().liveQuestions[me]:void 0,r=ge.trim();if(!me||!n||!r||De.hasUploaded){hn();return}let i=IA(r,n);if(!i)ze(t(`composer.pickAnOption`));else{ze(null),_e(``);try{await FA(e,me,i.value,i.shown)}catch(e){_e(r),e instanceof NA||ze(t(`composer.answerFailed`,{error:aN(e)}))}}},[me,ge,De,hn,_e,e,t]),kn=(0,B.useCallback)(()=>{for(let e=i.length-1;e>=0;e--)if(i[e].role===`user`){xn(i[e]);return}},[i,xn]),An=(0,B.useCallback)(e=>{let t=i.indexOf(e);for(let n=t-1;n>=0;n--)if(i[n].role===`user`){xn(i[n],e);return}},[i,xn]),jn=(0,B.useCallback)(e=>{let t=i.indexOf(e);for(let e=t-1;e>=0;e--)if(i[e].role===`user`){xn(i[e]);return}},[i,xn]),[Mn,Nn]=(0,B.useState)(null),Pn=(0,B.useRef)(null),Fn=(0,B.useCallback)(e=>{Pn.current=null,Nn(e)},[]),In=(0,B.useCallback)(()=>{let e=lR(i);e&&Fn(e.id)},[i,Fn]),Ln=(0,B.useCallback)(()=>{Pn.current=null,Nn(null),Ye.current?.focus()},[]),Rn=(0,B.useCallback)(async(e,t)=>{Pn.current=t,await xn(e,void 0,t)&&(Pn.current=null,Nn(t=>t===e.id?null:t))},[xn]),zn=(0,B.useCallback)(()=>{ct.current(t(`msg.continuePrompt`))},[t]),Vn=()=>{xe(M?.title||``),ye(!0)},Hn=async()=>{let n=be.trim().slice(0,200).trim();if(n&&be!==M?.title&&n!==M?.title){ze(null);try{await re(e,{title:n,title_is_custom:!0}),u(e,{title:n})}catch(n){F.chat.error(`Could not rename chat ${e}`,n),ze(t(`chat.renameFailed`,{error:aN(n)}))}}ye(!1)},Un=(0,B.useCallback)(async()=>{if(e){ze(null);try{let t=await Ce(e);u(e,{private:t.private})}catch(e){F.ui.warn(`Failed to toggle private mode`,e),ze(t(`chat.privateFailed`,{error:aN(e)}))}}},[e,u,t]),Wn=(0,B.useCallback)(async n=>{if(n.preventDefault(),n.stopPropagation(),we(!1),n.dataTransfer.files.length===0)return;let r=Array.from(n.dataTransfer.files),i=r.filter(e=>RL(e.name));i.length>0&&De.addFiles(i);let a=r.filter(e=>!RL(e.name));if(a.length===0||!await Sc(`embedding`))return;ze(null);let o=await zW(e,a);o.length>0&&ze(o.map(({name:e,stage:n,error:r})=>n===`unreadable`||n===`server`||n===`busy`?t(n===`server`?`docsBar.serverTitle`:n===`busy`?`docsBar.busyTitle`:`docsBar.failedTitle`,{name:e}):t(n===`attach`?`chat.dropAttachFailed`:`chat.dropUploadFailed`,{name:e,error:aN(r)})).join(` `))},[e,De,t]),Kn=e=>{e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),e.stopPropagation(),we(!0))},qn=e=>{e.preventDefault(),e.stopPropagation(),we(!1)},Yn=i.length>0?i[i.length-1]:void 0,Xn=(0,B.useMemo)(()=>GA(Yn),[Yn]),Zn=(0,B.useMemo)(()=>KA(Yn),[Yn]),$n=!d&&!ne&&Yn?.role===`assistant`&&(qA(Yn)?Xn.length>0:Fk(Yn.content)),er=(0,B.useMemo)(()=>{let e=new Map,t;for(let n of i)if(n.role===`user`&&n.created_at)t=new Date(n.created_at).getTime();else if(n.role===`assistant`&&n.created_at&&t!==void 0){let r=new Date(n.created_at).getTime();r>t&&e.set(n.id,r-t),t=void 0}return e},[i]),tr=Ve?`This chat used the retired "${Ve}" agent and is read-only. Start a new chat.`:QI(ie)?Du:null;return z(`main`,{className:`task-view ${Se?`drag-active`:``}`,style:{"--session-panel-w":`${nn}px`},onDrop:Wn,onDragOver:Kn,onDragLeave:qn,"aria-label":IW(M?.title)||`Chat`,children:[L(dI,{busy:Tn}),z(`header`,{className:`task-header`,children:[L(`div`,{className:`task-header-left`,children:ve?L(`input`,{className:`title-edit`,value:be,maxLength:200,onChange:e=>xe(e.target.value),onBlur:Hn,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&Hn(),e.key===`Escape`&&(e.preventDefault(),ye(!1))},...Nt,autoFocus:!0,"aria-label":`Chat title`,dir:`auto`}):z(`button`,{type:`button`,className:`task-title`,onClick:Vn,title:t(`row.rename`),children:[L(`span`,{children:FW(M?.title)?t(`sidebar.newChat`):IW(M?.title)}),L(Po,{size:12,"aria-hidden":`true`,className:`task-title-edit`})]})}),z(`div`,{className:`task-header-right`,children:[L(`button`,{ref:sn,className:`btn-icon-sm task-header-resources`,onClick:()=>on(!an),"aria-pressed":an,"aria-label":t(`resources.toggle`),title:t(an?`resources.hide`:`resources.show`),children:L(hr,{size:15,"aria-hidden":`true`})}),L(WU,{isPrivate:!!M?.private,onToggle:Un}),L(`button`,{className:`btn-icon-sm`,onClick:()=>ee(!0),title:t(`chat.browseFiles`),"aria-label":t(`chat.browseFiles`),children:L(ha,{size:15})}),L(`button`,{className:`btn-icon-sm`,onClick:Fe,title:t(`chat.exportTitle`),"aria-label":t(`chat.exportLabel`),children:L(Ni,{size:15})}),L(UU,{messages:i,busy:d})]})]}),an&&L(fW,{onClose:un}),!an&&cn&&z(`div`,{className:`resource-strip resource-hidden-note`,role:`status`,children:[L(`span`,{children:t(`resources.hiddenNote`)}),L(`button`,{type:`button`,className:`resource-hidden-undo`,onClick:()=>on(!0),children:t(`resources.show`)})]}),L(KU,{sessionId:e,onDetachFailed:Be}),L(`div`,{className:`messages-scroll`,ref:Je,...kt,children:z(`div`,{className:`messages-column`,children:[ne&&!Rt&&L(`div`,{className:`skeleton-messages`,"aria-label":t(`chat.loadingMessages`),children:[0,1,2].map(e=>L(`div`,{className:`skeleton-msg`,children:z(`div`,{className:`skeleton-lines`,children:[L(`div`,{className:`skeleton-line`}),L(`div`,{className:`skeleton-line`}),e!==2&&L(`div`,{className:`skeleton-line`})]})},e))}),zt.map((e,t)=>{let n=e.role===`assistant`?e.historyNotice??rG.get(e.id):void 0,r=e.role===`assistant`&&FF(e.content,e.stopState)===`interrupted`,a=e.role===`assistant`&&e.stopState===`stopped`&&!e.stopError,o=(e.failed===!0||r||a)&&!Tn&&!Ve&&t===i.length-1,s=!o&&!Tn&&!qt&&!Ve&&e.role===`assistant`&&t===i.length-1&&!e.stopState&&!e.failed&&!pF(e.content),c=e.stats?.seconds==null?er.get(e.id):e.stats.seconds*1e3,l=I(e);return z(`div`,{className:Oe===e.id?`msg-deleting`:Ge.current.has(We.current.get(e.id)??e.id)?`msg-settled`:void 0,"data-message-id":e.id,"data-role":e.role,children:[n&&L(uz,{text:n}),e.libraryNotices&&e.libraryNotices.length>0&&L(dz,{notices:e.libraryNotices}),L(zF,{message:e,agentSteps:e.role===`assistant`?e.agentSteps:void 0,onDelete:!Tn&&!l?vn:void 0,onResend:!Tn&&!l&&e.role===`user`&&!Ve?xn:void 0,onEditStart:!Tn&&!l&&e.role===`user`&&!Ve?()=>Fn(e.id):void 0,editing:Mn===e.id&&!Tn,editDraft:Mn===e.id?Pn.current:null,onEditDraft:e=>{Pn.current=e},onEdit:Rn,onEditCancel:Ln,laterCount:e.role===`user`?uR(i,t):0,onRegenerate:s&&!l?()=>jn(e):void 0,extraActions:s?L(Gz,{answeredBy:e.stats?.model??M?.effective_model,onPick:t=>Qt(e,t)}):void 0,onTryAgain:o?()=>An(e):void 0,onContinue:o&&a?zn:void 0,latest:e.role===`assistant`&&t===i.length-1,latencyMs:c}),e.failure===`model_server_down`&&t===i.length-1&&!Tn&&L(WW,{}),qt?.messageId===e.id&&L(Yz,{original:e,originalModel:e.stats?.model??M?.effective_model,originalLatencyMs:c,state:qt.state,keeping:qt.keeping,onKeep:e=>{$t(e)},onClose:en})]},Bt(e)??We.current.get(e.id)??e.id)}),d&&He&&L(uz,{text:He}),d&&L(UI,{}),(d||!!Rt)&&L(`div`,{className:`streaming-bubble stream-active`,children:L(zF,{message:{id:-1,session_id:e,role:`assistant`,content:d&&f||``,created_at:``,rag_sources:null},isStreaming:d||!!Rt,agentSteps:d?_:tG,agentStepsActive:d&&_.some(e=>e.active),cards:d?w:nG,liveStatus:d?ue:null,toolStatus:d?de:null,awaitingUser:d&&(fe||pe||j)})}),L(`div`,{ref:Ke})]})}),L(VU,{sessionId:e,messages:i,busy:Tn,usage:Vt,onUsage:Kt,onJumpToMessage:dn}),Se&&z(`div`,{className:`drag-overlay`,children:[L(Js,{size:32,strokeWidth:1.5,"aria-hidden":`true`}),L(`span`,{children:t(`chat.dropOverlay`)})]}),Ae&&z(`div`,{className:`toast policy-alert-toast`,role:`alert`,children:[L(`span`,{children:t(`chat.policyBlocked`,{tool:Ae.tool})}),Ae.receiptId?L(`button`,{type:`button`,className:`policy-alert-toast-link`,onClick:()=>{let e=Ae.receiptId;e&&(ce(`policy_alert`),oe(!0),Pe(e))},children:t(`chat.policyViewReceipt`)}):L(`span`,{className:`policy-alert-toast-missing`,children:t(`activity.policy.receiptUnavailable`)})]}),z(`div`,{className:`input-area`,children:[Te&&L(`button`,{className:`scroll-bottom-btn`,onClick:pn,title:t(`chat.scrollBottom`),"aria-label":t(`chat.scrollBottom`),children:L(yr,{size:16})}),z(`div`,{className:`input-column`,children:[L(mW,{message:Ie,onDismiss:Le,dismissLabel:t(`chat.dismissExportError`)}),L(mW,{message:Re,onDismiss:()=>ze(null),dismissLabel:t(`chat.dismissError`)}),$n&&Yn&&L(rR,{content:Yn.content,providers:Xn,accounts:Zn,onRetry:kn},Yn.id),L(FD,{sessionId:e}),L(Rz,{usage:Vt}),L(pW,{sessionId:e}),le&&It&&L(`ul`,{className:`queued-messages`,"aria-label":t(`composer.heldLabel`),"aria-live":`polite`,children:z(`li`,{className:`queued-message is-queued`,children:[L(yi,{size:12,"aria-hidden":`true`}),L(`span`,{className:`queued-message-text`,title:le.text,children:le.text}),L(`span`,{className:`queued-message-state`,children:t(`composer.heldUntilStarted`)})]})}),L(mz,{items:ut,onRemove:e=>dt(t=>Zt(t,e)),onRetry:e=>dt(t=>m(t,e,`failed`,`queued`)),onSteer:d&&!tt&&!mt?Dn:void 0,replying:d,busyRetry:!!bt}),L(wR,{value:ge,onChange:_e,onSubmit:me?On:()=>hn(),answering:!!me,onStop:mn,streaming:d,stopping:tt,queueWhileStreaming:!0,disabledReason:tr,attachments:De,inputRef:Ye,onEditLast:!Tn&&!Ve?In:void 0,placeholder:me?t(`composer.answerQuestion`):d?t(`composer.queueNext`):n?t(`composer.researchPlaceholder`):i.length===0?t(`composer.placeholder`):t(`composer.reply`),leftControls:z(P.Fragment,{children:[L(oz,{sessionId:e,disabled:!!Ve}),L(lz,{sessionId:e,disabled:!!Ve,compact:!0})]}),rightControls:z(P.Fragment,{children:[L(Lz,{usage:Vt,unavailable:Ht,sessionId:e,busy:Tn,onUsage:Kt,onDetails:()=>rn(`context`)}),L(Hz,{sessionId:e,busy:Tn}),L(tz,{sessionId:e,onOpen:()=>rn(`environment`)}),L(HR,{})]})})]})]})]})}var oG=1.1,sG=60,cG=110,lG=24,uG=2.4,dG=Math.PI*2,fG=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)};function pG(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 mG=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=pG(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()*dG),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*fG(.75,1.5,a))*fG(0,50,i)*fG(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()*dG})}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()*dG},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*uG),a=Math.min(1,e*14),o=Math.min(1,e*9),s=r?sG+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)>lG+.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)/lG;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<cG){let i=(1-n/cG)**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/oG),i=(1-(1-r)**3)*n.reach,a=new Path2D;for(let e=0;e<=180;e++){let t=e/180*dG,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)}},hG=90;function gG(){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 _G(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 vG({activity:e,progress:t=0,pulse:n,docked:r,contentRef:i,composerRef:a}){let o=(0,B.useRef)(null),s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(()=>{}),u=(0,B.useRef)(()=>{}),d=(0,B.useRef)(r),f=(0,B.useRef)({value:n,at:0});d.current=r,(0,B.useEffect)(()=>{let e=o.current,t=e?.parentElement;if(!e||!t)return;let n=e.getContext(`2d`);if(!n){F.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 mG;s.current=r;let f=typeof window.matchMedia==`function`?window.matchMedia(SB):null,p=gG(),m=0,h=0,g=!1,_=``,v={x:0,y:0,at:0,speed:0},y=()=>r.draw(n,p),b=(e,t=!1)=>{let n=d.current?a.current:i.current,r=(n&&_G(n,e,d.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!==_?(_=o,r):null},x=()=>{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,b(i,!0)),y()},S=e=>{if(m=requestAnimationFrame(S),e-h<31.833333333333336)return;let n=Math.min(.1,(e-h)/1e3);h=e;let i=b(t.getBoundingClientRect());i&&r.setHole(i),e-v.at>80&&(v.speed*=.8),(r.step(n)||i)&&y(),r.cleared&&w()},C=()=>{g||document.hidden||f?.matches||r.cleared||(g=!0,h=performance.now(),m=requestAnimationFrame(S))},w=()=>{g=!1,cancelAnimationFrame(m)};l.current=C,u.current=()=>{let e=b(t.getBoundingClientRect());e&&r.setHole(e),g||y()};let T=()=>document.hidden?w():C(),E=()=>{w(),y(),C()},D=()=>{p=gG(),y()},O=e=>{let n=t.getBoundingClientRect(),i=e.clientX-n.left,a=e.clientY-n.top,o=performance.now();if(v.at&&o>v.at){let e=Math.hypot(i-v.x,a-v.y)/((o-v.at)/1e3);v.speed+=(Math.min(4e3,e)-v.speed)*.35}Object.assign(v,{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,v.speed)},ee=()=>{v.at=0,v.speed=0,r.clearPointer()},te=typeof ResizeObserver>`u`?null:new ResizeObserver(x);te?.observe(t,{box:`border-box`});let ne=new MutationObserver(D);return ne.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`data-palette`,`style`]}),document.addEventListener(`visibilitychange`,T),f?.addEventListener(`change`,E),t.addEventListener(`pointermove`,O),t.addEventListener(`pointerleave`,ee),x(),C(),()=>{w(),te?.disconnect(),ne.disconnect(),document.removeEventListener(`visibilitychange`,T),f?.removeEventListener(`change`,E),t.removeEventListener(`pointermove`,O),t.removeEventListener(`pointerleave`,ee),s.current=null,l.current=()=>{},u.current=()=>{}}},[i,a]);let p=(0,B.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,B.useEffect)(()=>{let t=s.current;if(t){if(t.setActivity(e),e===`sending`){let e=p();e&&t.dissolve(...e)}else t.dissolving&&(t.restore(),l.current())}},[e,p]),(0,B.useEffect)(()=>{s.current?.setProgress(t)},[t]),(0,B.useEffect)(()=>{u.current()},[r]),(0,B.useEffect)(()=>{let e=f.current;if(n===e.value)return;let t=performance.now();if(e.value=n,t-e.at<hG)return;e.at=t;let r=p();r&&s.current?.ripple(...r,.45)},[n,p]),L(`canvas`,{ref:o,className:`npu-backdrop`,"aria-hidden":`true`})}async function yG(e,t,n){let r=`${Hn()}${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 bG(e){let t=[];for(let[n,r]of Object.entries(e))if(r!=null&&r!==``){if(Array.isArray(r))for(let e of r)t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(e))}`);else t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`)}return t.length?`?${t.join(`&`)}`:``}function xG(){return yG(`GET`,`/memory/stats`)}function SG(e=30){return yG(`GET`,`/memory/activity?days=${e}`)}function CG(e={}){return yG(`GET`,`/memory/knowledge${bG(e)}`)}function wG(e){return yG(`POST`,`/memory/knowledge`,e)}function TG(e,t){return yG(`PUT`,`/memory/knowledge/${encodeURIComponent(e)}`,t)}function EG(e){return yG(`DELETE`,`/memory/knowledge/${encodeURIComponent(e)}`)}function DG(){return yG(`GET`,`/memory/entities`)}function OG(){return yG(`GET`,`/memory/tools`)}function kG(e=20){return yG(`GET`,`/memory/conversations?limit=${e}`)}function AG(e,t=20){return yG(`GET`,`/memory/conversations/search?query=${encodeURIComponent(e)}&limit=${t}`)}function jG(e){return yG(`GET`,`/memory/conversations/${encodeURIComponent(e)}`)}function MG(e=7){return yG(`GET`,`/memory/upcoming?days=${e}`)}function NG(){return yG(`GET`,`/memory/embedding-coverage`)}function PG(){return yG(`POST`,`/memory/consolidate`)}function FG(){return yG(`POST`,`/memory/rebuild-embeddings`)}function IG(){return yG(`POST`,`/memory/reconcile`)}function LG(){return yG(`POST`,`/memory/rebuild-fts`)}function RG(){return yG(`POST`,`/memory/refresh-system-context`)}function zG(){return new EventSource(`${Hn()}/memory/stream-discovery`)}function BG(e){return new EventSource(`${Hn()}/memory/stream-inference?include_browser=${e}`)}function VG(e){return yG(`POST`,`/memory/commit-discovery`,{items:e})}function HG(e){return yG(`POST`,`/memory/commit-inference`,{insights:e})}function UG(){return yG(`GET`,`/memory/settings`)}function WG(e){return yG(`PUT`,`/memory/settings`,e)}function GG(){return yG(`GET`,`/memory/embedder`)}function KG(e){return yG(`PUT`,`/memory/embedder`,{device:e})}function qG(){return yG(`DELETE`,`/memory/all`)}function JG(){return yG(`POST`,`/memory/reinitialize`)}function YG(){return yG(`GET`,`/goals/health`)}function XG(){return yG(`POST`,`/goals/store/reset`)}function ZG(){return yG(`GET`,`/goals/stats`)}function QG(e={}){return yG(`GET`,`/goals${bG(e)}`)}function $G(e){return yG(`POST`,`/goals`,e)}function eK(e){return yG(`PUT`,`/goals/${encodeURIComponent(e)}/approve`)}function tK(e){return yG(`PUT`,`/goals/${encodeURIComponent(e)}/reject`)}function nK(e){return yG(`PUT`,`/goals/${encodeURIComponent(e)}/cancel`)}function rK(e){return yG(`DELETE`,`/goals/${encodeURIComponent(e)}`)}function iK({disabled:e}){let t=R(),n=N(e=>e.draftPrivate),r=N(e=>e.setDraftPrivate),i=N(e=>e.settingsSection!==null),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),d=(0,B.useRef)(null),f=(0,B.useCallback)(()=>u(!1),[]);if((0,B.useEffect)(()=>{if(i)return;let e=!1;return UG().then(t=>{e||(o(t.memory_enabled),c(!1))}).catch(t=>{e||(F.ui.error(`Could not read the memory setting for the Private chip`,t),o(null),c(!0))}),()=>{e=!0}},[i]),(0,B.useEffect)(()=>{a===!1&&n&&r(!1)},[a,n,r]),a===!1)return z(`button`,{type:`button`,className:`composer-chip composer-chip-memory is-unavailable`,disabled:!0,"aria-label":t(`composer.memoryOff`),title:t(`composer.memoryOffTitle`),children:[L(Gi,{size:13,"aria-hidden":`true`}),L(`span`,{className:`composer-chip-label`,dir:`auto`,children:t(`composer.memoryOff`)})]});let p=e=>{r(e),u(!1)},m=[{priv:!1,Icon:qi,label:t(`composer.remember`),note:t(s?`composer.memoryUnknownTitle`:`composer.rememberNote`)},{priv:!0,Icon:Gi,label:t(`composer.privateChat`),note:t(`composer.privateChatNote`)}];return z(`div`,{className:`composer-chip-wrap`,children:[z(`button`,{ref:d,type:`button`,className:`composer-chip composer-chip-memory${n?` is-on`:``}`,onClick:()=>u(e=>!e),disabled:e,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":t(`composer.memoryChipAria`,{state:t(n?`composer.private`:s?`composer.memoryUnknown`:`composer.memoryOn`)}),title:t(n?`composer.privateChatNote`:s?`composer.memoryUnknownTitle`:`composer.rememberNote`),children:[L(n?Gi:qi,{size:13,"aria-hidden":`true`}),L(`span`,{className:`composer-chip-label`,dir:`auto`,children:t(n?`composer.private`:s?`composer.memoryUnknown`:`composer.memoryOn`)}),L($r,{size:12,"aria-hidden":`true`})]}),L(pc,{open:l,onClose:f,anchor:d,label:t(`composer.memoryMenu`),children:m.map(({priv:e,Icon:t,label:r,note:i})=>z(`button`,{type:`button`,className:`popover-item`,onClick:()=>p(e),"aria-pressed":n===e,children:[L(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:L(n===e?Yr:t,{size:13})}),z(`span`,{className:`popover-item-body`,children:[L(`span`,{className:`popover-item-title`,children:r}),L(`span`,{className:`popover-item-note`,children:i})]})]},String(e)))})]})}var aK=[{icon:Zr,label:`cards.try.recipe`,prompt:`cards.try.recipePrompt`},{icon:Fi,label:`cards.try.workout`,prompt:`cards.try.workoutPrompt`},{icon:ec,label:`cards.try.howTo`,prompt:`cards.try.howToPrompt`},{icon:Ya,label:`cards.try.checklist`,prompt:`cards.try.checklistPrompt`},{icon:ao,label:`cards.try.trip`,prompt:`cards.try.tripPrompt`},{icon:Xo,label:`cards.try.bill`,prompt:`cards.try.billPrompt`},{icon:Vr,label:`cards.try.loan`,prompt:`cards.try.loanPrompt`}];function oK({onPick:e,disabled:t}){let n=R();return z(`div`,{className:`try-chips`,role:`group`,"aria-label":n(`cards.tryGroup`),children:[L(`span`,{className:`try-chips-label`,"aria-hidden":`true`,children:n(`cards.try`)}),aK.map(({icon:r,label:i,prompt:a})=>{let o=n(i),s=n.bare(a);return z(`button`,{type:`button`,className:`try-chip`,title:s,"aria-label":`${o}: ${s}`,onClick:()=>e(s),disabled:t,children:[L(r,{size:14,"aria-hidden":`true`}),o]},i)})]})}var sK=1e3;function cK(){let[e,t]=(0,B.useState)(null);return(0,B.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(()=>{ke().then(r,i)},sK)):t(null))},i=n=>{e||(F.system.warn(`Warm-up status unavailable`,n),t(null))};return yt().then(r,i),()=>{e=!0,n&&clearTimeout(n)}},[]),e}function lK(e){return e===`gpu`?`your GPU`:e===`npu`?`your NPU`:e===`cpu`?`the CPU`:null}function uK(e){return e<1?`under 1 GB`:`${e.toFixed(1)} GB`}var dK=15e3;function fK(e=new Date,t=mt){let n=e.getHours();return t(`newChat.greeting.${n<5?`evening`:n<12?`morning`:n<18?`afternoon`:`evening`}`)}var pK={gpu:`device.gpu`,npu:`device.npu`,cpu:`device.cpu`};function mK({seconds:e,model:t,device:n},r=mt){if(!t)return r(`newChat.warmup.ready`,{s:e});let i=Uc(t),a=n?pK[n]:void 0;if(a)return r(`newChat.warmup.loadingOn`,{model:i,where:We(a),s:e});let o=lK(n);return o?r(`newChat.warmup.loadingOn`,{model:i,where:o,s:e}):r(`newChat.warmup.loading`,{model:i,s:e})}function hK({detail:e,onRetry:t}){let n=R(),[r,i]=(0,B.useState)(!1);return z(`div`,{className:`new-chat-note`,children:[z(`p`,{children:[n(`newChat.assistantUnavailable`),` `,L(`button`,{type:`button`,className:`link-btn`,onClick:t,children:n(`newChat.tryAgain`)})]}),z(`button`,{type:`button`,className:`new-chat-details`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[L(ri,{size:12,className:r?`is-open`:``,"aria-hidden":`true`}),` `,n(`newChat.details`)]}),r&&L(`pre`,{className:`new-chat-details-text`,children:e})]})}function gK(){let{documents:e,draftDocumentIds:t,addDraftDocuments:n}=N.getState();n(e.filter(e=>e.indexing_status===`complete`&&!t.includes(e.id)).map(e=>e.id))}function _K(){let e=R(),[t,n]=(0,B.useState)(!1),r=N(e=>e.documents),i=N(e=>e.draftDocumentIds),a=N(e=>e.removeDraftDocument),o=N(e=>e.setShowDocLibrary),s=r.filter(e=>i.includes(e.id)),c=r.filter(e=>e.indexing_status===`complete`&&!i.includes(e.id));if(!s.length&&!c.length)return null;let l=c.length,u=s.length-5,d=t||u<=0?s:s.slice(0,5);return z(`div`,{className:`new-chat-docs`,children:[s.length>0&&L(`ul`,{id:`new-chat-doc-list`,className:`new-chat-doc-list${t?` is-expanded`:``}`,"aria-label":e(`newChat.docs.forChat`),children:d.map(t=>z(`li`,{className:`new-chat-doc`,children:[L(sa,{size:12,"aria-hidden":`true`}),L(`span`,{dir:`ltr`,children:V(t.filename)}),L(`button`,{type:`button`,className:`new-chat-doc-remove`,onClick:()=>a(t.id),"aria-label":e(`newChat.docs.dontAttach`,{name:V(t.filename)}),children:L(nc,{size:12,"aria-hidden":`true`})})]},t.id))}),u>0&&L(`button`,{type:`button`,className:`link-btn new-chat-doc-toggle`,"aria-expanded":t,"aria-controls":`new-chat-doc-list`,onClick:()=>n(e=>!e),children:t?e(`newChat.docs.fewer`):e(`newChat.docs.hidden`,{n:u})}),l>0&&z(`p`,{className:`new-chat-note`,children:[s.length?e.plural(`newChat.docs.more`,l):e.plural(`newChat.docs.library`,l),` `,L(`button`,{type:`button`,className:`link-btn`,onClick:gK,children:l===1?e(`newChat.docs.attachIt`):e(`newChat.docs.attachAll`,{n:l})}),l>1&&z(P.Fragment,{children:[` · `,L(`button`,{type:`button`,className:`link-btn`,onClick:()=>o(!0),children:e(`newChat.docs.choose`)})]})]})]})}function vK({error:e}){let t=R(),n=N(e=>e.openSettings);return z(`div`,{className:`new-chat-setup-failed`,role:`alert`,children:[L(`p`,{className:`new-chat-setup-failed-title`,children:t(`newChat.setupFailed.title`)}),L(`p`,{className:`new-chat-setup-failed-error`,children:e}),z(`p`,{children:[t(`newChat.setupFailed.hint`),` `,L(`button`,{type:`button`,className:`link-btn`,onClick:()=>n(`model`),children:t(`newChat.setupFailed.choose`)})]})]})}function yK({onSend:e,initialText:t=``,focusRequest:n=0,agentMissing:r=!1,agentRefused:i=!1}){let a=R(),o=N(e=>tr(e,null)),s=N(e=>QI(e.systemStatus)),c=N(e=>e.systemStatus?.download_progress??null),l=N(e=>e.systemStatus?.model_loaded?null:e.systemStatus?.setup_error??null),u=zc(e=>!!e.active?.remote),[d,p]=GW(kn,t),[m,h]=(0,B.useState)(null),[g,_]=(0,B.useState)(i),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)(null),[S,C]=(0,B.useState)(null),w=(0,B.useRef)(null),T=(0,B.useRef)(null),E=(0,B.useRef)(null),D=xW(),O=cK();Vc();let ee=(0,B.useRef)(!0),te=(0,B.useCallback)((e=!1)=>{e||C(null),it().then(e=>{ee.current&&(x(e),C(e.skills_error??null))}).catch(e=>{F.api.warn(`New-chat start screen unavailable`,e),ee.current&&C(oN(e))})},[]);(0,B.useEffect)(()=>(ee.current=!0,te(),()=>{ee.current=!1}),[te]),(0,B.useEffect)(()=>{fn().then(e=>N.getState().setDocuments(e.documents||[])).catch(e=>F.api.warn(`Document library unavailable; not offering its documents`,e))},[]),(0,B.useEffect)(()=>{if(S)return BW(()=>te(!0),dK)},[S,te]);let ne=(0,B.useRef)(!1),re=(0,B.useRef)([]),k=(0,B.useCallback)(async(t,n=``)=>{if(t){if(ne.current)re.current.push(n||t),p(``);else{ne.current=!0,y(!0),h(null),_(!1),p(``);try{let n=await e(t);D.clear();let r=re.current.splice(0),i=N.getState().currentSessionId;if(r.length>0&&i){let e=(e,t)=>n===!1?[...e,{...f(t,`failed`),error:`The first message was not sent.`}]:Qn(e,t,`queued`);N.getState().updateQueue(i,t=>r.reduce(e,t))}}catch(e){let r=re.current.splice(0);p([n||t,...r].join(`
|
|
206
|
-
|
|
207
|
-
`)),e instanceof ak?_(!0):h(oN(e))}finally{ne.current=!1,y(!1)}}}},[D,e]),ie=(0,B.useCallback)(()=>k(D.compose(on(d.trim(),tr(N.getState(),null))),d.trim()),[D,k,d]);(0,B.useEffect)(()=>{n&&w.current?.focus()},[n]),(0,B.useEffect)(()=>{let e=w.current;t&&e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},[t]);let ae=v,A=(0,B.useRef)(null);(0,B.useLayoutEffect)(()=>{let e=T.current;if(!e)return;typeof e.getAnimations==`function`&&e.getAnimations().forEach(e=>e.cancel());let t=e.getBoundingClientRect().top,n=A.current;if(A.current={top:t,docked:ae},!n||n.docked===ae||wB()||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:CB(`--duration-spring`),easing:r})});let oe=(0,B.useRef)(``),se=(0,B.useCallback)(e=>{let t=oe.current,n=(t&&d.endsWith(t)?d.slice(0,-t.length):d).trimEnd();oe.current=e,p(n?`${n}\n\n${e}`:e),w.current?.focus()},[d,p]),ce=c?.state===`starting`||c?.state===`downloading`,le=v?`sending`:ce?`download`:s||O!==null?`loading`:`idle`,ue=b?.working_folder;return z(`main`,{className:`new-chat${ae?` is-docked`:``}`,"aria-label":a(`newChat.label`),children:[L(vG,{activity:le,progress:(c?.percent??0)/100,pulse:d.length,docked:ae,contentRef:T,composerRef:E}),L(`div`,{className:`new-chat-actions`,children:L(aU,{})}),z(`div`,{className:`new-chat-inner`,ref:T,children:[L(`h1`,{className:`new-chat-greeting`,"aria-hidden":ae,children:fK(new Date,a)}),l&&!u&&L(vK,{error:l}),L(`div`,{ref:E,children:L(wR,{value:d,onChange:p,onSubmit:ie,attachments:D,disabledReason:s?a(`composer.starting`):null,autoFocus:!0,inputRef:w,placeholder:o?a(`composer.researchPlaceholder`):void 0,leftControls:z(P.Fragment,{children:[L(oz,{sessionId:null}),L(iK,{disabled:v}),L(lz,{sessionId:null,disabled:v,compact:!0})]}),rightControls:L(HR,{})})}),L(`div`,{className:`new-chat-meta`,children:ue&&L(ez,{folder:ue,disabled:s||v})}),L(_K,{}),O!==null&&!s&&O.seconds>=2&&L(`p`,{className:`new-chat-warmup`,role:`status`,children:mK(O,a)}),m&&L(`p`,{className:`new-chat-error`,role:`alert`,children:m}),g&&r&&L(`p`,{className:`new-chat-error`,role:`alert`,children:a(`agentNotice.sendRefused`)}),L(oK,{onPick:se,disabled:s||v}),S&&L(hK,{detail:S,onRetry:()=>te()})]})]})}var bK=1e3,xK=15,SK=5,CK=new Map;function wK(){let e=R(),t=xc(e=>e.need),n=xc(e=>e.settle),r=(0,B.useRef)(null),i=(0,B.useRef)(null),a=(0,B.useRef)(0),o=(0,B.useRef)(0),s=(0,B.useRef)(null);s.current=t;let[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)(!1),g=(0,B.useCallback)(()=>{i.current&&clearInterval(i.current),i.current=null},[]);(0,B.useEffect)(()=>(l(null),d(!1),p(null),h(!1),g),[t,g]);let _=(0,B.useCallback)(()=>{g(),u&&t?.model&&S(t.model.id).catch(e=>console.warn(`[ModelNeededDialog] could not cancel the download`,e)),n(!1)},[u,t,n,g]);ut(!!t,_),un(r,!!t);let v=(0,B.useCallback)(async r=>{if(!t?.model)return;let c=t,u=t.model.id,f=(CK.get(u)??0)+1;CK.set(u,f),p(null),d(!0),a.current=0,o.current=0;try{await Ke(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(()=>{oe().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<xK)return;g(),d(!1),p(e(`modelNeeded.failed`))}}).catch(e=>{s.current===c?++o.current<SK||(g(),d(!1),p(e instanceof Error?e.message:String(e))):g()})},bK)):CK.get(u)===f&&S(u).catch(e=>console.warn(`[ModelNeededDialog] could not cancel the download`,e))},[t,n,g,e]);if(t?.off)return(0,hM.createPortal)(L(`div`,{className:`model-needed-overlay`,children:z(`div`,{ref:r,className:`model-needed`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`modelNeeded.off.${t.off}.title`),children:[L(`h2`,{className:`model-needed-title`,children:e(`modelNeeded.off.${t.off}.title`)}),L(`p`,{className:`model-needed-from`,children:e(`modelNeeded.off.${t.off}.body`)}),z(`div`,{className:`model-needed-actions`,children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:_,children:e(`modelNeeded.notNow`)}),L(`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,C=y.size_gb!=null&&x!=null&&y.size_gb>x,w=C||m;return(0,hM.createPortal)(L(`div`,{className:`model-needed-overlay`,children:z(`div`,{ref:r,className:`model-needed`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`modelNeeded.dialog`),children:[L(`h2`,{className:`model-needed-title`,children:e(`modelNeeded.title.${b}`)}),z(`p`,{className:`model-needed-line`,children:[L(`bdi`,{children:y.name}),y.size_gb!=null&&z(P.Fragment,{children:[`, `,L(`bdi`,{dir:`ltr`,children:Ck(y.size_gb)})]}),x!=null&&z(P.Fragment,{children:[` · `,e(`modelNeeded.free`),` `,L(`bdi`,{dir:`ltr`,children:Ck(x)})]})]}),y.source&&z(`p`,{className:`model-needed-from`,children:[e(`setup.contents.from`),` `,L(`bdi`,{dir:`ltr`,children:y.source})]}),L(`p`,{className:`model-needed-from`,children:e(`modelNeeded.waits`)}),u&&(c==null?z(`p`,{role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,e(`modelNeeded.starting`)]}):L(`progress`,{className:`setup-progress`,max:100,value:c,"aria-label":e(`modelNeeded.dialog`)})),C&&!u&&L(`p`,{className:`setup-error`,role:`alert`,children:e(`modelNeeded.lowDisk`,{need:Ck(y.size_gb??0),free:Ck(x??0),freeUp:Ck((y.size_gb??0)-(x??0))})}),f&&L(`p`,{className:`setup-error`,role:`alert`,children:f}),z(`div`,{className:`model-needed-actions`,children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:_,children:e(`modelNeeded.notNow`)}),L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void v(w),disabled:u,children:e(w?`setup.confirm.downloadAnyway`:f?`setup.tryAgain`:`modelNeeded.download`)})]})]})}),document.body)}function TK(e,t,n){let r=(0,B.useRef)(n);(0,B.useEffect)(()=>{r.current=n});let i=(0,B.useRef)(!1),a=(0,B.useRef)(null);if(t&&!i.current){let e=document.activeElement;a.current=e instanceof HTMLElement?e:null}(0,B.useEffect)(()=>{if(!t)return;i.current=!0;let n=a.current,o=e.current;if(o&&!o.contains(document.activeElement)){let e=r.current?.()??Ln(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])}var EK=2e3,DK=``,OK=``,kK={model_server:`logs.source.modelServer`,gaia:`logs.source.gaia`,service:`logs.source.service`,agent:`logs.source.agent`,desktop:`logs.source.desktop`,other:`logs.source.other`},AK={model_server:`logs.hint.modelServer`,gaia:`logs.hint.gaia`,service:`logs.hint.service`,agent:`logs.hint.agent`,desktop:`logs.hint.desktop`,other:`logs.hint.other`},jK={no_file:`logs.reason.noFile`,unreadable:`logs.reason.unreadable`,not_running:`logs.reason.notRunning`,remote:`logs.reason.remote`,no_stream:`logs.reason.noStream`,stream_failed:`logs.reason.streamFailed`},MK=e=>e.severity===`warning`||e.severity===`error`;function NK(e){return e instanceof Error?e.message:String(e)}function PK(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}${t(e.getMonth()+1)}${t(e.getDate())}-${t(e.getHours())}${t(e.getMinutes())}${t(e.getSeconds())}`}function FK({source:e,file:t}){let n=R(),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)([]),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(!0),[d,f]=(0,B.useState)(!0),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),_=(0,B.useRef)(null),v=(0,B.useRef)(!1),y=(0,B.useRef)(null),b=(0,B.useRef)(!0),x=(0,B.useRef)(null),S=(0,B.useCallback)(async n=>{if(!v.current){v.current=!0,n&&u(!0);try{let r=await Ne(e,{file:t,after:n?null:_.current});r.cursor&&(_.current=r.cursor);let a=r.lines??[],s=n||!!r.reset;o(e=>(s?a:[...e,...a]).slice(-5e3)),i(e=>s||!e?r:{...r,server_answering:r.server_answering??e.server_answering,dropped:e.dropped}),c(null)}catch(e){c(NK(e))}finally{v.current=!1,u(!1)}}},[e,t]);(0,B.useEffect)(()=>{_.current=null,b.current=!0,i(null),o([]),g(null),S(!0)},[S]),(0,B.useEffect)(()=>{if(!d)return;let e=setInterval(()=>{S(!1)},EK);return()=>clearInterval(e)},[d,S]);let C=p?a.filter(MK):a,w=C.map(e=>e.text).join(`
|
|
208
|
-
`),T=(0,B.useCallback)(()=>{let e=y.current;e&&b.current&&(e.scrollTop=e.scrollHeight,x.current=e.scrollTop)},[]);(0,B.useEffect)(T,[w,T]);let E=C.length>0;(0,B.useEffect)(()=>{let e=y.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(T);return t.observe(e),e.firstElementChild&&t.observe(e.firstElementChild),()=>t.disconnect()},[E,T]);let D=(0,B.useCallback)(async()=>{try{await navigator.clipboard.writeText(w),g({ok:!0,text:n(`logs.copied`)})}catch(e){g({ok:!1,text:n(`logs.copyFailed`,{error:NK(e)})})}},[n,w]),O=(0,B.useCallback)(()=>{let t=URL.createObjectURL(new Blob([`${w}\n`],{type:`text/plain;charset=utf-8`})),n=document.createElement(`a`);n.href=t,n.download=`gaia-${e.replace(`_`,`-`)}-log-${PK(new Date)}.txt`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),6e4),g(null)},[e,w]),ee=e===`model_server`,te=r&&!r.available&&r.reason?!ee&&r.reason===`no_file`?`logs.reason.notWritten`:jK[r.reason]:void 0;return z(`div`,{className:`log-viewer-view`,children:[L(`p`,{className:`log-viewer-hint`,children:n(AK[e])}),r?.source===`file`&&r.log_path&&z(`p`,{className:`log-viewer-source`,children:[n(`logs.fromFile`),` `,L(`bdi`,{dir:`ltr`,children:r.log_path})]}),r?.source===`stream`&&z(`p`,{className:`log-viewer-source`,children:[n(`logs.fromStream`),` `,L(`bdi`,{dir:`ltr`,children:r.base_url})]}),ee&&r?.source===`file`&&r.server_answering===!1&&L(`p`,{className:`log-viewer-warning`,role:`alert`,children:n(`logs.notAnswering`)}),te&&z(`div`,{className:`log-viewer-warning`,role:`alert`,children:[L(`p`,{children:n(te)}),r?.detail&&L(`p`,{className:`log-viewer-detail`,children:L(`bdi`,{dir:`ltr`,children:r.detail})})]}),r?.available&&r.detail&&L(`p`,{className:`log-viewer-hint`,role:`note`,children:L(`bdi`,{dir:`ltr`,children:r.detail})}),s&&L(`p`,{className:`log-viewer-warning`,role:`alert`,children:n(`logs.readFailed`,{error:s})}),z(`div`,{className:`log-viewer-toolbar`,children:[z(`label`,{className:`log-viewer-check`,children:[L(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),n(`logs.follow`)]}),z(`label`,{className:`log-viewer-check`,children:[L(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),n(`logs.problemsOnly`)]}),z(`div`,{className:`log-viewer-actions`,children:[z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void S(!0),disabled:l,children:[l?L(Za,{size:13,className:`spin`,"aria-hidden":`true`}):L(is,{size:13,"aria-hidden":`true`}),n(`logs.refresh`)]}),z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void D(),disabled:!w,children:[h?.ok?L(Yr,{size:13,"aria-hidden":`true`}):L(Ti,{size:13,"aria-hidden":`true`}),n(`logs.copy`)]}),z(`button`,{type:`button`,className:`btn-secondary`,onClick:O,disabled:!w,children:[L(Zi,{size:13,"aria-hidden":`true`}),n(`logs.save`)]})]})]}),l&&!r?z(`p`,{className:`log-viewer-empty`,role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,n(`logs.loading`)]}):r?.available&&C.length===0?L(`p`,{className:`log-viewer-empty`,role:`status`,children:p&&a.length>0?n(`logs.noProblems`):n(`logs.empty`)}):C.length>0&&L(`pre`,{ref:y,className:`log-viewer-lines`,dir:`ltr`,tabIndex:0,"aria-label":n(kK[e]),onScroll:e=>{let t=e.currentTarget;t.scrollTop!==x.current&&(x.current=null,b.current=t.scrollHeight-t.scrollTop-t.clientHeight<8)},children:L(`span`,{className:`log-viewer-body`,children:C.map((e,t)=>z(`span`,{className:e.severity?`is-${e.severity}`:void 0,children:[e.text,`
|
|
209
|
-
`]},t))})}),(r?.dropped??0)>0&&L(`p`,{className:`log-viewer-hint`,children:n(`logs.older`)}),h&&L(`p`,{className:h.ok?`settings-ok`:`log-viewer-warning`,role:h.ok?`status`:`alert`,children:h.text})]})}function IK(){let e=R(),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null),s=(0,B.useCallback)(async()=>{n(!0),o(null),i(null);try{let e=await or(),t=await ee(e.name),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(n),6e4),i(e)}catch(t){o(e(`logs.saveAllFailed`,{error:NK(t)}))}finally{n(!1)}},[e]);return z(`div`,{className:`log-viewer-save-all`,children:[z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void s(),disabled:t,children:[t?L(Za,{size:13,className:`spin`,"aria-hidden":`true`}):L(_r,{size:13,"aria-hidden":`true`}),e(`logs.saveAll`)]}),L(`span`,{className:`log-viewer-hint`,children:e(`setup.logs.reportNote`)}),r&&z(`p`,{className:`log-viewer-hint`,role:`status`,children:[e(`logs.savedAll`,{size:Dk(r.size_bytes)}),` `,L(`bdi`,{dir:`ltr`,children:r.path})]}),a&&L(`p`,{className:`log-viewer-warning`,role:`alert`,children:a})]})}function LK(){let e=R(),t=hc(e=>e.open),n=hc(e=>e.source),r=hc(e=>e.show),i=hc(e=>e.hide),a=(0,B.useRef)(null),o=(0,B.useRef)(null),[s,c]=(0,B.useState)({}),[l,u]=(0,B.useState)(null);if(ut(t,i),un(a,t),TK(a,t,()=>o.current),(0,B.useEffect)(()=>{t&&sr().then(e=>c(Object.fromEntries(e.sources.map(e=>[e.id,e.files??[]])))).catch(e=>console.warn(`[LogsDialog] could not list log files`,e))},[t]),(0,B.useEffect)(()=>{u(null)},[n]),!t)return null;let d=s[n]??[];return(0,hM.createPortal)(L(`div`,{className:`log-viewer-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&i()},children:z(`div`,{ref:a,className:`log-viewer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`log-viewer-title`,children:[z(`div`,{className:`log-viewer-head`,children:[L(`h2`,{id:`log-viewer-title`,className:`log-viewer-title`,children:e(`logs.title`)}),L(`button`,{ref:o,type:`button`,className:`log-viewer-close`,onClick:i,"aria-label":e(`logs.close`),title:e(`logs.close`),children:L(nc,{size:16,"aria-hidden":`true`})})]}),L(`div`,{className:`log-viewer-tabs`,role:`tablist`,"aria-label":e(`logs.title`),children:mc.map(t=>L(`button`,{type:`button`,role:`tab`,"aria-selected":t===n,className:t===n?`is-active`:``,onClick:()=>r(t),children:t===`gaia`?L(`bdi`,{children:e(kK[t])}):e(kK[t])},t))}),d.length>1&&z(`label`,{className:`log-viewer-file`,children:[e(`logs.file`),L(`select`,{dir:`ltr`,value:l??d[0].name,onChange:e=>u(e.target.value),children:d.map(e=>z(`option`,{value:e.name,children:[e.name,e.size_bytes==null?``:` (${DK}${aR(e.size_bytes)}${OK})`]},e.name))})]}),L(`div`,{role:`tabpanel`,className:`log-viewer-panel`,children:L(FK,{source:n,file:l},`${n}:${l??``}`)}),L(`p`,{className:`log-viewer-hint`,children:e(`logs.privacy`)}),L(IK,{})]})}),document.body)}var RK=[{label:`shortcuts.newChat`,keys:`Mod+Shift+O`},{label:`shortcuts.search`,keys:`Mod+K`},{label:`shortcuts.sidebar`,keys:`Mod+B`},{label:`shortcuts.settings`,keys:`Mod+,`},{label:`shortcuts.sheet`,keys:`Mod+/`},{label:`shortcuts.browserPane`,keys:`Mod+Shift+B`,desktopOnly:!0},{label:`shortcuts.send`,keys:`Enter`},{label:`shortcuts.newLine`,keys:`Shift+Enter`},{label:`shortcuts.editLast`,keys:`↑`},{label:`shortcuts.stop`,keys:`Esc`}];function zK(){let e=!!hH();return RK.filter(t=>e||!t.desktopOnly)}function BK({onClose:e}){let t=R(),n=(0,B.useRef)(null);return ut(!0,e),un(n,!0),TK(n,!0),L(`div`,{ref:n,className:`modal-overlay`,onClick:e,role:`dialog`,"aria-modal":`true`,"aria-label":t(`shortcuts.title`),children:z(`div`,{className:`modal-panel shortcuts-dialog`,onClick:e=>e.stopPropagation(),children:[z(`div`,{className:`modal-header`,children:[L(`h3`,{children:t(`shortcuts.title`)}),L(`button`,{type:`button`,className:`btn-icon`,onClick:e,"aria-label":t(`shortcuts.close`),children:L(nc,{size:18,"aria-hidden":`true`})})]}),L(`dl`,{className:`modal-body shortcuts-list`,children:zK().map(({label:e,keys:n})=>z(`div`,{className:`shortcuts-row`,children:[L(`dt`,{children:t(e)}),L(`dd`,{children:L(`kbd`,{dir:`ltr`,children:vu(n)})})]},e))})]})})}function VK(e){let t=e?.reason;return t===`needs_key`||t===`bad_key`}function HK({provider:e,limit:t,picked:n=null,onPick:r,pickDisabled:i=!1,onDefault:a}){let o=R(),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null),d=(0,B.useRef)(a);if(d.current=a,(0,B.useEffect)(()=>{let t=!0;return c(null),u(null),d.current?.(null),Xt(e).then(e=>{t&&(c(e),d.current?.(e.models[0]?.model??null))}).catch(e=>{t&&u(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e]),l)return L(`p`,{className:`settings-error`,role:`alert`,children:o(`settings.price.loadFailed`,{reason:l})});if(!s)return z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,o(`settings.price.loading`)]});if(s.models.length===0)return z(`p`,{className:`settings-hint cloud-prices-note`,children:[o(`settings.price.unknownSentence`),` `,L(`bdi`,{children:s.note})]});let f=t?s.models.slice(0,t):s.models,p=n?s.models.find(e=>e.model===n&&!f.includes(e)):void 0,m=p?[...f,p]:f,h=n??m[0]?.model,g=r!==void 0;return z(`div`,{className:`cloud-prices`,"aria-label":o(`settings.model.prices`),children:[g&&L(`p`,{className:`cloud-prices-legend`,id:`cloud-prices-legend`,children:o(`settings.price.pickLegend`)}),L(`ul`,{className:`cloud-prices-list${g?` is-pickable`:``}`,role:g?`radiogroup`:void 0,"aria-labelledby":g?`cloud-prices-legend`:void 0,children:m.map((t,n)=>{let a=z(`span`,{className:`cloud-prices-name`,children:[L(`bdi`,{children:t.name}),n===0&&g&&z(`span`,{className:`cloud-prices-default`,children:[` · `,o(`settings.price.default`)]}),t.note&&z(`span`,{className:`cloud-prices-note`,children:[` · `,L(`bdi`,{children:t.note})]})]});return z(`li`,{className:g&&h===t.model?`is-chosen`:void 0,children:[g?z(`label`,{className:`cloud-prices-pick`,children:[L(`input`,{type:`radio`,name:`cloud-model-${e}`,value:t.model,checked:h===t.model,disabled:i,onChange:()=>r(t.model)}),a]}):a,L(`span`,{className:`cloud-prices-price`,children:kR(t.price,o)})]},t.model)})}),z(`span`,{className:`settings-hint`,children:[L(`bdi`,{children:s.source}),`. `,o(`settings.price.payProvider`)]})]})}function UK(){return Ou(SB)}function WK(e,t=150){let n=UK(),[r,i]=(0,B.useState)(e),a=(0,B.useRef)(e);return(0,B.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 GK(e,t){let[n,r]=(0,B.useState)(e);return(0,B.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function KK(){let[e,t]=(0,B.useState)(()=>typeof document>`u`||document.visibilityState!==`hidden`);return(0,B.useEffect)(()=>{let e=()=>t(document.visibilityState!==`hidden`);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}var qK=180;function JK({open:e,children:t}){let[n,r]=(0,B.useState)(e),[i,a]=(0,B.useState)(e),o=(0,B.useRef)(t);return e&&(o.current=t),(0,B.useEffect)(()=>{if(e){r(!0);let e=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(e)}a(!1);let t=setTimeout(()=>r(!1),qK);return()=>clearTimeout(t)},[e]),n?L(`div`,{className:`reveal${i?` is-open`:``}`,"aria-hidden":!e||void 0,children:L(`div`,{className:`reveal-inner`,children:e?t:o.current})}):null}var YK=e=>e?.catalog??[],XK=e=>e.roles.includes(`vision`),ZK=e=>e.roles.includes(`embedding`),QK=e=>e.recipe===`flm`,$K=e=>e.fits===!1&&(e.fit_code===`npu`||e.fit_code===`backend`),eq=e=>e.support===null,tq=e=>e?.feature_tier!==`compact`;function nq(e,t){let n=e.find(e=>e.id===t.defaultChat);return n&&QK(n)||t.vision===`none`?null:t.vision?t.vision:n?.reads_images?n.id:e.find(e=>XK(e)&&e.gaia_model)?.id??null}function rq(e,t){let n=nq(t,e),r=new Set(e.ticked),i=new Set(e.unticked);for(let a of t)XK(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 iq(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),!tq(a))for(let e of t)e.roles.includes(`image_creation`)&&r.delete(e.id);return rq({...e,ticked:r,defaultChat:n,chatChosen:!0,vision:null},t)}function aq(e,t,n){return rq({...e,vision:n},t)}function oq(e,t){if(t.vision===`none`)return null;let n=nq(e,t),r=e.find(e=>e.id===t.defaultChat);return r&&QK(r)||n===(r?.reads_images?r.id:e.find(e=>XK(e)&&e.gaia_model)?.id)?null:n}function sq(e){return e.filter(e=>e.gaia_model&&(e.planned||e.recommended||e.downloaded||e.partial))}function cq(e){let t=new Set(sq(e).map(e=>e.id));return e.filter(e=>e.gaia_model&&!t.has(e.id))}function lq(e){return e.filter(e=>!e.gaia_model&&e.downloaded)}function uq(e){let t=YK(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=>XK(e)&&e.gaia_model&&e.skipped);return rq({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 dq(e,t){return e.filter(e=>e.chat_choice&&(t.has(e.id)||e.downloaded))}function fq(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=dq(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 pq(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 mq(e){let t=YK(e),n=new Set(t.filter(e=>e.recommended||e.gaia_model&&e.downloaded).map(e=>e.id)),r=dq(t,n);return rq({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 hq(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 gq(e,t){let n=hq(YK(e),t).map(e=>e.size_gb),r=n.every(e=>e!=null)?Cq(n.reduce((e,t)=>e+t,0)):null,i=e.disk?.free_gb??null;return{downloadGb:r,freeGb:i,afterGb:r!=null&&i!=null?Cq(i-r):null}}function _q(e,t){let{downloadGb:n,freeGb:r}=gq(e,t);return n==null||r==null||n<=r?null:{needGb:n,freeGb:r,freeUpGb:Cq(n-r),drop:hq(YK(e),t).find(e=>e.size_gb!=null&&n-e.size_gb<=r)??null}}function vq(e,t){return e.filter(e=>e.fits===!1&&(t.ticked.has(e.id)||e.id===t.defaultChat)||e.fits===!0&&!!e.tight&&e.id===t.defaultChat)}function yq(e){return e.length>0&&e.every(e=>e.fits===!0&&!!e.tight)}function bq(e,t){let n=[];for(let r of YK(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 xq(e,t){return YK(e).filter(e=>t.ticked.has(e.id)&&!e.planned&&!e.downloaded).map(e=>e.id)}function Sq(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 Cq(e){return Math.round(e*10)/10}var wq=6;function Tq(e,t){let n=[];return e.chat_choice&&!ZK(e)&&n.push(t(`setup.models.purpose.chat`)),XK(e)&&n.push(t(`setup.models.purpose.vision`)),ZK(e)&&n.push(t(`setup.models.purpose.documents`)),e.roles.includes(`speech`)&&n.push(t(`setup.models.purpose.speech`)),e.roles.includes(`voice`)&&n.push(t(`setup.models.purpose.voice`)),e.roles.includes(`image_creation`)&&n.push(t(`setup.models.purpose.imageCreation`)),n}function Eq(e,t){return ZK(e)?t(`setup.models.line.documents`):XK(e)?t(`setup.models.line.vision`):e.roles.includes(`speech`)?t(`setup.models.line.speech`):e.roles.includes(`voice`)?t(`setup.models.line.voice`):e.roles.includes(`image_creation`)?t(`setup.models.line.imageCreation`):t(`setup.models.line.chat`)}function Dq(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:Ck(e.size_gb)}):t(`setup.models.status.download`,{size:Ck(e.size_gb)})}function Oq(e,t){return e.fits!==!0||e.need_gb==null||e.capacity_gb==null?null:t(`setup.models.fit.ok`,{need:Ek(e.need_gb),have:Ek(e.capacity_gb)})}function kq(e,t){return e.fits===!0&&e.tight?t(`setup.models.warn.tight`):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:Ek(e.need_gb),have:Ek(e.capacity_gb)}):t(`setup.models.warn.tooBigNoNumbers`)}function Aq(e,t,n,r){return!XK(e)&&!ZK(e)||XK(e)&&!e.downloaded&&r?null:n===`settings`?e.downloaded?t(`settings.models.warn.kept`,{name:e.name}):t(XK(e)?`settings.models.warn.vision`:`settings.models.warn.documents`,{name:e.name}):t(XK(e)?`setup.models.warn.vision`:`setup.models.warn.documents`,{name:e.name})}function jq({entry:e,ticked:t,onToggle:n,disabled:r,progress:i,actions:a,place:o,imagesCovered:s}){let c=R(),l=(0,B.useId)(),u=e.fits===!1,d=t?null:Aq(e,c,o,s),f=i?.state===`downloading`&&i.bytes_total>0,p=e.fits===!0&&!!e.tight,m=u?kq(e,c):d??(p?c(`setup.models.warn.tight`):null),h=[`${l}-status`,`${l}-note`,m?`${l}-warn`:null].filter(Boolean).join(` `);return z(`li`,{className:`mc-row${t?` is-ticked`:``}${m?` has-warning`:``}`,children:[z(`div`,{className:`mc-row-top`,children:[z(`label`,{className:`mc-row-main`,children:[L(`input`,{type:`checkbox`,className:`mc-input`,checked:t,disabled:r,onChange:e=>n(e.target.checked),"aria-describedby":h}),L(`span`,{className:`mc-box`,"aria-hidden":`true`,children:L(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,children:L(`path`,{className:`mc-tick`,d:`M3.5 8.5l3 3 6-7`})})}),z(`span`,{className:`mc-text`,children:[z(`span`,{className:`mc-name-line`,children:[L(`bdi`,{className:`mc-name`,title:e.id,children:e.name}),z(`span`,{className:`mc-chips`,children:[Tq(e,c).map(e=>L(`span`,{className:`mc-chip`,children:e},e)),QK(e)&&L(`span`,{className:`mc-chip is-npu`,children:c(`setup.models.npu`)})]})]}),z(`span`,{className:`mc-status`,id:`${l}-status`,children:[f?c(`setup.models.status.downloading`,{done:Dk(i.bytes_done),total:Dk(i.bytes_total)}):Dq(e,c),e.recommended&&L(`span`,{className:`mc-pill`,children:c(`setup.models.recommended`)}),e.fits===null&&z(`span`,{className:`mc-chip is-unknown`,children:[L(pi,{size:11,"aria-hidden":`true`}),` `,c(`setup.models.fitUnknown`)]})]}),L(`span`,{className:`mc-note`,id:`${l}-note`,children:c.compose(t=>[Eq(e,t),Oq(e,t),e.fits===null?t(`setup.models.fit.unknown`):null].filter(Boolean).join(` `))})]})]}),a&&L(`span`,{className:`mc-actions`,children:a})]}),f&&L(`progress`,{className:`mc-mini-progress`,max:i.bytes_total,value:i.bytes_done,"aria-label":c(`setup.progress.rowLabel`,{name:e.name,state:c(`setup.state.downloading`)})}),L(JK,{open:!!m,children:z(`p`,{className:`mc-warn${u?` is-big`:``}`,role:`note`,id:`${l}-warn`,children:[L(Ws,{size:13,"aria-hidden":`true`}),L(`span`,{children:m})]})})]})}function Mq({plan:e,selection:t}){let n=R(),{downloadGb:r,freeGb:i,afterGb:a}=gq(e,t),o=_q(e,t),s=WK(r??0),c=WK(a??0),l=Nq(e.disk?.path??null),u=r!=null&&i?Math.min(1,r/i):0,d=GK(r==null?n(`setup.summary.spokenUnknown`):a==null?n(`setup.summary.spokenNoDisk`,{download:Ck(r)}):n(`setup.summary.spoken`,{download:Ck(r),after:Ck(Math.max(0,a))}),600);return z(`div`,{className:`mc-summary${o?` is-warn`:``}`,role:`group`,"aria-label":n(`setup.summary.label`),children:[z(`div`,{className:`mc-summary-stats`,children:[z(`span`,{className:`mc-stat`,children:[L(`span`,{className:`mc-stat-label`,children:n(`setup.summary.download`)}),L(`bdi`,{className:`mc-stat-value`,children:r==null?n(`setup.summary.sizeUnknown`):Ck(Pq(s))})]}),z(`span`,{className:`mc-stat`,children:[z(`span`,{className:`mc-stat-label`,children:[L(ka,{size:12,"aria-hidden":`true`}),` `,l?z(P.Fragment,{children:[n(`setup.summary.freeOn`),` `,L(`bdi`,{dir:`ltr`,className:`mc-stat-path`,children:l})]}):n(`setup.summary.free`)]}),L(`bdi`,{className:`mc-stat-value`,children:i==null?n(`setup.summary.freeUnknown`):Ck(i)})]}),a!=null&&!o&&z(`span`,{className:`mc-stat`,children:[L(`span`,{className:`mc-stat-label`,children:n(`setup.summary.after`)}),L(`bdi`,{className:`mc-stat-value`,children:Ck(Math.max(0,Pq(c)))})]})]}),i!=null&&L(`div`,{className:`mc-disk`,"aria-hidden":`true`,children:L(`span`,{className:`mc-disk-fill`,style:{inlineSize:`${(u*100).toFixed(1)}%`}})}),L(JK,{open:!!o,children:o&&z(`p`,{className:`mc-disk-warn`,role:`note`,children:[L(Ws,{size:13,"aria-hidden":`true`}),L(`span`,{children:o.drop?n(`setup.summary.shortDrop`,{need:Ck(o.needGb),free:Ck(o.freeGb),drive:l??n(`setup.summary.theDrive`),freeUp:Ck(o.freeUpGb),name:o.drop.name,saves:Ck(o.drop.size_gb??0)}):n(`setup.summary.short`,{need:Ck(o.needGb),free:Ck(o.freeGb),drive:l??n(`setup.summary.theDrive`),freeUp:Ck(o.freeUpGb)})})]})}),L(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:d})]})}function Nq(e){if(!e)return null;let t=/^([A-Za-z]:)[\\/]/.exec(e);return t?t[1]:e}function Pq(e){return Math.round(e*10)/10}function Fq({plan:e,selection:t,onToggle:n,onDefaultChat:r,labelledBy:i,cloud:a,disabled:o,progress:s,rowActions:c,place:l=`setup`}){let u=R(),d=YK(e),[f,p]=(0,B.useState)(``),m=(0,B.useId)(),h=a?d.filter(ZK):sq(d),g=a?[]:cq(d),_=a?[]:lq(d),v=(0,B.useMemo)(()=>{let e=f.trim().toLowerCase();return e?_.filter(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)):_},[_,f]),y=dq(d,t.ticked),b=e=>L(jq,{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,imagesCovered:d.some(n=>n.id!==e.id&&XK(n)&&(t.ticked.has(n.id)||n.downloaded===!0))},e.id);return z(`div`,{className:`mc`,children:[L(`ul`,{className:`mc-list`,role:`group`,"aria-labelledby":i,children:h.map(b)}),a?L(`p`,{className:`setup-hint`,children:u(`setup.models.cloudNote`)}):L(`p`,{className:`mc-foot`,children:u(`setup.models.neverDeletes`)}),g.length>0&&z(`details`,{className:`mc-more`,children:[L(`summary`,{children:u(`setup.models.more`,{n:String(g.length)})}),L(`ul`,{className:`mc-list`,role:`group`,"aria-label":u(`setup.models.moreLabel`),children:g.map(b)})]}),_.length>0&&z(`details`,{className:`mc-more`,children:[L(`summary`,{children:u(`setup.models.installed`,{n:String(_.length)})}),_.length>wq&&L(`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`)}),L(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-label":u(`setup.models.installedLabel`),children:v.map(e=>L(`li`,{className:`mc-row is-installed${t.defaultChat===e.id?` is-ticked`:``}`,children:z(`label`,{className:`mc-row-main`,children:[L(`input`,{type:`radio`,name:`${m}-installed`,className:`mc-radio`,checked:t.defaultChat===e.id,disabled:o,onChange:()=>r(e.id)}),z(`span`,{className:`mc-text`,children:[z(`span`,{className:`mc-name-line`,children:[L(`bdi`,{className:`mc-name`,title:e.id,children:e.name}),z(`span`,{className:`mc-chips`,children:[L(`span`,{className:`mc-chip`,children:u(`setup.models.purpose.chat`)}),QK(e)&&L(`span`,{className:`mc-chip is-npu`,children:u(`setup.models.npu`)})]})]}),z(`span`,{className:`mc-status`,children:[u(`setup.models.status.onPc`),` · `,u(`setup.models.useAsDefault`)]})]})]})},e.id))})]}),!a&&z(`div`,{className:`mc-default`,children:[L(`label`,{htmlFor:m,className:`mc-default-label`,children:u(`setup.models.defaultChat`)}),z(`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&&L(`option`,{value:``,children:u.bare(`setup.models.noChat`)}),y.map(e=>z(`option`,{value:e.id,children:[e.name,QK(e)?` (${u(`setup.models.npu`)})`:``]},e.id))]})]})]})}function Iq(){let e=R();return z(`div`,{className:`mc`,"aria-busy":`true`,children:[z(`p`,{className:`setup-hint`,role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,e(`setup.models.loading`)]}),L(`ul`,{className:`mc-list`,"aria-hidden":`true`,children:[0,1,2].map(e=>L(`li`,{className:`mc-row is-skeleton`,children:L(`span`,{className:`mc-skeleton`})},e))})]})}function Lq({entry:e}){let t=R();return e.support===`verified`?L(`span`,{className:`mc-chip is-verified`,children:t(`setup.label.verified`)}):e.support===`untested`?L(`span`,{className:`mc-chip is-untested`,children:t(`setup.label.untested`)}):null}function Rq({name:e,entry:t,checked:n,recommended:r,disabled:i,onPick:a,children:o}){let s=R();return L(`li`,{className:`mc-row${n?` is-ticked`:``}`,children:z(`label`,{className:`mc-row-main`,children:[L(`input`,{type:`radio`,className:`mc-radio`,name:e,checked:n,disabled:i||$K(t),onChange:a}),z(`span`,{className:`mc-text`,children:[z(`span`,{className:`mc-name-line`,children:[L(`span`,{className:`mc-name`,title:t.id,children:L(`bdi`,{children:t.name})}),z(`span`,{className:`mc-chips`,children:[r&&L(`span`,{className:`mc-pill`,children:s(`setup.models.recommended`)}),L(Lq,{entry:t}),QK(t)&&L(`bdi`,{className:`mc-chip is-npu`,children:s(`setup.models.npu`)})]})]}),L(`span`,{className:`mc-status`,children:Dq(t,s)}),t.fits===!1&&z(`span`,{className:`mc-warn is-big`,role:`note`,children:[L(Ws,{size:13,"aria-hidden":`true`}),` `,kq(t,s)]}),t.fits===!0&&t.tight&&z(`span`,{className:`mc-warn`,role:`note`,children:[L(Ws,{size:13,"aria-hidden":`true`}),` `,s(`setup.models.warn.tight`)]}),o]})]})})}function zq({label:e,note:t,size:n,checked:r,disabled:i,warning:a,chips:o,onChange:s}){return L(`li`,{className:`mc-row${r?` is-ticked`:``}${i?` is-off`:``}`,children:z(`label`,{className:`mc-row-main`,children:[L(`input`,{type:`checkbox`,className:`mc-input`,checked:r,disabled:i,onChange:e=>s(e.target.checked)}),L(`span`,{className:`mc-box`,"aria-hidden":`true`,children:L(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,children:L(`path`,{className:`mc-tick`,d:`M3.5 8.5l3 3 6-7`})})}),z(`span`,{className:`mc-text`,children:[z(`span`,{className:`mc-name-line`,children:[L(`span`,{className:`mc-name`,children:L(`bdi`,{children:e})}),L(`span`,{className:`mc-chips`,children:o})]}),L(`span`,{className:`mc-status`,children:L(`bdi`,{dir:`ltr`,children:n})}),L(`span`,{className:`mc-note`,children:t}),a&&z(`span`,{className:`mc-warn`,role:`note`,children:[L(Ws,{size:13,"aria-hidden":`true`}),` `,a]})]})]})})}function Bq({plan:e,selection:t,onSelection:n,disabled:r}){let i=R(),a=(0,B.useId)(),o=YK(e),[s,c]=(0,B.useState)(!1),l=o.find(e=>e.id===t.defaultChat),u=!!l&&QK(l),d=o.filter(e=>e.chat_choice&&!ZK(e)&&(e.gaia_model||e.downloaded)&&QK(e)===u),f=d.filter(e=>e.support===`verified`),p=d.filter(e=>e.support!==`verified`),m=nq(o,t),h=!!l?.reads_images,g=o.filter(e=>XK(e)&&e.id!==l?.id),_=o.find(ZK),v=e=>o.find(t=>eq(t)&&t.roles.includes(e)),y=e=>e.downloaded?i(`setup.models.status.onPc`):e.size_gb==null?i(`setup.contents.sizeOnDownload`):Ck(e.size_gb),b=(e,r)=>n(fq(t,o,e,r)),x=e=>n(iq(t,o,e)),S=e=>n(aq(t,o,e)),C=v(`speech`),w=v(`voice`),T=v(`image_creation`),E=tq(l),D=l?.support===`untested`;return z(`div`,{className:`mc`,children:[z(`section`,{className:`mc-job`,"aria-labelledby":`${a}-chat`,children:[L(`h3`,{className:`mc-job-title`,id:`${a}-chat`,children:i(`setup.job.chat`)}),L(`p`,{className:`setup-hint`,children:i(`setup.job.verifiedNote`)}),L(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-labelledby":`${a}-chat`,children:f.map(n=>L(Rq,{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&&z(P.Fragment,{children:[L(`p`,{className:`setup-hint`,children:i(`setup.job.untestedNote`)}),L(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-labelledby":`${a}-chat`,children:p.map(e=>L(Rq,{name:`${a}-chat-model`,entry:e,checked:e.id===t.defaultChat,recommended:!1,disabled:r,onPick:()=>x(e.id)},e.id))})]}),D&&z(`p`,{className:`mc-warn`,role:`note`,children:[L(Ws,{size:13,"aria-hidden":`true`}),` `,i(`setup.job.untestedPicked`)]})]}),z(`section`,{className:`mc-job`,"aria-labelledby":`${a}-vision`,children:[L(`h3`,{className:`mc-job-title`,id:`${a}-vision`,children:i(`setup.job.vision`)}),u?L(`p`,{className:`setup-hint`,role:`note`,children:i(`setup.job.visionOffNpu`,{name:l?.name??``})}):h?z(`div`,{className:`setup-card`,children:[z(`p`,{className:`mc-job-line`,children:[L(`bdi`,{children:i(`setup.job.visionBuiltIn`,{name:l?.name??``})}),L(`span`,{className:`setup-ok`,children:i(`setup.job.nothingMore`)})]}),L(`button`,{type:`button`,className:`link-btn`,"aria-expanded":s,onClick:()=>c(e=>!e),children:i(s?`setup.job.hideVision`:`setup.job.otherVision`)})]}):L(`p`,{className:`setup-hint`,children:i(`setup.job.visionNeeded`,{name:l?.name??``})}),!u&&(!h||s)&&z(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-labelledby":`${a}-vision`,children:[g.map(e=>L(Rq,{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)),L(`li`,{className:`mc-row${m===null?` is-ticked`:``}`,children:z(`label`,{className:`mc-row-main`,children:[L(`input`,{type:`radio`,className:`mc-radio`,name:`${a}-vision-model`,checked:h?m===l?.id:m===null,disabled:r,onChange:()=>S(h?null:`none`)}),z(`span`,{className:`mc-text`,children:[L(`span`,{className:`mc-name`,children:i(h?`setup.job.useChatForVision`:`setup.job.skipVision`)}),m===null&&!h&&z(`span`,{className:`mc-warn`,role:`note`,children:[L(Ws,{size:13,"aria-hidden":`true`}),` `,i(`setup.job.skipVisionNote`)]})]})]})})]})]}),_&&z(`section`,{className:`mc-job`,"aria-labelledby":`${a}-docs`,children:[L(`h3`,{className:`mc-job-title`,id:`${a}-docs`,children:i(`setup.job.documents`)}),L(`ul`,{className:`mc-list`,children:L(zq,{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:z(P.Fragment,{children:[L(`span`,{className:`mc-pill`,children:i(`setup.models.recommended`)}),L(Lq,{entry:_})]}),onChange:e=>b(_.id,e)})})]}),z(`section`,{className:`mc-job`,"aria-labelledby":`${a}-extras`,children:[L(`h3`,{className:`mc-job-title`,id:`${a}-extras`,children:i(`setup.job.extras`)}),L(`p`,{className:`setup-hint`,children:i(`setup.job.extrasNote`)}),z(`ul`,{className:`mc-list`,children:[C&&L(zq,{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&&L(zq,{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)}),T&&L(zq,{label:i(`setup.job.images`),note:i(`setup.job.imagesNote`),size:y(T),checked:t.ticked.has(T.id),disabled:r||!E,warning:E?null:i(`setup.job.imagesBlocked`,{name:l?.name??``}),onChange:e=>b(T.id,e)})]})]}),L(Vq,{plan:e,selection:t})]})}function Vq({plan:e,selection:t}){let n=R(),r=YK(e),i=e=>r.find(t=>t.id===e)?.name??e??n(`setup.get.off`),a=e=>r.find(n=>eq(n)&&n.roles.includes(e)&&t.ticked.has(n.id)),o=r.find(e=>ZK(e)&&t.ticked.has(e.id)),s=r.find(e=>e.id===t.defaultChat),c=nq(r,t),l=[a(`speech`)&&n(`setup.job.speech`),a(`voice`)&&n(`setup.job.voice`)].filter(Boolean).join(`, `);return z(`section`,{className:`setup-card`,"aria-label":n(`setup.get.title`),children:[L(`h3`,{className:`mc-job-title`,children:n(`setup.get.title`)}),z(`dl`,{className:`setup-summary-list`,children:[z(`div`,{children:[L(`dt`,{children:n(`setup.job.chat`)}),L(`dd`,{children:L(`bdi`,{children:i(t.defaultChat)})})]}),z(`div`,{children:[L(`dt`,{children:n(`setup.job.vision`)}),L(`dd`,{children:L(`bdi`,{children:s&&QK(s)?n(`setup.get.offNpu`):c?i(c):n(`setup.get.off`)})})]}),z(`div`,{children:[L(`dt`,{children:n(`setup.job.documents`)}),L(`dd`,{children:L(`bdi`,{children:o?o.name:n(`setup.get.off`)})})]}),z(`div`,{children:[L(`dt`,{children:n(`setup.get.voice`)}),L(`dd`,{children:l||n(`setup.get.off`)})]}),z(`div`,{children:[L(`dt`,{children:n(`setup.job.images`)}),L(`dd`,{children:tq(s)?a(`image_creation`)?n(`setup.get.on`):n(`setup.get.off`):n(`setup.get.notAvailable`)})]})]})]})}var Hq=(0,B.createContext)(void 0),Uq=Hq.Provider;function Wq({children:e}){let t=(0,B.useContext)(Hq);return t===void 0?L(`div`,{className:`setup-row setup-nav`,children:e}):t===null?null:(0,hM.createPortal)(L(`div`,{className:`setup-footer-row`,children:e}),t)}function Gq({title:e,children:t,confirmLabel:n,cancelLabel:r,onConfirm:i,onCancel:a,danger:o,busy:s}){let c=(0,B.useRef)(null),l=(0,B.useRef)(null),u=(0,B.useId)(),d=(0,B.useId)();return un(c,!0),(0,B.useEffect)(()=>{let e=document.activeElement;return l.current?.focus(),()=>e?.focus?.()},[]),ut(!0,a,!s),(0,hM.createPortal)(L(`div`,{className:`confirm-overlay`,children:z(`div`,{ref:c,className:`confirm-sheet`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":u,"aria-describedby":t?d:void 0,children:[L(`h2`,{id:u,className:`confirm-title`,children:e}),t&&L(`div`,{id:d,className:`confirm-body`,children:t}),z(`div`,{className:`confirm-actions`,children:[L(`button`,{ref:l,type:`button`,className:`btn-secondary`,onClick:a,disabled:s,children:r}),L(`button`,{type:`button`,className:o?`btn-danger`:`btn-primary`,onClick:i,disabled:s,children:n})]})]})}),document.body)}function Kq(e){return e===`windows`?`Windows`:e===`linux`?`Linux`:e}function qq(e){let t=/^Run:\s*(.+)$/.exec(e)??/^(sudo .+)$/.exec(e);return t?t[1].trim():null}function Jq(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 Yq(e,t,n=!1){return t==null?e(n?`gpu.appliedAny`:`gpu.pending.restartAny`):e(n?`gpu.applied`:`gpu.pending.restart`,{gb:Ck(t)})}function Xq(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 Zq(e){return e instanceof Error?e.message:String(e)}function Qq({status:e,targetGpuGb:t}){let n=R(),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=>Ck(e/10),u=e=>i>0?Math.min(100,e/i*100):0,d=e.pending?.state===`took_effect`;return z(`div`,{className:`gpu-split`,children:[z(`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:[L(`span`,{className:`gpu-seg is-gpu`,style:{inlineSize:`${u(a)}%`}}),L(`span`,{className:`gpu-seg is-target`,style:{inlineSize:`${u(s)}%`}}),L(`span`,{className:`gpu-seg is-cpu`}),o!=null&&L(`span`,{className:`gpu-marker`,style:{insetInlineStart:`${u(o)}%`}})]}),z(`div`,{className:`gpu-legend`,"aria-hidden":`true`,children:[L(`span`,{className:`gpu-key is-gpu`,children:L(`bdi`,{children:n(`gpu.split.gpu`,{gb:l(a)})})}),o!=null&&L(`span`,{className:`gpu-key is-target`,children:L(`bdi`,{children:n(`gpu.split.added`,{gb:l(s)})})}),L(`span`,{className:`gpu-key is-cpu`,children:L(`bdi`,{children:n(`gpu.split.cpu`,{gb:l(c)})})})]})]})}function $q({presets:e,value:t,onChange:n,recommended:r,max:i,keepGb:a,disabled:o}){let s=R();return z(MB,{className:`gpu-presets`,"aria-label":s(`gpu.presets.label`),children:[a!=null&&L(`button`,{type:`button`,role:`radio`,"aria-checked":t===null,className:`gpu-preset${t===null?` is-active`:``}`,disabled:o,onClick:()=>n(null),children:L(`bdi`,{children:s(`gpu.presets.keep`,{gb:Ck(a)})})}),e.map(e=>z(`button`,{type:`button`,role:`radio`,"aria-checked":e.setting_gb===t,className:`gpu-preset${e.setting_gb===t?` is-active`:``}`,disabled:o,onClick:()=>n(e.setting_gb),children:[L(`bdi`,{children:s(`gpu.presets.gpu`,{gb:Ck(e.gpu_gb)})}),e.setting_gb===r&&z(P.Fragment,{children:[` `,L(`span`,{className:`gpu-tag is-recommended`,children:s(`gpu.presets.recommended`)})]}),e.setting_gb===i&&z(P.Fragment,{children:[` `,L(`span`,{className:`gpu-tag is-max`,children:s(`gpu.presets.max`)})]})]},e.setting_gb))]})}function eJ({status:e,onStatus:t,mode:n,names:r,onSkip:i,onContinue:o,onBack:s,headingId:c,cloud:l=!1}){let u=R(),f=zc(e=>!!e.active?.remote)||l,p=(0,B.useCallback)(()=>{let e=c?document.getElementById(c):null;e&&Xq(e)},[c]);(0,B.useEffect)(()=>{n===`setup`&&p()},[n,p]);let m=(0,B.useId)(),h=e.presets??[],g=f?null:e.recommended_setting_gb??null,[_,v]=(0,B.useState)(g??(e.gpu_gb==null?h[0]?.setting_gb??null:null)),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(null),[C,w]=(0,B.useState)(void 0),[T,E]=(0,B.useState)(null),[D,O]=(0,B.useState)(null),[ee,te]=(0,B.useState)(null),[ne,re]=(0,B.useState)(null),k=h.find(e=>e.setting_gb===_)??null,ie=h.length>0&&h[h.length-1].setting_gb===e.setting?.max_gb?h[h.length-1].setting_gb:null,ae=k&&e.total_gb!=null?Math.max(0,e.total_gb-k.gpu_gb):null,A=g==null&&!f?(e.models??[]).find(e=>e.default&&e.fits_now):void 0,oe=(k?.unlocks??[]).slice(0,2).map(e=>r[e]??e),se=e.pending??null,ce=e.method===`apply`,le=e.guided_value!==null,ue=(0,B.useCallback)(async()=>{b(!0),S(null),O(`steps`),te(null);try{let e=await Xe(_??void 0);w(e.guided_value),S(e.guided_value===null?[]:e.guided_steps??[])}catch(e){w(void 0),S([]),te({kind:`error`,message:Zq(e)})}finally{O(null)}},[_]),de=async()=>{if(_!=null){E(null),O(`apply`),te(null);try{t(await we(_)),te({kind:`applied`})}catch(e){let t=e instanceof Vn&&e.httpStatus===403;te(t?{kind:`denied`}:{kind:`error`,message:Zq(e)}),t&&p()}finally{O(null)}}},fe=async()=>{E(null),O(`revert`),te(null);try{t(await a()),te({kind:`applied`})}catch(e){te(e instanceof Vn&&e.httpStatus===403?{kind:`denied`}:{kind:`error`,message:Zq(e)})}finally{O(null)}},pe=async()=>{if(_!=null){O(`done`),te(null);try{t(await ct(_)),b(!1)}catch(e){te({kind:`error`,message:Zq(e)})}finally{O(null)}}},me=async()=>{O(`keep`),te(null);try{t(await d())}catch(e){te({kind:`error`,message:Zq(e)})}finally{O(null)}},j=async e=>{try{await navigator.clipboard.writeText(e),re(e)}catch(e){te({kind:`error`,message:u(`gpu.copyFailed`,{reason:Zq(e)})})}},he=se?.state===`restart_required`;return z(`div`,{className:`gpu`,children:[L(`p`,{className:`setup-hint`,children:u(`gpu.body`,{total:Ck(e.total_gb??0),gpu:Ck(e.gpu_gb??0)})}),L(Qq,{status:e,targetGpuGb:!he&&!y?k?.gpu_gb??null:null}),se?.state===`took_effect`&&z(`div`,{className:`gpu-notice is-ok`,role:`status`,children:[L(Yr,{size:14,"aria-hidden":`true`}),L(`span`,{children:u(`gpu.pending.tookEffect`,{gb:Ck(e.gpu_gb??0)})}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void me(),disabled:D!==null,children:u(`gpu.ok`)})]}),he&&z(`div`,{className:`gpu-notice`,role:`status`,children:[L(Na,{size:14,"aria-hidden":`true`}),L(`span`,{children:u.compose(t=>[Yq(t,Jq(e,se.setting_gb),ee?.kind===`applied`),t(`gpu.pending.restartHow`),n===`setup`?t(`gpu.pending.downloadsFirst`):null].filter(Boolean).join(` `))}),se.source===`guided`&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void me(),disabled:D!==null,children:u(`gpu.keep`,{gb:Ck(e.gpu_gb??0)})})]}),se?.state===`not_applied`&&z(`div`,{className:`gpu-notice is-warn`,role:`status`,children:[L(Ws,{size:14,"aria-hidden":`true`}),L(`span`,{children:u(`gpu.pending.notApplied`,{gb:Ck(e.gpu_gb??0)})}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void me(),disabled:D!==null,children:u(`gpu.keep`,{gb:Ck(e.gpu_gb??0)})})]}),!he&&!y&&h.length>0&&z(P.Fragment,{children:[A&&z(`p`,{className:`gpu-unlock is-keep`,children:[L(Yr,{size:13,"aria-hidden":`true`}),` `,u(`gpu.keepRecommended`,{model:r[A.id]??A.id})]}),L($q,{presets:h,value:_,onChange:v,recommended:g,max:ie,keepGb:e.gpu_gb??null,disabled:D!==null}),k&&L(`p`,{className:`gpu-unlock`,children:oe.length>0?u(oe.length>1?`gpu.unlock.two`:`gpu.unlock.one`,{gb:Ck(k.gpu_gb),a:oe[0],b:oe[1]??``}):u(`gpu.unlock.none`,{gb:Ck(k.gpu_gb)})}),k&&k.setting_gb===ie&&ae!=null&&z(`p`,{className:`gpu-unlock is-warn`,role:`note`,children:[L(Ws,{size:13,"aria-hidden":`true`}),` `,u(`gpu.maxWarn`,{cpu:Ck(ae),os:Kq(e.os)})]}),L(`p`,{className:`setup-hint`,children:u.compose(t=>`${t(`gpu.reserve`,{gb:Ck(e.reserve_gb??16),os:Kq(e.os)})} ${t(`gpu.needs`)}`)}),!ce&&e.method_reason&&L(`p`,{className:`setup-hint`,children:L(`bdi`,{dir:`ltr`,children:e.method_reason})})]}),!he&&!y&&h.length===0&&L(`p`,{className:`setup-hint`,children:u(`gpu.noPresets`)}),y&&z(`div`,{className:`gpu-guided`,children:[k&&L(`p`,{className:`setup-hint`,id:m,children:u(`gpu.guided.lede`,{gb:Ck(k.gpu_gb)})}),x===null?z(`p`,{className:`setup-hint`,role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,u(`gpu.guided.loading`)]}):C===null?L(`p`,{className:`setup-hint`,children:u(`gpu.noPresets`)}):L(`ol`,{className:`gpu-steps`,"aria-labelledby":m,children:x.map(e=>{let t=qq(e);return z(`li`,{children:[L(`span`,{children:e}),t&&z(`button`,{type:`button`,className:`btn-secondary gpu-copy`,onClick:()=>void j(t),"aria-label":u(`gpu.copyAria`,{what:t}),children:[L(ne===t?Yr:Ti,{size:12,"aria-hidden":`true`}),u(ne===t?`gpu.copied`:`gpu.copy`)]})]},e)})}),z(Wq,{children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>b(!1),disabled:D!==null,children:u(`gpu.guided.back`)}),!ce&&C!==null&&z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void pe(),disabled:D!==null||_==null,children:[D===`done`&&L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,u(`gpu.guided.done`)]})]})]}),D===`apply`||D===`revert`?z(`p`,{className:`setup-hint`,role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,u(`gpu.waiting`)]}):null,ee?.kind===`denied`&&z(`div`,{className:`gpu-notice is-warn`,role:`alert`,children:[L(Ws,{size:14,"aria-hidden":`true`}),L(`span`,{children:u(`gpu.denied`)})]}),ee?.kind===`error`&&L(`p`,{className:`setup-error`,role:`alert`,children:ee.message}),!y&&(()=>{let t=!he&&ce&&h.length>0&&L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>E(`apply`),disabled:D!==null||_==null,children:ee?.kind===`denied`||se?.state===`not_applied`?u(`gpu.tryAgain`):u(`gpu.apply`)}),r=!he&&h.length>0&&le&&L(`button`,{type:`button`,className:ce?`btn-secondary`:`btn-primary`,onClick:()=>void ue(),disabled:D!==null||_==null,children:u(`gpu.showMe`)});return n===`setup`?z(Wq,{children:[s&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:s,children:u(`setup.back`)}),he?o&&L(`button`,{type:`button`,className:`btn-primary`,onClick:o,autoFocus:!0,children:u(`setup.continue`)}):_==null&&h.length>0?(i??o)&&L(`button`,{type:`button`,className:`btn-primary`,onClick:i??o,disabled:D!==null,children:u(`gpu.keepAsIs`)}):z(P.Fragment,{children:[i&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:i,disabled:D!==null,children:u(`gpu.skip`)}),ce?z(P.Fragment,{children:[r,t]}):r]})]}):z(`div`,{className:`setup-row gpu-actions`,children:[t,r,e.revert?.available&&z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>E(`revert`),disabled:D!==null,children:[L(ns,{size:13,"aria-hidden":`true`}),` `,u(`gpu.undo`)]})]})})(),T===`apply`&&_!=null&&z(Gq,{title:k?u(`gpu.consent.title`,{gb:Ck(k.gpu_gb)}):u(`gpu.consent.titleAny`),confirmLabel:u(`setup.continue`),cancelLabel:u(`setup.cancel`),onConfirm:()=>void de(),onCancel:()=>E(null),children:[L(`p`,{children:k?u(`gpu.consent.body`,{name:e.setting?.name??``,gb:Ck(k.gpu_gb)}):u(`gpu.consent.bodyAny`,{name:e.setting?.name??``})}),L(`p`,{className:`confirm-note`,children:u(`gpu.consent.saved`,{gb:Ck(e.gpu_gb??0)})})]}),T===`revert`&&L(Gq,{title:u(`gpu.revert.title`),confirmLabel:u(`setup.continue`),cancelLabel:u(`setup.cancel`),onConfirm:()=>void fe(),onCancel:()=>E(null),children:L(`p`,{children:u(`gpu.revert.body`)})})]})}function tJ({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=R(),m=(0,B.useRef)(null),[h,g]=(0,B.useState)(!1),_=!!e&&!!i&&!!e.catalog,v=(0,B.useRef)(null);if(_&&v.current===null&&(v.current=!o&&hq(YK(e),i).length===0&&!!i.defaultChat&&YK(e).some(e=>e.downloaded)),(0,B.useEffect)(()=>{_&&m.current?.querySelector(`input:not([disabled])`)?.focus()},[_,h]),t&&!_)return z(`div`,{className:`setup-models-error`,children:[L(`p`,{className:`setup-error`,role:`alert`,children:p(`setup.models.listFailed`,{reason:t})}),z(`div`,{className:`setup-row`,children:[L(`button`,{type:`button`,className:`btn-primary`,onClick:n,children:p(`setup.tryAgain`)}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:r,children:p(`setup.models.useRecommended`)})]}),L(`p`,{className:`setup-hint`,children:p(`setup.models.useRecommendedNote`)})]});if(!_)return L(Iq,{});let y=YK(e),b=hq(y,i),x=!o&&!i.defaultChat,S=_q(e,i),C=o?[]:y.filter(e=>e.fits===!1&&i.ticked.has(e.id)),w=!h&&!!v.current&&b.length===0,T=p(S?`setup.continueAnyway`:`setup.continue`);return w?z(`div`,{className:`setup-present`,role:`status`,children:[z(`p`,{children:[L(Yr,{size:14,"aria-hidden":`true`}),` `,p(`setup.models.allPresent`)]}),L(`button`,{type:`button`,className:`link-btn`,onClick:()=>g(!0),children:p(`setup.models.change`)}),z(Wq,{children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:l,disabled:d,children:p(`setup.back`)}),z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>u(!1),disabled:d,children:[d&&L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,p(`setup.finish`)]})]}),f&&L(`p`,{className:`setup-error`,role:`alert`,children:f})]}):z(`div`,{className:`setup-models`,ref:m,children:[L(`p`,{className:`setup-hint`,children:p(`setup.job.lede`)}),L(Bq,{plan:e,selection:i,onSelection:a,disabled:d}),!o&&L(`button`,{type:`button`,className:`link-btn setup-reset`,onClick:()=>a(mq(e)),disabled:d,children:p(`setup.models.resetRecommended`)}),z(`div`,{className:`setup-models-footer`,children:[L(Mq,{plan:e,selection:i}),z(`label`,{className:`setup-keep-trying`,children:[L(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),disabled:d}),L(`span`,{children:p(`setup.keepTrying`)})]}),L(JK,{open:x,children:L(`p`,{className:`setup-error`,id:`setup-no-chat`,children:p(`setup.models.noChatReason`)})}),C.length>0&&L(`span`,{className:`visually-hidden`,children:C.map(e=>kq(e,p)).join(` `)}),f&&L(`p`,{className:`setup-error`,role:`alert`,children:f}),z(Wq,{children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:l,disabled:d,children:p(`setup.back`)}),z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>u(!!S),disabled:d||x,"aria-describedby":x?`setup-no-chat`:void 0,children:[d&&L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,T]})]})]})]})}function nJ({plan:e,chatModel:t,gpu:n}){let r=R();if(!e?.catalog)return null;let i=e.catalog,a=e=>e?i.find(t=>t.id===e)?.name??e:null,o=nq(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=>XK(e)&&e.gaia_model),c=i.find(e=>ZK(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 z(`dl`,{className:`setup-summary-list`,children:[t&&z(`div`,{children:[L(`dt`,{children:r(`setup.ready.chat`)}),z(`dd`,{children:[L(`bdi`,{children:a(t)}),d?.recipe===`flm`?` (${r(`setup.models.npu`)})`:``]})]}),z(`div`,{children:[L(`dt`,{children:r(`setup.ready.vision`)}),L(`dd`,{children:s?.downloaded?L(`bdi`,{children:s.name}):r(`setup.ready.visionOff`,{name:s?.name??`Gemma-4-E4B-it`})})]}),c&&z(`div`,{children:[L(`dt`,{children:r(`setup.ready.documents`)}),L(`dd`,{children:L(`bdi`,{children:c.name})})]}),l.length>0&&z(`div`,{children:[L(`dt`,{children:r(`setup.ready.notInstalled`)}),L(`dd`,{children:l.map(e=>e.name).join(`, `)})]}),u?.state===`restart_required`&&z(`div`,{className:`is-warn`,children:[L(`dt`,{children:r(`setup.ready.gpu`)}),z(`dd`,{children:[L(Ws,{size:13,"aria-hidden":`true`}),` `,Yq(r,n?Jq(n,u.setting_gb):null)]})]}),u?.state===`took_effect`&&z(`div`,{children:[L(`dt`,{children:r(`setup.ready.gpu`)}),L(`dd`,{children:n?.gpu_gb==null?r(`setup.ready.gpuChanged`):r(`setup.ready.gpuNow`,{gb:Ck(n.gpu_gb)})})]})]})}function rJ(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 iJ(e,t,n,r){let i=`${n}.one`,a=`${n}.other`,o=fe(i)&&fe(a)&&typeof r?.n==`number`?r.n===1?i:a:n;return!fe(o)||Be[o].includes(`{`)&&!r?t:mt(o,r)===t?e(o,r):t}function aJ(e,t){return{title:iJ(t,e.title,`card.${e.skill}.title`),note:iJ(t,e.note,`card.${e.skill}.note`,rJ(e))}}function oJ({text:e}){let t=b(e);return t.length===1?L(P.Fragment,{children:e}):L(P.Fragment,{children:t.map((e,t)=>L(`span`,{className:`start-card-part`,children:e},t))})}function sJ({cards:e,onPick:t,disabled:n}){let r=R();return e.length===0?null:L(`ul`,{className:`start-cards`,"aria-label":r(`newChat.cardsLabel`),children:e.map(e=>{let{title:i,note:a}=aJ(e,r);return L(`li`,{children:z(`button`,{type:`button`,className:`start-card`,onClick:()=>t(e),disabled:n,title:e.needs_input?`${e.prompt}…`:e.prompt,children:[z(`span`,{className:`start-card-title`,children:[i,L(Tr,{size:13,"aria-hidden":`true`})]}),L(`span`,{className:`start-card-note`,children:L(oJ,{text:a})})]})},e.skill)})})}function cJ(){let[e,t]=(0,B.useState)(null),[n,r]=(0,B.useState)([]),i=(0,B.useCallback)(()=>{Promise.resolve(gt()).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,B.useEffect)(i,[i]),{network:e,providers:n,recheck:i}}function lJ(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 uJ(e,t){return e==null?t(`setup.contents.sizeOnDownload`):Ck(e)}function dJ({state:e}){return e===`done`?L(Yr,{size:13,"aria-hidden":`true`}):e===`active`?L(Za,{size:13,className:`spin`,"aria-hidden":`true`}):L(e===`failed`?nc:_i,{size:13,"aria-hidden":`true`})}function fJ({id:e,error:t,transient:n,onRetry:r,disabled:i}){let a=R(),o=a(`setup.component.${e}`);return z(`div`,{className:`setup-content-failure`,role:`alert`,children:[L(`p`,{children:a(n?`setup.contents.failedNetwork`:`setup.contents.failedOther`,{name:o})}),t&&z(`details`,{className:`dl-details`,children:[L(`summary`,{children:a(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:t})]}),r&&L(`button`,{type:`button`,className:`btn-primary`,onClick:r,disabled:i,"aria-label":a(`setup.contents.retryNamed`,{name:o}),children:a(`setup.progress.retry`)})]})}function pJ({plan:e,run:t,models:n=[],onRetry:r,retryDisabled:i}){let a=R();return z(`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 z(`li`,{className:`setup-content is-${s??(e.installed?`done`:`waiting`)}`,children:[L(`span`,{className:`setup-content-icon`,children:L(dJ,{state:s??(e.installed?`done`:void 0)})}),z(`span`,{className:`setup-content-main`,children:[L(`span`,{className:`setup-content-name`,children:a(`setup.component.${e.id}`)}),L(`span`,{className:`setup-content-note`,children:a(`setup.component.${e.id}Note`)}),e.bundled?L(`span`,{className:`setup-content-from`,children:a(`setup.contents.bundled`)}):z(`span`,{className:`setup-content-from`,children:[a(`setup.contents.from`),` `,L(`bdi`,{dir:`ltr`,children:e.source})]})]}),z(`span`,{className:`setup-content-side`,children:[L(`bdi`,{dir:`ltr`,children:uJ(e.size_gb,a)}),L(`span`,{children:lJ(e,s,a)})]}),s===`failed`&&o&&!t?.problem&&L(fJ,{id:e.id,error:t?.error,transient:t?.component_kinds?.[e.id]===`transient`,onRetry:r,disabled:i})]},e.id)}),n.map(e=>z(`li`,{className:`setup-content is-waiting`,children:[L(`span`,{className:`setup-content-icon`,children:L(dJ,{state:void 0})}),z(`span`,{className:`setup-content-main`,children:[L(`span`,{className:`setup-content-name`,children:L(`bdi`,{children:e.name})}),L(`span`,{className:`setup-content-note`,children:e.roles.map(e=>a(`setup.purpose.${e}`)).join(` · `)}),e.source&&z(`span`,{className:`setup-content-from`,children:[a(`setup.contents.from`),` `,L(`bdi`,{dir:`ltr`,children:e.source})]})]}),L(`span`,{className:`setup-content-side`,children:L(`bdi`,{dir:`ltr`,children:uJ(e.size_gb,a)})})]},e.id))]})}function mJ({lines:e,className:t,id:n}){let r=(0,B.useRef)(null),i=(0,B.useRef)(!0),a=e.join(`
|
|
210
|
-
`);return(0,B.useEffect)(()=>{let e=r.current;e&&i.current&&(e.scrollTop=e.scrollHeight)},[a]),L(`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 hJ=1e9,gJ={downloading:0,verifying:1,failed:2,ready:3,unchecked:3,cancelled:4,queued:5,skipped:6};function _J(e){return e.roles.includes(`embedding`)?0:e.roles.includes(`chat`)?1:2}function vJ(e){return[...e].filter(e=>e.state!==`skipped`).sort((e,t)=>gJ[e.state]-gJ[t.state]||_J(e)-_J(t))}var yJ=/^\s*(Downloading:|Downloaded\b|\[[=\-\s>#]*\])/;function bJ(e){return e.some(e=>e.trim()&&!yJ.test(e))}var xJ={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 SJ(e){return e?e.state===`running`||e.state===`verifying`||!!e.models?.some(e=>e.state===`downloading`||e.state===`queued`||e.state===`verifying`):!1}function CJ(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:Dk(e.bytes_done),need:Ck(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 wJ({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=R(),m=(0,B.useId)(),h=(0,B.useId)(),[g,_]=(0,B.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(xJ[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=kk(p.locale,e.bytes_total>0?`${Dk(e.bytes_done)} / ${Dk(e.bytes_total)}`:Dk(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} · ${kk(p.locale,Ok(e))} · ${Ak(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?Dk(e.bytes_total):``:e.state===`unchecked`?p(`setup.progress.unchecked`):e.state===`cancelled`?e.bytes_done>0?p(`setup.progress.keptPartial`,{done:Dk(e.bytes_done)}):``:e.state===`queued`&&e.bytes_total?Dk(e.bytes_total):``;let T=e.state===`downloading`?p.compose(t=>[t(`setup.progress.percent`,{n:String(Math.floor(y))}),e.bytes_total?t(`setup.progress.of`,{done:Dk(e.bytes_done),total:Dk(e.bytes_total)}):null,n?.eta==null?null:jk(n.eta,t)].filter(Boolean).join(`, `)):b;return z(`li`,{className:`dl-row is-${e.state}${C?` is-live`:``}${S>=15?` is-stalled`:``}`,children:[z(`div`,{className:`dl-row-head`,children:[L(`span`,{className:`dl-icon`,"aria-hidden":`true`,children:e.state===`ready`||e.state===`unchecked`?L(Yr,{size:14}):e.state===`failed`?L(di,{size:14}):e.state===`cancelled`?L(Mo,{size:13}):L(`span`,{className:`dl-dot`})}),L(`span`,{className:`dl-name`,children:L(`bdi`,{title:e.id,children:t})}),L(`span`,{className:`dl-state`,children:b}),e.state===`downloading`&&z(`bdi`,{className:`dl-pct`,children:[Math.floor(y),`%`]}),e.state!==`failed`&&bJ(v)&&L(`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:L(ri,{size:14,className:g?`is-open`:``,"aria-hidden":`true`})})]}),L(`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":T,children:L(`span`,{className:`dl-fill`,style:{inlineSize:`${e.state===`verifying`?100:y}%`}})}),w&&L(`p`,{className:`dl-detail`,children:L(`bdi`,{children:w})}),g&&e.state!==`failed`&&bJ(v)&&L(mJ,{lines:v,id:h,className:`dl-log`}),e.state===`failed`&&z(`div`,{className:`dl-fail`,children:[L(`p`,{className:`dl-error`,id:m,children:CJ(e,t,i,p)}),(v.length>0||e.error)&&z(`details`,{className:`dl-details`,children:[L(`summary`,{children:p(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:v.length>0?v.join(`
|
|
211
|
-
`):e.error})]}),u?L(`p`,{className:`dl-detail`,children:p(`setup.progress.retryLater`)}):z(`div`,{className:`setup-row`,children:[a&&z(`button`,{type:`button`,className:`btn-primary`,disabled:l,onClick:()=>a(e.id,e.error_kind),"aria-describedby":m,children:[L(is,{size:13,"aria-hidden":`true`}),` `,p(`setup.progress.retry`)]}),s&&L(`button`,{type:`button`,className:`btn-secondary`,disabled:l,onClick:()=>s(e.id),children:p(`setup.progress.skipModel`)})]})]}),e.state===`cancelled`&&o&&L(`div`,{className:`setup-row`,children:L(`button`,{type:`button`,className:`btn-secondary`,disabled:l,onClick:()=>o(e.id),children:p(`setup.progress.resume`)})}),S>=60&&c&&L(`div`,{className:`setup-row`,children:z(`button`,{type:`button`,className:`btn-secondary`,disabled:l,onClick:c,children:[L(is,{size:13,"aria-hidden":`true`}),` `,p(`setup.progress.retry`)]})})]})}function TJ({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=R(),p=KK(),m=(0,B.useMemo)(()=>vJ(e.models??[]),[e.models]),h=(0,B.useRef)(new Map),g=(0,B.useRef)(new Map),_=(0,B.useRef)(new Nk),v=(0,B.useRef)(!1),[y,b]=(0,B.useState)(()=>Date.now()),[x,S]=(0,B.useState)(!1),[C,w]=(0,B.useState)(null),T=i&&((e,t)=>{let n=m.find(t=>t.id===e);t===`verify`&&n?w(n):i(e,t)}),[E,D]=(0,B.useState)(``),[O,ee]=(0,B.useState)(``),te=(0,B.useRef)(null),ne=e.state===`verifying`||e.state!==`running`&&m.some(e=>e.state===`verifying`),re=(0,B.useRef)(new Map);(0,B.useEffect)(()=>{if(!p||!(m.some(e=>e.retrying_until)||ne))return;let e=setInterval(()=>b(Date.now()),1e3);return()=>clearInterval(e)},[m,p,ne]);let k=e.overall,{estimates:ie,overallEstimate:ae}=(0,B.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 Nk,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 Nk),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&&k?_.current.update(k.bytes_done,k.bytes_done+r,e):void 0}},[m,k]);(0,B.useEffect)(()=>{let e=new Map(m.map(e=>[e.id,e.state])),n=Math.floor((k?.percent??0)/25),r=te.current;if(te.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`?ee(f(`setup.progress.announceFailed`,{name:n})):i.push(f(`setup.progress.announceState`,{name:n,state:f(xJ[e.state])}))}n>r.quarter&&n>0&&n<4&&i.push(f(`setup.progress.announceOverall`,{n:String(n*25)})),i.length&&D(i.join(`. `))},[m,k?.percent,t,f]);let A=e=>{if(!ne)return re.current.delete(e),0;let t=Date.now(),n=re.current.get(e)??t;return re.current.set(e,n),Math.floor((t-n)/1e3)},oe=SJ(e),se=m.filter(e=>e.state===`cancelled`),ce=k?.failed??m.filter(e=>e.state===`failed`).length,le=k?.percent??0,ue=()=>{(k?.bytes_done??0)>hJ?S(!0):r?.()},de=f.compose(e=>[e(`setup.progress.overallPct`,{n:String(le)}),k&&k.bytes_total>0?e(`setup.progress.of`,{done:Dk(k.bytes_done),total:Dk(k.bytes_total)}):null,oe&&ae?.speed?kk(f.locale,Ok(ae.speed)):null,oe?ae?.eta==null?e(`setup.progress.estimating`):e(`setup.progress.left`,{eta:Ak(ae.eta,e)}):null,ce>0?e(`setup.progress.failedCount`,{n:String(ce)}):null].filter(Boolean).join(` · `));return z(`section`,{className:`dl${p?``:` is-paused`}`,"aria-labelledby":d,children:[z(`div`,{className:`dl-overall`,children:[L(`p`,{className:`dl-overall-line`,children:L(`bdi`,{children:de})}),L(`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":le,"aria-valuetext":f(`setup.progress.percent`,{n:String(le)}),children:L(`span`,{className:`dl-fill`,style:{inlineSize:`${le}%`}})})]}),L(`ul`,{className:`dl-list`,children:m.map(e=>L(wJ,{model:e,name:t[e.id]??e.id,estimate:ie[e.id],now:y,freeGb:n,onRetry:T,onResume:oe?void 0:a,onSkip:s,onRestart:c,busy:l,retryLater:u,checking:ne,checkingFor:A(e.id)},e.id))}),oe&&L(`p`,{className:`setup-hint dl-controls`,children:f(`setup.progress.keepsGoing`)}),(oe&&r||!oe&&se.length>0&&o)&&z(Wq,{children:[oe&&r&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:ue,disabled:l,children:f(`setup.progress.cancel`)}),!oe&&se.length>0&&o&&L(`button`,{type:`button`,className:`btn-primary`,onClick:o,disabled:l,children:f(`setup.progress.resumeAll`)})]}),L(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:E}),L(`span`,{className:`visually-hidden`,role:`alert`,children:O}),x&&L(Gq,{title:f(`setup.progress.cancelTitle`),confirmLabel:f(`setup.progress.cancelConfirm`),cancelLabel:f(`setup.progress.cancelKeep`),onConfirm:()=>{S(!1),r?.()},onCancel:()=>S(!1),children:L(`p`,{children:f(`setup.progress.cancelBody`)})}),C&&L(Gq,{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:L(`p`,{children:f(`setup.redownload.body`,{name:t[C.id]??C.id,size:Dk(C.bytes_total)})})})]})}function EJ({run:e,plan:t,idle:n,bar:r=!0}){let i=R(),a=t?.components??[],o=a.find(t=>e.components?.[t.id]===`active`),s=a.filter(t=>e.components?.[t.id]===`done`||e.components?.[t.id]==null&&t.installed).length,c=e.percent==null?null:Math.max(0,Math.min(100,Math.round(e.percent))),l=o?i(`setup.download.now`,{name:i(`setup.component.${o.id}`)}):n;return z(`div`,{className:`setup-activity`,children:[z(`p`,{className:`setup-hint`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,L(`span`,{role:`status`,children:l}),c!=null&&z(P.Fragment,{children:[` · `,z(`bdi`,{dir:`ltr`,children:[c,`%`]})]}),a.length>0&&z(P.Fragment,{children:[` · `,i(`setup.download.partsReady`,{done:String(s),total:String(a.length)})]})]}),r&&c!=null&&L(`progress`,{className:`setup-progress`,max:100,value:c,"aria-label":l})]})}var DJ=[`check`,`download`,`test`],OJ={root:`setup-report`,button:`btn-secondary setup-report-button`,hint:`setup-hint`,error:`setup-error`},kJ=/\d+(\.\d+)?\s*%/;function AJ(e){let t=[],n=null;for(let r of e){let e=r.search(kJ),i=e>=0?r.slice(0,e):null;i!==null&&i===n?t[t.length-1]=r:t.push(r),n=i}return t}function jJ({run:e,before:t={},failed:n=!1}){let r=R(),[i,a]=(0,B.useState)(n),[o,s]=(0,B.useState)(()=>new Set);(0,B.useEffect)(()=>{n&&a(!0)},[n]);let c=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=n=>AJ([...t[n]??[],...e?.logs?.[n]??[]]),u=DJ.filter(e=>l(e).length>0);return z(`section`,{className:`setup-logs`,"aria-label":r(`setup.logs.title`),children:[z(`button`,{type:`button`,className:`setup-log-toggle setup-help-toggle`,onClick:()=>a(e=>!e),"aria-expanded":i,"aria-controls":`setup-help`,children:[L(ri,{size:13,className:i?`is-open`:``,"aria-hidden":`true`}),` `,r(`setup.logs.help`)]}),i&&z(`div`,{id:`setup-help`,className:`setup-help`,children:[u.map(e=>{let t=l(e),n=o.has(e);return z(`div`,{className:`setup-log`,children:[z(`button`,{type:`button`,className:`setup-log-toggle`,onClick:()=>c(e),"aria-expanded":n,children:[L(ri,{size:13,className:n?`is-open`:``,"aria-hidden":`true`}),` `,r(`setup.logs.${e}`)]}),n&&L(mJ,{lines:t,className:`setup-log-pre`})]},e)}),L(sP,{classes:OJ,note:r(`setup.logs.reportNote`)})]})]})}function MJ(){let e=R(),t=N(e=>e.locale),n=N(e=>e.setLocale);return z(`label`,{className:`setup-language`,children:[L(La,{size:14,"aria-hidden":`true`}),L(`span`,{className:`visually-hidden`,children:e(`settings.language`)}),L(`select`,{value:t,onChange:e=>n(e.target.value),children:_e.map(({meta:e})=>L(`option`,{value:e.code,lang:e.code,dir:e.dir,children:ir(e)},e.code))})]})}var NJ=1e3,PJ=e=>e instanceof Error?e.message:String(e);function FJ(e){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),a=(0,B.useRef)(e);a.current=e;let o=(0,B.useRef)(!1),s=(0,B.useRef)(!1),c=(0,B.useCallback)(async()=>{o.current=!1,s.current=!0,i(!1),n({state:`downloading`,bytes_done:0,bytes_total:null,error:null});try{n(await Yt())}catch(e){n({state:`failed`,bytes_done:0,bytes_total:null,error:PJ(e)})}},[]),l=(0,B.useCallback)(e=>{e.state===`downloading`&&(o.current=!1,s.current=!1,i(!1),n(e))},[]),u=t?.state;return(0,B.useEffect)(()=>{if(u!==`downloading`)return;let e=!0,t=setTimeout(()=>{g().then(t=>{e&&(t.state===`idle`?(i(!0),n(e=>({...e??t,state:`failed`,error:null}))):n(t))}).catch(t=>{e&&n(e=>({...e??{bytes_done:0,bytes_total:null},state:`failed`,error:PJ(t)}))})},NJ);return()=>{e=!1,clearTimeout(t)}},[t,u]),(0,B.useEffect)(()=>{u!==`done`||o.current||(o.current=!0,a.current(s.current))},[u]),{job:t,start:c,follow:l,interrupted:r}}function IJ(e,t){return e.state===`done`?t(`setup.state.ready`):e.state===`failed`?t(`setup.state.failed`):t(`setup.state.downloading`)}function LJ({job:e,name:t,onRetry:n,failedNote:r,interrupted:i=!1}){let a=R(),o=(0,B.useId)(),s=e.bytes_total??0,c=e.state===`done`?100:s>0?Math.min(100,e.bytes_done/s*100):0,l=IJ(e,a),u=s>0?`${Dk(e.bytes_done)} / ${Dk(s)}`:Dk(e.bytes_done);return L(`ul`,{className:`dl-list agent-download`,children:z(`li`,{className:`dl-row is-${e.state===`done`?`ready`:e.state}${e.state===`downloading`?` is-live`:``}`,children:[z(`div`,{className:`dl-row-head`,children:[L(`span`,{className:`dl-icon`,"aria-hidden":`true`,children:e.state===`done`?L(Yr,{size:14}):e.state===`failed`?L(di,{size:14}):L(`span`,{className:`dl-dot`})}),L(`span`,{className:`dl-name`,children:L(`bdi`,{dir:`ltr`,children:t})}),L(`span`,{className:`dl-state`,children:l}),e.state===`downloading`&&z(`bdi`,{className:`dl-pct`,children:[Math.floor(c),`%`]})]}),L(`div`,{className:`dl-track`,role:`progressbar`,"aria-label":a(`setup.progress.rowLabel`,{name:t,state:l}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.floor(c),"aria-valuetext":s>0?a(`setup.progress.of`,{done:Dk(e.bytes_done),total:Dk(s)}):l,children:L(`span`,{className:`dl-fill`,style:{inlineSize:`${c}%`}})}),e.state===`downloading`&&L(`p`,{className:`dl-detail`,children:L(`bdi`,{children:kk(a.locale,u)})}),e.state===`failed`&&z(`div`,{className:`dl-fail`,role:`alert`,children:[L(`p`,{className:`dl-error`,id:o,children:a(`setup.agent.downloadFailed`,{name:t})}),i&&L(`p`,{className:`dl-detail`,children:a(`setup.agent.downloadInterrupted`)}),r&&L(`p`,{className:`dl-detail`,children:r}),e.error&&z(`details`,{className:`dl-details`,children:[L(`summary`,{children:a(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:e.error})]}),L(`div`,{className:`setup-row`,children:z(`button`,{type:`button`,className:`btn-primary`,onClick:n,"aria-describedby":o,children:[L(is,{size:13,"aria-hidden":`true`}),` `,a(`setup.progress.retry`)]})})]})]})})}var RJ=[{id:`gaiapy`,label:`setup.agent.gaiapy`,more:`setup.agent.gaiapyMore`,tag:`setup.offer.recommended`},{id:`gaiacpp`,label:`setup.agent.gaiacpp`,more:`setup.agent.gaiacppMore`,tag:`setup.agent.beta`}],zJ={no_release:`setup.agent.why.noRelease`,unreachable:`setup.agent.why.unreachable`,unverifiable:`setup.agent.why.unverifiable`},BJ=e=>e instanceof Error?e.message:String(e);function VJ({inSettings:e=!1,disabled:t=!1,pending:n=null,onPending:r}){let i=R(),a=(0,B.useId)(),o=`${a}-title`,s=`${a}-more`,c=`${a}-off`,[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)(!1),y=(0,B.useRef)(!0),b=(0,B.useCallback)(async(e,t)=>{g(!0),m(null),u(t=>t&&{...t,current:e});try{let t=await pe({flagship_agent:e});y.current&&u(e=>e&&{...e,current:t.flagship_agent})}catch(e){if(!y.current)return;m(BJ(e));let n=e instanceof Vn&&(e.httpStatus===422||e.httpStatus===409)?null:await $t().catch(()=>null);y.current&&u(e=>n??(e&&{...e,current:t}))}finally{y.current&&g(!1)}},[]),x=(0,B.useRef)(`gaiapy`);x.current=l?.current??`gaiapy`;let{job:S,start:C,follow:w,interrupted:T}=FJ(e=>{let t=x.current;$t().then(e=>{y.current&&u(e)},e=>console.warn(`[AgentChoice] could not re-read the agents after the download`,e)).then(()=>{y.current&&e&&b(`gaiacpp`,t)})});(0,B.useEffect)(()=>(y.current=!0,$t().then(t=>{y.current&&(u(t),e&&w(t.download))}).catch(e=>{y.current&&f(BJ(e))}),()=>{y.current=!1}),[e,w]);let E=e=>l?.programs.find(t=>t.id===e),D=e=>e.id===`gaiapy`||e.installed,O=e=>!!e&&!D(e)&&!e.can_download,ee=t=>!!t&&e&&!D(t)&&t.can_download,te=S?.state===`downloading`,ne=n??l?.current,re=n=>{let i=E(n);l&&i&&!t&&!O(i)&&(e?h||te||ee(i)||n!==l.current&&b(n,l.current):r?.(n===l.current?null:{id:n,download:!D(i),current:l.current}))},k=E(`gaiacpp`),ie=k?.unavailable_code?i(zJ[k.unavailable_code]):k?.unavailable_reason,ae=!k||D(k)?null:k.can_download?i(e?`setup.agent.downloadsOnButton`:`setup.agent.downloadsLater`):ie?i(`setup.agent.cantDownload`,{reason:ie}):i(`setup.agent.notInstalledMore`);return z(`section`,{className:`agent-choice${e?` settings-card`:``}`,"aria-labelledby":o,"aria-busy":h||te||!l&&!d,children:[z(`h3`,{className:`agent-choice-title ${e?`settings-label`:`mc-job-title`}`,id:o,children:[i(`setup.agent.title`),h&&L(Za,{size:13,className:`spin`,"aria-hidden":`true`})]}),d&&L(`p`,{className:`agent-choice-error`,role:`alert`,children:i(`setup.agent.loadFailed`,{error:d})}),l&&z(P.Fragment,{children:[L(MB,{className:`setup-choices`,"aria-labelledby":o,children:RJ.map(n=>{let r=E(n.id),a=O(r),o=ee(r),s=z(`button`,{type:`button`,role:`radio`,"aria-checked":ne===n.id,"aria-disabled":a||o||t||void 0,"aria-describedby":a||o?c:void 0,className:`setup-choice agent-choice-row${ne===n.id?` is-active`:``}${a?` is-disabled`:``}${o?` is-pending`:``}`,onClick:()=>re(n.id),children:[z(`span`,{className:`agent-choice-what`,children:[L(`bdi`,{dir:`ltr`,className:`agent-choice-name`,children:n.id}),L(`span`,{className:`agent-choice-label`,children:i(n.label)}),r?.size_bytes!=null&&L(`bdi`,{dir:`ltr`,className:`agent-choice-size`,children:Dk(r.size_bytes)})]}),L(`span`,{className:`setup-choice-tag`,children:i(n.tag)}),a&&L(`span`,{className:`setup-choice-tag agent-choice-off`,children:i(`setup.agent.notInstalled`)}),r&&!D(r)&&!a&&!e&&L(`span`,{className:`setup-choice-tag agent-choice-off is-quiet`,children:i(`settings.model.notDownloaded`)})]},n.id);return a?z(`div`,{className:`agent-choice-blocked`,children:[s,L(`p`,{id:c,className:`agent-choice-why`,dir:`auto`,children:ae})]},n.id):!o||te||S?.state===`failed`?s:z(`div`,{className:`agent-choice-item`,children:[s,z(`button`,{type:`button`,className:`btn-secondary agent-choice-download`,onClick:()=>void C(),disabled:h||t,"aria-label":i(`setup.agent.downloadNamed`,{name:n.id}),children:[L(Ni,{size:13,"aria-hidden":`true`}),` `,i(`setup.agent.download`)]})]},n.id)})}),S&&(S.state===`downloading`||S.state===`failed`)&&L(LJ,{job:S,name:`gaiacpp`,onRetry:()=>void C(),failedNote:i(`setup.agent.stays`,{name:l.current}),interrupted:T}),z(`button`,{type:`button`,className:`agent-choice-more`,"aria-expanded":_,"aria-controls":s,onClick:()=>v(e=>!e),children:[L($r,{size:13,className:`agent-choice-chevron${_?` is-open`:``}`,"aria-hidden":`true`}),` `,i(`setup.agent.compare`)]}),z(`div`,{id:s,className:`agent-choice-detail`,hidden:!_,children:[RJ.map(e=>z(`p`,{children:[i(e.more,{name:e.id}),e.id===`gaiacpp`&&ae&&!O(k)&&z(P.Fragment,{children:[` `,L(`span`,{id:c,children:ae})]})]},e.id)),L(`p`,{children:i(e?`settings.agent.nextMessage`:`setup.agent.hint`)})]})]}),p&&L(`p`,{className:`agent-choice-error`,role:`alert`,children:i(`setup.agent.saveFailed`,{error:p})})]})}var HJ={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`]},UJ={cancelled:`setup.npu.fixError.cancelled`,timeout:`setup.npu.fixError.timeout`,not_authorized:`setup.npu.fixError.notAuthorized`,no_pkexec:`setup.npu.fixError.noPkexec`};function WJ({problem:e}){let t=R(),n=HJ[e.code];if(!n)return z(`li`,{children:[L(`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`),z(`li`,{children:[L(`strong`,{children:t(a,{device:r.device??``,limit:r.limit??``,version:r.version??``,detail:r.detail??``})}),` `,t(i,{group:r.group??``})]})}function GJ({problems:e,disabled:t,onRecheck:n,id:r=`setup-npu-problems`}){let i=R(),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.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 UJ?UJ[n]:t;c(i(r))}finally{o(!1)}};return z(`div`,{className:`setup-npu-problems`,id:r,role:`note`,children:[L(`p`,{children:i(`setup.npu.notReady`)}),L(`ul`,{children:e.map(e=>L(WJ,{problem:e},e.code))}),L(`p`,{className:`setup-hint`,children:i(`setup.npu.meanwhile`)}),s&&L(`p`,{className:`setup-npu-error`,role:`alert`,children:s}),z(`div`,{className:`setup-npu-actions`,children:[l&&L(`button`,{type:`button`,className:`btn-primary`,disabled:t||a,onClick:()=>void u(He,`setup.npu.fixError.failed`),children:i(`setup.npu.fixMemlock`)}),n&&L(`button`,{type:`button`,className:`btn-secondary`,disabled:t||a,onClick:()=>void u(et,`setup.npu.recheckFailed`),children:i(`setup.npu.recheck`)})]})]})}async function KJ(){let e=await Ue();e.reachable&&(e.available_backends??[]).some(e=>e.name===`vulkan`)&&(e.preferred_backend??e.default_backend)!==`vulkan`&&await Qt(`vulkan`)}function qJ({plan:e,selection:t,onSelection:n,disabled:r=!1,onRecheck:i}){let a=R(),o=YK(e),s=e.npu?.present&&!e.npu.ready?e.npu.problems:[],c=s.length?void 0:o.find(e=>QK(e)&&e.gaia_model&&e.chat_choice&&e.fits!==!1)??o.find(e=>QK(e)&&e.chat_choice&&e.downloaded&&!$K(e)),l=!s.length&&!c&&o.some(e=>QK(e)&&e.fit_code===`npu`),u=!!o.find(e=>e.id===t.defaultChat&&QK(e)),d=mq(e).defaultChat,f=d&&!o.find(e=>e.id===d&&QK(e))?d:o.find(e=>e.chat_choice&&e.gaia_model&&e.support===`verified`&&!QK(e))?.id,p=e=>{e===`npu`&&c&&!u&&n(iq(t,o,c.id)),e===`gpu`&&u&&f&&n(iq(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 z(`section`,{className:`setup-backend`,"aria-labelledby":`setup-backend-title`,children:[L(`h3`,{className:`mc-job-title`,id:`setup-backend-title`,children:a(`setup.backend.title`)}),L(MB,{className:`segmented`,"aria-labelledby":`setup-backend-title`,children:m.map(e=>L(`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:L(`bdi`,{children:e.label})},e.id))}),s.length>0?L(GJ,{problems:s,disabled:r,onRecheck:i}):L(`p`,{className:`setup-hint`,children:a(c?`setup.backend.hint`:l?`setup.backend.hintNpuUnusable`:`setup.backend.hintNoNpu`)})]})}var JJ=({children:e})=>L(`bdi`,{dir:`ltr`,children:e});function YJ({label:e,children:t}){return z(`div`,{className:`found-row`,children:[L(`dt`,{children:e}),L(`dd`,{children:t})]})}function XJ(e){return e.family?`${e.name} (${e.family})`:e.name}var ZJ=[[`llamacpp`,`llama.cpp`],[`flm`,`FastFlowLM`],[`whispercpp`,`whisper.cpp`],[`kokoro`,`Kokoro`],[`sd-cpp`,`stable-diffusion.cpp`]],QJ=new Set([`llamacpp`,`flm`]);function $J(e){let t=[];for(let[n,r]of ZJ){let i=(e.backends??[]).find(e=>e.recipe===n&&e.default);i&&i.state!==`unsupported`&&t.push({name:r,b:i})}return t}function eY(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 tY={release:`release`,release_candidate:`release candidate`,local:`local build`,source:`from source`};function nY(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=$J(e);return{sys:n,cpu:r(e=>e===`cpu`)[0],gpus:i,graphics:i.length?i.map(XJ).join(`; `):t?.gpu_name??null,npus:a,runsOn:i[0]?.name??t?.gpu_name??null,npu:a[0]??null,runtimes:o,gaia:eY(n?.gaia_build,n?.gaia_version),build:n?.gaia_build?.kind??null,software:[eY(n?.gaia_build,n?.gaia_version)?`GAIA ${eY(n?.gaia_build,n?.gaia_version)}`:null,n?.lemonade_version?`Lemonade ${n.lemonade_version}`:null,...o.filter(({b:e})=>QJ.has(e.recipe)&&iY(e)).map(({name:e,b:t})=>`${e} ${t.version??t.backend}`)].filter(e=>!!e),totalMemory:Tk(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 rY={installed:`installed`,update_required:`installed, updates on first use`},iY=e=>e.state===`installed`||e.state===`update_required`,aY={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 oY(e,t){let n=nY(e,t),r=e.lemonade.mode===`external`?`the user's own`:`GAIA's own`;return[`GAIA: ${n.gaia??`unknown`}${n.build?`, ${tY[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}`:``} (${rY[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.graphics??`none found`}`,`NPU: ${n.npus.map(XJ).join(`; `)||`none found`}`,`Memory: ${n.totalMemory??`unknown`}${e.capacity_gb==null?``:`, ${Ck(e.capacity_gb)} for models${e.memory_source?` (${e.memory_source})`:``}`}`,`Models folder: ${n.modelsPath??`unknown`}${n.freeGb==null?``:` (${Ck(n.freeGb)} free)`}`,`GAIA data and logs: ${n.gaiaHome??`unknown`}`].join(`
|
|
212
|
-
`)}function sY({plan:e,hardware:t,onChangeMemory:n}){let r=R(),i=nY(e,t),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null),d=async e=>{u(null);try{await Ft(e,!1)}catch(e){u(r(`setup.found.openFailed`,{error:e instanceof Error?e.message:String(e)}))}},f=L(`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,B.useRef)(null);(0,B.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let h=e=>{c(e),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>c(null),2e3)};return z(`section`,{className:`setup-card found`,"aria-label":r(`setup.found.title`),children:[z(`div`,{className:`found-head`,children:[L(`h3`,{className:`mc-job-title`,children:r(`setup.found.title`)}),L(`button`,{type:`button`,className:`found-copy`,onClick:()=>{navigator.clipboard.writeText(oY(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:L(s===`done`?Yr:Ti,{size:14,"aria-hidden":`true`})}),s&&L(`span`,{className:`found-copied`,role:`status`,children:r(s===`done`?`setup.found.copied`:`setup.found.copyFailed`)})]}),z(`dl`,{className:`found-glance`,children:[z(YJ,{label:r(`setup.found.runsOn`),children:[i.runsOn?L(JJ,{children:i.runsOn}):f,i.npu&&L(`span`,{className:`found-chip`,children:L(JJ,{children:`NPU`})})]}),z(YJ,{label:r(`setup.found.memory`),children:[e.capacity_gb!=null&&i.totalMemory?r(`setup.found.memoryOf`,{size:Ck(e.capacity_gb),total:i.totalMemory}):e.capacity_gb==null?i.totalMemory?L(JJ,{children:i.totalMemory}):f:L(JJ,{children:Ck(e.capacity_gb)}),n&&L(`button`,{type:`button`,className:`link-btn found-link`,onClick:n,children:r(`setup.found.changeMemory`)})]}),L(YJ,{label:r(`setup.found.space`),children:i.freeGb==null?f:L(JJ,{children:Ck(i.freeGb)})}),z(YJ,{label:r(`setup.found.software`),children:[i.software.length?L(JJ,{children:i.software.join(` · `)}):f,i.build&&i.build!==`release`&&L(`span`,{className:`found-chip`,children:r(`setup.found.build.${i.build}`)})]})]}),z(`div`,{className:`found-paths`,children:[[[`setup.found.modelsFolder`,i.modelsPath],[`setup.found.gaiaFolder`,i.gaiaHome]].map(([e,t])=>t&&z(`button`,{type:`button`,className:`link-btn found-open`,onClick:()=>void d(t),title:t,children:[L(da,{size:13,"aria-hidden":`true`}),` `,r(e)]},e)),l&&L(`p`,{className:`setup-error`,role:`alert`,children:l})]}),p.length>0&&z(`details`,{className:`dl-details found-warnings`,children:[z(`summary`,{children:[L(di,{size:13,"aria-hidden":`true`}),` `,r(`setup.found.noticed`)]}),L(`ul`,{children:p.map(e=>L(`li`,{children:L(JJ,{children:e})},e))})]}),z(`button`,{type:`button`,className:`setup-log-toggle found-more`,onClick:()=>o(e=>!e),"aria-expanded":a,children:[L(ri,{size:13,className:a?`is-open`:``,"aria-hidden":`true`}),` `,r(`setup.found.details`)]}),a&&z(`div`,{className:`found-details`,children:[L(`h4`,{className:`found-group`,children:r(`setup.found.software`)}),z(`dl`,{className:`found-list`,children:[z(YJ,{label:L(JJ,{children:`GAIA`}),children:[i.gaia?L(JJ,{children:i.gaia}):f,i.build&&i.build!==`release`&&L(`span`,{className:`found-chip`,children:r(`setup.found.build.${i.build}`)})]}),L(YJ,{label:r(`setup.found.agent`),children:i.sys?.agent_version?L(JJ,{children:i.sys.agent_version}):L(`span`,{className:`found-muted`,children:r(`setup.found.agentLater`)})}),z(YJ,{label:r(`setup.found.server`),children:[e.lemonade.mode===`external`?r(`setup.found.serverYours`):r(`setup.found.serverOwn`),i.sys?.lemonade_version&&z(P.Fragment,{children:[` `,L(JJ,{children:i.sys.lemonade_version})]}),e.lemonade.url&&L(`span`,{className:`found-sub`,children:L(JJ,{children:e.lemonade.url})})]})]}),L(`h4`,{className:`found-group`,children:r(`setup.found.runtime`)}),i.runtimes.length?L(`div`,{className:`found-table-wrap`,children:z(`table`,{className:`found-table`,children:[L(`thead`,{className:`visually-hidden`,children:z(`tr`,{children:[L(`th`,{scope:`col`,children:r(`setup.found.col.runtime`)}),L(`th`,{scope:`col`,children:r(`setup.found.col.device`)}),L(`th`,{scope:`col`,children:r(`setup.found.col.version`)}),L(`th`,{scope:`col`,children:r(`setup.found.col.state`)})]})}),L(`tbody`,{children:i.runtimes.map(({name:e,b:t})=>z(`tr`,{children:[L(`th`,{scope:`row`,children:L(JJ,{children:e})}),L(`td`,{children:L(JJ,{children:t.backend})}),L(`td`,{children:L(JJ,{children:t.version??``})}),L(`td`,{className:iY(t)?`is-installed`:void 0,children:r(iY(t)?`setup.pc.backend.installed`:`setup.pc.backend.available`)})]},t.recipe))})]})}):L(`p`,{className:`found-muted`,children:r(`setup.found.unknown`)}),L(`h4`,{className:`found-group`,children:r(`setup.found.models`)}),(e.catalog??[]).length?L(`div`,{className:`found-table-wrap`,children:z(`table`,{className:`found-table`,children:[L(`thead`,{className:`visually-hidden`,children:z(`tr`,{children:[L(`th`,{scope:`col`,children:r(`setup.found.col.model`)}),L(`th`,{scope:`col`,children:r(`setup.found.col.job`)}),L(`th`,{scope:`col`,children:r(`setup.found.col.tested`)}),L(`th`,{scope:`col`,children:r(`setup.found.col.size`)}),L(`th`,{scope:`col`,children:r(`setup.found.col.state`)})]})}),L(`tbody`,{children:(e.catalog??[]).map(e=>z(`tr`,{children:[L(`th`,{scope:`row`,title:e.id,children:L(`bdi`,{children:e.name})}),L(`td`,{children:e.roles.map(e=>r(aY[e])).join(` · `)}),z(`td`,{children:[e.support===`verified`&&L(`span`,{className:`mc-chip is-verified`,children:r(`setup.label.verified`)}),e.support===`untested`&&L(`span`,{className:`mc-chip is-untested`,children:r(`setup.label.untested`)})]}),L(`td`,{children:L(JJ,{children:e.full_size_gb??e.size_gb?Ck(e.full_size_gb??e.size_gb):``})}),L(`td`,{className:e.downloaded?`is-installed`:void 0,children:r(e.downloaded?`setup.models.status.onPc`:`setup.found.notDownloaded`)})]},e.id))})]})}):L(`p`,{className:`found-muted`,children:r(`setup.found.unknown`)}),L(`h4`,{className:`found-group`,children:r(`setup.found.hardware`)}),z(`dl`,{className:`found-list`,children:[L(YJ,{label:r(`setup.found.os`),children:i.sys?.os??t?.os?L(JJ,{children:i.sys?.os??t?.os}):f}),z(YJ,{label:r(`setup.found.cpu`),children:[i.cpu||i.sys?.processor?L(JJ,{children:i.cpu?.name??i.sys?.processor}):f,i.cpu?.cores?L(`span`,{className:`found-sub`,children:r(`setup.found.cores`,{cores:String(i.cpu.cores),threads:String(i.cpu.threads??i.cpu.cores)})}):null]}),L(YJ,{label:r(`setup.found.gpu`),children:i.graphics?L(JJ,{children:i.graphics}):L(`span`,{className:`found-muted`,children:r(`setup.found.none`)})}),L(YJ,{label:r(`setup.found.npu`),children:i.npus.length?L(JJ,{children:i.npus.map(XJ).join(`; `)}):L(`span`,{className:`found-muted`,children:r(`setup.found.none`)})})]})]})]})}function cY(){return window.gaiaUpdater}var lY={status:`idle`,version:null,progress:0,releaseNotes:null,error:null,currentVersion:null,pinnedVersion:null,autoUpdate:!1,includePrereleases:!1};function uY(){let[e,t]=(0,B.useState)({...lY}),n=(0,B.useRef)(!1),r=(0,B.useRef)(0),i=(0,B.useCallback)(async()=>{let e=cY();if(!e)return;let i=r.current;try{let r=await e.getStatus();n.current&&r&&t(r)}catch(e){F.system.error(`Reading the update status failed`,e),n.current&&r.current===i&&t(e=>({...e,readFailed:!0}))}},[]);return(0,B.useEffect)(()=>{let e=cY();if(!e)return;n.current=!0;let a=e.onStatusChange(e=>{e&&(r.current+=1,n.current&&t(e))});return i(),()=>{n.current=!1,a()}},[i]),{...e,reload:i}}var dY=`gaia-update-error:`;function fY(e,t){let n=`update.err.${e}`;return fe(n)?We(n,t??{}):null}function pY(e){let t=e instanceof Error?e.message:String(e),n=t.indexOf(dY);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=fY(r.code,r.params)??r.message??r.code,a=r.note&&fY(r.note.code,r.note.params);return a?We(`update.err.withNote`,{error:i,note:a}):i}function mY(e,t){let n=pY(e);return typeof n==`object`?t(n.ref,n.params):String(n)}function hY({className:e}){let t=R(),n=uY(),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(null),s=n.lastWorking;if(!cY()||!s)return null;let c=(r||n.version===s.version)&&n.status===`downloading`,l=r&&n.status===`downloaded`,u=!r&&n.status===`downloaded`&&n.version===s.version,d=new Date(s.at).toLocaleDateString(On(t),{year:`numeric`,month:`short`,day:`numeric`}),f=t(`setup.goBack.title`);return z(`section`,{className:e?`setup-card ${e}`:`setup-card`,"aria-label":f,children:[L(`h3`,{className:`mc-job-title`,children:f}),L(`p`,{children:t(`setup.goBack.lead`,{version:s.version,date:d})}),L(`p`,{className:`setup-hint`,children:t(`setup.goBack.fixes`,{version:s.version})}),c||l?z(`p`,{className:`setup-hint`,role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,c?t(`setup.goBack.downloading`,{version:s.version,pct:Math.max(0,Math.min(100,Math.round(n.progress)))}):t(`setup.goBack.restarting`,{version:s.version})]}):u?z(P.Fragment,{children:[L(`p`,{className:`setup-hint`,children:t(`setup.goBack.ready`,{version:s.version})}),L(`div`,{className:`setup-row`,children:L(`button`,{type:`button`,className:`btn-secondary go-back-action`,onClick:()=>{let e=cY();e&&(o(null),e.restart().catch(e=>{F.system.error(`Restarting into the last working version failed`,e),o(t(`setup.goBack.failed`,{reason:mY(e,t)}))}))},children:t(`setup.goBack.restart`,{version:s.version})})})]}):L(`div`,{className:`setup-row`,children:L(`button`,{type:`button`,className:`btn-secondary go-back-action`,onClick:()=>{let e=cY();e&&(i(!0),o(null),e.revertToLastWorking().catch(e=>{F.system.error(`Going back to the last working version failed`,e),o(t(`setup.goBack.failed`,{reason:mY(e,t)}))}).finally(()=>i(!1)))},disabled:r,children:t(`setup.goBack.action`,{version:s.version})})}),a&&L(`p`,{className:`setup-error`,role:`alert`,children:a}),z(`details`,{className:`dl-details`,children:[L(`summary`,{children:t(`setup.progress.details`)}),L(`p`,{className:`setup-hint`,children:t(`setup.goBack.note`,{version:s.version,current:n.currentVersion??``})})]})]})}function gY({state:e}){return e===`done`?L(Yr,{size:13,"aria-hidden":`true`}):e===`active`?L(Za,{size:13,className:`spin`,"aria-hidden":`true`}):L(e===`failed`?nc:e===`question`?pi:_i,{size:13,"aria-hidden":`true`})}function _Y({hardware:e,hardwareError:t,plan:n,serverRun:r,awaitingChoice:i=!1}){let a=R(),[o,s]=(0,B.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?Tk(n?.system?.physical_memory,e?.ram_gb):null:Ck(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:kk(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=L(`ul`,{className:`setup-rows`,id:`setup-check-rows`,children:g.map(e=>z(`li`,{className:`setup-result is-${e.state}`,children:[L(gY,{state:e.state}),L(`span`,{className:`setup-result-label`,children:e.label}),e.value&&L(`bdi`,{className:`setup-result-value`,children:e.value})]},e.id))});return _===g.length?z(`section`,{className:`setup-card setup-checks-done`,"aria-label":a(`setup.check.title`),children:[L(`p`,{className:`setup-result is-done`,role:`status`,children:z(`button`,{type:`button`,className:`setup-checks-toggle`,"aria-expanded":o,"aria-controls":`setup-check-rows`,onClick:()=>s(e=>!e),children:[L(Yr,{size:13,"aria-hidden":`true`}),L(`span`,{className:`setup-result-label`,children:a(`setup.checks.allPassed`,{n:String(g.length)})}),L(ri,{size:13,className:o?`is-open`:``,"aria-hidden":`true`})]})}),o&&y]}):z(`section`,{className:`setup-card`,"aria-label":a(`setup.check.title`),children:[L(`div`,{className:`setup-bar-head`,children:i?L(`span`,{children:a(`setup.checks.waitingChoice`)}):z(P.Fragment,{children:[L(`span`,{children:a(`setup.checks.count`,{done:String(_),total:String(g.length)})}),z(`bdi`,{dir:`ltr`,children:[v,`%`]})]})}),L(`progress`,{className:`setup-progress`,max:100,value:v,"aria-label":a(`setup.check.title`)}),y]})}function vY({steps:e}){let t=R();return z(`nav`,{className:`setup-rail`,"aria-label":t(`setup.rail.label`),children:[L(`p`,{className:`setup-rail-title`,children:t(`setup.title`)}),L(`ol`,{className:`setup-rail-list`,children:e.map((e,t)=>{let n=e.status===`done`?L(Yr,{size:13,"aria-hidden":`true`}):e.status===`active`?L(Za,{size:13,className:`spin`,"aria-hidden":`true`}):e.status===`failed`?L(di,{size:13,"aria-hidden":`true`}):t+1,r=z(P.Fragment,{children:[L(`span`,{className:`setup-rail-num`,children:n}),L(`span`,{children:e.label})]}),i=`setup-rail-step is-${e.status}${e.shown?` is-shown`:``}`,a=e.shown?`step`:void 0;return L(`li`,{children:e.onOpen?L(`button`,{type:`button`,className:i,onClick:e.onOpen,children:r}):L(`span`,{className:i,"aria-current":a,children:r})},e.id)})})]})}var yY={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 bY(e,t){return t(`setup.test.job.${e}`)}function xY({state:e}){return e===`passed`?L(Yr,{size:13,"aria-hidden":`true`}):e===`running`?L(Za,{size:13,className:`spin`,"aria-hidden":`true`}):L(e===`failed`?nc:e===`skipped`?mo:_i,{size:13,"aria-hidden":`true`})}function SY(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 CY({run:e,expected:t,names:n,catalog:r,onRetry:i,onChooseAnother:a,onCancel:o,onDownloadAgain:s,busy:c}){let l=R(),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,B.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`),w=e.state===`verifying`&&!u.some(e=>e.state===`running`)?f[0]:void 0;return z(P.Fragment,{children:[z(`section`,{className:`setup-card`,"aria-label":l(`setup.test.title`),children:[z(`div`,{className:`setup-bar-head`,children:[L(`span`,{children:l(`setup.test.count`,{done:String(p),total:String(m)})}),z(`bdi`,{dir:`ltr`,children:[h,`%`]})]}),L(`progress`,{className:`setup-progress`,max:100,value:h,"aria-label":l(`setup.test.title`)}),z(`ul`,{className:`setup-rows`,children:[u.map(e=>z(`li`,{className:`setup-result is-${e.state}`,children:[L(xY,{state:e.state}),z(`span`,{className:`setup-result-label`,children:[bY(e.job,l),e.subject&&z(`bdi`,{className:`setup-result-model`,children:[` `,n[e.subject]??Uc(e.subject)]})]}),L(`span`,{className:`setup-result-value`,children:SY(e,l)}),e.error&&z(`div`,{className:`setup-result-error`,children:[L(`p`,{children:l(e.kind===`broken`&&!s?`setup.test.why.brokenYours`:yY[e.kind??``]??`setup.test.why.other`)}),z(`details`,{className:`dl-details`,children:[L(`summary`,{children:l(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:e.error})]})]})]},`${e.job}:${e.subject??``}`)),f.map(e=>e===`agent`&&S?z(`li`,{className:`setup-result is-failed`,children:[L(xY,{state:`failed`}),L(`span`,{className:`setup-result-label`,children:bY(e,l)}),L(`span`,{className:`setup-result-value`,children:l(`setup.test.failed`)}),L(`div`,{className:`setup-result-error`,children:L(`p`,{children:l(`setup.test.why.hub`)})})]},e):e===w?z(`li`,{className:`setup-result is-running`,children:[L(xY,{state:`running`}),L(`span`,{className:`setup-result-label`,children:bY(e,l)}),L(`span`,{className:`setup-result-value`,children:l(`setup.test.starting`)})]},e):z(`li`,{className:`setup-result is-waiting`,children:[L(xY,{state:`waiting`}),L(`span`,{className:`setup-result-label`,children:bY(e,l)}),L(`span`,{className:`setup-result-value`,children:l(`setup.test.waiting`)})]},e))]})]}),e.state===`verifying`&&o&&L(Wq,{children:L(`button`,{type:`button`,className:`btn-secondary`,onClick:o,disabled:c,children:l(`setup.progress.cancel`)})}),_&&z(`div`,{className:`setup-failure`,role:`alert`,children:[L(`p`,{children:e.state===`cancelled`?l(`setup.test.cancelled`):g.some(e=>e.kind===`memory`)?l(`setup.test.failedMemory`):l(`setup.test.failedHelp`)}),z(Wq,{children:[C&&a&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:a,disabled:c,children:l(`setup.test.chooseAnother`)}),L(`button`,{type:`button`,className:v.length?`btn-secondary`:`btn-primary`,onClick:i,disabled:c,children:l(`setup.test.tryAgain`)}),v.map(e=>L(`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&&L(Gq,{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:L(`p`,{children:l(`setup.redownload.body`,{name:n[y]??y,size:x==null?``:Ck(x)})})})]})}var wY=`https://app.fireworks.ai/settings/users/api-keys`,TY=`https://amd-gaia.ai/docs/guides/llm-gateway`,EY=[{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 DY(e,t){return fe(e.title)?t(e.title):e.title}var OY=1e3,kY=`gaia-setup-choice`;function AY(){try{let e=localStorage.getItem(kY);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 jY(e){try{localStorage.setItem(kY,e)}catch(e){console.warn(`[SetupScreen] could not save the provider choice; a reload will ask again`,e)}}var MY=[`ok`,`needs_key`,`too_old`];function NY({onChosen:e,onNothingToOffer:t,onFound:n,canInstallOwn:r=!0}){let i=R(),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(``),[h,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)(!1),[y,b]=(0,B.useState)(null),[x,S]=(0,B.useState)(null),[C,w]=(0,B.useState)(null),[T,E]=(0,B.useState)(`gaia`),D=(0,B.useRef)(!0),O=(0,B.useCallback)(async()=>{c(null);try{let e=await ie();if(!e.offer){t?.();return}f(!0);let{found:r,unchecked:i=[]}=await er();if(!D.current)return;u(r?[]:i),r&&MY.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){D.current&&c(e instanceof Error?e.message:String(e))}finally{D.current&&f(!1)}},[t,n]);(0,B.useEffect)(()=>(D.current=!0,O(),()=>{D.current=!1}),[O]);let ee=(0,B.useCallback)(async t=>{if(a){b(t),S(null);try{await be(t===`external`?{mode:t,base_url:a.found.url,api_key:p.trim()||void 0}:{mode:t}),m(``),w(t),e(t)}catch(e){VK(e)&&g(!0),S(e instanceof Error?e.message:String(e))}finally{b(null)}}},[a,p,e]);if(s||l.length>0)return z(P.Fragment,{children:[L(`p`,{className:`setup-hint`,children:s?i(`setup.offer.checkFailed`):i(`setup.offer.noAnswer`,{url:l.join(`, `)})}),s&&z(`details`,{className:`dl-details`,children:[L(`summary`,{children:i(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:s})]}),z(Wq,{children:[z(`button`,{type:`button`,className:`btn-secondary`,disabled:d,onClick:()=>void O(),children:[d&&L(Za,{size:13,className:`spin`}),` `,i(`setup.offer.checkAgain`)]}),t&&r&&L(`button`,{type:`button`,className:`btn-primary`,disabled:d,onClick:t,children:i(`setup.offer.useOwn`)})]})]});if(!a)return d?z(`p`,{className:`setup-hint`,role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,i(`setup.offer.looking`)]}):null;let{target:te,found:ne}=a;return C?L(`p`,{className:`setup-hint`,role:`status`,children:C===`external`?i(`setup.offer.usingYours`,{url:ne.url}):i(`setup.offer.usingOwn`)}):ne.status===`too_old`?z(`p`,{className:`setup-hint`,role:`status`,children:[i(`setup.offer.tooOld`),` `,z(`bdi`,{dir:`ltr`,className:`setup-choice-note`,children:[`Lemonade `,ne.version??``,` · `,ne.url]})]}):z(`form`,{id:`setup-lemonade-form`,className:`setup-lemonade`,"aria-label":i(`setup.offer.label`),onSubmit:e=>{e.preventDefault(),ee(T)},children:[z(`fieldset`,{className:`setup-choices`,disabled:!!y,children:[L(`legend`,{className:`setup-choice-title`,children:i(`setup.offer.title`)}),[{mode:`gaia`,title:`setup.offer.useOwn`,note:`setup.offer.ownNote`},{mode:`external`,title:`setup.offer.useMine`,note:`setup.offer.mineNote`}].map(e=>z(`label`,{className:`setup-choice${T===e.mode?` is-active`:``}`,children:[L(`input`,{type:`radio`,name:`setup-server`,value:e.mode,checked:T===e.mode,onChange:()=>{E(e.mode),S(null)}}),z(`span`,{children:[z(`span`,{className:`setup-choice-title`,children:[i(e.title),e.mode===`gaia`&&L(`span`,{className:`setup-choice-tag`,children:i(`setup.offer.recommended`)})]}),L(`span`,{className:`setup-choice-note`,children:i(e.note)})]})]},e.mode))]}),z(`button`,{type:`button`,className:`setup-log-toggle setup-offer-more`,onClick:()=>v(e=>!e),"aria-expanded":_,"aria-controls":`setup-offer-detail`,children:[L(ri,{size:13,className:_?`is-open`:``,"aria-hidden":`true`}),` `,i(`setup.offer.whatGaiaDoes`)]}),_&&z(`div`,{id:`setup-offer-detail`,children:[L(`p`,{className:`setup-choice-note`,children:z(`bdi`,{dir:`ltr`,children:[`Lemonade`,ne.version?` ${ne.version}`:``,` · `,ne.url]})}),L(`p`,{className:`setup-choice-note`,children:i(`setup.offer.whatGaiaDoesText`)})]}),T===`external`&&h&&L(`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&&T===`external`?L(`p`,{className:`setup-error`,role:`alert`,children:i(`setup.offer.keyRejected`)}):L(FY,{text:x})),L(Wq,{children:z(`button`,{type:`submit`,form:`setup-lemonade-form`,className:`btn-primary`,disabled:!!y||T===`external`&&h&&!p.trim(),children:[y&&L(Za,{size:13,className:`spin`}),` `,i(`setup.continue`)]})})]})}function PY({problem:e,onRetry:t,onUseGaia:n}){let r=R(),i=e.kind===`server_too_old`&&e.use_gaia;return z(P.Fragment,{children:[e.start&&z(`details`,{className:`dl-details`,children:[L(`summary`,{children:r(`setup.server.howToStart`)}),L(`pre`,{dir:`ltr`,children:e.start})]}),z(Wq,{children:[L(`button`,{type:`button`,className:i?`btn-secondary`:`btn-primary`,onClick:t,children:r(`setup.tryAgain`)}),e.use_gaia&&L(`button`,{type:`button`,className:i?`btn-primary`:`btn-secondary`,onClick:n,children:r(`setup.server.useGaia`)})]}),e.use_gaia&&L(`p`,{className:`setup-hint`,children:r(`setup.server.useGaiaNote`)}),e.use_gaia&&e.env_url&&L(`p`,{className:`setup-hint`,children:r(`setup.server.envIgnoredNote`,{url:e.env_url})})]})}function FY({text:e}){let t=R();return z(`div`,{className:`setup-error`,role:`alert`,children:[L(`p`,{children:t(`setup.failedLead`)}),z(`details`,{className:`dl-details`,children:[L(`summary`,{children:t(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:e})]})]})}function IY({run:e}){let t=R();return e.problem?z(`div`,{className:`setup-error`,role:`alert`,children:[L(`p`,{children:t(e.problem.kind===`server_too_old`?`setup.server.tooOld`:`setup.server.unreachable`)}),z(`details`,{className:`dl-details`,children:[L(`summary`,{children:t(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:e.problem.message})]})]}):z(`div`,{className:`setup-error`,role:`alert`,children:[L(`p`,{children:t(e.components?.server===`failed`?`setup.server.ownFailed`:`setup.stopped`)}),e.error&&z(`details`,{className:`dl-details`,children:[L(`summary`,{children:t(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:e.error})]})]})}var LY=[`check`,`plan`,`key`,`models`,`gpu`,`download`,`test`,`ready`],RY=`gaia.setup.agentPick`,zY=`gaia.setup.heldRun`;function BY(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return console.warn(`[SetupScreen] could not read ${e}; the agent pick starts fresh`,t),null}}function VY(e,t){try{t==null?sessionStorage.removeItem(e):sessionStorage.setItem(e,JSON.stringify(t))}catch(t){console.warn(`[SetupScreen] could not save ${e}; a reload will lose the agent pick`,t)}}function HY(e){return e instanceof Error?e.message:String(e)}function UY({onReady:e,onClose:t}){let n=R(),r=zc(e=>e.refresh),i=zc(e=>e.select),[a,o]=(0,B.useState)(`local`),[s,c]=(0,B.useState)(`check`),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(`models`),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(()=>new Set([`check`])),y=(0,B.useRef)(`check`),[b,x]=(0,B.useState)(null),[C,w]=(0,B.useState)(null),[T,E]=(0,B.useState)(null),[D,O]=(0,B.useState)(null),[ee,te]=(0,B.useState)(null),[ne,re]=(0,B.useState)(``),[k,ae]=(0,B.useState)({busy:!1,error:null,done:!1}),[A,se]=(0,B.useState)(null),[ce,le]=(0,B.useState)(null),[de,fe]=(0,B.useState)(null),[j,he]=(0,B.useState)(null),[M,ge]=(0,B.useState)(null),[_e,ve]=(0,B.useState)(null),[ye,be]=(0,B.useState)(!1),[xe,Se]=(0,B.useState)(null),[Ce,we]=(0,B.useState)(!1),[Te,Ee]=(0,B.useState)(!1),[De,ke]=(0,B.useState)(null),[Ae,je]=(0,B.useState)(!1),[Ne,Pe]=(0,B.useState)(null),[Fe,Ie]=(0,B.useState)(null),[Le,Re]=(0,B.useState)(null),[ze,Be]=(0,B.useState)(!1),[Ve,He]=(0,B.useState)([]),[Ue,We]=(0,B.useState)([]),[Ge,qe]=(0,B.useState)([]),[Je,Ye]=(0,B.useState)(!1),[Ze,Qe]=(0,B.useState)(!1),$e=(0,B.useRef)({gaiaLemonade:!1,options:{}}),et=(0,B.useRef)(null),tt=(0,B.useRef)(!1),nt=(0,B.useRef)(!1),[rt,at]=(0,B.useState)(!1),[ot,st]=(0,B.useState)(!1),ct=(0,B.useCallback)(()=>st(!0),[]),[lt,ut]=(0,B.useState)(null),[dt,ft]=(0,B.useState)(null),pt=(0,B.useRef)(!0);(0,B.useEffect)(()=>(pt.current=!0,()=>{pt.current=!1}),[]);let{network:mt,providers:ht,recheck:gt}=cJ(),_t=e=>ht.find(t=>t.id===e),vt=_t(a),N=vt?.key_source===`environment`&&vt.key_hint?vt:void 0,yt=e=>!!_t(e)?.blocked,bt=mt?.reachable!==!1||a===`amd`,F=vt?.key_source===`stored`||vt?.key_source===`lemonade`,xt=yt(`fireworks`)&&yt(`amd`),St=e=>yt(e)||e===`amd`&&mt?.reachable===!1,Ct=e=>yt(e)?n(`settings.privacy.localOnlyBlocked`):n(`setup.key.gatewayOff`),wt=a!==`local`,Tt=T?.server_only?T:null,Et=T&&!T.server_only?T:null,Dt=T?.state===`running`||T?.state===`verifying`,Ot=Et?.state===`ready`,At=SJ(T),jt=!(Et?.models??[]).some(e=>e.state===`downloading`||e.state===`queued`)&&((Et?.tests?.length??0)>0||Et?.state===`verifying`),Mt=(0,B.useCallback)(()=>{w(null),ue().then(x).catch(e=>w(HY(e)))},[]),Nt=(0,B.useRef)(0),Pt=(0,B.useCallback)(async()=>{let e=++Nt.current;le(null);try{let t=await En(!1);return e===Nt.current?(se(t),t):null}catch(t){return e===Nt.current&&le(HY(t)),null}},[]),Ft=(0,B.useCallback)(async()=>{try{let e=await Xe();pt.current&&ve(e??null)}catch(e){console.warn(`[SetupScreen] GPU memory could not be read; the step stays hidden`,e)}},[]),It=t!=null;(0,B.useEffect)(()=>{ie().then(e=>Ye(e.source===`config`)).catch(e=>console.warn(`[SetupScreen] could not read which Lemonade GAIA uses`,e)),Mt(),Pt(),oe().then(e=>{e.state===`idle`&&!e.models?.length||It&&e.state!==`running`&&e.state!==`verifying`||(E(e),e.server_only||c(`download`),e.skip_chat_model&&o(AY()===`amd`?`amd`:`fireworks`))}).catch(e=>te(HY(e))).finally(()=>at(!0))},[Mt,Pt,It]),(0,B.useEffect)(()=>{A?.catalog&&A.lemonade.reachable&&(fe(e=>e??uq(A)),Ft(),!T&&A.catalog.some(e=>e.partial&&e.selected)&&je(!0))},[A,Ft,T]);let Lt=(0,B.useCallback)(()=>{et.current&&clearInterval(et.current),et.current=null},[]),Rt=(T?.models??[]).filter(e=>e.state===`failed`&&e.error_kind===`disk_full`).length;(0,B.useEffect)(()=>{Rt>0&&Pt()},[Rt,Pt]);let zt=(0,B.useCallback)(async()=>{try{let e=await oe();if(O(null),e.state===`idle`&&!e.models?.length){E(null),c(`plan`),Qe(!0),Pt();return}E(e)}catch(e){O(HY(e))}},[Pt,n]);(0,B.useEffect)(()=>(!At&&!D||(et.current=setInterval(()=>{zt()},OY)),Lt),[At,D,zt,Lt]),(0,B.useEffect)(()=>{Tt&&Tt.state===`ready`&&(Mt(),Pt())},[Tt,Tt?.state,Mt,Pt]),(0,B.useEffect)(()=>{Ot&&(Mt(),Pt().then(e=>{e&&ge(e)}),Ft())},[Ot,Mt,Pt,Ft]);let I=(0,B.useRef)(!1),Bt=(0,B.useCallback)(async(e=!1,t={})=>{if(I.current)return!1;I.current=!0,te(null),ke(null),je(!1),Qe(!1);try{jY(a),$e.current={gaiaLemonade:e,options:t};let n=await dn(wt,e,t);E(n),g(null);let r=t.extraModels??[];return r.length&&qe(e=>e.filter(e=>!r.includes(e))),t.serverOnly||c(`download`),e&&Ye(!1),!0}catch(e){let t=kt(e);if(t)return Se({kind:`server`,detail:t,then:`run`}),!1;if(e instanceof Vn&&e.httpStatus===409){let e=await oe().catch(()=>null);if(e&&(e.state===`running`||e.state===`verifying`))return E(e),g(null),e.server_only||c(`download`),!0}return te(HY(e)),!1}finally{I.current=!1}},[a,wt]);(0,B.useEffect)(()=>{s===`check`&&rt&&ot&&A&&!A.lemonade.reachable&&!T&&!tt.current&&(tt.current=!0,Bt(!1,{serverOnly:!0}))},[s,rt,ot,A,T,Bt]);let Vt=!!(de&&A?.catalog&&A.lemonade.reachable&&(b||C)),Ht=(0,B.useCallback)(()=>{let{gaiaLemonade:e,options:t}=$e.current;Bt(e,t)},[Bt]),Ut=(0,B.useCallback)((e,t=A)=>{he(t);let n=t&&de&&!wt?xq(t,de):[];return Bt(!1,{acknowledgeLowDisk:e,keepTrying:ye,extraModels:n})},[A,de,wt,ye,Bt]),[Wt,Kt]=(0,B.useState)(!1),[qt,Jt]=(0,B.useState)(()=>BY(RY)),Yt=(0,B.useCallback)(e=>{Jt(e),VY(RY,e)},[]),[Xt,Zt]=(0,B.useState)(()=>BY(zY)),Qt=(0,B.useCallback)(e=>{Zt(e),VY(zY,e)},[]),[en,tn]=(0,B.useState)(null),[nn,rn]=(0,B.useState)(!1),an=(0,B.useCallback)(async(e,t,n)=>{if(tn(null),t){rn(!0);try{await pe({flagship_agent:t})}catch(e){tn(HY(e));return}finally{rn(!1)}}Yt(null),Qt(null),await Ut(e.acknowledgeLowDisk,n)},[Ut,Yt,Qt]),on=(0,B.useRef)(qt);on.current=qt;let sn=(0,B.useRef)(Xt);sn.current=Xt;let cn=(0,B.useRef)(an);cn.current=an;let un=FJ(()=>{let e=on.current;e&&Yt({...e,download:!1}),e&&sn.current&&cn.current(sn.current,e.id)}),fn=un.start,pn=un.follow,mn=(0,B.useCallback)(async(e,t)=>{let n=on.current;if(Qt(e),g(null),c(`download`),!n||!n.download){await an(e,n?.id??null,t);return}tn(null);let r;try{r=await $t()}catch(e){tn(HY(e));return}r.programs.find(e=>e.id===n.id)?.installed?await an(e,n.id,t):r.download.state===`downloading`?pn(r.download):fn()},[an,Qt,pn,fn]),hn=(0,B.useCallback)(()=>{Qt(null),tn(null),g(null),c(`models`)},[Qt]),gn=(0,B.useCallback)(()=>{Xt&&an(Xt,null)},[Xt,an]),_n=(0,B.useRef)(!1);(0,B.useEffect)(()=>{_n.current||(_n.current=!0,$t().then(e=>{let t=e.download.state===`downloading`;if(pn(e.download),!sn.current)return;if(t){c(`download`);return}Qt(null);let n=on.current;n&&e.programs.find(e=>e.id===n.id)?.installed&&Yt({...n,download:!1})}).catch(e=>console.warn(`[SetupScreen] could not read the agent programs; the Agent card says so on Customize`,e)))},[pn,Qt,Yt]);let vn=(0,B.useRef)(!1),yn=(0,B.useCallback)(async(e,t=Ce)=>{if(!A||!de||vn.current)return;ke(null),Kt(e);let r=YK(A),i=wt?[]:vq(r,de).filter(e=>!e.downloaded||e.id===de.defaultChat),a=i.find($K);if(a){let e=a.id===de.defaultChat?`setup.models.cantRun.chat`:`setup.models.cantRun.other`;ke(n(e,{name:a.name,why:kq(a,n)}))}else if(!wt&&!t&&i.length>0&&i.every(e=>e.need_gb!=null))Se({kind:`no_fit`,models:i});else{Ee(!0),vn.current=!0;try{let n=A;if(!wt&&de.defaultChat&&de.defaultChat!==n.chat_model.id)try{n=await me(de.defaultChat,t,!1)}catch(e){let t=kt(e);if(t){Se({kind:`server`,detail:t,then:`chat`});return}throw e}if(!wt){await KJ();let e=oq(r,de);e!==(n.vision_model??null)&&(n=await Me(e,!1));for(let e of bq(n,de))n=await Rn(e.id,e.skipped,!1)}se(n),on.current?await mn({acknowledgeLowDisk:e},n):await Ut(e,n)}catch(e){ke(HY(e))}finally{vn.current=!1,Ee(!1)}}},[A,de,wt,Ce,Ut,mn,n]),bn=(0,B.useCallback)(e=>{ke(null),s===`download`?g(e===y.current?null:e):(g(null),c(e===`test`||e===`ready`?`download`:e))},[s]),xn=(0,B.useCallback)(()=>{h??o(`local`),bn(`plan`)},[bn,h]),Sn=(0,B.useCallback)(()=>{Dt&&h!=null||(o(`local`),u(!0),bn(`models`))},[bn,Dt,h]),[Cn,wn]=(0,B.useState)(`local`),Tn=zc(e=>e.active?.remote&&e.active.provider!==`local`?e.active.provider:null),Dn=zc(e=>e.active?.remote?e.active.model:null),On=(0,B.useCallback)(e=>{Dt&&h!=null||(u(!1),o(e),wn(`cloud`),Ie(e===Tn?Dn:null),bn(`key`))},[bn,Dt,h,Tn,Dn]),kn=(0,B.useCallback)(()=>On(AY()===`amd`?`amd`:`fireworks`),[On]),An=(0,B.useCallback)(()=>{Tn?On(Tn):bn(`plan`)},[Tn,On,bn]),jn=!!_e?.applies,Mn=(0,B.useCallback)(()=>{bn((h??s)===`gpu`?d:`plan`)},[d,bn,h,s]),Nn=(0,B.useCallback)(e=>{f(e),bn(`gpu`)},[bn]),Pn=(0,B.useRef)({prev:null,next:null});(0,B.useEffect)(()=>{let e=e=>{if(!e.altKey||xe||(e.target instanceof Element?e.target:null)?.closest(`input, textarea, select, [contenteditable="true"]`))return;let t=e.key===`ArrowLeft`?Pn.current.prev:e.key===`ArrowRight`?Pn.current.next:null;t&&(e.preventDefault(),bn(t))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[bn,xe]);let Fn=(0,B.useCallback)(async()=>{try{await S(),await zt()}catch(e){ke(HY(e))}},[zt]),In=(0,B.useCallback)(async(e,t)=>{ke(null),Ee(!0);try{t===`verify`&&await Oe(e),t===`disk_full`&&Pt();try{E(await Ke(e,{keepTrying:ye}))}catch(t){let n=kt(t);if(!n)throw t;Se({kind:`server`,detail:n,then:`retry`,id:e})}}catch(e){ke(HY(e))}finally{Ee(!1)}},[ye,Pt]),Ln=(0,B.useCallback)(async e=>{ke(null),Ee(!0);try{A?.catalog?.find(t=>t.id===e)?.planned&&se(await Rn(e,!0,!1)),E(t=>t&&{...t,models:t.models?.map(t=>t.id===e?{...t,state:`skipped`}:t)});let{options:t}=$e.current;$e.current.options={...t,extraModels:t.extraModels?.filter(t=>t!==e)},fe(t=>t&&t.ticked.has(e)?fq(t,YK(A),e,!1):t)}catch(e){ke(HY(e))}finally{Ee(!1)}},[A]),zn=(0,B.useCallback)(async()=>{await Fn(),Ht()},[Fn,Ht]),Bn=(0,B.useCallback)(async()=>{if(!Dt){ae({busy:!0,error:null,done:!1});try{await ln(a,{api_key:!Je&&ne||void 0},e=>ae({busy:!0,error:null,done:!1,waiting:e}),()=>!pt.current);let{models:e}=await Gt(a),t=Fe??Le,r=t?e.find(e=>e.id===t):e.find(e=>e.rank===1)??e[0];if(!r)throw Error(t?n(`setup.key.modelNotOffered`,{model:Xc(t)}):n(`setup.key.noModels`));await i(r.id),Pe(r.id),re(``),ae({busy:!1,error:null,done:!0}),Ut(!1)}catch(e){ae({busy:!1,error:HY(e),done:!1})}}},[a,ne,Fe,Le,i,Je,Ut,n,Dt]),Hn=(0,B.useCallback)(e=>{jY(e),o(e),Ie(e===Tn?Dn:null),Re(null),ae({busy:!1,error:null,done:!1})},[Tn,Dn]);(0,B.useEffect)(()=>{if(!Ot||Ue.length===0||nt.current)return;let e=Ue;nt.current=!0,Bt(!1,{keepTrying:ye,extraModels:e}).then(t=>{nt.current=!1,We(t=>t.filter(t=>!e.includes(t))),t||qe(t=>[...t,...e.filter(e=>!t.includes(e))])})},[Ot,Ue,ye,Bt]);let Un=Ot&&Ue.length===0,Wn=wt?Ne:Et?.chat_model??(A&&!A.decided_after_server?A.chat_model.id:null),Gn=(0,B.useCallback)(async t=>{ke(null);try{!wt&&Wn&&await i(Wn),await r()}catch(e){ke(HY(e));return}e(t)},[Wn,wt,e,r,i]);(0,B.useEffect)(()=>{Un&&it().then(e=>He(e.cards)).catch(e=>console.warn(`[SetupScreen] no first tasks to offer`,e))},[Un]);let Kn=(0,B.useMemo)(()=>{let e={};for(let t of A?.catalog??[])e[t.id]=t.name;return e},[A]),qn=T?.state===`failed`||T?.state===`cancelled`,Jn=T?.state===`failed`||!!ee||!!ce||!!C||!!D||!!De,Yn=It?Ve:Ve.filter(e=>e.skill!==`check-in`),Xn=Et&&(Et.state===`failed`||Et.state===`cancelled`)&&(Et.models??[]).length>0&&(Et.models??[]).every(e=>e.state===`ready`||e.state===`skipped`||e.state===`verifying`||e.state===`unchecked`)&&!At,Zn=!!Et&&qn&&!Et.problem&&Object.values(Et.components??{}).includes(`failed`),Qn=YK(A),$n=de?hq(Qn,de):[],er=A&&de?_q(A,de):null,tr=de?Qn.filter(e=>de.ticked.has(e.id)&&e.downloaded).length:0,nr=Qn.some(e=>e.downloaded),rr=Vt?tr===0?nr?`setup.check.ledeOthersOnPc`:`setup.check.ledeDone`:$n.length===0?`setup.check.ledeAllOnPc`:`setup.check.ledeSomeOnPc`:`setup.check.lede`,ir=Qn.find(e=>e.id===de?.defaultChat),ar=!!b&&!b.compatible&&b.blockers.length>0,or=Un?`ready`:s===`download`&&jt?`test`:s;y.current=or;let sr=h??or;(0,B.useEffect)(()=>{v(e=>e.has(sr)?e:new Set(e).add(sr))},[sr]);let cr=(0,B.useRef)(!0);(0,B.useEffect)(()=>{if(cr.current){cr.current=!1;return}let e=document.querySelector(`.setup-scroll`);e&&(e.scrollTop=0),document.getElementById(`setup-title`)?.focus({preventScroll:!0})},[sr]);let lr=[{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`}],ur=e=>e===`models`||e===`key`?`plan`:e===`gpu`?d===`check`?`check`:`plan`:e,dr=wt?`key`:l?`models`:`plan`,fr=lr.findIndex(e=>e.id===ur(or)),pr=e=>e===`download`||e===`test`||e===`ready`,mr=[];if(b){let e=[A?.system?.physical_memory?`${Tk(A.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`;mr.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 C&&mr.push(`Couldn't read this PC: ${C}`);lt&&(mr.push(`Found your Lemonade${lt.version?` ${lt.version}`:``} at ${lt.url}`),mr.push(dt===`external`?`You chose your own Lemonade`:dt===`gaia`?`You chose GAIA's own Lemonade`:`Waiting for you to choose which Lemonade GAIA uses`)),A&&(!lt||dt)?mr.push(A.lemonade.reachable?`Model server answering at ${A.lemonade.url??`its address`}`:`No model server answering yet`):ce&&mr.push(`Couldn't read the model list: ${ce}`);let hr=(e,t)=>t<=fr||_.has(e)&&!pr(e),gr=lr.map((e,t)=>({id:e.id,label:e.label,status:t<fr?`done`:t>fr?`pending`:or===`ready`?`done`:qn&&(or===`download`||or===`test`||or===`check`)?`failed`:Dt&&(or===`download`||or===`test`)?`active`:`current`,shown:e.id===ur(sr),onOpen:e.id!==ur(sr)&&hr(e.id,t)?()=>bn(e.id===`plan`?dr:e.id):void 0})),_r=lr.findIndex(e=>e.id===ur(sr)),vr=sr===`gpu`&&d===`check`?.5:LY.indexOf(sr),yr=(0,B.useRef)(vr),br=(0,B.useRef)(`forward`);yr.current!==vr&&(br.current=vr>yr.current?`forward`:`back`,yr.current=vr);let xr=sr===`gpu`?d:sr===`models`||sr===`key`?`plan`:_r>0?lr[_r-1].id===`plan`?dr:lr[_r-1].id:null,Sr=(sr!==`gpu`&&_r>=0&&_r<lr.length-1&&hr(lr[_r+1].id,_r+1)?lr[_r+1].id:null)??(h==null?sr===`check`&&Vt?`plan`:sr===`gpu`?d:null:null);Pn.current={prev:xr,next:Sr};let Cr=sr===`gpu`||sr===`models`||sr===`key`,wr=h!=null&&Dt,Tr=[`server`];wt||Tr.push(`chat`),!wt&&de&&nq(Qn,de)&&Tr.push(`vision`),de&&Qn.some(e=>ZK(e)&&de.ticked.has(e.id))&&Tr.push(`embedding`);for(let e of Qn)de&&eq(e)&&de.ticked.has(e.id)&&!e.downloaded&&Tr.push(e.roles[0]);Tr.push(`agent`);let Er=un.job,Dr=Er?.state===`failed`,Or=Xt?z(P.Fragment,{children:[Er&&Er.state!==`idle`&&Er.state!==`done`&&z(`section`,{className:`setup-agent-download`,"aria-labelledby":`setup-agent-download-title`,children:[L(`h3`,{className:`mc-job-title`,id:`setup-agent-download-title`,children:n(`setup.agent.title`)}),L(LJ,{job:Er,name:qt?.id??`gaiacpp`,onRetry:()=>void fn(),failedNote:n(`setup.agent.carryOnNote`,{name:qt?.current??`gaiapy`}),interrupted:un.interrupted})]}),en&&L(`p`,{className:`setup-error`,role:`alert`,children:n(`setup.agent.saveFailed`,{error:en})}),(nn||!Er&&!en)&&z(`p`,{className:`setup-hint`,role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,n(`setup.download.starting`)]}),A&&L(`section`,{className:`setup-card`,"aria-label":n(`setup.contents.title`),children:L(pJ,{plan:A,models:$n})}),z(Wq,{children:[(Dr||en)&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:gn,disabled:nn,children:n(`setup.agent.carryOn`,{name:qt?.current??`gaiapy`})}),en&&Xt&&L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void mn(Xt),disabled:nn,children:n(`setup.tryAgain`)}),!Dr&&!en&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:hn,disabled:nn,children:n(`setup.progress.cancel`)})]})]}):null,kr=wt&&k.done&&Ne?z(`p`,{className:`setup-ok setup-key-accepted`,role:`status`,children:[L(Yr,{size:14,"aria-hidden":`true`}),` `,n(`setup.key.accepted`,{model:Xc(Ne)})]}):null,Ar=de&&!wt?Qn.filter(e=>eq(e)&&!de.ticked.has(e.id)&&!e.downloaded&&(tq(ir)||!e.roles.includes(`image_creation`))):[],jr=Qn.find(e=>e.fit_code===`memory`&&e.chat_choice&&e.support===`verified`);return z(`main`,{className:`setup`,"aria-labelledby":`setup-title`,children:[L(vY,{steps:gr}),L(Uq,{value:p,children:z(`div`,{className:`setup-pane`,children:[L(`div`,{className:`setup-scroll`,children:z(`div`,{className:`setup-inner`,children:[_r>=0&&z(`nav`,{className:`setup-topnav`,"aria-label":n(`setup.nav.label`),children:[L(`button`,{type:`button`,className:`setup-arrow`,onClick:()=>xr&&bn(xr),disabled:!xr,"aria-label":n(`setup.nav.prev`),children:L(ti,{size:16,"aria-hidden":`true`})}),L(`button`,{type:`button`,className:`setup-arrow`,onClick:()=>Sr&&bn(Sr),disabled:!Sr,"aria-label":n(`setup.nav.next`),children:L(ri,{size:16,"aria-hidden":`true`})}),L(`span`,{children:L(`bdi`,{children:n(`setup.nav.stepOf`,{n:String(_r+1),total:String(lr.length)})})}),h!=null&&h!==or&&L(`button`,{type:`button`,className:`link-btn`,onClick:()=>g(null),children:n.compose(e=>e(`setup.nav.toLive`,{step:e(lr.find(e=>e.id===or)?.key??`setup.download.step`)}))}),L(MJ,{})]}),Ae&&s!==`download`&&z(`div`,{className:`setup-banner`,role:`status`,children:[L(Na,{size:14,"aria-hidden":`true`}),L(`span`,{children:n(`setup.resume.banner`)})]}),Ze&&s!==`download`&&L(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.interrupted`)}),z(`div`,{className:`setup-stage is-${br.current}`,children:[sr===`check`&&z(P.Fragment,{children:[L(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(Vt?`setup.check.headingDone`:`setup.check.heading`)}),L(`p`,{className:`setup-lede`,children:n(rr)}),L(_Y,{hardware:b,hardwareError:C,plan:A,serverRun:Tt,awaitingChoice:!!lt&&!ot}),Tt?.state===`running`&&z(P.Fragment,{children:[L(EJ,{run:Tt,idle:n(`setup.check.serverWorking`),bar:!1}),L(Wq,{children:L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void Fn(),children:n(`setup.progress.cancel`)})})]}),Vt&&A&&L(sY,{plan:A,hardware:b,onChangeMemory:jn&&h==null?()=>Nn(`check`):void 0}),Vt&&h==null&&!(lt&&!ot)&&L(Wq,{children:L(`button`,{type:`button`,className:`btn-primary`,onClick:An,children:n(`setup.continue`)})}),Tt&&qn&&z(P.Fragment,{children:[L(IY,{run:Tt}),Tt.problem?L(PY,{problem:Tt.problem,onRetry:()=>void Bt(!1,{serverOnly:!0}),onUseGaia:()=>void Bt(!0,{serverOnly:!0})}):L(Wq,{children:L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Bt(!!Tt.gaia_lemonade,{serverOnly:!0}),children:n(`setup.tryAgain`)})})]}),ce&&!A&&z(P.Fragment,{children:[L(FY,{text:ce}),z(Wq,{children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void Bt(!1,{keepTrying:ye}),children:n(`setup.models.useRecommended`)}),L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Pt(),children:n(`setup.tryAgain`)})]}),L(`p`,{className:`setup-hint`,children:n(`setup.models.useRecommendedNote`)})]}),ee&&L(FY,{text:ee}),ee&&!Tt&&A&&!A.lemonade.reachable&&L(Wq,{children:L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Bt(!1,{serverOnly:!0}),children:n(`setup.tryAgain`)})}),rt&&A&&(!A.lemonade.reachable&&!Tt||Vt&&h==null&&A.lemonade.mode!==`external`)&&L(NY,{onNothingToOffer:ct,canInstallOwn:!A.lemonade.reachable&&!Tt,onFound:ut,onChosen:e=>{Ye(e===`external`),ft(e),st(!0),Mt(),Pt()}})]}),sr===`plan`&&A&&de&&z(P.Fragment,{children:[L(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.plan.title`)}),L(`p`,{className:`setup-lede`,children:n(`setup.plan.lede`)}),z(`div`,{className:`setup-where`,children:[z(`section`,{className:`setup-hero setup-where-card${Cn===`local`?` is-active`:``}`,"aria-label":n(`setup.plan.label`),onClick:()=>!wr&&wn(`local`),children:[L(`p`,{className:`setup-eyebrow`,children:de.chatChosen?n(`setup.plan.yours`):n(`setup.plan.recommended`)}),z(`p`,{className:`setup-hero-title`,children:[L(`input`,{type:`radio`,name:`setup-where`,checked:Cn===`local`,onChange:()=>wn(`local`),disabled:wr,"aria-labelledby":`setup-where-local`}),L(`bdi`,{id:`setup-where-local`,children:n(`setup.plan.run`,{name:ir?.name??``})})]}),z(`dl`,{className:`setup-facts`,children:[z(`div`,{children:[L(`dt`,{children:n(`setup.summary.download`)}),L(`dd`,{children:L(`bdi`,{dir:`ltr`,children:Ck(gq(A,de).downloadGb??0)})})]}),z(`div`,{children:[L(`dt`,{children:n(`setup.plan.runsOn`)}),L(`dd`,{children:L(`bdi`,{children:ir&&QK(ir)?n(`setup.checks.npu`):b?.gpu_name??n(`setup.plan.cpu`)})})]}),z(`div`,{children:[L(`dt`,{children:n(`setup.plan.diskAfter`)}),L(`dd`,{children:L(`bdi`,{dir:`ltr`,children:gq(A,de).afterGb==null?`—`:Ck(Math.max(0,gq(A,de).afterGb))})})]})]}),z(`ul`,{className:`setup-reasons`,children:[!de.chatChosen&&L(`li`,{children:n(`setup.plan.why.evaluated`)}),!de.chatChosen&&A.left_for_apps_gb!=null&&L(`li`,{children:n(`setup.plan.why.headroom`,{left:Ek(A.left_for_apps_gb)})}),ir&&(ir.fits===!1||ir.fits===!0&&ir.tight)&&L(`li`,{role:`note`,children:kq(ir,n)}),ir?.need_gb!=null&&ir.capacity_gb!=null&&ir.fits&&!ir.tight&&L(`li`,{children:n(`setup.plan.why.fits`,{need:Ek(ir.need_gb),have:Ek(ir.capacity_gb)})}),L(`li`,{children:n(`setup.plan.why.private`)}),ir&&QK(ir)&&L(`li`,{children:n(`setup.plan.why.noImagesNpu`)}),jr&&jr.id!==ir?.id&&jr.need_gb!=null&&jr.capacity_gb!=null&&ir?.fits!==!1&&!ir?.tight&&L(`li`,{children:n(`setup.plan.why.bigger`,{name:jr.name,need:Ek(jr.need_gb),have:Ek(jr.capacity_gb)})})]}),$n.length>0&&L(`p`,{className:`setup-hint`,children:n(`setup.plan.cancelAnytime`)})]}),z(`section`,{className:`setup-hero setup-where-card${Cn===`cloud`?` is-active`:``}${xt?` is-disabled`:``}`,"aria-label":n(`setup.plan.cloudLabel`),onClick:()=>!wr&&!xt&&wn(`cloud`),children:[z(`p`,{className:`setup-hero-title`,children:[L(`input`,{type:`radio`,name:`setup-where`,checked:Cn===`cloud`,onChange:()=>wn(`cloud`),disabled:wr||xt,"aria-labelledby":`setup-where-cloud`}),L(`span`,{id:`setup-where-cloud`,children:n(`setup.plan.cloud`)})]}),xt?L(`p`,{className:`setup-hint`,children:n(`settings.privacy.localOnlyBlocked`)}):z(`ul`,{className:`setup-reasons`,children:[L(`li`,{children:n(`setup.plan.cloudWhy.stillLocal`)}),L(`li`,{children:n(`setup.plan.cloudWhy.key`)}),L(`li`,{children:n(`setup.plan.cloudWhy.sent`)})]})]})]}),z(Wq,{children:[Cn!==`cloud`&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:Sn,disabled:Te||wr,children:n(`setup.plan.customize`)}),Cn===`cloud`?L(`button`,{type:`button`,className:`btn-primary`,onClick:kn,disabled:wr,children:n(`setup.continue`)}):z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>er?Se({kind:`low_disk`}):void yn(!1),disabled:Te||ar||wr,children:[Te&&L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,$n.length?n(`setup.plan.start`):n(`setup.plan.startNoDownload`)]})]}),t&&L(`div`,{className:`setup-row`,children:L(`button`,{type:`button`,className:`link-btn`,onClick:t,children:n(`setup.backToGaia`)})}),ar&&z(`div`,{className:`setup-error`,role:`alert`,children:[L(`p`,{children:n(`setup.blocked`)}),z(`details`,{className:`dl-details`,children:[L(`summary`,{children:n(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:b?.blockers.join(`
|
|
213
|
-
`)})]})]}),er&&L(`p`,{className:`setup-error`,role:`alert`,children:n(`setup.summary.short`,{need:Ck(er.needGb),free:Ck(er.freeGb),drive:n(`setup.summary.theDrive`),freeUp:Ck(er.freeUpGb)})}),(De??ee)&&L(FY,{text:De??ee}),Cn!==`cloud`&&z(`details`,{className:`setup-disclosure`,children:[L(`summary`,{children:n(`setup.plan.whatDownloads`)}),L(pJ,{plan:A,models:$n})]})]}),sr===`gpu`&&_e&&z(P.Fragment,{children:[L(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.gpu.title`)}),L(`p`,{className:`setup-lede`,children:n(`setup.gpu.lede`)}),L(eJ,{status:_e,onStatus:ve,mode:`setup`,headingId:`setup-title`,names:Kn,cloud:a!==`local`,onBack:Mn,onSkip:()=>bn(d),onContinue:()=>bn(d)})]}),sr===`models`&&z(P.Fragment,{children:[L(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.models.title`)}),A&&de&&L(qJ,{plan:A,selection:de,onSelection:fe,disabled:Te||wr,onRecheck:()=>void Pt()}),jn&&_e?.total_gb!=null&&_e.gpu_gb!=null&&z(`p`,{className:`setup-hint setup-gpu-option`,children:[n(`setup.models.gpu`,{gpu:Ck(_e.gpu_gb),total:Ck(_e.total_gb)}),` `,L(`button`,{type:`button`,className:`link-btn`,onClick:()=>Nn(`models`),disabled:Te||wr,children:n(`setup.found.changeMemory`)})]}),L(VJ,{disabled:Te||wr,pending:qt?.id??null,onPending:Yt}),L(tJ,{plan:A,planError:ce,onRetryPlan:()=>void Pt(),onUseRecommended:()=>void Bt(!1,{keepTrying:ye}),selection:de,onSelection:fe,cloud:!1,keepTrying:ye,onKeepTrying:be,onBack:Mn,onContinue:e=>void yn(e),busy:Te||wr,error:De??ee})]}),sr===`key`&&z(`form`,{id:`setup-key-form`,onSubmit:e=>{e.preventDefault(),Bn()},className:`setup-form`,children:[L(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.key.title`)}),L(MB,{className:`setup-choices`,"aria-label":n(`setup.key.provider`),children:EY.filter(e=>e.id!==`local`&&(e.id!==`amd`||bt)).map(e=>z(`button`,{type:`button`,role:`radio`,"aria-checked":a===e.id,className:`setup-choice${a===e.id?` is-active`:``}${St(e.id)?` is-disabled`:``}`,onClick:()=>Hn(e.id),disabled:k.busy||St(e.id),title:yt(e.id)?n(`settings.privacy.localOnlyBlocked`):void 0,children:[L(xi,{size:16,"aria-hidden":`true`}),z(`span`,{children:[L(`span`,{className:`setup-choice-title`,children:L(`bdi`,{children:DY(e,n)})}),L(`span`,{className:`setup-choice-note`,children:St(e.id)?Ct(e.id):n(e.note)})]})]},e.id))}),mt?.reachable===!1&&bt&&L(`button`,{type:`button`,className:`link-btn setup-start`,onClick:gt,children:n(`setup.key.checkAgain`)}),yt(a)&&L(`p`,{className:`setup-a11y-alert`,role:`alert`,children:n(`settings.privacy.localOnlyBlocked`)}),a===`fireworks`&&!Je&&!yt(a)&&z(`section`,{className:`setup-card`,children:[L(`h3`,{className:`mc-job-title`,children:n(`setup.key.getOne`)}),z(`ol`,{className:`setup-key-steps`,children:[L(`li`,{children:L(`a`,{href:wY,target:`_blank`,rel:`noreferrer`,children:n(`setup.key.step1`)})}),L(`li`,{children:n(`setup.key.step2`)}),L(`li`,{children:n(`setup.key.step3`)})]})]}),a===`amd`&&!Je&&!yt(a)&&L(`section`,{className:`setup-card`,children:L(`p`,{className:`setup-hint`,children:L(`a`,{href:TY,target:`_blank`,rel:`noreferrer`,children:n(`setup.key.gatewayHelp`)})})}),!yt(a)&&L(HK,{provider:a,limit:3,picked:Fe,onPick:Ie,onDefault:Re,pickDisabled:k.busy||wr}),!Je&&z(P.Fragment,{children:[L(`label`,{className:`setup-key-label`,htmlFor:`setup-key-input`,children:n(`setup.key.labelFor`,{provider:DY(EY.find(e=>e.id===a)??EY[1],n)})}),z(`div`,{className:`setup-row setup-key-row`,children:[L(`input`,{id:`setup-key-input`,className:`settings-input`,type:ze?`text`:`password`,autoComplete:`off`,spellCheck:!1,value:ne,onChange:e=>re(e.target.value),placeholder:F?n.bare(`setup.key.placeholder`):n.bare(`setup.key.placeholderNew`)}),L(`button`,{type:`button`,className:`btn-secondary setup-key-show`,"aria-label":n(ze?`setup.key.hide`:`setup.key.show`),title:n(ze?`setup.key.hide`:`setup.key.show`),onClick:()=>Be(e=>!e),children:L(ze?Gi:qi,{size:14,"aria-hidden":`true`})})]})]}),L(`p`,{className:`setup-hint`,children:n(Je?`setup.key.usersServer`:`setup.key.where`)}),N&&!Je&&!ne&&L(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.key.foundEnv`,{name:N.name,hint:N.key_hint??``})}),k.busy&&!k.waiting&&L(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.key.testing`)}),k.busy&&k.waiting&&L(`p`,{className:`setup-hint`,role:`status`,children:k.waiting}),k.error&&L(`p`,{className:`setup-error`,role:`alert`,children:k.error}),z(Wq,{children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:xn,disabled:k.busy,children:n(`setup.back`)}),z(`button`,{type:`submit`,form:`setup-key-form`,className:`btn-primary`,disabled:k.busy||St(a)||wr,children:[k.busy&&L(Za,{size:13,className:`spin`}),` `,n(`setup.key.connect`)]})]})]}),sr===`download`&&!Et&&z(P.Fragment,{children:[L(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.download.title`)}),L(`p`,{className:`setup-lede`,children:n(`setup.download.lede`)}),kr,Or??z(`p`,{className:`setup-hint`,role:`status`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,n(`setup.download.starting`)]})]}),sr===`download`&&Et&&z(P.Fragment,{children:[L(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.download.title`)}),L(`p`,{className:`setup-lede`,children:n(`setup.download.lede`)}),kr,A&&L(`section`,{className:`setup-card`,"aria-label":n(`setup.contents.title`),children:L(pJ,{plan:A,run:Et,onRetry:Ht,retryDisabled:Te})}),(Et.models?.length??0)>0?L(`div`,{className:D?`is-stale`:void 0,children:L(TJ,{status:{...Et,overall:Sq(Et,j??A)},names:Kn,freeGb:A?.disk?.free_gb??null,onCancel:()=>void Fn(),onRetry:(e,t)=>void In(e,t),onResume:e=>void In(e,null),onResumeAll:Ht,onSkip:e=>void Ln(e),onRestart:()=>void zn(),busy:Te||!!D,retryLater:Dt,labelledBy:`setup-title`})}):Dt?z(P.Fragment,{children:[L(EJ,{run:Et,plan:A,idle:n(`setup.download.working`)}),L(Wq,{children:L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void Fn(),disabled:Te,children:n(`setup.progress.cancel`)})})]}):null,Ar.length>0&&z(`section`,{className:`setup-card`,"aria-label":n(`setup.optional.title`),children:[L(`h3`,{className:`mc-job-title`,children:n(`setup.optional.title`)}),L(`p`,{className:`setup-hint`,children:n(`setup.optional.lede`)}),L(`ul`,{className:`setup-rows`,children:Ar.map(e=>{let t=Ue.includes(e.id);return z(`li`,{className:`setup-result is-waiting`,children:[L(`span`,{className:`setup-result-label`,children:n(`setup.purpose.${e.roles[0]}`)}),z(`span`,{className:`setup-result-value`,children:[L(`bdi`,{dir:`ltr`,children:e.size_gb==null?n(`setup.contents.sizeOnDownload`):Ck(e.size_gb)}),L(`button`,{type:`button`,className:`btn-secondary`,"aria-pressed":t,onClick:()=>We(n=>t?n.filter(t=>t!==e.id):[...n,e.id]),children:n(t?`setup.optional.added`:`setup.optional.add`)})]})]},e.id)})})]}),D&&z(P.Fragment,{children:[L(`p`,{className:`setup-error`,role:`alert`,children:n(`setup.lostContact`,{error:D})}),L(Wq,{children:L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void zt(),children:n(`setup.reconnect`)})})]}),qn&&Xn&&!Zn&&Et.state===`failed`&&!Et.model_failed&&(Et.problem?L(PY,{problem:Et.problem,onRetry:Ht,onUseGaia:()=>void Bt(!0,$e.current.options)}):z(`div`,{className:`setup-error`,role:`alert`,children:[L(`p`,{children:n(`setup.download.stoppedBeforeCheck`)}),Et.error&&z(`details`,{className:`dl-details`,children:[L(`summary`,{children:n(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:Et.error})]})]})),qn&&Xn&&!Zn&&z(P.Fragment,{children:[L(`p`,{className:`setup-hint`,children:n(`setup.download.finishNote`)}),L(Wq,{children:L(`button`,{type:`button`,className:`btn-primary`,onClick:Ht,disabled:Te,children:n(`setup.finish`)})})]}),qn&&!Xn&&!Zn&&!(Et.models??[]).some(e=>e.state===`failed`||e.state===`cancelled`)&&z(P.Fragment,{children:[L(IY,{run:Et}),Et.problem?L(PY,{problem:Et.problem,onRetry:Ht,onUseGaia:()=>void Bt(!0,$e.current.options)}):L(Wq,{children:L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Bt(!!Et.gaia_lemonade,$e.current.options),children:n(`setup.tryAgain`)})})]}),(De||ee)&&L(FY,{text:De??ee})]}),sr===`test`&&Et&&z(P.Fragment,{children:[L(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.test.title`)}),L(`p`,{className:`setup-lede`,children:n(`setup.test.lede`)}),L(CY,{run:Et,expected:Tr,names:Kn,catalog:Qn,onRetry:Ht,onChooseAnother:wt?void 0:Sn,onCancel:()=>void Fn(),onDownloadAgain:A?.lemonade.mode===`external`?void 0:e=>void In(e,`verify`),busy:Te}),qn&&Et.error&&!(Et.tests??[]).some(e=>e.error===Et.error)&&z(`details`,{className:`dl-details`,children:[L(`summary`,{children:n(`setup.progress.details`)}),L(`pre`,{dir:`ltr`,children:Et.error})]}),(De||ee)&&L(FY,{text:De??ee})]}),sr===`ready`&&z(P.Fragment,{children:[L(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.ready.heading`)}),z(`div`,{className:`setup-done`,role:`status`,children:[L(`div`,{className:`setup-done-head`,children:Wn&&L(`p`,{children:n(wt?`setup.ready.answersCloud`:`setup.ready.answersLocal`,{model:wt?Uc(Wn):Kn[Wn]??M?.catalog?.find(e=>e.id===Wn)?.name??Uc(Wn)})})}),L(Wq,{children:L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Gn(),autoFocus:!0,children:n(`setup.ready.start`)})}),!wt&&M&&L(nJ,{plan:M,chatModel:Wn,gpu:_e}),ee&&L(FY,{text:ee}),(Et?.tests??[]).filter(e=>e.state===`failed`).map(e=>L(`p`,{className:`setup-failed-extra`,role:`alert`,children:n(`setup.ready.extraFailed`,{job:n(`setup.test.job.${e.job}`)})},`${e.job}:${e.subject??``}`)),Ge.length>0&&!xe&&L(`p`,{className:`setup-failed-extra`,role:`alert`,children:n(`setup.ready.extraNotFetched`,{names:Ge.map(e=>Kn[e]??e).join(`, `)})}),Yn.length>0&&z(P.Fragment,{children:[L(`p`,{className:`setup-hint`,children:n(`setup.ready.tasks`)}),L(sJ,{cards:Yn,onPick:e=>void Gn(e)})]})]})]}),T?.state===`failed`&&L(hY,{})]},sr),t&&!Dt&&sr!==`plan`&&sr!==`ready`&&L(`div`,{className:`setup-row`,children:L(`button`,{type:`button`,className:`link-btn setup-close`,onClick:t,children:n(`setup.backToGaia`)})}),wr&&(Cr||sr===`plan`)&&L(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.nav.runGoing`)}),L(jJ,{run:T,before:{check:mr},failed:Jn})]})}),L(`div`,{className:`setup-footer`,ref:m})]})}),xe?.kind===`no_fit`&&L(Gq,{title:yq(xe.models)?n(`setup.confirm.tightOne`,{name:xe.models[0].name}):xe.models.length===1?n(`setup.confirm.noFitOne`,{name:xe.models[0].name}):n(`setup.confirm.noFitMany`),confirmLabel:yq(xe.models)?n(`setup.confirm.useAnyway`):n(`setup.confirm.downloadAnyway`),cancelLabel:n(`setup.confirm.pickSmaller`),onConfirm:()=>{Se(null),we(!0),yn(Wt,!0)},onCancel:()=>Se(null),children:xe.models.map(e=>z(`p`,{children:[L(`bdi`,{children:e.name}),`: `,kq(e,n)]},e.id))}),xe?.kind===`low_disk`&&er&&L(Gq,{title:n(`setup.confirm.lowDiskTitle`),confirmLabel:n(`setup.confirm.downloadAnyway`),cancelLabel:n(`setup.confirm.changeModels`),onConfirm:()=>{Se(null),yn(!0)},onCancel:()=>{Se(null),Sn()},children:L(`p`,{children:n(`setup.summary.short`,{need:Ck(er.needGb),free:Ck(er.freeGb),drive:n(`setup.summary.theDrive`),freeUp:Ck(er.freeUpGb)})})}),xe?.kind===`server`&&L(Gq,{title:xe.detail.code===`low_disk`?n(`setup.confirm.lowDiskTitle`):n(`setup.confirm.noFitServerTitle`),confirmLabel:xe.detail.code===`low_disk`?n(`setup.confirm.downloadAnyway`):n(`setup.confirm.useAnyway`),cancelLabel:n(`setup.confirm.changeModels`),onConfirm:()=>{let e=xe;if(Se(null),e.then===`chat`)we(!0),yn(Wt,!0);else if(e.then===`retry`)Ke(e.id,{keepTrying:ye,acknowledgeLowDisk:!0}).then(E).catch(e=>ke(HY(e)));else{let{gaiaLemonade:e,options:t}=$e.current;Bt(e,{...t,acknowledgeLowDisk:!0})}},onCancel:()=>{let e=xe;Se(null),e.then!==`retry`&&!Ot&&Sn()},children:L(`p`,{children:xe.detail.message})})]})}function WY({title:e,titleId:t,count:n,hint:r,defaultOpen:i=!1,forceOpen:a=!1,targetId:o,children:s}){let[c,l]=(0,B.useState)(i);return z(`details`,{className:`settings-disclosure`,"data-settings-target":o,open:c||a,onToggle:e=>{a||l(e.currentTarget.open)},children:[z(`summary`,{onClick:e=>{a&&e.preventDefault()},children:[L($r,{size:15,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),z(`span`,{className:`settings-disclosure-text`,children:[L(`span`,{className:`settings-disclosure-title`,id:t,tabIndex:t?-1:void 0,children:e}),r&&L(`span`,{className:`settings-disclosure-hint`,children:r})]}),n!=null&&L(`bdi`,{dir:`ltr`,className:`settings-disclosure-count`,children:n})]}),L(`div`,{className:`settings-disclosure-body`,children:s})]})}var GY=We(mu()?`settings.desktop.menuBar`:`settings.desktop.tray`),KY=[{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`}],qY=new Set([`startMinimized`]),JY={minimizeToTray:`settings.desktop.keepRunningNoTray`};function YY(e){return e?.reason===`no-host`?`settings.desktop.noTray`:e?.reason===`check-failed`?`settings.desktop.noTrayCheckFailed`:null}function XY(){let e=R(),t=window.gaiaAPI?.tray,[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null);(0,B.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,B.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=YY(i);return L(WY,{title:e(`settings.desktop.title`),children:z(`div`,{className:`settings-field`,role:`group`,"aria-labelledby":`desktop-app-label`,children:[L(`span`,{className:`settings-label`,id:`desktop-app-label`,children:e(`settings.desktop.title`)}),KY.map(({key:t,label:r,hint:i})=>{let a=qY.has(t)?d:null,o=d&&JY[t]||i;return z(`div`,{children:[z(`label`,{className:`setting-row`,children:[L(`span`,{children:e(r,{tray:GY})}),z(`span`,{className:`toggle-switch`,children:[L(`input`,{id:`desktop-${t}`,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:GY})}),L(`span`,{className:`toggle-track`})]})]}),L(`p`,{className:`settings-hint`,id:`desktop-${t}-hint`,children:a?e(a):e(o,{tray:GY})})]},t)}),o&&L(`p`,{className:`settings-error`,role:`alert`,children:o})]})})}function ZY(){return window.gaiaUpdater}function QY({onClose:e,manualInstall:t=!1}){let n=R(),[r,i]=(0,B.useState)({kind:`loading`}),a=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=ZY();e?e.listReleases().then(e=>{i(Array.isArray(e)?{kind:`list`,releases:e}:{kind:`error`,message:e.error})}).catch(()=>{i({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`})}):i({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`})},[]),ut(!0,e),un(a,!0),(0,B.useEffect)(()=>{let e=a.current;e&&e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)?.focus()},[]),(0,B.useEffect)(()=>{let e=a.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 o(e,t){e.isCurrent||i({kind:`confirm`,release:e,releases:t})}async function s(t){i({kind:`installing`});let r=ZY();if(!r)i({kind:`error`,message:n(`update.picker.noBridge`)});else try{await r.installVersion(t.tag),e()}catch(e){i({kind:`error`,message:n(`update.picker.failed`,{reason:pY(e)})})}}function c(e){if(!e)return``;try{return new Date(e).toLocaleDateString(On(n),{year:`numeric`,month:`short`,day:`numeric`})}catch{return e}}return L(`div`,{className:`version-picker-overlay`,onClick:t=>{t.target===t.currentTarget&&e()},children:z(`div`,{className:`version-picker-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`update.picker.title`),ref:a,children:[z(`div`,{className:`version-picker-header`,children:[L(`h3`,{children:n(`update.picker.title`)}),L(`button`,{className:`version-picker-close`,onClick:e,"aria-label":n(`update.picker.close`),type:`button`,children:`×`})]}),z(`div`,{className:`version-picker-body`,children:[r.kind===`loading`&&z(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[L(`span`,{className:`version-picker-spinner`}),n(`update.picker.loading`)]}),r.kind===`error`&&z(`div`,{className:`version-picker-error`,children:[L(`p`,{children:r.message}),L(`p`,{children:L(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:n(`update.picker.browse`)})})]}),r.kind===`list`&&L(`ul`,{className:`version-picker-list`,role:`listbox`,"aria-label":n(`update.picker.listAria`),children:r.releases.map(e=>L(`li`,{children:z(`button`,{type:`button`,className:`version-picker-row`,"data-version":e.version,"aria-label":e.isCurrent?n(`update.picker.rowInstalled`,{version:e.version}):e.isPinned?n(`update.picker.rowPinned`,{version:e.version}):e.version,"aria-disabled":e.isCurrent?`true`:`false`,onClick:()=>o(e,r.releases),disabled:e.isCurrent,children:[L(`span`,{className:`vp-version`,children:e.version}),L(`span`,{className:`vp-date`,children:c(e.date)}),e.isCurrent&&L(`span`,{className:`vp-badge vp-badge-current`,children:n(`update.picker.installed`)}),e.isPinned&&!e.isCurrent&&L(`span`,{className:`vp-badge vp-badge-pinned`,children:n(`update.picker.pinned`)}),!e.isCurrent&&L(`span`,{className:`vp-arrow`,"aria-hidden":`true`,children:`›`})]})},e.tag))}),r.kind===`list`&&z(`p`,{className:`version-picker-more`,children:[n(`update.picker.recent`,{n:r.releases.length}),` `,L(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:n(`update.picker.browseAll`)})]}),r.kind===`confirm`&&z(`div`,{className:`version-picker-confirm`,children:[t?L(`p`,{children:n(`update.picker.manual`,{version:r.release.version})}):z(P.Fragment,{children:[L(`p`,{children:n(`update.picker.confirm`,{version:r.release.version})}),L(`p`,{className:`vp-confirm-note`,children:n(`update.picker.confirmNote`,{version:r.release.version})})]}),z(`div`,{className:`vp-confirm-actions`,children:[L(`button`,{type:`button`,className:`vp-btn-cancel`,onClick:()=>i({kind:`list`,releases:r.releases}),children:n(`update.picker.back`)}),t?L(`a`,{className:`vp-btn-confirm`,href:r.release.notesUrl??`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noopener noreferrer`,children:n(`update.picker.openRelease`)}):L(`button`,{type:`button`,className:`vp-btn-confirm`,onClick:()=>s(r.release),children:n(`update.picker.install`)})]})]}),r.kind===`installing`&&z(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[L(`span`,{className:`version-picker-spinner`}),n(`update.picker.starting`)]})]})]})})}var $Y=`https://github.com/amd/gaia/releases`;function eX(e){return/^\d+\.\d+\.\d+-/.test(e??``)}function tX(e,t){let n=e.version??``;if(e.readFailed)return t(`update.status.readFailed`);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 nX(){let e=uY(),t=R(),n=cY(),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1);if(!n)return null;async function l(e,r){if(n){i(!0),o(null);try{await r(n)}catch(n){F.system.error(`${e} failed`,n),o(t(`update.settings.failed`,{action:We(e),reason:pY(n)}))}finally{i(!1)}}}let u=e.status===`disabled`,d=r||e.status===`checking`||e.status===`downloading`,f=e.readFailed?tX(e,t):`${t(`update.settings.running`,{version:e.currentVersion??t(`update.settings.unknownVersion`)})} ${tX(e,t)}`,p=[`available`,`downloaded`,`error`].includes(e.status)||!!e.pinnedVersion||!!e.installFailed||!!e.configError||!!e.readFailed||!!a;return L(WY,{title:t(`update.settings.title`),titleId:`updates-label`,hint:f,forceOpen:p,children:z(`div`,{className:`settings-field`,role:`group`,"aria-labelledby":`updates-label`,children:[L(`p`,{className:`visually-hidden`,role:`status`,children:f}),!e.manualInstall&&z(P.Fragment,{children:[z(`label`,{className:`setting-row`,children:[L(`span`,{children:t(`update.settings.auto`)}),z(`span`,{className:`toggle-switch`,children:[L(`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))}}),L(`span`,{className:`toggle-track`})]})]}),L(`p`,{className:`settings-hint`,id:`updates-auto-hint`,children:t(`update.settings.autoHint`)})]}),z(`label`,{className:`setting-row`,children:[L(`span`,{children:t(`update.settings.rc`)}),z(`span`,{className:`toggle-switch`,children:[L(`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))}}),L(`span`,{className:`toggle-track`})]})]}),z(`p`,{className:`settings-hint`,id:`updates-rc-hint`,children:[t(`update.settings.rcHint`),eX(e.currentVersion)&&` ${t(`update.settings.rcHintRunning`)}`]}),e.pinnedVersion&&z(`p`,{className:`settings-hint`,children:[t(`update.settings.pinned`,{version:e.pinnedVersion}),` `,L(`button`,{type:`button`,className:`btn-secondary`,disabled:r,onClick:()=>void l(`update.action.resume`,e=>e.resumeUpdates()),children:t(`update.settings.unpin`)})]}),z(`div`,{className:`setting-actions`,children:[e.status===`available`&&e.manualInstall&&L(`a`,{className:`btn-primary update-download-link`,href:e.downloadUrl??$Y,target:`_blank`,rel:`noopener noreferrer`,"aria-describedby":`updates-manual-hint`,children:t(`update.settings.downloadVersion`,{version:e.version??``})}),e.status===`available`&&!e.manualInstall&&!e.pinnedVersion&&L(`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`&&L(`button`,{type:`button`,className:`btn-primary`,disabled:r,onClick:()=>void l(`update.action.restart`,e=>e.restart()),children:t(`update.settings.restart`)}),e.readFailed?L(`button`,{type:`button`,className:`btn-secondary`,disabled:r,onClick:async()=>{i(!0);try{await e.reload()}finally{i(!1)}},children:t(`update.settings.retryRead`)}):L(`button`,{type:`button`,className:`btn-secondary`,disabled:d||u,onClick:()=>void l(`update.action.check`,e=>e.check()),children:t(`update.settings.check`)}),L(`button`,{type:`button`,className:`btn-secondary`,disabled:d||u,onClick:()=>c(!0),children:t(`update.settings.pick`)}),e.previousVersion&&L(`button`,{type:`button`,className:`btn-secondary`,"aria-describedby":`updates-back-hint`,disabled:d||u,onClick:()=>void l(`update.action.goBack`,e=>e.revertUpdate()),children:t(`update.settings.goBack`,{version:e.previousVersion})})]}),e.status===`available`&&e.manualInstall&&L(`p`,{className:`settings-hint`,id:`updates-manual-hint`,children:t(`update.settings.manualHint`)}),e.previousVersion&&L(`p`,{className:`settings-hint`,id:`updates-back-hint`,children:t(`update.settings.goBackHint`)}),e.installFailed&&L(`p`,{className:`settings-error`,role:`alert`,children:t(`update.settings.installFailed`,{...e.installFailed,url:$Y})}),e.lastCheckError&&L(`p`,{className:`settings-hint`,children:t(`update.settings.lastCheckError`,{reason:e.lastCheckError})}),e.configError&&L(`p`,{className:`settings-error`,role:`alert`,children:e.configError}),a&&L(`p`,{className:`settings-error`,role:`alert`,children:a}),s&&L(QY,{onClose:()=>c(!1),manualInstall:e.manualInstall})]})})}var rX=[{value:`light`,label:`settings.theme.light`},{value:`dark`,label:`settings.theme.dark`},{value:`system`,label:`settings.theme.system`}],iX={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`};function aX(){let e=R(),t=N(e=>e.locale),n=N(e=>e.setLocale),r=N(e=>e.themePreference),i=N(e=>e.setThemePreference),a=N(e=>e.palette),o=N(e=>e.setPalette),s=N(e=>e.customColors),c=N(e=>e.setCustomColors),l=_W(e=>e.visible),u=_W(e=>e.setVisible),d=e=>t=>c({...s,[e]:t.target.value.toUpperCase()});return z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.general`)}),z(`div`,{className:`settings-field`,children:[L(`label`,{className:`settings-label`,htmlFor:`ui-language`,children:e(`settings.language`)}),L(`select`,{id:`ui-language`,className:`settings-input`,value:t,onChange:e=>n(e.target.value),children:_e.map(({meta:e})=>L(`option`,{value:e.code,lang:e.code,dir:e.dir,children:ir(e)},e.code))}),L(`span`,{className:`settings-hint`,children:e(`settings.languageHint`)})]}),z(`div`,{className:`settings-field`,children:[L(`span`,{className:`settings-label`,id:`appearance-label`,children:e(`settings.appearance`)}),L(MB,{className:`segmented`,"aria-labelledby":`appearance-label`,children:rX.map(t=>L(`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))})]}),z(`div`,{className:`settings-field`,children:[z(`label`,{className:`setting-row`,children:[L(`span`,{children:e(`resources.settings`)}),z(`span`,{className:`toggle-switch`,children:[L(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),"aria-label":e(`resources.settings`),"aria-describedby":`resources-hint`}),L(`span`,{className:`toggle-track`})]})]}),L(`span`,{className:`settings-hint`,id:`resources-hint`,children:e(`resources.settingsHint`)})]}),z(WY,{title:e(`settings.colors`),titleId:`palette-label`,defaultOpen:a===`custom`,children:[z(MB,{className:`palette-grid`,"aria-labelledby":`palette-label`,children:[ae.map(t=>z(`button`,{type:`button`,role:`radio`,"aria-checked":a===t.id,className:`palette-tile${a===t.id?` is-active`:``}`,onClick:()=>o(t.id),children:[L(`span`,{className:`palette-swatch`,"aria-hidden":`true`,children:t.swatch.map(e=>L(`i`,{style:{background:e}},e))}),e(iX[t.id])]},t.id)),z(`button`,{type:`button`,role:`radio`,"aria-checked":a===`custom`,className:`palette-tile${a===`custom`?` is-active`:``}`,onClick:()=>o(`custom`),children:[z(`span`,{className:`palette-swatch`,"aria-hidden":`true`,children:[L(`i`,{style:{background:s.base}}),L(`i`,{style:{background:s.accent}})]}),e(`settings.colors.custom`)]})]}),a===`custom`&&z(`div`,{className:`palette-custom`,children:[z(`label`,{className:`palette-color`,htmlFor:`custom-accent`,children:[L(`input`,{id:`custom-accent`,type:`color`,value:s.accent,onChange:d(`accent`)}),z(`span`,{children:[e(`settings.colors.accent`),L(`small`,{children:e(`settings.colors.accentHint`)})]})]}),z(`label`,{className:`palette-color`,htmlFor:`custom-base`,children:[L(`input`,{id:`custom-base`,type:`color`,value:s.base,onChange:d(`base`)}),z(`span`,{children:[e(`settings.colors.base`),L(`small`,{children:e(`settings.colors.baseHint`)})]})]}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>c(wn),children:e(`settings.colors.reset`)}),L(`p`,{className:`settings-hint`,children:e(`settings.colors.hint`)})]})]}),L(XY,{}),L(nX,{}),L(WY,{title:e(`settings.shortcuts`),children:L(`dl`,{className:`shortcut-list`,children:zK().map(({label:t,keys:n})=>z(`div`,{className:`shortcut-row`,children:[L(`dt`,{children:L(`kbd`,{children:vu(n)})}),L(`dd`,{children:e(t)})]},t))})})]})}function oX(e){return/not reachable|not answering|model server at|ConnectionPool|NewConnectionError|Connection refused|Max retries/i.test(e)}function sX(e){return/gaia init/i.test(e??``)}var cX=`GAIA doesn't run this model server, so it can't start it. Start it the way you usually do.`;function lX(e,t){return t?t===cX?e(`server.otherServerStart`):t:null}function uX(e){return!!e&&!e.lemonade_running&&(sX(e.start_command)||sX(e.start_instruction))}function dX({className:e=`btn-secondary`}){let t=R();return L(`button`,{type:`button`,className:e,onClick:()=>window.dispatchEvent(new CustomEvent(`gaia:set-up-local`)),children:t(`settings.errors.setUpLocal`)})}function fX({message:e,onRetry:t}){let n=R(),r=N(e=>uX(e.systemStatus));return oX(e)?z(`div`,{className:`settings-notice`,role:`alert`,children:[L(`strong`,{children:n(r?`settings.errors.notInstalledTitle`:`settings.errors.serverDownTitle`)}),L(`p`,{children:n(r?`settings.errors.notInstalled`:`settings.errors.serverDown`)}),r&&L(dX,{className:`btn-primary`}),t&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:t,children:n(`settings.key.checkAgain`)}),z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[L($r,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,n(`settings.errors.details`)]}),L(`bdi`,{dir:`ltr`,className:`settings-notice-raw`,children:e})]})]}):L(`p`,{className:`settings-error`,role:`alert`,children:e})}function pX({onAdded:e}){let t=R(),[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(null),f=(0,B.useRef)(``),p=(0,B.useCallback)(async e=>{let t=n.trim();f.current=t,l(`check`),d(null);try{let n=await Cn(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,B.useCallback)(async()=>{l(`add`),d(null);try{let{report:o}=await vt(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 z(`form`,{className:`settings-field custom-model-add`,onSubmit:e=>{e.preventDefault(),p(``)},children:[L(`label`,{className:`visually-hidden`,htmlFor:`custom-model-url`,children:t(`settings.custom.title`)}),L(`span`,{className:`settings-hint`,children:t(`settings.custom.hint`)}),z(`div`,{className:`settings-row`,children:[L(`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`}),z(`button`,{type:`submit`,className:`btn-secondary`,disabled:c!==null||!n.trim(),children:[c===`check`?L(Za,{size:13,className:`spin`}):null,` `,t(`settings.custom.check`)]})]}),o&&(()=>{let e=L(`ul`,{className:`custom-model-checks`,"aria-label":t(`settings.custom.checks`),children:o.checks.map(e=>z(`li`,{className:e.ok?`is-ok`:`is-failed`,children:[e.ok?L(Yr,{size:13,"aria-label":t(`settings.custom.passed`)}):L(nc,{size:13,"aria-label":t(`settings.custom.failed`)}),z(`bdi`,{children:[L(`strong`,{children:e.label}),` — `,e.detail]})]},e.id))});return o.ok?z(`details`,{className:`custom-model-checks-summary`,children:[z(`summary`,{children:[L(Yr,{size:13,"aria-hidden":`true`}),` `,t(`settings.custom.allPassed`,{n:o.checks.length})]}),e]}):e})(),o&&o.warnings.length>0&&L(`ul`,{className:`custom-model-checks`,"aria-label":t(`settings.custom.warnings`),children:o.warnings.map(e=>z(`li`,{className:`is-warning`,children:[L(Ws,{size:13,"aria-label":t(`settings.custom.warning`)}),` `,L(`bdi`,{children:e})]},e))}),o&&o.variants.length>1&&z(`div`,{className:`settings-row`,children:[L(`label`,{className:`settings-hint`,htmlFor:`custom-model-quant`,children:t(`settings.custom.quantization`)}),L(`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=>z(`option`,{value:e.file,children:[e.quant,` · `,e.size_gb,` GB`,e.fits?``:` · ${t.bare(`settings.custom.tooLarge`)}`]},e.file))})]}),o?.ok&&z(`div`,{className:`settings-row`,children:[z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void m(),disabled:c!==null,children:[c===`add`?L(Za,{size:13,className:`spin`}):null,` `,t(`settings.custom.add`,{name:o.display_name??``})]}),L(`span`,{className:`settings-hint`,children:t(`settings.model.sizeDownload`,{size:`${o.size_gb} GB`})})]}),u&&L(fX,{message:u})]})}function mX(e){return e instanceof Error?e.message:String(e)}function hX(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}function gX({downloadsSlot:e}){let t=R(),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)(null),b=xl(e=>e.status),x=xl(e=>e.started),S=(0,B.useMemo)(()=>vl(b,x),[b,x]),C=xl(e=>e.error),w=xl(e=>e.refresh),T=xl(e=>e.enqueue),E=xl(e=>e.cancel),D=(0,B.useCallback)(async(e=!1)=>{a(null);try{let t=await En();r(t),s(n=>e||!n?uq(t):n)}catch(e){a(mX(e))}},[]);(0,B.useEffect)(()=>{D(!0),w(),(async()=>{try{_(await Xe()??null)}catch(e){y(mX(e))}})()},[D,w]);let O=(S?.models??[]).filter(e=>e.state===`ready`).map(e=>e.id).join(`,`),ee=(0,B.useRef)(O);(0,B.useEffect)(()=>{O!==ee.current&&(ee.current=O,D(!0))},[O,D]);let te=(0,B.useMemo)(()=>{let e={};for(let t of S?.models??[])e[t.id]=t;return e},[S]),ne=(0,B.useMemo)(()=>{let e={};for(let t of n?.catalog??[])e[t.id]=t.name;return e},[n]),re=(0,B.useMemo)(()=>n?uq(n):null,[n]),k=YK(n),ie=n&&o?hq(k,o).filter(e=>te[e.id]?.state!==`downloading`):[],ae=ie.reduce((e,t)=>e+(t.size_gb??0),0),A=!!n&&!!o&&!!re&&(!hX(o.ticked,re.ticked)||o.defaultChat!==re.defaultChat||ie.length>0),oe=(0,B.useCallback)(async(e,i)=>{if(!n||!o)return;if(p(null),!e){let e=vq(k,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=_q(n,o);if(a&&!i)l({kind:`low_disk`,message:a.drop?t(`setup.summary.shortDrop`,{need:Ck(a.needGb),free:Ck(a.freeGb),drive:Nq(n.disk?.path??null)??t(`setup.summary.theDrive`),freeUp:Ck(a.freeUpGb),name:a.drop.name,saves:Ck(a.drop.size_gb??0)}):t(`setup.summary.short`,{need:Ck(a.needGb),free:Ck(a.freeGb),drive:Nq(n.disk?.path??null)??t(`setup.summary.theDrive`),freeUp:Ck(a.freeUpGb)})});else{d(!0);try{let i=n,a=!1;if(o.defaultChat&&o.defaultChat!==i.chat_model.id){a=!0;try{i=await me(o.defaultChat,e||m)}catch(e){let t=kt(e);if(t){l({kind:`server`,detail:t});return}throw e}}for(let e of bq(i,o))i=await Rn(e.id,e.skipped);let c=hq(YK(i),o).map(e=>e.id).filter(e=>te[e]?.state!==`downloading`);r(i),s({...o,defaultChat:i.chat_model.id});let u=null;if(a&&i.chat_model.downloaded)try{await zc.getState().select(i.chat_model.id)}catch(e){u=mX(e),zc.getState().refresh()}else zc.getState().refresh();c.length&&await T(c,{acknowledgeLowDisk:!0}),p(u===null?{ok:!0,text:t(`settings.models.applied`)}:{ok:!1,text:t(`settings.models.appliedNotSwitched`,{reason:u})})}catch(e){p({ok:!1,text:mX(e)})}finally{d(!1)}}},[n,o,k,m,te,T,t]),se=(0,B.useCallback)(async e=>{l(null),d(!0),p(null);try{let n=await Oe(e.id);bc(),r(n),s(uq(n)),p({ok:!0,text:t(`settings.models.removed`,{name:e.name,size:Ck(n.freed_gb)})})}catch(e){p({ok:!1,text:mX(e)})}finally{d(!1)}},[t]),ce=(0,B.useCallback)((e,t)=>{(async()=>{try{t===`verify`&&await Oe(e),await T([e])}catch(e){p({ok:!1,text:mX(e)})}})()},[T]),le=!!S&&(S.models?.length??0)>0&&(SJ(S)||S.models.some(e=>e.state!==`skipped`))&&S&&z(`section`,{className:`settings-field models-pane-section`,"aria-labelledby":`settings-downloads-title`,children:[L(`span`,{className:`settings-label`,id:`settings-downloads-title`,children:t(`settings.models.downloads`)}),L(TJ,{status:S,names:ne,freeGb:n?.disk?.free_gb??null,onCancel:()=>void E(),onRetry:ce,onResume:e=>void T([e]),onResumeAll:()=>void T((S.models??[]).filter(e=>e.state===`cancelled`).map(e=>e.id))}),C&&L(`p`,{className:`settings-error`,role:`alert`,children:C})]});return z(P.Fragment,{children:[L(WY,{title:t(`settings.models.manage`),hint:t(`settings.models.manageHint`),forceOpen:!!i||f?.ok===!1,children:z(`section`,{className:`settings-field models-pane-section`,"aria-labelledby":`settings-models-title`,children:[L(`span`,{className:`visually-hidden`,id:`settings-models-title`,children:t(`settings.models.title`)}),L(`p`,{className:`settings-hint`,children:t(`settings.models.lede`)}),i&&L(fX,{message:i}),n&&!n.lemonade.reachable&&L(`p`,{className:`settings-hint`,children:t(`settings.models.unavailable`)}),!n&&!i&&z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),` `,t(`setup.models.loading`)]}),n&&n.lemonade.reachable&&o&&z(P.Fragment,{children:[L(Fq,{plan:n,selection:o,onToggle:(e,t)=>s(fq(o,k,e,t)),onDefaultChat:e=>s(pq(o,k,e)),labelledBy:`settings-models-title`,place:`settings`,disabled:u,progress:te,rowActions:e=>e.downloaded&&e.id!==o.defaultChat?L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>l({kind:`remove`,entry:e}),disabled:u||te[e.id]?.state===`downloading`,"aria-label":t(`settings.models.removeAria`,{name:e.name}),children:t(`settings.models.remove`)}):null}),L(Mq,{plan:n,selection:o}),L(`div`,{className:`models-apply`,children:z(`button`,{type:`button`,className:`btn-primary`,disabled:!A||u,onClick:()=>void oe(!1,!1),children:[u&&L(Za,{size:13,className:`spin`,"aria-hidden":`true`}),u?t(`settings.models.applying`):ie.length>0?t(`settings.models.applyDownload`,{size:Ck(Math.round(ae*10)/10)}):t(`settings.models.apply`)]})})]}),f?.ok&&L(`p`,{className:`settings-ok`,role:`status`,children:f.text}),f&&!f.ok&&L(fX,{message:f.text})]})}),(g?.applies||v&&!oX(v))&&L(WY,{title:t(`gpu.settingsTitle`),titleId:`settings-gpu-title`,defaultOpen:!!g?.pending||!!v,children:z(`section`,{className:`settings-field models-pane-section`,"aria-labelledby":`settings-gpu-title`,children:[v&&L(`p`,{className:`settings-error`,role:`alert`,children:v}),g?.applies&&L(eJ,{status:g,onStatus:_,mode:`settings`,names:ne,headingId:`settings-gpu-title`})]})}),e?(0,hM.createPortal)(le,e):e===void 0&&le,c?.kind===`remove`&&L(Gq,{title:t(`settings.models.removeTitle`,{name:c.entry.name}),confirmLabel:t(`settings.models.removeConfirm`),cancelLabel:t(`settings.models.keep`),danger:!0,onConfirm:()=>void se(c.entry),onCancel:()=>l(null),children:L(`p`,{children:XK(c.entry)?t(`settings.models.removeVision`,{size:Ck(c.entry.full_size_gb??0)}):t(`settings.models.removeBody`,{size:Ck(c.entry.full_size_gb??0)})})}),c?.kind===`no_fit`&&L(Gq,{title:yq(c.models)?t(`setup.confirm.tightOne`,{name:c.models[0].name}):c.models.length===1?t(`setup.confirm.noFitOne`,{name:c.models[0].name}):t(`setup.confirm.noFitMany`),confirmLabel:yq(c.models)?t(`setup.confirm.useAnyway`):t(`setup.confirm.downloadAnyway`),cancelLabel:t(`setup.confirm.pickSmaller`),onConfirm:()=>{l(null),h(!0),oe(!0,!1)},onCancel:()=>l(null),children:c.models.map(e=>z(`p`,{children:[L(`bdi`,{children:e.name}),`: `,kq(e,t)]},e.id))}),c?.kind===`low_disk`&&L(Gq,{title:t(`setup.confirm.lowDiskTitle`),confirmLabel:t(`setup.confirm.downloadAnyway`),cancelLabel:t(`setup.confirm.changeModels`),onConfirm:()=>{l(null),oe(!0,!0)},onCancel:()=>l(null),children:L(`p`,{children:c.message})}),c?.kind===`server`&&L(Gq,{title:t(`setup.confirm.noFitServerTitle`),confirmLabel:t(`setup.confirm.useAnyway`),cancelLabel:t(`setup.confirm.changeModels`),onConfirm:()=>{l(null),h(!0),oe(!0,!1)},onCancel:()=>l(null),children:L(`p`,{children:c.detail.message})})]})}var _X=`auto`;function vX({model:e}){let t=R(),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(null);(0,B.useEffect)(()=>{r(null),a(null),l(null),ge(e).then(r).catch(e=>a(e instanceof Error?e.message:String(e)))},[e]);let u=(0,B.useCallback)(async n=>{s(!0),a(null),l(null);try{let i=await h(e,n===_X?null:Number(n));r(i);let a={name:i.display_name,size:i.chosen?tl(i.chosen):We(`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 oX(i)?L(`p`,{className:`settings-hint`,children:t(`settings.ctx.serverDown`)}):L(`p`,{className:`settings-error`,role:`alert`,children:i});if(!n)return z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,t(`settings.ctx.checking`)]});let d=n.chosen==null?_X:String(n.chosen),f=n.chosen!=null&&n.loaded_ctx!=null&&n.loaded_ctx!==n.chosen;return z(P.Fragment,{children:[z(`div`,{className:`model-in-use-field`,children:[L(`label`,{className:`settings-label`,htmlFor:`ctx-size`,children:t(`settings.ctx.label`)}),z(`select`,{id:`ctx-size`,className:`settings-input`,value:d,onChange:e=>void u(e.target.value),disabled:o||n.options.length===0,children:[L(`option`,{value:_X,children:n.automatic?t.bare(`settings.ctx.automaticAt`,{size:tl(n.automatic)}):t.bare(`settings.ctx.automatic`)}),n.options.map(e=>L(`option`,{value:String(e),children:t.bare(`settings.ctx.tokens`,{size:tl(e)})},e))]})]}),n.note&&L(`span`,{className:`settings-hint`,children:L(`bdi`,{children:n.note})}),!n.note&&!!n.max_fit&&z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[L($r,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,t(`settings.ctx.about`)]}),L(`span`,{className:`settings-hint`,children:t(`settings.ctx.explain`,{size:tl(n.max_fit),name:n.display_name,memory:n.memory_source})})]}),f&&L(`span`,{className:`settings-hint`,children:t(`settings.ctx.loadedAt`,{size:tl(n.loaded_ctx)})}),o&&z(`span`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,t(`settings.ctx.applying`)]}),c&&L(`p`,{className:`settings-ok`,role:`status`,children:c}),i&&L(`p`,{className:`settings-error`,role:`alert`,children:i})]})}function yX({row:e,providerName:t,choices:n,labels:r,disabled:i,onSwitch:a}){let o=R(),s=zc(e=>e.active),c=zc(e=>e.error),l=s?.model??null,u=!!s?.remote,d=n.some(e=>Hc(l,e.id)),f=s?.downloaded??e?.downloaded,p=u?null:e?.state===`loaded`?o(`settings.model.loaded`):f===!0?o(`settings.model.downloaded`):f===!1?o(`settings.model.notDownloaded`):null,m=e?.placement?.device;return z(`section`,{className:`settings-card model-in-use`,"aria-label":o(`settings.model.inUseTitle`),children:[L(`span`,{className:`model-in-use-label`,children:o(`settings.model.inUseTitle`)}),l?L(`bdi`,{className:`model-in-use-name`,title:l,children:e?.display_name||s?.display_name||Uc(l)}):s||c?L(`span`,{className:`settings-hint`,children:o(`settings.model.noneInUse`)}):L(`span`,{className:`settings-hint`,children:o(`settings.loading`)}),s?.config_error&&L(`p`,{className:`settings-error`,role:`alert`,children:L(`bdi`,{children:s.config_error})}),l&&!u&&e?.available===!1&&L(`p`,{className:`settings-error`,role:`alert`,children:o(`settings.model.inUseCantRun`)}),l&&z(`span`,{className:`model-chips`,children:[u&&L(`span`,{className:`model-badge is-device`,children:o(`settings.model.cloud`)}),u&&t&&L(`bdi`,{className:`model-badge is-ready`,children:t}),m&&L(`span`,{className:`model-badge is-device`,children:m.toUpperCase()}),p&&L(`span`,{className:`model-badge ${e?.state===`loaded`?`is-loaded`:`is-ready`}`,children:p}),e?.fits===!0&&L(`span`,{className:`model-badge is-fit`,children:o(`settings.model.fits`)}),!!e?.size_gb&&z(`bdi`,{dir:`ltr`,className:`model-badge is-size`,children:[e.size_gb,` GB`]}),u&&!!e?.context_length&&L(`span`,{className:`model-badge is-ready`,children:o(`settings.model.contextChip`,{size:tl(e.context_length)})})]}),(n.length>1||n.length===1&&!d)&&z(`div`,{className:`model-in-use-field`,children:[L(`label`,{className:`settings-label`,htmlFor:`model-switch`,children:o(`settings.model.switch`)}),z(`select`,{id:`model-switch`,className:`settings-input`,value:d?n.find(e=>Hc(l,e.id))?.id:``,onChange:e=>a(e.target.value),disabled:i,children:[!d&&L(`option`,{value:``,disabled:!0,children:o.bare(`settings.model.switchPlaceholder`)}),n.map(e=>L(`option`,{value:e.id,children:r[e.id]},e.id))]})]}),l&&!u&&s?.downloaded!==!1&&L(vX,{model:l})]})}var bX=e=>new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:0}).format(e),xX={"best overall, fastest":`settings.model.note.bestFastest`,cheapest:`settings.model.note.cheapest`,"most truthful":`settings.model.note.mostTruthful`},SX=/^(\d+\/\d+) tasks · quality ([\d.]+\/5) · (\$[\d.]+) per (\d+)-task run$/;function CX(e,t){let n=SX.exec(t);return e.compose(e=>e(`settings.model.measured`,{evidence:n?e(`settings.model.evidence`,{tasks:n[1],quality:n[2],cost:n[3],n:n[4]}):t}))}function wX({model:e,label:t,current:n,remote:r,busy:i,onUse:a,onDownload:o,onAskRemove:s,onNpuRecheck:c}){let l=R(),u=il(e)?e.download_progress:null,d=e.placement?.label,f=l.compose(t=>[d&&(e.placement?.source===`expected`?t(`settings.model.expected`,{label:d}):d),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:bX(e.context_length)}):null].filter(Boolean).join(` · `)),p=!!(e.display_name||f||e.evidence||e.custom&&e.source_url);return z(`li`,{className:`model-row${n?` is-current`:``}`,children:[z(`div`,{className:`model-row-text`,children:[L(`bdi`,{className:`model-row-name`,title:e.id,children:t}),z(`div`,{className:`model-chips`,children:[e.placement?.device&&L(`span`,{className:`model-badge is-device`,children:e.placement.device.toUpperCase()}),e.rank&&z(`span`,{className:`model-badge is-rank`,children:[z(`bdi`,{dir:`ltr`,children:[`#`,e.rank]}),` `,e.note&&(xX[e.note]?l(xX[e.note]):L(`bdi`,{children:e.note}))]}),e.state===`loaded`&&L(`span`,{className:`model-badge is-loaded`,children:l(`settings.model.loaded`)}),e.fits===!0&&e.available!==!1&&!e.tight&&L(`span`,{className:`model-badge is-fit`,children:l(`settings.model.fits`)}),e.fits===!0&&e.available!==!1&&e.tight&&L(`span`,{className:`model-badge is-tight`,title:l(`setup.models.warn.tight`),children:l(`settings.model.tight`)}),e.custom&&L(`span`,{className:`model-badge is-custom`,children:l(`settings.model.custom`)}),!!e.size_gb&&z(`bdi`,{dir:`ltr`,className:`model-badge is-size`,children:[e.size_gb,` GB`]}),p&&z(`details`,{className:`settings-more model-row-facts`,children:[z(`summary`,{children:[L($r,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,l(`settings.model.details`)]}),e.display_name&&L(`span`,{className:`model-row-meta`,children:L(`bdi`,{children:e.id})}),f&&L(`span`,{className:`model-row-meta`,children:f}),e.evidence&&L(`span`,{className:`model-row-meta`,children:CX(l,e.evidence)}),e.custom&&e.source_url&&L(`span`,{className:`model-row-meta`,children:l(`settings.model.from`,{url:e.source_url})})]})]}),r&&L(`span`,{className:`model-row-meta${e.price?``:` is-unknown-price`}`,children:kR(e.price,l)}),e.placement?.warning&&L(`span`,{className:`model-row-meta is-warning`,role:`alert`,children:L(`bdi`,{children:e.placement.warning})}),e.npu_problems?.length?L(GJ,{problems:e.npu_problems,disabled:i!==null,onRecheck:c,id:`npu-problems-${e.id}`}):e.unavailable_reason&&L(`span`,{className:`model-row-meta`,children:l(`settings.model.cantRun`,{reason:e.unavailable_reason})}),u&&L(`progress`,{max:100,value:u.percent,"aria-label":l(`settings.model.downloadingAria`,{name:t})})]}),z(`div`,{className:`model-row-actions`,children:[e.custom&&!n&&!u&&z(`button`,{type:`button`,className:`btn-secondary`,onClick:s,disabled:i!==null,"aria-label":l(`settings.models.removeAria`,{name:t}),children:[i===`rm:${e.id}`?L(Za,{size:13,className:`spin`}):null,l(`settings.models.remove`)]}),n&&e.available===!1?L(`span`,{className:`model-row-current is-blocked`,children:l(`settings.model.inUseBlocked`)}):n?z(`span`,{className:`model-row-current`,children:[L(Yr,{size:13,"aria-hidden":`true`}),` `,l(`settings.model.inUse`)]}):e.available===!1?null:u?z(`span`,{className:`model-row-current`,children:[L(Za,{size:13,className:`spin`}),` `,u.message?L(`bdi`,{children:u.message}):z(`bdi`,{dir:`ltr`,children:[Math.round(u.percent),`%`]})]}):e.downloaded?z(`button`,{type:`button`,className:`btn-secondary`,onClick:a,disabled:i!==null,"aria-label":l(`settings.model.useAria`,{name:t}),children:[i===e.id?L(Za,{size:13,className:`spin`}):null,` `,l(`settings.model.use`)]}):z(`button`,{type:`button`,className:`btn-secondary`,onClick:o,disabled:i!==null,"aria-label":l(`settings.model.downloadAria`,{name:t}),children:[i===`dl:${e.id}`?L(Za,{size:13,className:`spin`}):null,` `,l(`settings.model.download`)]})]})]})}function TX(){let e=R(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1),u=(0,B.useCallback)(async e=>{l(!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{l(!1)}},[]);if((0,B.useEffect)(()=>{u(Dn)},[u]),!t)return r?L(`p`,{className:`settings-error`,role:`alert`,children:r}):z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,e(`settings.spend.loading`)]});let d=t.limit_usd,f=a.trim()===``?null:Number(a),p=f===null||Number.isFinite(f)&&f>0,m=f!==d;return z(`section`,{className:`settings-field spending`,"aria-label":e(`settings.spend.aria`),children:[L(`span`,{className:`settings-label`,children:e(`settings.spend.title`)}),z(`p`,{className:`spending-total`,children:[L(`bdi`,{dir:`ltr`,children:L(`strong`,{children:AR(t.total_usd)})}),d!=null&&z(P.Fragment,{children:[` `,e(`settings.spend.ofLimit`,{limit:AR(d)})]}),z(`span`,{className:`settings-hint`,children:[` · `,e.plural(`settings.spend.turns`,t.turns-t.unpriced_turns-t.unreported_turns)]})]}),t.unpriced_turns>0&&L(`p`,{className:`settings-hint`,children:e.plural(`settings.spend.unpriced`,t.unpriced_turns)}),t.unreported_turns>0&&L(`p`,{className:`settings-hint`,children:e.plural(`settings.spend.unreported`,t.unreported_turns)}),t.state===`near`&&z(`p`,{className:`spending-warning`,role:`status`,children:[L(Ws,{size:13,"aria-hidden":`true`}),` `,e(`settings.spend.near`)]}),t.state===`reached`&&z(`div`,{className:`spending-warning`,role:`alert`,children:[z(`p`,{children:[L(Ws,{size:13,"aria-hidden":`true`}),` `,e(`settings.spend.reached`)]}),L(`button`,{type:`button`,className:`btn-secondary`,disabled:c,onClick:()=>void u(In),children:e(`settings.spend.allow`)})]}),t.state===`allowed_over`&&L(`p`,{className:`settings-hint`,children:e(`settings.spend.allowed`)}),z(`form`,{className:`settings-row`,onSubmit:e=>{e.preventDefault(),p&&m&&u(()=>s(f))},children:[L(`label`,{className:`spending-limit-label`,htmlFor:`spend-limit`,children:e(`settings.spend.limit`)}),L(`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":!p}),z(`button`,{type:`submit`,className:`btn-secondary`,disabled:c||!p||!m,children:[c?L(Za,{size:13,className:`spin`}):null,` `,e(`settings.advanced.save`)]}),d!=null&&L(`button`,{type:`button`,className:`btn-secondary`,disabled:c,onClick:()=>void u(()=>s(null)),children:e(`settings.spend.removeLimit`)})]}),L(`span`,{className:`settings-hint`,children:e(`settings.spend.how`)}),r&&L(`p`,{className:`settings-error`,role:`alert`,children:r})]})}var EX=2e3;function DX(e,t){return e.key_source===`environment`?t(`settings.key.setIn`,{name:e.env_var??``}):`••••••••••••••••••••${e.key_hint?` ${e.key_hint}`:``}`}function OX(){let e=R(),t=zc(e=>e.active),n=zc(e=>e.select),r=zc(e=>e.refresh),i=zc(e=>e.rememberNames),a=N(e=>!!e.systemStatus&&$I(e.systemStatus)===`unresponsive`),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),u=N(e=>e.settingsProvider),[d,f]=(0,B.useState)(u??t?.provider??`local`),[m,h]=(0,B.useState)(null),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)(``),[b,x]=(0,B.useState)(!1),[S,C]=(0,B.useState)(``),[w,T]=(0,B.useState)(!1),[E,D]=(0,B.useState)(!1),[O,ee]=(0,B.useState)({base_url:``,auth_header_name:``,auth_header_prefix:``}),[te,ne]=(0,B.useState)(null),[re,k]=(0,B.useState)(null),[ie,ae]=(0,B.useState)(null),[A,oe]=(0,B.useState)(null),[se,ce]=(0,B.useState)(!1),[le,ue]=(0,B.useState)(null),[de,fe]=(0,B.useState)(null),pe=(0,B.useRef)(d);pe.current=d;let me=(0,B.useRef)(!0);(0,B.useEffect)(()=>(me.current=!0,()=>{me.current=!1}),[]);let j=o?.find(e=>e.id===d)??null,he=e=>e?.network?.reachable===!1,M=e=>!!e?.blocked,ge=!!j&&!M(j)&&(!j.remote||!!j.models_discovered),_e=(0,B.useCallback)(async()=>{l(null);try{let e=await gt();s(e.providers),e.lemonade_error&&l(e.lemonade_error)}catch(e){l(e instanceof Error?e.message:String(e))}},[]),ve=(0,B.useCallback)(async()=>{try{await Fe()}catch(e){l(e instanceof Error?e.message:String(e));return}await _e()},[_e]),ye=(0,B.useCallback)(async(t,n=!1)=>{n||(h(null),_(null));try{let n=await Gt(t);i(n.models),h(n.models),k(n.memory_gb?`${n.memory_gb} GB (${n.memory_source})`:n.capacity_error??null),n.blocked&&_(e(`settings.privacy.localOnlyBlocked`))}catch(e){_(e instanceof Error?e.message:String(e))}},[i,e]);(0,B.useEffect)(()=>{_e()},[_e]);let be=!!o?.some(e=>e.key_state===`waiting_for_os_permission`);(0,B.useEffect)(()=>{if(!be)return;let e=setInterval(()=>{_e()},EX);return()=>clearInterval(e)},[be,_e]);let xe=t?.provider;(0,B.useEffect)(()=>{xe&&!u&&f(xe)},[xe,u]),(0,B.useEffect)(()=>{C(``),T(!1),D(!1),ae(null),y(``),x(!1),ce(!1)},[d]),(0,B.useEffect)(()=>{ge?ye(d):h(null)},[d,ge,ye]);let Se=(0,B.useCallback)(async()=>{if(j){ne(`connect`),ae(null);try{let t=d===`amd`?{api_key:S||void 0,...Object.fromEntries(Object.entries(O).filter(([,e])=>e!==``))}:{api_key:S||void 0},n=()=>!me.current||pe.current!==d,r=await ln(d,t,e=>{n()||ae({ok:!0,text:e})},n);if(n())return;C(``),T(!1),ae({ok:!0,text:r.remember_error?e(`settings.key.sessionOnly`,{reason:r.remember_error}):r.known_models?e(`settings.key.knownModels`,{name:j.name}):r.remembered?e(`settings.key.kept`):e(`settings.key.connectedDone`)}),await _e()}catch(e){me.current&&pe.current===d&&ae({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{me.current&&ne(null)}}},[O,d,S,_e,j,e]),Ce=(0,B.useCallback)(async()=>{ne(`forget`),D(!1),ae(null);try{await ze(d),ae({ok:!0,text:e(`settings.key.cleared`)}),await _e(),await r()}catch(e){ae({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{ne(null)}},[d,_e,r,e]),we=(0,B.useCallback)(async t=>{ne(t),ae(null);try{await n(t),ae({ok:!0,text:e(`settings.model.switched`,{name:Uc(t)})}),await ye(d,!0)}catch(e){ae({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{ne(null)}},[d,ye,n,e]),Te=(0,B.useCallback)(async e=>{ne(`dl:${e}`),ae(null),ce(!1);try{await p(e),await ye(`local`,!0)}catch(e){ae({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{ne(null)}},[ye]),Ee=(0,B.useCallback)(async t=>{let n=zc.getState().active?.model;ne(`rm:${t}`),ae(null);try{let r=await nr(t);oe(null);let i=r.cleared.includes(`last_model`)?`settings.model.removedLast`:r.cleared.includes(`default_model`)?`settings.model.removedDefault`:`settings.model.removed`;ae({ok:!0,text:e(i,{name:r.display_name})}),await ye(`local`,!0),await Bc(n)}catch(e){ae({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{ne(null)}},[ye,e]),De=(0,B.useCallback)(async t=>{ae({ok:!0,text:e(`settings.model.added`,{name:t})}),ce(!0),await ye(`local`,!0)},[ye,e]),Oe=!!m?.some(il);(0,B.useEffect)(()=>{if(Oe)return()=>{r()}},[Oe,r]),(0,B.useEffect)(()=>{if(d!==`local`||!Oe)return;let e=setInterval(()=>{ye(`local`,!0)},EX);return()=>clearInterval(e)},[Oe,d,ye]);let ke=t?.model,Ae=m?.find(e=>Hc(ke,e.id));(0,B.useEffect)(()=>{Ae&&ue(Ae)},[Ae]);let je=(0,B.useMemo)(()=>{let e=v.trim().toLowerCase();return(m??[]).filter(t=>!e||t.id.toLowerCase().includes(e)||(t.display_name??``).toLowerCase().includes(e))},[m,v]),Me=je.filter(e=>e.available!==!1),Ne=d===`fireworks`&&!b&&!v.trim()&&Me.some(e=>e.rank!==null),Pe=e=>e.rank!==null||e.id===t?.model,Ie=Ne?Me.filter(Pe):Me,Le=Ne?Me.filter(e=>!Pe(e)):[],Re=je.filter(e=>e.available===!1),Be=Zc(m??[]),Ve=!!v.trim(),He=e=>Hc(t?.model,e.id),Ue=j?.id===`local`,We=Ie.filter(e=>e.downloaded).sort((e,t)=>Number(He(t))-Number(He(e))),Ge=Ie.filter(e=>!e.downloaded),Ke=(m??[]).filter(e=>e.available!==!1&&e.downloaded),qe=Ke.filter(Pe),Je=A?(m??[]).find(e=>e.id===A)??null:null,Ye=d===`fireworks`&&qe.some(e=>e.rank!==null)?qe:Ke,Xe=e=>L(wX,{model:e,label:Be[e.id],current:He(e),remote:!!j?.remote,busy:te,onUse:()=>void we(e.id),onDownload:()=>void Te(e.id),onAskRemove:()=>oe(e.id),onNpuRecheck:()=>void ye(d,!0)},e.id);return z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.model`)}),L(VJ,{inSettings:!0}),L(yX,{row:Ae??(Hc(le?.id,t?.model)?le:null),providerName:t?.provider_name??null,choices:ge?Ye:[],labels:Be,disabled:te!==null,onSwitch:e=>void we(e)}),L(MB,{className:`provider-tabs`,"aria-label":e(`settings.model.whereRuns`),children:(o??[{id:`local`,name:`Local`,remote:!1}]).map(t=>z(`button`,{type:`button`,role:`radio`,"aria-checked":d===t.id,className:`provider-tab${d===t.id?` is-active`:``}${he(t)||M(t)?` is-disabled`:``}`,onClick:()=>f(t.id),disabled:(he(t)||M(t))&&d!==t.id,title:M(t)?e(`settings.privacy.localOnlyBlocked`):he(t)?e(`setup.key.gatewayOff`):void 0,children:[t.remote?L(xi,{size:14,"aria-hidden":`true`}):L(ki,{size:14,"aria-hidden":`true`}),L(`span`,{children:MR(e,t)}),t.remote&&t.models_discovered&&L(`span`,{className:`provider-tab-dot`,"aria-label":e(`settings.key.connectedDot`)})]},t.id))}),!o&&!c&&z(`p`,{className:`settings-hint`,role:`status`,children:[L(Za,{size:13,className:`spin`}),` `,e(a?`settings.model.waitingServer`:`settings.loading`)]}),c&&L(fX,{message:c,onRetry:()=>{_e(),ye(d)}}),j&&z(`section`,{className:`settings-card`,"aria-label":MR(e,j),children:[j.remote&&L(`p`,{className:`settings-note`,children:L(`bdi`,{children:NR(e,j)})}),z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[L($r,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,e(`settings.model.howItWorks`)]}),L(`p`,{className:`settings-hint`,children:e(`settings.model.lede`)}),Ue&&L(`p`,{className:`settings-hint`,children:L(`bdi`,{children:NR(e,j)})}),Ue&&L(`p`,{className:`settings-hint`,children:e(`settings.model.devices`)}),Ue&&re&&L(`p`,{className:`settings-hint`,children:e(`settings.model.memory`,{memory:re})})]}),j.remote&&!ge&&z(`div`,{className:`settings-field`,children:[L(`span`,{className:`settings-label`,children:e(`settings.model.prices`)}),L(HK,{provider:j.id})]}),M(j)&&L(`div`,{className:`settings-field`,children:L(`p`,{className:`settings-error`,role:`alert`,children:e(`settings.privacy.localOnlyBlocked`)})}),he(j)&&z(`div`,{className:`settings-field`,children:[L(`p`,{className:`settings-error`,role:`alert`,children:j.network?.detail}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void _e(),children:e(`settings.key.checkAgain`)})]}),j.remote&&!he(j)&&!M(j)&&z(`form`,{className:`settings-field`,"data-settings-target":`cloud-key`,onSubmit:e=>{e.preventDefault(),Se()},children:[z(`div`,{className:`settings-row settings-row-between`,children:[L(`span`,{className:`settings-label`,children:e(`settings.key.title`)}),j.key_source&&L(`span`,{className:`settings-key-status ${ge?`settings-ok`:`settings-error`}`,children:e(ge?`settings.key.connected`:`settings.key.notConnected`)})]}),!j.key_source&&j.key_state===`store_locked`&&z(`span`,{className:`settings-hint`,role:`status`,children:[e(`settings.key.storeLocked`),` `,L(`button`,{type:`button`,className:`link-btn`,onClick:()=>void ve(),children:e(`settings.key.unlockAgain`)})]}),!j.key_source&&j.key_state!==`store_locked`&&L(`span`,{className:`settings-hint`,children:j.key_state===`waiting_for_os_permission`?j.key_message??e(`settings.key.waitingOs`):e(`settings.key.none`)}),j.id===`amd`&&(!j.key_source||w)&&z(`div`,{className:`settings-grid`,children:[L(`input`,{className:`settings-input`,placeholder:e(`settings.key.gatewayPlaceholder`),value:O.base_url,onChange:e=>ee({...O,base_url:e.target.value}),"aria-label":e(`settings.key.gatewayUrl`)}),L(`input`,{className:`settings-input`,placeholder:e(`settings.key.headerPlaceholder`),value:O.auth_header_name,onChange:e=>ee({...O,auth_header_name:e.target.value}),"aria-label":e(`settings.key.headerName`)})]}),j.key_source&&!w?z(`div`,{className:`settings-row`,children:[L(`input`,{className:`settings-input settings-key-masked`,readOnly:!0,value:DX(j,e),"aria-label":e(`settings.key.savedAria`,{name:j.name})}),!ge&&z(`button`,{type:`submit`,className:`btn-primary`,disabled:te!==null,children:[te===`connect`?L(Za,{size:13,className:`spin`}):null,e(`settings.key.reconnect`)]}),(j.key_source!==`environment`||j.key_from_gaia_env)&&z(P.Fragment,{children:[L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>T(!0),disabled:te!==null,children:e(`settings.key.replace`)}),j.key_source!==`environment`&&L(`button`,{type:`button`,className:`btn-secondary settings-key-remove`,onClick:()=>D(!0),disabled:te!==null,"aria-label":e(`settings.key.remove`),title:e(`settings.key.remove`),children:L(Hs,{size:14,"aria-hidden":`true`})})]})]}):z(`div`,{className:`settings-row`,children:[L(`input`,{className:`settings-input`,type:`password`,autoComplete:`off`,spellCheck:!1,autoFocus:w,value:S,onChange:e=>C(e.target.value),placeholder:e(w?`settings.key.pasteNew`:`settings.key.paste`),"aria-label":e(`settings.key.fieldAria`,{name:j.name})}),z(`button`,{type:`submit`,className:`btn-primary`,disabled:te!==null||!S,children:[te===`connect`?L(Za,{size:13,className:`spin`}):null,e(w?`settings.key.save`:`settings.key.connect`)]}),w&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{C(``),T(!1)},disabled:te!==null,children:e(`settings.key.cancel`)})]}),j.key_source&&!ge&&!j.error&&!w&&L(`p`,{className:`settings-hint`,children:e(`settings.key.notConnectedHint`,{name:j.name})}),j.error&&L(`p`,{className:`settings-error`,role:`alert`,children:j.error})]}),ie?.ok&&L(`p`,{className:`settings-ok`,role:`status`,children:ie.text}),ie&&!ie.ok&&L(fX,{message:ie.text}),j.known_models&&L(`p`,{className:`settings-hint`,role:`status`,children:e(`settings.key.knownList`,{name:j.name})}),Ue&&L(`div`,{className:`models-downloads-slot`,ref:fe}),ge&&z(`div`,{className:`settings-field`,children:[L(`span`,{className:`settings-label`,children:e(`settings.model.models`)}),(m?.length??0)>6&&L(`input`,{className:`settings-input`,type:`search`,value:v,onChange:e=>y(e.target.value),placeholder:e(`settings.model.search`),"aria-label":e(`settings.model.search`)}),g&&!(c&&oX(g))&&L(fX,{message:g}),!m&&!g&&z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,e(`settings.loading`)]}),m&&je.length===0&&!g&&L(`p`,{className:`settings-hint`,children:e(Ve||!Ue?`settings.model.noMatch`:`settings.model.noModels`)}),Ue?z(P.Fragment,{children:[We.length>0&&L(WY,{title:e(`settings.model.groupDownloaded`),count:We.length,defaultOpen:!0,forceOpen:Ve,targetId:`models-on-pc`,children:L(`ul`,{className:`model-list`,children:We.map(Xe)})}),Ge.length>0&&L(WY,{title:e(`settings.model.groupAvailable`),count:Ge.length,defaultOpen:We.length===0,forceOpen:Ve||se||Ge.some(il),children:L(`ul`,{className:`model-list`,children:Ge.map(Xe)})})]}):L(`ul`,{className:`model-list`,children:Ie.map(Xe)}),Ne&&Le.length>0&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>x(!0),children:e(`settings.model.showAll`)}),d===`fireworks`&&b&&!Ve&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>x(!1),children:e(`settings.model.showRecommended`)}),Re.length>0&&L(WY,{title:e(`settings.model.groupUnavailable`),count:Re.length,forceOpen:Ve,children:L(`ul`,{className:`model-list`,children:Re.map(Xe)})})]}),Ue&&ge&&L(WY,{title:e(`settings.custom.title`),children:L(pX,{onAdded:e=>void De(e)})}),Ue&&ge&&L(gX,{downloadsSlot:de}),j.remote&&L(TX,{})]}),Je&&L(Gq,{title:e(`settings.models.removeTitle`,{name:Be[Je.id]??Je.id}),confirmLabel:Je.downloaded?e(`settings.model.removeDownload`):e(`settings.models.remove`),cancelLabel:e(`settings.models.keep`),danger:!0,onConfirm:()=>{oe(null),Ee(Je.id)},onCancel:()=>oe(null),children:Je.downloaded&&L(`p`,{children:e(`settings.model.removeDownloadBody`)})}),E&&j&&L(Gq,{title:e(`settings.key.removeAsk`),confirmLabel:e(`settings.key.remove`),cancelLabel:e(`settings.models.keep`),danger:!0,onConfirm:()=>void Ce(),onCancel:()=>D(!1),children:L(`p`,{children:e(`settings.key.removeBody`,{name:j.name})})})]})}async function kX(){return Ct(`GET`,`/images/settings`)}async function AX(e){return Ct(`PUT`,`/images/settings`,e)}var jX=[4,8,12,20,30,50],MX=e=>`${e}`;function NX(e){return e instanceof Vn?e.detail||e.message:String(e)}function PX(){let e=R(),t=N(e=>e.openSettings);Vc();let[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(!1),u=()=>{a(null),kX().then(r).catch(e=>a({unreachable:e instanceof Vn&&e.httpStatus===503,detail:NX(e)}))};(0,B.useEffect)(u,[]);let d=e=>{l(!0),s(null),AX(e).then(r).catch(e=>s(NX(e))).finally(()=>l(!1))},f=L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.images`)});if(i)return z(`div`,{className:`settings-pane`,children:[f,i.unreachable?z(P.Fragment,{children:[L(`p`,{className:`settings-error`,role:`alert`,children:e(`images.settings.unreachable`)}),L(`p`,{className:`settings-hint`,children:i.detail}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:u,children:e(`images.settings.retry`)})]}):L(`p`,{className:`settings-error`,role:`alert`,children:e(`images.settings.loadFailed`,{reason:i.detail})})]});if(!n)return z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,e(`settings.loading`)]});let p=n.models.find(e=>e.id===n.model),m=p?[...new Set([...jX,p.default_steps,...n.steps?[n.steps]:[]])].filter(e=>e<=n.max_steps).sort((e,t)=>e-t):[];return z(`div`,{className:`settings-pane`,children:[f,L(`p`,{className:`settings-pane-lede`,children:e(`images.settings.lede`)}),!n.chat_model_creates_images&&z(`div`,{className:`settings-notice`,role:`status`,children:[L(`p`,{children:e(`images.settings.chatModelCannot`,{model:Uc(n.chat_model)})}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>t(`model`),children:e(`images.settings.chooseChatModel`)})]}),!n.model_available&&L(`p`,{className:`settings-error`,role:`alert`,children:e(`images.settings.modelGone`,{model:n.model})}),n.models.length===0?L(`p`,{className:`settings-hint`,children:e(`images.settings.noModels`)}):z(P.Fragment,{children:[z(`div`,{className:`settings-field`,children:[L(`label`,{className:`settings-label`,htmlFor:`image-model`,children:e(`images.settings.model`)}),z(`select`,{id:`image-model`,className:`settings-input`,value:n.model_available?n.model:``,disabled:c,onChange:e=>d({model:e.target.value}),children:[!n.model_available&&L(`option`,{value:``,disabled:!0,children:n.model}),n.models.map(t=>L(`option`,{value:t.id,children:t.downloads_on_first_use?e.bare(`images.settings.downloadsOnFirstUse`,{model:t.id,size:MX(`${t.size_gb??`?`} GB`)}):t.id},t.id))]})]}),p&&z(P.Fragment,{children:[z(`div`,{className:`settings-field`,children:[L(`label`,{className:`settings-label`,htmlFor:`image-size`,children:e(`images.settings.size`)}),z(`select`,{id:`image-size`,className:`settings-input`,value:n.size??``,disabled:c,onChange:e=>d({size:e.target.value||null}),children:[L(`option`,{value:``,children:e.bare(`images.settings.automatic`,{value:MX(p.default_size)})}),p.sizes.map(e=>L(`option`,{value:e,children:MX(e)},e))]})]}),z(`div`,{className:`settings-field`,children:[L(`label`,{className:`settings-label`,htmlFor:`image-steps`,children:e(`images.settings.steps`)}),z(`select`,{id:`image-steps`,className:`settings-input`,value:n.steps??``,disabled:c,onChange:e=>d({steps:e.target.value?Number(e.target.value):null}),children:[L(`option`,{value:``,children:e.bare(`images.settings.automatic`,{value:MX(String(p.default_steps))})}),m.map(e=>L(`option`,{value:e,children:MX(String(e))},e))]}),L(`span`,{className:`settings-hint`,children:e(`images.settings.stepsHint`)})]})]})]}),L(`p`,{className:`settings-hint`,children:e(`images.settings.shared`)}),o&&L(`p`,{className:`settings-error`,role:`alert`,children:e(`images.settings.saveFailed`,{reason:o})})]})}function FX(){let e=R(),t=N(e=>e.sessions),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(null),u=(0,B.useCallback)(async()=>{l(null);try{let e=await nn();r(e.sessions),a(e.default_mode),N.getState().setDefaultPermissionMode(e.default_mode)}catch(e){l(e instanceof Error?e.message:String(e))}},[]);(0,B.useEffect)(()=>{u()},[u]);let d=(0,B.useCallback)(async e=>{l(null);try{await e(),await u()}catch(e){l(e instanceof Error?e.message:String(e))}},[u]),f=(0,B.useCallback)(async e=>{s(!1),await d(()=>cn(e))},[d]),p=()=>{i===`full_access`?f(`ask`):s(e=>!e)},m=e=>t.find(t=>t.id===e)?.title??e;return z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.permissions`)}),L(`p`,{className:`settings-pane-lede`,children:e(`settings.permissions.lede`)}),z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[L($r,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,e(`settings.model.howItWorks`)]}),L(`p`,{className:`settings-hint`,children:e(`settings.permissions.perChat`)})]}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.permissions.newChats`),children:[z(`label`,{className:`setting-row`,children:[L(`span`,{className:`settings-label`,children:e(`settings.permissions.fullAccess`)}),z(`span`,{className:`toggle-switch`,children:[L(`input`,{type:`checkbox`,checked:i===`full_access`,onChange:p,disabled:i===null,"aria-label":e(`settings.permissions.fullAccess`)}),L(`span`,{className:`toggle-track`})]})]}),L(`p`,{className:`settings-hint`,children:e(i===`full_access`?`settings.permissions.on`:`settings.permissions.off`)}),o&&z(`div`,{className:`settings-warning`,role:`alert`,children:[L(`p`,{children:e(`settings.permissions.warning`)}),z(`div`,{className:`settings-row`,children:[L(`button`,{type:`button`,className:`btn-danger`,onClick:()=>void f(`full_access`),children:e(`settings.permissions.turnOn`)}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>s(!1),children:e(`settings.key.cancel`)})]})]})]}),c&&L(`p`,{className:`settings-error`,role:`alert`,children:c}),n&&n.length===0&&L(`p`,{className:`settings-hint`,children:e(`settings.permissions.none`)}),!!n?.length&&L(WY,{title:e(`settings.permissions.chats`),count:n.length,defaultOpen:!0,children:n.map(t=>z(`section`,{className:`settings-field permission-chat`,"aria-label":m(t.session_id),children:[z(`div`,{className:`settings-row settings-row-between`,children:[L(`bdi`,{className:`settings-label`,children:m(t.session_id)}),t.mode===`full_access`&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>d(async()=>{let e=(await Vt(t.session_id,`ask`)).mode;rz(t.session_id,e)}),children:e(`settings.permissions.turnOff`)})]}),t.grants.length>0&&L(`ul`,{className:`grant-list`,children:t.grants.map(n=>z(`li`,{className:`grant-row`,children:[L(`code`,{children:n.label}),L(`button`,{type:`button`,className:`link-btn`,onClick:()=>d(()=>It(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&&L(`button`,{type:`button`,className:`link-btn`,onClick:()=>d(()=>It(t.session_id)),children:e(`settings.permissions.revokeAll`)})]},t.session_id))})]})}var IX=(e,t)=>!e.error&&(!e.installed||e.update)&&(t||!e.has_code);function LX(e,t){let n=e.added.filter(e=>e.updated).map(e=>e.name),r=e.added.filter(e=>!e.updated).map(e=>e.name),i=(e,n)=>n.length>3?t(`settings.skills.link.${e}Count`,{n:n.length}):t(`settings.skills.link.${e}`,{names:n.join(`, `)});return[r.length?i(`added`,r):``,n.length?i(`updated`,n):``].filter(Boolean).join(` `)}function RX({onAdded:e}){let t=R(),[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(new Set),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(null),[g,_]=(0,B.useState)([]);(0,B.useEffect)(()=>{let e=!1;return An().then(t=>{e||_(t.libraries)}).catch(n=>{e||s(t(`settings.skills.link.featuredFailed`,{error:oN(n,t)}))}),()=>{e=!0}},[t]);let v=async e=>{if(e.trim()){a(`preview`),s(null),l(null),h(null);try{let t=await dt(e.trim());l(t),d(new Set(t.skills.filter(e=>IX(e,!1)).map(e=>e.name)))}catch(e){s(oN(e,t))}finally{a(null)}}},y=async()=>{if(c&&u.size!==0){a(`add`),s(null);try{let t=await vn(c.link,[...u],f,c.pin);h(t),l(null),r(``),t.added.length&&e()}catch(e){s(oN(e,t))}finally{a(null)}}},b=e=>d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),x=e=>{if(p(e),!e&&c){let e=new Set(c.skills.filter(e=>e.has_code).map(e=>e.name));d(t=>new Set([...t].filter(t=>!e.has(t))))}},S=c?.skills.filter(e=>IX(e,f))??[],C=S.length>0&&S.every(e=>u.has(e.name)),w=c?.skills.some(e=>e.has_code&&!e.error)??!1;return z(`div`,{className:`settings-card skill-link`,children:[z(`div`,{className:`skill-link-top`,children:[L(`span`,{className:`settings-label`,children:t(`settings.skills.link.title`)}),g.map(e=>{let n=`settings.skills.link.featured.${e.id}`,a=fe(n);return L(`button`,{type:`button`,className:`btn-secondary skill-link-chip`,onClick:()=>{r(e.url),v(e.url)},disabled:i!==null,title:a?t(n):e.description,"aria-label":t(`settings.skills.link.getAria`,{name:e.name,description:a?We(n):e.description}),children:t(`settings.skills.link.get`,{name:e.name})},e.id)})]}),z(`form`,{className:`skill-link-form`,onSubmit:e=>{e.preventDefault(),v(n)},children:[L(`input`,{className:`settings-input`,type:`text`,inputMode:`url`,value:n,onChange:e=>r(e.target.value),onPaste:e=>{let t=e.clipboardData.getData(`text`).trim();t&&(e.preventDefault(),r(t),v(t))},placeholder:t.bare(`settings.skills.link.placeholder`),title:t(`settings.skills.link.hint`),"aria-label":t(`settings.skills.link.aria`),disabled:i!==null}),L(`button`,{type:`submit`,className:`btn-secondary`,disabled:!n.trim()||i!==null,children:i===`preview`?z(P.Fragment,{children:[L(Za,{size:13,className:`spin`}),` `,t(`settings.skills.link.reading`)]}):t(`settings.skills.link.read`)})]}),o&&L(`p`,{className:`settings-error`,role:`alert`,children:o}),c&&z(`div`,{className:`skill-link-preview`,children:[z(`details`,{className:`skill-link-warning`,role:`note`,children:[z(`summary`,{children:[L(Ws,{size:14,"aria-hidden":`true`}),t(`settings.skills.link.trust`)]}),L(`p`,{children:L(`bdi`,{children:c.warning})})]}),z(`div`,{className:`skill-link-head`,children:[L(`span`,{children:t(`settings.skills.link.found`,{n:c.skills.length,source:c.source})}),S.length>1&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>d(C?new Set:new Set(S.map(e=>e.name))),children:t(C?`settings.skills.link.none`:`settings.skills.link.all`)})]}),L(`ul`,{className:`skill-list skill-link-list`,children:c.skills.map(e=>{let n=IX(e,f),r=e.error?e.verdict===`BLOCK`?t(`settings.skills.link.tagBlocked`):t(`settings.skills.link.tagUnreadable`):e.installed&&!e.update?t(`settings.skills.link.tagElsewhere`):e.update?t(`settings.skills.link.tagUpdate`):null,i=e.error??(e.installed&&!e.update?t(`settings.skills.link.whyElsewhere`):e.update?t(`settings.skills.link.whyUpdate`):null),a=!!i||e.findings.length>0||e.has_code&&!f;return L(`li`,{className:`skill-row`,children:z(`label`,{className:`skill-link-pick`,children:[L(`input`,{type:`checkbox`,checked:n&&u.has(e.name),disabled:!n,onChange:()=>b(e.name),"aria-label":t(`settings.skills.link.addAria`,{name:e.name})}),z(`span`,{className:`skill-row-text`,children:[z(`span`,{className:`skill-row-name`,children:[e.name,r&&L(`span`,{className:`skill-link-tag${e.error?` is-bad`:``}`,children:r}),e.has_code&&L(`span`,{className:`skill-link-tag`,children:t(`settings.skills.link.tagCode`)}),e.verdict===`REVIEW`&&L(`span`,{className:`skill-link-tag`,children:t(`settings.skills.link.tagReview`)})]}),e.description&&L(`span`,{className:`skill-row-desc skill-link-desc`,dir:`auto`,title:e.description,children:L(`bdi`,{children:e.description})}),e.permissions.length>0?z(`span`,{className:`skill-link-perms`,children:[L(`span`,{className:`skill-link-perms-label`,children:t(`settings.skills.link.can`)}),L(`ul`,{"aria-label":t(`settings.skills.link.permsAria`,{name:e.name}),children:e.permissions.map(e=>z(`li`,{children:[L(`bdi`,{children:e.text}),` `,L(`bdi`,{dir:`ltr`,children:L(`code`,{children:e.grant})})]},e.grant))})]}):L(`span`,{className:`skill-link-perms`,children:t(e.permissions_unreadable?`settings.skills.link.permissionsUnreadable`:`settings.skills.link.noPermissions`)}),a&&z(`details`,{className:`skill-link-findings`,children:[L(`summary`,{children:t(`settings.skills.link.details`)}),i&&L(`p`,{children:L(`bdi`,{children:i})}),e.has_code&&!f&&L(`p`,{children:t(`settings.skills.link.shipsCode`)}),e.findings.length>0&&L(`ul`,{children:e.findings.map(e=>L(`li`,{children:L(`bdi`,{children:e})},e))})]})]})]})},e.path)})}),z(`div`,{className:`skill-link-actions`,children:[w&&z(`label`,{className:`skill-link-code`,title:t(`settings.skills.link.codeHint`),children:[L(`input`,{type:`checkbox`,checked:f,onChange:e=>x(e.target.checked)}),L(`span`,{children:t(`settings.skills.link.includeCode`)})]}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>l(null),disabled:i!==null,children:t(`settings.skills.link.cancel`)}),L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void y(),disabled:u.size===0||i!==null,children:i===`add`?z(P.Fragment,{children:[L(Za,{size:13,className:`spin`}),` `,t(`settings.skills.link.adding`)]}):t(`settings.skills.link.add`,{n:u.size})})]})]}),m&&z(`div`,{className:`skill-link-result`,role:`status`,children:[m.added.length>0&&L(`p`,{children:LX(m,t)}),Object.keys(m.failed).length>0&&z(`details`,{children:[L(`summary`,{children:t(`settings.skills.link.notAdded`,{n:Object.keys(m.failed).length})}),L(`ul`,{className:`grant-list`,children:Object.entries(m.failed).map(([e,t])=>z(`li`,{children:[L(`bdi`,{children:L(`strong`,{children:e})}),` — `,L(`bdi`,{children:t})]},e))})]})]})]})}var zX={path:`~/.gaia/skills`},BX=[{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:zX},{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 VX(e){return/description is \d+ characters/.test(e)?`settings.skills.skipped.tooLong`:/'description' is missing/.test(e)?`settings.skills.skipped.noDescription`:`settings.skills.skipped.other`}function HX({text:e}){let t=R(),n=(0,B.useRef)(null),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(!1);return(0,B.useLayoutEffect)(()=>{let e=n.current;if(!e||r)return;let t=()=>o(e.scrollHeight>e.clientHeight+1);if(t(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,r]),z(P.Fragment,{children:[L(`span`,{ref:n,className:`skill-row-desc${r?` is-open`:``}${a||r?` is-toggle`:``}`,dir:`auto`,onClick:a||r?()=>i(!r):void 0,children:L(`bdi`,{children:e})}),(a||r)&&L(`button`,{type:`button`,className:`skill-row-more`,"aria-expanded":r,onClick:()=>i(!r),children:t(r?`settings.skills.less`:`settings.skills.more`)})]})}function UX({onUseSkill:e}){let t=R(),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)({}),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(``),u=(0,B.useRef)(null),d=(0,B.useRef)(!0),f=(0,B.useCallback)(()=>{Pn().then(e=>{d.current&&(r(e.skills),a(e.invalid),s(null))}).catch(e=>{d.current&&s(e instanceof Error?e.message:String(e))})},[]);(0,B.useEffect)(()=>(d.current=!0,f(),window.addEventListener(`focus`,f),()=>{d.current=!1,window.removeEventListener(`focus`,f)}),[f]);let p=c.trim().toLowerCase(),m=(n??[]).filter(e=>!p||e.name.toLowerCase().includes(p)||e.description.toLowerCase().includes(p)),h=n?.every(e=>BX.some(t=>t.source===e.source))??!1,g=n=>z(`li`,{className:`skill-row`,children:[z(`div`,{className:`skill-row-text`,children:[z(`span`,{className:`skill-row-name`,children:[L(`span`,{title:n.version?`v${n.version}`:void 0,children:n.name}),n.always_on&&z(`span`,{className:`skill-row-meta`,children:[` · `,t(`settings.skills.alwaysOn`)]})]}),L(HX,{text:n.description})]}),!n.always_on&&L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>e(n.name),"aria-label":t(`settings.skills.useAria`,{name:n.name}),children:t(`settings.skills.try`)})]},n.name);return z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:t(`settings.section.skills`)}),L(`p`,{className:`settings-pane-lede`,children:t(`settings.skills.lede`)}),z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[L($r,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,t(`settings.model.howItWorks`)]}),L(`p`,{className:`settings-hint`,children:t(`settings.skills.how`,zX)})]}),L(RX,{onAdded:f}),o&&L(`p`,{className:`settings-error`,role:`alert`,children:o}),!n&&!o&&z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,t(`settings.loading`)]}),n&&n.length>6&&L(`input`,{ref:u,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&&L(`p`,{className:`settings-hint`,children:t(`settings.skills.none`)}),p&&n&&n.length>0&&m.length===0&&z(`p`,{className:`settings-hint`,role:`status`,children:[t(`settings.skills.noMatch`,{query:c.trim()}),` `,L(`button`,{type:`button`,className:`link-btn`,onClick:()=>{l(``),u.current?.focus()},children:t(`settings.skills.clearSearch`)})]}),h?BX.map(e=>{let n=m.filter(t=>t.source===e.source);return n.length===0&&(p||!e.empty)?null:L(WY,{title:t(e.title),count:n.length,hint:t(e.note,e.params),defaultOpen:e.source===`agent-bundled`||e.source===`user`&&n.length>0,forceOpen:!!p,children:L(`section`,{"aria-label":t(e.title),children:n.length===0?L(`p`,{className:`settings-hint`,children:e.empty&&t(e.empty,e.params)}):L(`ul`,{className:`skill-list`,children:n.map(g)})})},e.source)}):L(`ul`,{className:`skill-list`,children:m.map(g)}),Object.keys(i).length>0&&z(`div`,{className:`settings-card`,role:`alert`,children:[L(`span`,{className:`settings-label`,children:t(`settings.skills.skipped`)}),L(`ul`,{className:`grant-list`,children:Object.entries(i).map(([e,n])=>L(`li`,{children:t(VX(n),{name:e.split(/[\\/]/).filter(Boolean).pop()??e})},e))})]})]})}var WX=`profile`;function GX(){let e=R(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1);(0,B.useEffect)(()=>{GG().then(n).catch(e=>i(e instanceof Error?e.message:String(e)))},[]);let l=(0,B.useCallback)(async e=>{o(!0),i(null),c(!1);try{let t=await KG(e===WX?null:e);n(t),c(t.changed!==!1)}catch(e){i(e instanceof Error?e.message:String(e)),await GG().then(n).catch(()=>void 0)}finally{o(!1)}},[]);if(!t)return r?L(`p`,{className:`settings-error`,role:`alert`,children:r}):z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,e(`settings.memory.embedder.checking`)]});let u=t.options.find(e=>e.device===t.device),d=t=>e.bare(t===`npu`?`settings.memory.embedder.npu`:`settings.memory.embedder.gpu`);return z(P.Fragment,{children:[z(`div`,{className:`model-in-use-field`,children:[L(`label`,{className:`settings-label`,htmlFor:`embedder-device`,children:e(`settings.memory.embedder.label`)}),z(`select`,{id:`embedder-device`,className:`settings-input`,value:t.chosen?t.device:WX,onChange:e=>void l(e.target.value),disabled:a,children:[L(`option`,{value:WX,children:e.bare(`settings.memory.embedder.default`,{device:d(t.default_device)})}),t.options.map(t=>L(`option`,{value:t.device,disabled:t.available===!1,children:t.present===!1?e.bare(`settings.memory.embedder.unavailable`,{device:d(t.device)}):t.proven?d(t.device):e.bare(`settings.memory.embedder.unproven`,{device:d(t.device)})},t.device))]})]}),z(`span`,{className:`settings-hint`,children:[e(`settings.memory.embedder.runsOn`,{name:Ae(u?.display_name??t.device,`ltr`),device:d(t.device)}),` `,e(`settings.memory.embedder.why`)]}),t.options.some(e=>e.device===`npu`&&!e.proven&&e.present)&&L(`span`,{className:`settings-hint`,children:e(`settings.memory.embedder.npuUnproven`)}),u?.downloaded===!1&&L(`span`,{className:`settings-hint`,children:e(`settings.memory.embedder.notDownloaded`)}),a&&z(`span`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,e(`settings.memory.embedder.applying`)]}),s&&L(`p`,{className:`settings-ok`,role:`status`,children:e(`settings.memory.embedder.changed`)}),r&&L(`p`,{className:`settings-error`,role:`alert`,children:r})]})}function KX(){let e=R(),t=N(e=>e.setShowMemoryDashboard),n=N(e=>e.closeSettings),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1);(0,B.useEffect)(()=>{UG().then(i).catch(e=>o(e instanceof Error?e.message:String(e)))},[]);let l=(0,B.useCallback)(async()=>{if(r){c(!0),o(null);try{i(await WG({memory_enabled:!r.memory_enabled}))}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}}},[r]);return z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.memory`)}),L(`p`,{className:`settings-pane-lede`,children:e(`settings.memory.lede`)}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.section.memory`),children:[z(`label`,{className:`setting-row`,children:[L(`span`,{children:e(`settings.memory.remember`)}),z(`span`,{className:`toggle-switch`,children:[L(`input`,{type:`checkbox`,checked:!!r?.memory_enabled,onChange:()=>void l(),disabled:!r||s,"aria-label":e(`settings.memory.remember`)}),L(`span`,{className:`toggle-track`})]})]}),a&&L(`p`,{className:`settings-error`,role:`alert`,children:a}),z(`div`,{className:`settings-row settings-row-between`,children:[L(`span`,{className:`settings-hint`,children:e(`settings.memory.dashboardHint`)}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{n(),t(!0)},children:e(`settings.memory.dashboard`)})]})]}),L(`section`,{className:`settings-card`,"aria-label":e(`settings.memory.embedder.label`),children:L(GX,{})})]})}function qX(e,t,n){if(!/^\d+$/.test(e.trim()))return!1;let r=Number(e);return r>=t&&r<=n}function JX(e){return e<1048576?`${Math.ceil(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function YX(){let e=R(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(!1);(0,B.useEffect)(()=>{lt().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,B.useState)({days:!1,mb:!1}),p=!qX(r,1,365)||d.days,m=!qX(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 je(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 z(`div`,{className:`settings-field`,"aria-label":e(`settings.privacy.undo`),children:[L(`span`,{className:`settings-label`,children:e(`settings.privacy.undo`)}),L(`p`,{className:`settings-hint`,children:e(`settings.undo.hint`)}),t&&z(P.Fragment,{children:[z(`div`,{className:`setting-row`,children:[L(`label`,{htmlFor:`undo-days`,children:e(`settings.undo.days`)}),L(`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&&L(`p`,{id:`undo-days-error`,className:`settings-error`,children:e(`settings.undo.daysError`)}),z(`div`,{className:`setting-row`,children:[L(`label`,{htmlFor:`undo-mb`,children:e(`settings.undo.mb`)}),L(`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&&L(`p`,{id:`undo-mb-error`,className:`settings-error`,children:e(`settings.undo.mbError`)}),z(`div`,{className:`setting-row setting-row-path`,children:[L(`span`,{children:e(`settings.undo.inUse`)}),z(`span`,{children:[e.plural(`settings.undo.used`,t.turns,{size:JX(t.used_bytes)}),` `,L(`bdi`,{dir:`ltr`,children:L(`code`,{className:`setting-path`,children:t.path})})]})]}),L(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void g(),disabled:!h||l||p||m,children:e(l?`settings.models.applying`:`settings.advanced.save`)})]}),s&&L(`p`,{className:s.ok?`settings-ok`:`settings-error`,role:s.ok?`status`:`alert`,children:s.text})]})}var XX={root:`settings-report`,button:`btn-secondary`,hint:`settings-hint`,error:`settings-error`};function ZX(){let e=R(),t=N(e=>e.sessions),n=N(e=>e.removeSession),r=qc(),i=N(e=>e.systemStatus?.data_dir),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=!0;return de().then(t=>{e&&f(t.network_policy===`local_ai_only`)}).catch(t=>{e&&g({ok:!1,text:t instanceof Error?t.message:String(t)})}),()=>{e=!1}},[]);let _=(0,B.useCallback)(async()=>{if(d===null||p)return;let t=d,n=zc.getState().active?.model,r=!t;f(r),m(!0),g(null);try{let t=await pe({network_policy:r?`local_ai_only`:`cloud_allowed`});f(t.network_policy===`local_ai_only`),Bc(n);let i=t.policy_notices??[],a=i.some(e=>e.severity===`warning`),o=i.length?i.map(t=>t.code===`users_server_keeps_keys`?e(`settings.privacy.usersServerKeepsKeys`,{url:t.url??``}):t.code===`runtime_keys_not_dropped`?e(`settings.privacy.runtimeKeysNotDropped`,{reason:t.reason??``}):t.code===`saved_models_not_checked`&&t.cause===`model_server_down`&&t.models?.length?e.plural(`settings.privacy.savedModelNotCheckedServerDown`,t.models.length,{models:t.models.join(`, `)}):t.code===`saved_models_not_checked`?e(`settings.privacy.savedModelsNotChecked`,{reason:t.reason??``}):e(`settings.privacy.policyNoticeUnknown`)).join(` `):e(r?`settings.privacy.localOnlyOn`:`settings.privacy.localOnlyOff`);g({ok:!a,text:o})}catch(e){f(t),g({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{m(!1)}},[d,p,e]),v=(0,B.useCallback)(async t=>{try{await Ft(t,!1)}catch(t){u({ok:!1,text:e(`settings.privacy.openFolderFailed`,{reason:t instanceof Error?t.message:String(t)})})}},[e]),y=(0,B.useCallback)(async()=>{c(!0);let r=[];for(let e of t)try{await rr(e.id),n(e.id)}catch(t){r.push(`${e.title}: ${t instanceof Error?t.message:t}`)}c(!1),o(null),u(r.length?{ok:!1,text:e(`settings.privacy.deleteFailed`,{n:r.length,reason:r.join(`; `)})}:{ok:!0,text:e(`settings.privacy.deleted`)})},[n,t,e]);return z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.privacy`)}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.privacy.localOnlyTitle`),children:[z(`div`,{children:[z(`label`,{className:`setting-row`,children:[L(`strong`,{children:e(`settings.privacy.localOnlyTitle`)}),z(`span`,{className:`toggle-switch`,children:[L(`input`,{type:`checkbox`,role:`switch`,checked:d===!0,"aria-label":e(`settings.privacy.localOnlyTitle`),"aria-describedby":`privacy-local-only-hint`,onChange:()=>void _(),disabled:d===null,"aria-busy":p}),L(`span`,{className:`toggle-track`})]})]}),L(`p`,{className:`settings-hint`,id:`privacy-local-only-hint`,children:e(`settings.privacy.localOnlyHint`)})]}),h&&L(`p`,{className:h.ok?`settings-ok`:`settings-error`,role:h.ok?`status`:`alert`,children:h.text})]}),z(`section`,{className:`settings-card`,"aria-labelledby":`privacy-where-title`,children:[L(`h3`,{className:`settings-label`,id:`privacy-where-title`,children:e(`settings.privacy.whereTitle`)}),L(`p`,{className:`settings-note`,children:e(`settings.privacy.stays`)}),L(`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&&z(`div`,{className:`setting-row setting-row-path`,children:[L(`span`,{children:e(`settings.privacy.dataFolder`)}),z(`span`,{className:`setting-path-actions`,children:[L(`bdi`,{dir:`ltr`,className:`setting-path`,children:i}),L(`button`,{type:`button`,className:`link-btn`,onClick:()=>void v(i),children:e(`settings.privacy.openFolder`)})]})]})]}),z(`section`,{className:`settings-card`,"aria-labelledby":`privacy-report-title`,children:[L(`h3`,{className:`settings-label`,id:`privacy-report-title`,children:e(`settings.privacy.reportTitle`)}),L(`p`,{className:`settings-note`,children:e(`settings.privacy.reportNote`)}),L(sP,{classes:XX})]}),L(WY,{title:e(`settings.privacy.undo`),children:L(YX,{})}),z(`section`,{className:`settings-card`,"aria-labelledby":`privacy-delete-title`,children:[L(`h3`,{className:`settings-label`,id:`privacy-delete-title`,children:e(`settings.privacy.deleteTitle`)}),L(`p`,{className:`danger-warning`,children:t.length===0?e(`settings.privacy.nothingToDelete`):e(`settings.privacy.deleteWarning`)}),L(`button`,{type:`button`,className:`btn-danger`,onClick:()=>{u(null),o(t.length)},disabled:t.length===0,children:e(`settings.privacy.delete`)})]}),a!==null&&z(Gq,{title:e.plural(`settings.privacy.deleteAsk`,a),confirmLabel:e.plural(`settings.privacy.deleteYes`,a),cancelLabel:e(`settings.privacy.deleteCancel`),onConfirm:()=>void y(),onCancel:()=>o(null),danger:!0,busy:s,children:[L(`p`,{children:e(`settings.privacy.deleteWarning`)}),L(`p`,{children:e(`settings.privacy.deleteFinal`)})]}),l&&L(`p`,{className:l.ok?`settings-ok`:`settings-error`,role:l.ok?`status`:`alert`,children:l.text})]})}var QX=[{id:`needs_approval`,label:`settings.alerts.approval`},{id:`question`,label:`settings.alerts.question`},{id:`finished`,label:`settings.alerts.finished`}],$X=[{value:`banner`,label:`settings.alerts.banner`},{value:`badge`,label:`settings.alerts.badge`},{value:`off`,label:`settings.alerts.off`}],eZ=[0,10,20,30,50];function tZ(){return typeof Notification>`u`?`unsupported`:Notification.permission}function nZ(){let e=R(),t=Ql(),n=!!window.gaiaAPI,[r,i]=(0,B.useState)(tZ),a=Object.values(t.modes).includes(`banner`);return z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.notifications`)}),L(`p`,{className:`settings-pane-lede`,children:e(`settings.alerts.lede`)}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.alerts.when`),children:[QX.map(n=>z(`div`,{className:`setting-row`,children:[L(`span`,{id:`alert-${n.id}`,children:e(n.label)}),L(MB,{className:`segmented`,"aria-labelledby":`alert-${n.id}`,children:$X.map(r=>L(`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"?L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{Notification.requestPermission().then(i).catch(e=>{console.error(`[alerts] Notification permission request failed`,e),i(tZ())})},children:e(`settings.alerts.allow`)}):L(`p`,{className:`settings-error`,role:`alert`,children:e(r===`unsupported`?`settings.alerts.unsupported`:`settings.alerts.blocked`)})),z(`label`,{className:`setting-row`,children:[L(`span`,{children:e(`settings.alerts.sound`)}),z(`span`,{className:`toggle-switch`,children:[L(`input`,{type:`checkbox`,checked:t.sound,onChange:()=>t.update({sound:!t.sound}),"aria-label":e(`settings.alerts.sound`)}),L(`span`,{className:`toggle-track`})]})]}),n&&z(`label`,{className:`setting-row`,children:[L(`span`,{children:e(`settings.alerts.flash`)}),z(`span`,{className:`toggle-switch`,children:[L(`input`,{type:`checkbox`,checked:t.flash,onChange:()=>t.update({flash:!t.flash}),"aria-label":e(`settings.alerts.flash`)}),L(`span`,{className:`toggle-track`})]})]})]}),z(`section`,{className:`settings-card`,"aria-labelledby":`keep-awake-title`,children:[L(`h3`,{className:`settings-label`,id:`keep-awake-title`,children:e(`settings.alerts.keepAwakeTitle`)}),n?z(P.Fragment,{children:[z(`label`,{className:`setting-row`,children:[L(`span`,{children:e(`settings.alerts.keepAwake`)}),z(`span`,{className:`toggle-switch`,children:[L(`input`,{type:`checkbox`,checked:t.keepAwake,onChange:()=>t.update({keepAwake:!t.keepAwake}),"aria-label":e(`settings.alerts.keepAwake`)}),L(`span`,{className:`toggle-track`})]})]}),z(`div`,{className:`setting-row`,children:[L(`label`,{htmlFor:`battery-floor`,children:e(`settings.alerts.battery`)}),L(`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:eZ.map(t=>L(`option`,{value:t,children:t===0?e.bare(`settings.alerts.never`):`${t}%`},t))})]}),L(`p`,{className:`settings-hint`,children:e(`settings.alerts.screen`)})]}):L(`p`,{className:`settings-hint`,children:e(`settings.alerts.desktopOnly`)})]})]})}var rZ=[50,75,100,125,150,175,200],iZ=[{accent:`american`,gender:`female`},{accent:`american`,gender:`male`},{accent:`british`,gender:`female`},{accent:`british`,gender:`male`}],aZ=`settings:preview`,oZ=`Hello, I'm GAIA. This is how I'll read my replies to you.`;function sZ(e){return e instanceof Vn?e.detail||e.message:String(e)}function cZ(){let e=R(),t=VN(e=>e.settings),n=VN(e=>e.setSettings),r=VN(e=>e.read),i=VN(e=>e.stop),a=VN(e=>e.messageId===aZ),o=VN(e=>e.messageId===aZ&&e.status===`loading`),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1);(0,B.useEffect)(()=>{ON().then(n).catch(e=>c(sZ(e)))},[n]);let p=e=>{f(!0),u(null),VN.getState().messageId===aZ&&i(),kN(e).then(n).catch(e=>u(sZ(e))).finally(()=>f(!1))};return s?z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.voice`)}),L(`p`,{className:`settings-error`,role:`alert`,children:e(`readAloud.settings.loadFailed`,{reason:s})})]}):t?z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.voice`)}),L(`p`,{className:`settings-pane-lede`,children:e(`readAloud.settings.lede`)}),z(`div`,{className:`settings-field`,children:[L(`label`,{className:`settings-label`,htmlFor:`read-aloud-voice`,children:e(`readAloud.settings.voice`)}),z(`div`,{className:`read-aloud-voice-row`,children:[L(`select`,{id:`read-aloud-voice`,className:`settings-input`,value:t.voice,disabled:d,onChange:e=>p({voice:e.target.value}),children:iZ.map(n=>L(`optgroup`,{label:e(`readAloud.group.${n.accent}.${n.gender}`),children:t.voices.filter(e=>e.accent===n.accent&&e.gender===n.gender).map(e=>L(`option`,{value:e.id,lang:`en`,children:e.name},e.id))},`${n.accent}-${n.gender}`))}),z(`button`,{type:`button`,className:`btn-secondary`,"aria-pressed":a,disabled:d,onClick:()=>a?i():void r(aZ,oZ),children:[o?L(Za,{size:13,className:`spin`}):L(a?Is:Xs,{size:13}),e(a?`readAloud.stop`:`readAloud.settings.preview`)]})]}),L(`span`,{className:`settings-hint`,children:e(`readAloud.settings.englishOnly`)}),L(WN,{messageId:aZ})]}),z(`div`,{className:`settings-field`,children:[L(`label`,{className:`settings-label`,htmlFor:`read-aloud-speed`,children:e(`readAloud.settings.speed`)}),L(`select`,{id:`read-aloud-speed`,className:`settings-input`,value:t.speed,disabled:d,onChange:e=>p({speed:Number(e.target.value)}),children:(rZ.includes(t.speed)?rZ:[...rZ,t.speed].sort((e,t)=>e-t)).map(t=>L(`option`,{value:t,children:t===100?e.bare(`readAloud.settings.normalSpeed`):`${(t/100).toLocaleString(e.locale)}×`},t))})]}),z(`label`,{className:`setting-row`,children:[L(`span`,{children:e(`readAloud.settings.auto`)}),z(`span`,{className:`toggle-switch`,children:[L(`input`,{type:`checkbox`,checked:t.auto,disabled:d,onChange:()=>p({auto:!t.auto}),"aria-label":e(`readAloud.settings.auto`)}),L(`span`,{className:`toggle-track`})]})]}),L(`p`,{className:`settings-hint`,children:e(`readAloud.settings.shared`)}),l&&L(`p`,{className:`settings-error`,role:`alert`,children:e(`readAloud.settings.saveFailed`,{reason:l})})]}):z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,e(`settings.loading`)]})}function lZ(){let e=R(),t=N(e=>e.jumpToSetting),n=N(e=>e.closeSettings),r=N(e=>e.runSetupAgain),i=zc(e=>e.active),a=N(e=>e.systemStatus?.lemonade_running===!1),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)(null),[g,_]=(0,B.useState)(!1);(0,B.useEffect)(()=>{En().then(s).catch(e=>h(e instanceof Error?e.message:String(e))),ue().then(l).catch(e=>h(e instanceof Error?e.message:String(e))),Xe().then(e=>d(e??null)).catch(e=>p(e instanceof Error?e.message:String(e)))},[]);let v=o?.catalog?.find(e=>e.id===o.chat_model.id),y=(i?.model?i.remote?i.label??Uc(i.model):Uc(i.model):null)??v?.name??null,b=(o?.catalog??[]).filter(e=>e.downloaded),x=b.reduce((e,t)=>e+(t.full_size_gb??0),0),S=[c?.gpu_name,c?.npu_detected?e(`setup.checks.npu`):null].filter(Boolean).join(` · `),C=Tk(o?.system?.physical_memory,c?.ram_gb),w=C&&kk(e.locale,C),T=o?.capacity_gb==null?null:kk(e.locale,Ck(o.capacity_gb)),E=T?w?e(`settings.setup.memoryOf`,{size:T,total:w}):e(`settings.setup.memoryFor`,{size:T}):w,D=[{title:e(`settings.setup.where`),rows:[{label:e(`settings.setup.chatRuns`),value:y,section:`model`,target:`.model-in-use`},{label:e(`settings.setup.cloudKeys`),value:null,section:`model`,target:`[data-settings-target="cloud-key"]`,provider:`fireworks`}]},{title:e(`setup.pc.step`),rows:[{label:e(`settings.setup.detected`),value:[S,E].filter(Boolean).join(` · `)||null},{label:e(`settings.setup.server`),value:o?.lemonade.mode===`external`?e(`settings.setup.serverYours`):e(`settings.setup.serverOwn`),section:`advanced`,target:`[data-settings-target="model-server"]`},{label:e(`setup.gpu.title`),value:null,section:`model`,target:`#settings-gpu-title`,provider:`local`,shown:!!u?.applies||!!f&&!oX(f)}]},{title:e(`setup.models.step`),rows:[{label:e(`settings.setup.models`),value:o?.catalog?e(`settings.setup.modelsValue`,{n:String(b.length),size:Ck(x)}):null,section:`model`,target:`[data-settings-target="models-on-pc"]`,provider:`local`},{label:e(`settings.setup.context`),value:null,section:`model`,target:`#ctx-size`,shown:!!i?.model&&!i.remote&&i.downloaded!==!1}]},{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`,target:`#ui-language`},{label:e(`settings.setup.signIn`),value:null,section:`general`,target:`#desktop-startOnLogin`,shown:!!window.gaiaAPI?.tray}]}];return z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.setup`)}),L(`p`,{className:`settings-hint`,children:e(`settings.setup.lede`)}),z(`div`,{className:`settings-setup-status`,children:[z(`span`,{children:[L(`strong`,{children:e(a?`settings.setup.serverDown`:`settings.setup.ready`)}),y&&!a&&z(`span`,{className:`settings-hint`,children:[` `,L(`bdi`,{children:e(`settings.setup.running`,{name:y})})]})]}),L(`button`,{type:`button`,className:`btn-secondary`,"data-testid":`setup-run-again`,onClick:()=>_(!0),children:e(`settings.setup.runAgain`)})]}),m&&L(`p`,{className:`setup-error`,role:`alert`,children:m}),D.map(e=>z(`section`,{className:`settings-setup-group`,"aria-label":e.title,children:[L(`h3`,{className:`settings-label`,children:e.title}),e.rows.filter(e=>e.shown!==!1).map(e=>{let n=z(`span`,{children:[L(`span`,{className:`settings-setup-row-label`,children:e.label}),e.value&&L(`bdi`,{className:`settings-hint settings-setup-row-value`,children:e.value})]}),r=e.section;return r?z(`button`,{type:`button`,className:`settings-setup-row`,onClick:()=>t({section:r,target:e.target??`.settings-pane-title`,from:`setup`},e.provider),children:[n,L(ri,{size:14,className:`settings-setup-chevron`,"aria-hidden":`true`})]},e.label):L(`div`,{className:`settings-setup-row is-fact`,children:n},e.label)})]},e.title)),g&&L(Gq,{title:e(`settings.setup.confirmTitle`),confirmLabel:e(`settings.setup.confirmYes`),cancelLabel:e(`setup.again.notNow`),onConfirm:()=>{_(!1),n(),r(!0)},onCancel:()=>_(!1),children:L(`p`,{children:e(`settings.setup.confirmBody`)})})]})}var uZ=[{label:`settings.about.whatsNew`,href:`https://github.com/amd/gaia/releases`},{label:`settings.about.docs`,href:`https://amd-gaia.ai/docs/guides/agent-ui`},{label:`settings.about.report`,href:`https://github.com/amd/gaia/issues/new/choose`},{label:`settings.about.license`,href:`https://github.com/amd/gaia/blob/main/LICENSE.md`}];function dZ(){let e=R(),t=N(e=>e.openSettings),n=`GAIA v0.27.0rc8`,[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(null),s=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let c=(0,B.useCallback)(async()=>{o(null);try{await navigator.clipboard.writeText(n),i(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>i(!1),2e3)}catch(t){o(e(`settings.about.copyFailed`,{reason:t instanceof Error?t.message:String(t)}))}},[e,n]);return z(`div`,{className:`settings-pane`,children:[L(`h2`,{className:`settings-pane-title`,children:e(`settings.section.about`)}),z(`section`,{className:`settings-card`,"aria-labelledby":`about-version`,children:[z(`div`,{className:`settings-row settings-row-between`,children:[z(`span`,{children:[L(`strong`,{id:`about-version`,children:L(`bdi`,{dir:`ltr`,children:n})}),` `,L(`span`,{className:`beta-badge`,children:`BETA`})]}),z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void c(),children:[L(r?Yr:Ti,{size:13,"aria-hidden":`true`}),e(r?`settings.about.copied`:`settings.about.copy`)]})]}),L(`p`,{className:`settings-hint`,children:e(`settings.advanced.about`)}),a&&L(`p`,{className:`settings-error`,role:`alert`,children:a})]}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.about.links`),children:[L(`ul`,{className:`settings-about-links`,children:uZ.map(t=>L(`li`,{children:z(`a`,{href:t.href,target:`_blank`,rel:`noopener noreferrer`,children:[e(t.label),` `,L(Ui,{size:12,"aria-hidden":`true`})]})},t.href))}),z(`p`,{className:`settings-hint`,children:[e(`settings.about.reportHint`),` `,L(`button`,{type:`button`,className:`link-btn`,onClick:()=>t(`privacy`),children:e(`settings.about.reportWhere`)})]})]})]})}var fZ=class extends B.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidUpdate(e){this.state.hasError&&e.resetKey!==this.props.resetKey&&this.setState({hasError:!1})}componentDidCatch(e,t){console.error(`[ErrorBoundary] ${this.props.area} failed to render:`,e,t.componentStack)}render(){return this.state.hasError?L(pZ,{variant:this.props.variant??`fill`,onRetry:()=>this.setState({hasError:!1})}):this.props.children}};function pZ({onRetry:e,variant:t}){let n=R();return z(`div`,{role:`alert`,className:`error-boundary error-boundary-${t}`,children:[L(`p`,{className:`error-boundary-title`,children:n(`errorBoundary.title`)}),L(`p`,{className:`error-boundary-body`,children:n(t===`window`?`errorBoundary.bodyWindow`:`errorBoundary.body`)}),z(`div`,{className:`error-boundary-actions`,children:[L(`button`,{type:`button`,className:`btn-primary`,onClick:e,children:n(`errorBoundary.retry`)}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>window.location.reload(),children:n(`errorBoundary.reload`)})]})]})}var mZ=`modulepreload`,hZ=function(e,t){return new URL(e,t).href},gZ={},_Z=function(e){return e.pathname.endsWith(`.css`)},vZ=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},yZ=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=hZ(t,n);let r=s(t),i=_Z(r);return vZ(gZ,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`:mZ,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)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).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)})},bZ=(0,B.lazy)(()=>yZ(()=>import(`./ConnectorsPane-DR1BXwSE.js`).then(e=>({default:e.ConnectorsPane})),__vite__mapDeps([0,1,2,3]),import.meta.url)),xZ=(0,B.lazy)(()=>yZ(()=>import(`./MessagingSettings-naPht5_K.js`).then(e=>({default:e.MessagingSettings})),__vite__mapDeps([4,1,2]),import.meta.url)),SZ=(0,B.lazy)(()=>yZ(()=>import(`./AutomationsSettings-B-JefRcu.js`).then(e=>({default:e.AutomationsSettings})),__vite__mapDeps([5,1,2]),import.meta.url)),CZ=(0,B.lazy)(()=>yZ(()=>import(`./AdvancedSettings-DPIu61Ug.js`).then(e=>({default:e.AdvancedSettings})),__vite__mapDeps([6,1,2]),import.meta.url)),wZ=[`general`,`setup`,`model`,`images`,`permissions`,`skills`,`connectors`,`messaging`,`automations`,`memory`,`notifications`,`voice`,`privacy`,`advanced`,`about`];function TZ({onUseSkill:e}){let t=R(),n=N(e=>e.settingsSection),r=N(e=>e.openSettings),i=N(e=>e.closeSettings),a=N(e=>e.settingsJump),o=(0,B.useRef)(null),s=(0,B.useRef)(null),c=n!==null;if(ut(c,i),un(o,c),TK(o,c,()=>o.current?.querySelector(`.settings-nav-item.is-active`)),(0,B.useLayoutEffect)(()=>{s.current&&(s.current.scrollTop=0)},[n]),(0,B.useEffect)(()=>{let e=s.current;if(!a||a.section!==n||!e)return;o.current?.querySelector(`[data-section="${n}"]`)?.focus();let t,r=null,i=()=>r?.scrollIntoView({block:`start`}),c=typeof ResizeObserver>`u`?null:new ResizeObserver(i),l=()=>c?.disconnect(),u=[`wheel`,`touchstart`,`pointerdown`,`keydown`],d=()=>{let n=e.querySelector(a.target);if(!n||n.disabled)return!1;for(let e=n.closest(`details`);e;e=e.parentElement?.closest(`details`)??null)e.open=!0;r=n.closest(`.model-in-use-field, .settings-field, details, .settings-card`)??n,r.classList.add(`settings-target-hit`),i();let o=n instanceof HTMLDetailsElement?n.querySelector(`summary`):n.closest(`summary`)??n;o&&(o.matches(`summary, button, input, select, textarea, a[href], [tabindex]`)||(o.tabIndex=-1),o.focus({preventScroll:!0}));let s=n.closest(`.settings-pane`);return s&&c?.observe(s),t=setTimeout(()=>r?.classList.remove(`settings-target-hit`),1600),!0},f=new MutationObserver(()=>{d()&&f.disconnect()});d()||f.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`disabled`]}),u.forEach(t=>e.addEventListener(t,l,{passive:!0}));let p=setTimeout(()=>f.disconnect(),5e3);return()=>{f.disconnect(),l(),u.forEach(t=>e.removeEventListener(t,l)),clearTimeout(p),clearTimeout(t)}},[a,n]),!n)return null;let l=a&&a.section===n?a.from:void 0,u=e=>{let t=wZ.indexOf(n),i=e.key===`ArrowDown`?(t+1)%wZ.length:e.key===`ArrowUp`?(t-1+wZ.length)%wZ.length:e.key===`Home`?0:e.key===`End`?wZ.length-1:null;i!==null&&(e.preventDefault(),r(wZ[i]),o.current?.querySelector(`[data-section="${wZ[i]}"]`)?.focus())},d=(()=>{switch(n){case`general`:return L(aX,{});case`setup`:return L(lZ,{});case`model`:return L(OX,{});case`images`:return L(PX,{});case`permissions`:return L(FX,{});case`skills`:return L(UX,{onUseSkill:t=>{i(),e(t)}});case`connectors`:return L(bZ,{});case`messaging`:return L(xZ,{});case`automations`:return L(SZ,{});case`memory`:return L(KX,{});case`notifications`:return L(nZ,{});case`voice`:return L(cZ,{});case`privacy`:return L(ZX,{});case`advanced`:return L(CZ,{});case`about`:return L(dZ,{})}})();return L(`div`,{className:`settings-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&i()},children:z(`div`,{ref:o,className:`settings-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`settings.title`),children:[z(`nav`,{className:`settings-nav`,"aria-label":t(`settings.sections`),onKeyDown:u,children:[L(`h1`,{className:`settings-nav-title`,children:t(`settings.title`)}),wZ.map(e=>L(`button`,{type:`button`,"data-section":e,className:`settings-nav-item${n===e?` is-active`:``}`,"aria-current":n===e?`page`:void 0,tabIndex:n===e?0:-1,onClick:t=>{t.currentTarget.focus(),r(e)},children:t(`settings.section.${e}`)},e))]}),z(`div`,{className:`settings-body`,children:[L(`button`,{type:`button`,className:`settings-close`,onClick:i,"aria-label":t(`settings.close`),children:L(nc,{size:18})}),l&&z(`button`,{type:`button`,className:`settings-back`,onClick:()=>{r(l),o.current?.querySelector(`[data-section="${l}"]`)?.focus()},children:[L(ti,{size:14,"aria-hidden":`true`}),t.compose(e=>e(`settings.backTo`,{section:e(`settings.section.${l}`)}))]}),L(`div`,{ref:s,className:`settings-scroll`,children:L(fZ,{area:`settings.${n}`,children:L(B.Suspense,{fallback:z(`p`,{className:`settings-hint`,children:[L(Za,{size:13,className:`spin`}),` `,t(`settings.loading`)]}),children:d})},n)})]})]})})}var EZ=`gaia:personalize-connector`,DZ=[[`google`,`my last two weeks of Gmail (and Google Calendar, if it is connected)`],[`microsoft`,`my last two weeks of Outlook mail (and calendar, if it is connected)`],[`slack`,`my recent Slack channels and direct messages`],[`github`,`my recent GitHub activity: open PRs, review requests, issues and notifications`]];function OZ(e,t){let n=e.toLowerCase().replace(/^mcp-/,``),r=DZ.find(([e])=>n.startsWith(e));return r?r[1]:`my recent activity in ${t}`}function kZ(e){let t=e.toLowerCase().replace(/^mcp-/,``),n=DZ.find(([e])=>t.startsWith(e));return n?n[0]:null}function AZ({connectorId:e,displayName:t}){return[`I just connected ${t}. Get to know me from ${OZ(e,t)}.`,`Read only — do not send, delete, label or change anything.`,`If you have no tools that read it, or they fail, tell me you couldn't reach it and stop. Never guess or count what it holds.`,`1. Skim the recent items and work out who I deal with most, what I work on, recurring meetings or threads, and what keeps landing on my plate.`,`2. Save the durable facts to memory (people, projects, preferences, routines). Skip one-off details and anything sensitive like passwords, codes or financial numbers.`,`3. Recommend up to five automations you could run for me on a schedule, each with what it does, how often, and why it fits what you saw.`,`Don't create any schedules yet — tell me what you saved and list the automations so I can pick which to set up.`].join(`
|
|
214
|
-
`)}function jZ(e){window.dispatchEvent(new CustomEvent(EZ,{detail:e}))}var MZ=Pt((e,t)=>({lifecycle:null,restartError:null,apply:n=>{n.apiBase&&Tt(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){F.system.error(`Restart GAIA failed`,t),e({restartError:t instanceof Error?t.message:String(t)})}}}));function NZ(){let e=window.gaiaAPI?.backend;e&&e.getState().then(e=>MZ.getState().apply(e)).catch(e=>F.system.error(`Could not read the backend state from the desktop app`,e))}function PZ(e){let t=window.gaiaAPI?.backend;if(!t)return()=>{};let n=t=>{let n=MZ.getState().lifecycle?.status;MZ.getState().apply(t),t.status===`running`&&n&&n!==`running`&&e()},r=t.onState(n);return t.getState().then(n).catch(e=>F.system.error(`Could not read the backend state from the desktop app`,e)),r}function FZ(e,t){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null),u=(0,B.useRef)(null),d=(0,B.useCallback)(()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(clearTimeout(l.current),null),u.current&&=(clearInterval(u.current),null)},[]);(0,B.useEffect)(()=>d,[d]);let f=(0,B.useCallback)((e,t)=>{u.current&&clearInterval(u.current),u.current=setInterval(async()=>{try{let n=await se();t===`load`?Hc(n.model_loaded,e)&&(r(!1),c.current&&=(clearTimeout(c.current),null),u.current&&=(clearInterval(u.current),null)):(n.model_downloaded===!0||Hc(n.model_loaded,e))&&(a(!1),l.current&&=(clearTimeout(l.current),null),u.current&&=(clearInterval(u.current),null))}catch{}},Eu)},[]),m=e??`Gemma-4-E4B-it-GGUF`;return(0,B.useEffect)(()=>s(null),[m]),{isLoadingModel:n,isDownloadingModel:i,downloadError:o,loadModel:(0,B.useCallback)(async(e,n)=>{let i=e??m,a=n??t;r(!0);try{if(!await tn(i,a)){r(!1);return}F.system.info(`Load model triggered: ${i} (ctx=${a??`server default`})`),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>r(!1),wu),f(i,`load`)}catch(e){F.system.error(`Failed to trigger model load`,e),r(!1)}},[m,t,f]),downloadModel:(0,B.useCallback)(async(e=!1,t,n=!1)=>{let r=t??m;a(!0),s(null);try{await p(r,e,n),F.system.info(`Download model triggered: ${r} (force=${e})`),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>a(!1),Tu),f(r,`download`)}catch(e){F.system.error(`Failed to trigger model download`,e),s(e instanceof Error?e.message:String(e)),a(!1)}},[m,f])}}function IZ({onRetry:e,label:t,busyLabel:n=`Checking…`}){let[r,i]=(0,B.useState)(!1);return L(`button`,{className:`connection-banner__retry`,onClick:()=>{i(!0),Promise.resolve(e()).finally(()=>i(!1))},disabled:r,children:r?n:t})}function LZ(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function RZ({lifecycle:e}){let t=R(),n=MZ(e=>e.restart),r=MZ(e=>e.restartError),i=e.status===`restarting`,[a,o]=(0,B.useState)(()=>Date.now());if((0,B.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 z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Za,{size:16,className:`connection-banner__spinner`})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[t(`banner.restarting`),` `,L(`bdi`,{dir:`ltr`,className:`connection-banner__timer`,children:LZ(n)}),` `,L(`span`,{className:`connection-banner__hint`,children:t(`banner.restartingHint`)})]})]})}return z(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[t(`banner.restartStopped`),` `,L(`span`,{className:`connection-banner__hint`,children:r?t(`banner.restartFailed`,{error:r}):t(`banner.restartStoppedHint`)})]}),L(IZ,{onRetry:n,label:t(`banner.restartButton`),busyLabel:t(`banner.restartingShort`)})]})}function zZ({onRetry:e,backendSlow:t=!1,backendError:n=null}){let r=R(),{backendConnected:i,systemStatus:a,currentSessionId:o,messages:s}=N(),c=MZ(e=>e.lifecycle),[l,u]=(0,B.useState)(!1),d=!!o&&s.length>0,f=a?.default_model_name??`Gemma-4-E4B-it-GGUF`,{isDownloadingModel:p,downloadError:m,downloadModel:h}=FZ(f),g=zc(e=>e.pickLoad),_=zc(e=>e.retryPickLoad),v=zc(e=>e.dismissPickLoad);Vc();let y=(0,B.useRef)(a?.lemonade_running),b=(0,B.useRef)(a?.model_downloaded),x=(0,B.useRef)(a?.context_size_sufficient),S=(0,B.useRef)(a?.expected_model_loaded);(0,B.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]);let C=a?.download_progress??null,w=p||C?.state===`downloading`||C?.state===`starting`,T=N(e=>e.dismissDownloadFailure);if(c&&c.status!==`running`)return L(RZ,{lifecycle:c});let E=C?.model_name||f,D=async()=>{try{await T(C?.model_name??E)}catch{}};if(w||C?.state===`error`){let e=Uc(E),t=C?.total_bytes?kk(r.locale,`${(C.total_bytes/1e9).toFixed(1)} GB`):r(`banner.download.sizeUnknown`),n=C?.state===`error`;return z(`div`,{className:`connection-banner ${n?`connection-banner--error`:`connection-banner--warning`}`,role:n?`alert`:`status`,children:[L(`div`,{className:`connection-banner__icon`,children:L(n?Ws:Ni,{size:16})}),L(`div`,{className:`connection-banner__text`,dir:`auto`,children:n?z(P.Fragment,{children:[r(`banner.download.failed`,{model:e}),` `,(m??C?.message)&&L(`span`,{className:`connection-banner__hint`,children:m??C?.message})]}):z(P.Fragment,{children:[r(`banner.download.running`,{model:e,size:t}),C?.state===`downloading`&&C.file&&z(P.Fragment,{children:[` `,z(`span`,{className:`connection-banner__hint`,children:[r(`banner.download.file`,{index:C.file_index,total:C.total_files}),` `,L(`code`,{children:C.file})]})]})]})}),n?L(`button`,{className:`connection-banner__retry`,onClick:()=>h(!1,E,!a?.model_loaded),children:r(`banner.download.retry`)}):L(`span`,{className:`connection-banner__loading connection-banner__progress`,children:C&&C.state===`downloading`&&C.total_bytes>0?z(P.Fragment,{children:[L(`span`,{className:`connection-banner__progress-bar`,role:`progressbar`,"aria-valuenow":C.percent,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r(`banner.download.progress`),children:L(`span`,{className:`connection-banner__progress-fill`,style:{width:`${C.percent}%`}})}),z(`bdi`,{className:`connection-banner__progress-label`,dir:`ltr`,children:[C.percent,`% ·`,` `,(C.downloaded_bytes/1e9).toFixed(2),` /`,` `,(C.total_bytes/1e9).toFixed(2),` GB`]})]}):z(P.Fragment,{children:[L(Za,{size:13,className:`connection-banner__spinner`}),C?.state===`starting`?C.message??r(`banner.download.starting`):r(`banner.download.downloading`)]})}),n&&L(`button`,{className:`connection-banner__dismiss`,onClick:()=>void D(),"aria-label":r(`banner.dismiss`),children:L(nc,{size:14})})]})}if(g){let e=Uc(g.model);return g.error?z(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(`banner.pickLoad.failed`,{model:e}),` `,L(`span`,{className:`connection-banner__hint`,dir:`auto`,children:g.error.key?r(g.error.key,{reason:g.error.reason}):g.error.reason})]}),L(IZ,{onRetry:_,label:r(`banner.pickLoad.retry`)}),L(`button`,{className:`connection-banner__dismiss`,onClick:v,"aria-label":r(`banner.dismiss`),children:L(nc,{size:14})})]}):z(`div`,{className:`connection-banner connection-banner--init`,role:`status`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Za,{size:16,className:`connection-banner__spinner`})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(`banner.pickLoad.loading`,{model:e}),` `,L(`bdi`,{dir:`ltr`,children:r(`banner.pickLoad.seconds`,{s:g.seconds})}),` `,L(`span`,{className:`connection-banner__hint`,children:r(`banner.pickLoad.canType`)})]})]})}if(QI(a)&&!t&&!n){let e=a?.init_tasks?.find(e=>e.status===`running`)?.step,t=`banner.boot.${e}`,n=e&&fe(t)?r(t):r(`banner.boot.generic`);return z(`div`,{className:`connection-banner connection-banner--init`,role:`status`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Za,{size:16,className:`connection-banner__spinner`})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[n,z(`span`,{className:`thinking-dots`,children:[L(`span`,{children:`.`}),L(`span`,{children:`.`}),L(`span`,{children:`.`})]})]})]})}if(l||d)return null;if(!i)return z(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Qs,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(`banner.unreachable`),` `,L(`span`,{className:`connection-banner__hint`,children:r(`banner.unreachableHint`)})]}),e&&L(IZ,{onRetry:e,label:`Retry`})]});if(n)return z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`GAIA's backend answered with an error (`,n,`).`,` `,L(`span`,{className:`connection-banner__hint`,children:`It may be overloaded. GAIA keeps checking; if it lasts, restart GAIA.`})]}),e&&L(IZ,{onRetry:e,label:`Check again`})]});if(t)return z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`GAIA is slow to answer.`,` `,L(`span`,{className:`connection-banner__hint`,children:`It may be busy with another chat or app. GAIA keeps checking.`})]}),e&&L(IZ,{onRetry:e,label:`Check again`})]});if(a?.config_error)return z(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`GAIA settings could not be loaded.`,` `,L(`span`,{className:`connection-banner__hint`,children:a.config_error})]}),e&&L(IZ,{onRetry:e,label:`Check again`})]});if(a&&!a.lemonade_running){let t=$I(a)===`unresponsive`,n=!t&&uX(a),i=t&&sX(a.start_command)?null:a.start_command,o=t&&sX(a.start_instruction)?null:a.start_instruction;return z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[L(`div`,{className:`connection-banner__icon`,children:L(Ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(t?`banner.serverHung`:`banner.serverStopped`),` `,n?L(`span`,{className:`connection-banner__hint`,children:r(`banner.finishSetup`)}):i?z(`span`,{className:`connection-banner__hint`,children:[r(t?`banner.restartHint`:`banner.startHint`),` `,L(`code`,{dir:`ltr`,children:i})]}):o&&L(`span`,{className:`connection-banner__hint`,children:lX(r,o)})]}),n&&L(dX,{className:`connection-banner__retry`}),e&&L(IZ,{onRetry:e,label:r(`settings.key.checkAgain`)}),L(`button`,{className:`connection-banner__dismiss`,onClick:()=>u(!0),"aria-label":`Dismiss`,children:L(nc,{size:14})})]})}if(a&&a.lemonade_running&&a.model_loaded&&a.context_size_sufficient===!1){let t=a.model_context_size??0;return z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[L(`div`,{className:`connection-banner__icon`,children:L(za,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`LLM context window is too small (`,t.toLocaleString(),` tokens;`,` `,Su.toLocaleString(),` required).`,` `,L(`span`,{className:`connection-banner__hint`,children:`Reload it with a larger context in Settings → Advanced.`})]}),e&&L(IZ,{onRetry:e,label:`Check again`}),L(`button`,{className:`connection-banner__dismiss`,onClick:()=>u(!0),"aria-label":`Dismiss`,children:L(nc,{size:14})})]})}return null}var BZ=`https://github.com/amd/gaia/releases`;function VZ(){let e=uY(),t=R(),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(null),o=(0,B.useCallback)(e=>{let n=cY();n&&(a(null),n[e]().catch(n=>{F.system.error(`Update ${e} failed`,n),a(mY(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 z(`div`,{className:`update-chip update-chip--error`,role:`status`,children:[L(Ws,{size:13,className:`update-chip__icon`}),L(`span`,{className:`update-chip__label`,title:i??void 0,children:t(i?`update.chip.updateFailed`:`update.chip.startFailed`)}),L(`button`,{type:`button`,className:`update-chip__action`,onClick:()=>o(`revertUpdate`),children:t(`update.chip.goBack`,{version:e.previousVersion})}),L(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismissError`),children:L(nc,{size:11})})]});let l=e.status===`available`||e.status===`downloaded`;if(s&&!l)return z(`div`,{className:`update-chip update-chip--error`,role:`status`,title:s??void 0,children:[L(Ws,{size:13,className:`update-chip__icon`}),L(`span`,{className:`update-chip__label`,children:t(`update.chip.installFailed`)}),L(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismissError`),children:L(nc,{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 z(`div`,{className:`update-chip update-chip--downloading`,role:`status`,"aria-live":`polite`,title:t(`update.chip.downloadingTitle`,{version:e.version??``}),children:[L(Ni,{size:13,className:`update-chip__icon`}),L(`span`,{className:`update-chip__label`,children:e.preparing?t(`update.chip.preparing`):t(`update.chip.downloading`,{pct:n})})]})}return e.status===`available`?z(`div`,{className:`update-chip update-chip--available`,role:`status`,title:e.manualInstall?t(`update.chip.manualTitle`,{version:e.version??``}):i||s||e.releaseNotes||t(`update.chip.availableTitle`),children:[L(Ni,{size:13,className:`update-chip__icon`}),L(`span`,{className:`update-chip__label`,children:i?t(`update.chip.updateFailed`):s?t(`update.chip.installFailed`):t(`update.chip.available`,{version:e.version??``})}),e.manualInstall?L(`a`,{className:`update-chip__action`,href:e.downloadUrl??BZ,target:`_blank`,rel:`noopener noreferrer`,children:t(`update.chip.download`)}):!e.pinnedVersion&&L(`button`,{type:`button`,className:`update-chip__action`,onClick:()=>o(`downloadUpdate`),children:t(`update.chip.updateNow`)}),L(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismiss`),children:L(nc,{size:11})})]}):e.status===`downloaded`?z(`div`,{className:`update-chip update-chip--ready`,role:`status`,"aria-live":`polite`,children:[L(Qo,{size:13,className:`update-chip__icon`}),L(`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`?z(`div`,{className:`update-chip update-chip--error`,role:`status`,title:e.error||t(`update.chip.checkFailed`),children:[L(Ws,{size:13,className:`update-chip__icon`}),L(`span`,{className:`update-chip__label`,children:t(`update.chip.checkFailed`)}),L(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismissError`),children:L(nc,{size:11})})]}):null}var HZ={permission_request:{icon:L(bs,{size:16}),colorClass:`notif-type-permission`},policy_alert:{icon:L(bs,{size:16}),colorClass:`notif-type-policy`},security_alert:{icon:L(Ws,{size:16}),colorClass:`notif-type-security`},status_change:{icon:L(si,{size:16}),colorClass:`notif-type-status`},info:{icon:L(Na,{size:16}),colorClass:`notif-type-info`},error:{icon:L(di,{size:16}),colorClass:`notif-type-error`}},UZ=/([-])/;function WZ(e){return e.split(UZ).map((e,t)=>t%2?e:sd(e,!0)).join(``)}function GZ(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(On(t),{month:`short`,day:`numeric`})}function KZ({onClose:e,onOpenChat:t}){let n=R(),r=Bl(dc(Hl)),i=Bl(Vl),a=Bl(e=>e.markRead),o=Bl(e=>e.markAllRead),s=Bl(e=>e.clearAll),c=Bl(e=>e.dismiss),l=Bl(e=>e.respondToPermission),u=Bl(e=>e.typeFilter),d=Bl(dc(Ul)),f=Bl(e=>e.setTypeFilter),p=(0,B.useCallback)(e=>{a(e.id),e.sessionId&&e.type!==`permission_request`&&t?.(e.sessionId)},[a,t]),m=(0,B.useCallback)(e=>{l(e.id,`allow`).catch(e=>console.error(`[NotificationCenter] allow failed:`,e))},[l]),h=(0,B.useCallback)(e=>{l(e.id,`deny`).catch(e=>console.error(`[NotificationCenter] deny failed:`,e))},[l]);ut(!0,e);let g=[{key:null,label:n(`notifications.filter.all`)},{key:`permission_request`,label:n(`notifications.filter.permissions`)},{key:`policy_alert`,label:n(`notifications.filter.policy`)},{key:`error`,label:n(`notifications.filter.errors`)},{key:`security_alert`,label:n(`notifications.filter.security`)},{key:`status_change`,label:n(`notifications.filter.status`)},{key:`info`,label:n(`notifications.filter.info`)}].filter(e=>e.key===null||e.key===u||d.includes(e.key)),_=g.length>2||u!==null;return z(`div`,{className:`notification-center`,role:`dialog`,"aria-label":n(`notifications.dialogAria`),children:[z(`div`,{className:`notification-center-header`,children:[z(`div`,{className:`notification-center-title-row`,children:[L(`h2`,{className:`notification-center-title`,children:n(`notifications.title`)}),i>0&&L(`span`,{className:`notification-center-badge`,children:i})]}),L(`button`,{className:`btn-icon notification-center-close`,onClick:e,"aria-label":n(`notifications.close`),children:L(nc,{size:18})})]}),_&&L(`div`,{className:`notification-filter-bar`,role:`tablist`,"aria-label":n(`notifications.filterAria`),children:g.map(e=>L(`button`,{role:`tab`,"aria-selected":u===e.key,className:`notification-filter-tab ${u===e.key?`active`:``}`,onClick:()=>f(e.key),children:e.label},e.key??`all`))}),L(`div`,{className:`notification-list`,children:r.length===0?z(`div`,{className:`notification-empty`,children:[L(Nr,{size:40,strokeWidth:1.2}),L(`span`,{children:n(`notifications.empty`)})]}):r.map(e=>{let t=HZ[e.type],r=e.type===`permission_request`&&e.tool?jl(e,n,e=>al(sd(e,!0))):null;return z(`div`,{className:`notification-item ${e.read?``:`unread`} ${t.colorClass}`,id:e.type===`policy_alert`&&e.receiptId?`policy-receipt-${encodeURIComponent(e.receiptId)}`:void 0,onClick:()=>p(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&p(e)},children:[!e.read&&L(`span`,{className:`notification-unread-dot`}),L(`span`,{className:`notification-icon`,children:t.icon}),z(`div`,{className:`notification-content`,children:[z(`div`,{className:`notification-content-header`,children:[L(`span`,{className:`notification-agent`,dir:`auto`,children:e.agentName}),L(`span`,{className:`notification-time`,children:GZ(e.timestamp,n)})]}),r?z(P.Fragment,{children:[L(`span`,{className:`notification-title`,children:L(cl,{text:r.heading})}),L(`span`,{className:`notification-message`,dir:`auto`,children:L(cl,{text:r.question})})]}):z(P.Fragment,{children:[e.title&&L(`span`,{className:`notification-title`,children:WZ(e.title)}),L(`span`,{className:`notification-message`,dir:`auto`,children:WZ(e.message)})]}),e.type===`policy_alert`&&z(`div`,{className:`notification-policy-details`,children:[e.tool&&z(`span`,{className:`notification-tool`,children:[n(`activity.policy.tool`),`: `,L(`code`,{dir:`ltr`,children:e.tool})]}),e.reason&&z(`span`,{className:`notification-policy-reason`,children:[n(`notifications.reason`),`: `,e.reason]}),e.ruleIds&&e.ruleIds.length>0&&z(`span`,{className:`notification-tool`,children:[n(`activity.policy.rules`),`: `,L(`code`,{dir:`ltr`,children:e.ruleIds.join(`, `)})]}),e.policyVersion&&z(`span`,{className:`notification-tool`,children:[n(`activity.policy.policy`),`: `,L(`code`,{dir:`ltr`,children:e.policyVersion})]}),z(`span`,{className:`notification-tool`,children:[n(`activity.policy.receipt`),`:`,` `,e.receiptId?L(`code`,{dir:`ltr`,children:e.receiptId}):L(`em`,{children:n(`activity.policy.receiptUnavailable`)})]})]}),e.type===`permission_request`&&!e.response&&z(`div`,{className:`notification-actions`,children:[z(`button`,{className:`notification-action-btn notification-action-allow`,onClick:t=>{t.stopPropagation(),m(e)},children:[L(Yr,{size:14}),n(`notifications.approve`)]}),z(`button`,{className:`notification-action-btn notification-action-deny`,onClick:t=>{t.stopPropagation(),h(e)},children:[L(nc,{size:14}),n(`notifications.deny`)]})]}),e.type===`permission_request`&&e.response&&L(`span`,{className:`notification-response-badge ${e.response===`allow`?`response-allow`:`response-deny`}`,children:e.response===`allow`?n(`notifications.approved`):n(`notifications.denied`)})]}),L(`button`,{className:`notification-dismiss`,onClick:t=>{t.stopPropagation(),c(e.id)},"aria-label":n(`notifications.dismiss`),children:L(nc,{size:14})})]},e.id)})}),r.length>0&&z(`div`,{className:`notification-center-footer`,children:[z(`button`,{className:`notification-footer-btn`,onClick:o,disabled:i===0,children:[L(Yr,{size:14}),n(`notifications.markAllRead`)]}),z(`button`,{className:`notification-footer-btn notification-footer-clear`,onClick:s,children:[L(Hs,{size:14}),n(`notifications.clear`)]})]})]})}var qZ=1500,JZ=e=>new Promise(t=>setTimeout(t,e));async function YZ({onProgress:e,isCancelled:t=()=>!1,pollMs:n=qZ}={}){try{await At(rk)}catch(e){if(e?.httpStatus!==409)throw e;let t=await xe(rk).catch(()=>null);if(!t||t.status===`completed`||t.status===`failed`)throw e}for(;!t();){let t=await xe(rk);if(e?.(t),t.status===`completed`)return;if(t.status===`failed`)throw Error(t.error||`The GAIA agent could not be installed.`);await JZ(n)}}function XZ({onInstalled:e,noBuild:t=!1}){let n=R(),[r,i]=(0,B.useState)({kind:`idle`}),a=(0,B.useRef)(!1);(0,B.useEffect)(()=>()=>{a.current=!0},[]);let o=(0,B.useCallback)(async()=>{i({kind:`installing`,percent:0});try{if(await YZ({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?L(`div`,{className:`app-notice is-warning`,role:`status`,children:L(`span`,{children:n(`agentNotice.noBuild`)})}):z(`div`,{className:`app-notice is-warning`,role:`status`,children:[r.kind===`installing`?L(`span`,{children:n(`agentNotice.installing`,{percent:Math.round(r.percent)})}):r.kind===`failed`?L(`span`,{children:n(`agentNotice.failed`,{error:r.error})}):L(`span`,{children:n(`agentNotice.missing`)}),r.kind!==`installing`&&L(`button`,{type:`button`,className:`link-btn`,onClick:()=>void o(),children:r.kind===`failed`?n(`agentNotice.retry`):n(`agentNotice.install`)})]})}var ZZ=`goal-store-error-`,QZ=0;function $Z(){let e=Bl.getState();for(let t of e.notifications)t.id.startsWith(ZZ)&&!t.read&&e.markRead(t.id)}var eQ=Pt((e,t)=>({error:null,damaged:!1,check:async()=>{let n,r;try{({error:n,damaged:r}=await YG())}catch(e){F.api.error(`Could not check the goal store`,e);return}n&&n!==t().error&&(QZ+=1,Bl.getState().addNotification({id:`${ZZ}${QZ}`,type:`error`,agentId:`goals`,agentName:`GAIA`,title:Ut()(`mem.goals.storeError`),message:n,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`})),n||$Z(),e({error:n,damaged:!!r})}})),tQ=new Set([`loading_model`,`downloading_model`,`model_retry`,`waiting`]),nQ=5;function rQ(e,t){return{id:e,title:t.get(e)?.title??`Untitled chat`}}function iQ(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=>({...rQ(e,t),reason:`approval`}));n&&e.awaitingUser&&!a.has(e.currentSessionId)&&o.push({...rQ(e.currentSessionId,t),reason:`answer`});for(let[n,r]of Object.entries(e.awaitingBySession))o.some(e=>e.id===n)||o.push({...rQ(n,t),reason:r===`question`?`answer`:`approval`});let s=n&&!e.awaitingUser&&e.livePhase&&tQ.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,nQ).map(e=>rQ(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=>rQ(e,t)),needsYou:o,recent:u}}function aQ(e){let t=(0,B.useRef)(e);t.current=e,(0,B.useEffect)(()=>{let e=window.gaiaAPI?.tray;if(!e)return;let n=``,r=null,i=()=>{let t=N.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:Bl.getState().notifications},a=r;if(r=i,a&&Object.keys(i).every(e=>i[e]===a[e]))return;let o=iQ(i),s=JSON.stringify(o);s!==n&&(n=s,e.setActivity(o).catch(e=>{n=``,F.system.error(`The tray could not take the app state`,e)}))};i();let a=N.subscribe(i),o=Bl.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`:N.getState().openSettings(e.section);break;case`refresh-status`:t.current.refreshStatus();break;default:F.system.error(`Unknown tray command`,e)}});return()=>{a(),o(),s()}},[])}function oQ(){(0,B.useEffect)(()=>{let e=window.gaiaAPI;if(!e)return;let t=Bl.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=N.getState();n.currentSessionId!==t&&n.setMessages([]),n.setCurrentSession(t)})];return()=>n.forEach(e=>e())},[])}function sQ(e,t,n){let r=window.gaiaAPI;if(r){r.notification.show({title:t,body:n,sessionId:e}).then(e=>{e||F.system.warn(`This OS has no desktop notifications; the badge still counts it.`)}).catch(e=>F.system.error(`Could not show the desktop notification`,e));return}if(typeof Notification>`u`){F.system.warn(`This browser has no notifications; the alert was not shown.`);return}if(Notification.permission!==`granted`){F.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(),N.getState().setCurrentSession(e)}}function cQ(){let[e,t]=(0,B.useState)(null);return(0,B.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=>F.system.warn(`Battery level unavailable; keep-awake ignores the battery policy.`,e)),()=>{n?.removeEventListener(`levelchange`,r),n?.removeEventListener(`chargingchange`,r)}},[]),e}function lQ(){oQ();let e=N(e=>e.runningSessionIds),t=N(e=>e.awaitingBySession),n=N(e=>e.sessions),r=N(e=>e.currentSessionId),i=Bl(dc(Gl)),a=Ql(),o=cQ(),s=(0,B.useRef)(null),c=au(e,t,i),l=JSON.stringify(c);(0,B.useEffect)(()=>{let e=JSON.parse(l),t=s.current;if(s.current=e,t===null)return;let{sessions:n,currentSessionId:r}=N.getState(),i=document.hasFocus(),o=!1;for(let{sessionId:s,event:c}of ou(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`||lu(s,r,i))&&(o=!0,t===`banner`)){if(c!==`finished`){let{title:t,body:n}=cu(c,e);sQ(s,t,n)}else D(s).then(e=>{N.getState().updateSessionInList(s,e);let{title:t,body:n}=cu(c,e);sQ(s,t,n)}).catch(t=>{F.system.error(`Could not read how chat ${s} ended`,t);let{title:n,body:r}=cu(c,{...e,last_run_status:null});sQ(s,n,r)})}}if(o){if(a.sound)try{fu()}catch(e){F.system.warn(`Alert sound not played`,e)}a.flash&&!i&&window.gaiaAPI&&window.gaiaAPI.notification.flash().catch(e=>F.system.error(`Could not flash the taskbar button`,e))}},[l,a.modes,a.sound,a.flash]);let u=uu(n,c,a.modes,r);(0,B.useEffect)(()=>{window.gaiaAPI?.notification.setAttentionCount(u).catch(e=>F.system.error(`Could not update the taskbar badge`,e))},[u]);let d=a.keepAwake&&e.length>0&&du(o,a.batteryFloor);(0,B.useEffect)(()=>{window.gaiaAPI?.power.setKeepAwake(d).catch(e=>F.system.error(`Could not change keep-awake`,e))},[d])}function uQ(e){return e.indexing_status===`failed`&&BL(e.error_kind)}function dQ(){let e=N(e=>e.systemStatus?.lemonade_running===!0),t=N(e=>e.setDocuments),n=(0,B.useRef)(!1),r=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if(!e)return;if(n.current){r.current=!0;return}let i=async()=>{let{documents:e}=await fn(),n=(e||[]).filter(uQ).map(e=>e.id);if(n.length===0)return;F.doc.info(`Model server is back; retrying ${n.length} document(s) that were waiting for it`);for(let e of n){let n=(await fn()).documents||[],r=n.find(t=>t.id===e);if(r&&uQ(r)){t(n.map(t=>t.id===e?{...t,indexing_status:`indexing`}:t));try{await qn(e),F.doc.info(`Indexed "${r.filename}" now the model server is back`)}catch(e){F.doc.warn(`"${r.filename}" still couldn't be indexed after the model server came back`,e)}}}let r=await fn();t(r.documents||[])};n.current=!0,(async()=>{try{do{r.current=!1;try{await i()}catch(e){F.doc.warn(`Could not retry the documents waiting for the model server`,e)}}while(r.current&&N.getState().systemStatus?.lemonade_running===!0)}finally{n.current=!1}})()},[e,t])}var fQ=`GAIA Agent UI`;function pQ(){let e=N(e=>e.sessions.find(t=>t.id===e.currentSessionId)?.title);(0,B.useEffect)(()=>{document.title=e?.trim()?`${e.trim()} - GAIA`:fQ},[e])}function mQ(e,t,n){return!e||t&&(e===t||e===oR(t))?null:n.some(t=>t.id===e)?e:sR(n,e)}function hQ(e){return new URLSearchParams(e.search).get(`session`)||e.hash.replace(/^#/,``)||null}var gQ=`gaia:last-session`;function _Q(e){try{e?localStorage.setItem(gQ,e):localStorage.removeItem(gQ)}catch(e){F.ui.warn(`Could not save the open chat for the next launch`,e)}}function vQ(){try{return localStorage.getItem(gQ)}catch(e){return F.ui.warn(`Could not read the chat open at last launch`,e),null}}var yQ=1e3,bQ=3e4;function xQ(e,{initialMs:t=yQ,maxMs:n=bQ,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 SQ(e,t,n){return e&&!t&&!n}var CQ=(0,B.lazy)(()=>yZ(()=>import(`./MemoryDashboard-CeioRY3q.js`).then(e=>({default:e.MemoryDashboard})),__vite__mapDeps([7,1,2,8]),import.meta.url)),wQ=(0,B.lazy)(()=>yZ(()=>import(`./ScheduleManager-Dod2vW7s.js`).then(e=>({default:e.ScheduleManager})),__vite__mapDeps([9,1,2,10]),import.meta.url)),TQ=(0,B.lazy)(()=>yZ(()=>import(`./DocumentLibrary-je0OG0yL.js`).then(e=>({default:e.DocumentLibrary})),__vite__mapDeps([11,1,2,12]),import.meta.url)),EQ=(0,B.lazy)(()=>yZ(()=>import(`./FileBrowser-CsVRdbcE.js`).then(e=>({default:e.FileBrowser})),__vite__mapDeps([13,1,2,14]),import.meta.url)),DQ=(0,B.lazy)(()=>yZ(()=>import(`./MobileAccessModal-Bi6c7ior.js`).then(e=>({default:e.MobileAccessModal})),__vite__mapDeps([15,1,2,16]),import.meta.url)),OQ=3,kQ=3e5,AQ=4e3,jQ=6e4,MQ=e=>e instanceof TypeError,NQ=e=>new Promise(t=>setTimeout(t,e)),PQ=3e5,FQ=class extends Error{},IQ=class extends Error{constructor(e){super(Ut().bare(`setup.unknown.modelUnread`,{error:e}))}};async function LQ(){let e=Date.now()+PQ;for(;;){let t=await oe();if(t.state===`ready`)return;if(t.state===`failed`||t.state===`cancelled`)throw new FQ(t.error||Ut().bare(`setup.upgrading.stopped`));if(Date.now()>=e)throw Error(Ut().bare(`setup.upgrading.slow`));await NQ(yQ)}}function RQ(){return L(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})}var zQ=e=>e===1||e%10==0;function BQ(){zc.getState().active?.remote||cY()?.markSetupWorked().catch(e=>{F.system.warn(`Couldn't record that setup works on this version`,e)})}function VQ(){let e=R();pQ();let t=N(e=>e.currentSessionId),n=N(e=>e.setSessions),r=N(e=>e.setCurrentSession),i=N(e=>e.addSession),a=N(e=>e.setMessages),o=N(e=>e.showDocLibrary),s=N(e=>e.showFileBrowser),c=N(e=>e.showMemoryDashboard),l=N(e=>e.showSchedules),u=N(e=>e.sidebarOpen),d=N(e=>e.sidebarCollapsed),f=N(e=>e.setSidebarOpen),p=N(e=>e.setSystemStatus),m=N(e=>e.setBackendConnected),h=N(e=>e.setAgents),g=N(e=>e.agents),_=N(e=>e.setPendingPrompt),v=N(e=>e.setDefaultPermissionMode),y=N(e=>e.openSettings),b=N(e=>e.settingsSection),x=N(e=>e.syncSystemTheme),S=zc(e=>e.restoreNotice),C=zc(e=>e.dismissRestoreNotice),w=Bl(e=>e.showPanel),T=N(e=>e.systemStatus?.initialized===!0),E=(0,B.useRef)(!1),D=Bl(e=>e.setShowPanel);(0,B.useEffect)(()=>{if(!S?.ok)return;let e=setTimeout(C,AQ);return()=>clearTimeout(e)},[S,C]);let[O,ee]=(0,B.useState)({state:`checking`}),te=N(e=>e.setupAgain),ne=N(e=>e.runSetupAgain),re=(0,B.useRef)(O);re.current=O;let[ie,ae]=(0,B.useState)(!1),A=(0,B.useRef)(ie);A.current=ie;let[se,ce]=(0,B.useState)(!1),[le,ue]=(0,B.useState)(!1),de=se||ie&&!ik(g),fe=(0,B.useRef)(de);fe.current=de;let[pe,me]=(0,B.useState)(null),[j,he]=(0,B.useState)(!1),[ge,_e]=(0,B.useState)(``),[ye,be]=(0,B.useState)(0),[xe,Se]=(0,B.useState)(0),[Ce,we]=(0,B.useState)(!1),[Te,Ee]=(0,B.useState)(!1),[De,Oe]=(0,B.useState)(null),[ke,Ae]=(0,B.useState)(null),je=(0,B.useRef)(async()=>{}),Me=(0,B.useRef)(async()=>{}),Ne=(0,B.useCallback)(async(e=!1,t=!1)=>{e||ee({state:`checking`});let n=0;try{for(;;){await zc.getState().refresh();let e=zc.getState().active,r=!!e?.remote,i;try{if(i=await k(r),!e&&!i.ready)throw new IQ(zc.getState().error??`no answer`)}catch(e){let r=MQ(e)||e instanceof IQ;if(!t||!r||n>=jQ)throw e;await NQ(yQ),n+=yQ;continue}if(!i.ready&&i.stage===`upgrade`){ee({state:`upgrading`});let e=await oe();(!e.upgrade_embedded||e.state!==`running`&&e.state!==`verifying`)&&await dn(r,!1,{upgradeEmbedded:!0}),await LQ(),i=await k(r)}n>0&&await Promise.all([je.current(),Me.current()]),ue(!!i.no_agent_build),i.ready&&BQ();let a=!i.ready&&i.stage===`server`&&!!i.initialized;ee(i.ready?{state:`ready`}:a?{state:`serverDown`,modelListUnread:!!i.model_list_unread}:{state:`needed`,check:i});return}}catch(e){let t=e instanceof Error?e.message:String(e);if(e instanceof FQ){F.system.warn(`Updating the local model server failed`,e),ee({state:`unknown`,error:t,upgradeFailed:!0});return}F.system.warn(`Setup check could not be answered`,e),ee({state:`unknown`,error:t})}},[]),Pe=N(e=>!!e.systemStatus&&$I(e.systemStatus)===`unresponsive`),Fe=N(e=>e.systemStatus?.lemonade_running===!0);(0,B.useEffect)(()=>{O.state===`serverDown`&&Fe&&Ne(!0)},[O.state,Fe,Ne]);let Ie=N(e=>e.systemStatus?.lemonade_running===!1);(0,B.useEffect)(()=>{if(O.state!==`ready`||!Ie)return;let e=!1;return k(!!zc.getState().active?.remote).then(t=>{!e&&!t.ready&&t.stage===`server`&&t.initialized&&ee({state:`serverDown`,modelListUnread:!!t.model_list_unread})}).catch(e=>F.system.warn(`Could not confirm the model server is down`,e)),()=>{e=!0}},[O.state,Ie]);let Le=(0,B.useRef)(0),Re=(0,B.useCallback)(async()=>{let e=++Le.current,t=(await zn()).agents||[];e===Le.current&&(h(t),ae(!0),ik(t)&&ce(!1))},[h]),ze=(0,B.useCallback)(()=>{let e=A.current;ae(!1),Re().catch(t=>{F.api.warn(`Agent list unavailable after setup`,t),e&&ae(!0)})},[Re]);(0,B.useEffect)(()=>{let e=()=>{fe.current&&Re().catch(e=>F.api.warn(`Agent list unavailable`,e))};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Re]);let Be=(0,B.useCallback)(async()=>{v((await nn()).default_mode)},[v]),Ve=(0,B.useRef)([]);(0,B.useEffect)(()=>{en(`0.27.0rc8`),Ne(!1,!0);let e=[xQ(Re,{onError:(e,t)=>{zQ(t)&&F.api.warn(`Agent list unavailable (attempt ${t}); retrying`,e)}}),xQ(Be,{onError:(e,t)=>{zQ(t)&&F.api.warn(`Default permission mode unavailable (attempt ${t}); retrying`,e)}})];return Ve.current=e,()=>e.forEach(e=>e.stop())},[Ne,Re,Be]);let He=(0,B.useCallback)(()=>{Ve.current.forEach(e=>e.kick()),zc.getState().retryNow(),Me.current();let e=re.current;e.state===`unknown`&&!e.upgradeFailed&&Ne(!0)},[Ne]),Ue=(0,B.useRef)(He);Ue.current=He;let We=(0,B.useRef)(0),Ge=(0,B.useRef)(0),Ke=(0,B.useRef)(null),qe=(0,B.useRef)(!1),[Je,Ye]=(0,B.useState)(!1),[Xe,Ze]=(0,B.useState)(null),Qe=(0,B.useCallback)(e=>{if(e.kind===`unreachable`){F.system.warn(`System status check failed`,e.error),NZ(),qe.current=!0,Ge.current=0,Ke.current=null,Ye(!1),Ze(null),m(!1),p(null);return}if(e.kind===`error`){F.system.warn(`System status answered HTTP ${e.httpStatus}`,e.message),qe.current&&Ue.current(),qe.current=!1,Ge.current=0,Ke.current=null,Ye(!1),Ze(`HTTP ${e.httpStatus}: ${e.message}`),m(!0);return}if(e.kind===`slow`){if(Ge.current+=1,Ke.current??=Date.now(),Ze(null),F.system.warn(`System status did not answer in time (${Ge.current} in a row)`),Date.now()-Ke.current>=kQ){Ye(!1),m(!1),p(null);return}m(!0),(qe.current||Ge.current>=OQ)&&Ye(!0);return}let{status:t}=e;qe.current&&Ue.current(),qe.current=!1,Ge.current=0,Ke.current=null,Ye(!1),Ze(null),m(!0),We.current=t.lemonade_running?0:We.current+1;let n=N.getState().systemStatus;t.lemonade_running||We.current>=OQ||!n?.lemonade_running?p(t):p({...n,download_progress:t.download_progress})},[m,p]),$e=(0,B.useRef)(Qe);$e.current=Qe;let[et]=(0,B.useState)(()=>nL(e=>$e.current(e))),tt=et.check;je.current=tt,(0,B.useEffect)(()=>VW(et.start),[et]),(0,B.useEffect)(()=>PZ(()=>{tt()}),[tt]);let nt=(0,B.useRef)(``);(0,B.useEffect)(()=>{let e=e=>gn().then(t=>{let r=t.sessions||[];if(!e&&r.length===0&&N.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(`
|
|
215
|
-
`);if(i===nt.current)return;nt.current=i,n(r);let a=zc.getState().active?.model;a&&r.some(e=>e.effective_model&&e.effective_model!==a)&&zc.getState().refresh()}).catch(t=>{e&&F.system.error(`Could not load chats`,t)});Me.current=()=>e(!1),e(!0);let t=setInterval(()=>void e(!1),5e3);return()=>clearInterval(t)},[n]),(0,B.useEffect)(()=>hL(),[]),(0,B.useEffect)(()=>{let e=()=>{jV.getState().loadSchedules()};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]),(0,B.useEffect)(()=>{let e=()=>{eQ.getState().check()};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]),(0,B.useEffect)(()=>NL(),[]),lQ(),dQ();let rt=(0,B.useRef)(!1),it=(0,B.useRef)(!1);(0,B.useEffect)(()=>{let e=()=>{let e=hQ(window.location),{currentSessionId:t,sessions:n}=N.getState(),i=mQ(e,t,n);return i&&(r(i),a([])),i},t=()=>{if(rt.current||(rt.current=!0,e()||N.getState().currentSessionId))return;if(window.location.hash){window.history.replaceState(null,``,window.location.pathname+window.location.search);return}if(it.current||hn(`new-chat`))return;let{sessions:t}=N.getState(),n=mQ(vQ(),null,t);n&&(r(n),a([]))},n=N.subscribe(e=>{e.sessions.length>0&&t()});return N.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,B.useEffect)(()=>{let e=null,t=2e3,n=!1,i=null,o=()=>{n||(e=new EventSource(`${Hn()}/sessions/events`),e.onopen=()=>{t=2e3},e.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch(e){F.api.warn(`Malformed session event`,e);return}t.type===`set_active_session`&&t.session_id&&t.session_id!==N.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,B.useEffect)(()=>{if(rt.current&&_Q(t),t){let e=oR(t);window.location.hash!==`#${e}`&&window.history.replaceState(null,``,`#${e}`)}else rt.current&&window.location.hash&&window.history.replaceState(null,``,window.location.pathname+window.location.search)},[t]);let ot=(0,B.useCallback)(async e=>{if(me(null),he(!1),!await Sc(`chat`))return _e(e),!1;let t=N.getState(),n;try{n=await Ht({title:`New chat`,agent_type:rk,document_ids:t.draftDocumentIds,private:t.draftPrivate,folders:t.draftFolder?[t.draftFolder]:[]})}catch(e){throw ok(e)?(ce(!0),new ak):e}fe.current&&(ce(!1),Re().catch(e=>F.api.warn(`Agent list unavailable`,e))),t.defaultPermissionModeKnown||(await Be().catch(e=>F.api.warn(`Default permission mode unavailable; using the chip's mode`,e)),t=N.getState()),t.clearDraftDocuments(),t.setDraftPrivate(!1),t.adoptDraftResearch(n.id,e),t.setDraftFolder(null);let o=null;try{await Vt(n.id,t.draftPermissionMode)}catch(e){o=e}return ht(kn),o&&!n.private&&Nn(Wt(n.id),e),i(n),CH.getState().claimDraft(n.id),r(n.id),a([]),_e(``),o?(me(`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(),_({sessionId:n.id,text:e}),!0)},[i,r,a,_,Re,Be]),st=(0,B.useCallback)(async e=>{try{return await ot(e)}catch(t){if(!(t instanceof ak))throw t;let n=hn(kn),r=n.trimEnd().endsWith(e)?n:[n,e].filter(Boolean).join(`
|
|
216
|
-
|
|
217
|
-
`);return Nn(kn,r),_e(r),he(!0),Se(e=>e+1),!1}},[ot]),ct=(0,B.useCallback)(()=>{let e=N.getState(),t=e.currentSessionId,n=e.pendingPrompt?.sessionId===t?e.pendingPrompt:null;n&&(e.setPendingPrompt(null),_e(n.text)),t&&bu(t,N.getState())&&xu(t),e.setShowMemoryDashboard(!1),e.setShowSchedules(!1),it.current=!0,he(!1),r(null),a([]),be(e=>e+1)},[r,a]),lt=(0,B.useCallback)(e=>{let t=N.getState();t.closeSettings(),e!==t.currentSessionId&&(xu(t.currentSessionId),a([])),r(e)},[r,a]),ut=(0,B.useCallback)(e=>{let t=N.getState();t.setShowMemoryDashboard(!1),t.setShowSchedules(!1),D(!1),lt(e)},[lt]);aQ({openChat:lt,newChat:(0,B.useCallback)(()=>{N.getState().closeSettings(),ct()},[ct]),refreshStatus:()=>void tt()});let dt=(0,B.useCallback)(t=>{let n=N.getState(),r=n.pendingPrompt?.sessionId===n.currentSessionId?n.pendingPrompt?.text:null;ct();let i=e.bare(`settings.skills.tryPrompt`,{name:t}),a=[hn(kn),r].filter(Boolean).join(`
|
|
218
|
-
|
|
219
|
-
`),o=a.trimEnd().endsWith(i)?a:[a,i].filter(Boolean).join(`
|
|
220
|
-
|
|
221
|
-
`);Nn(kn,o),_e(o),Se(e=>e+1)},[ct,e]);(0,B.useEffect)(()=>{let e=e=>{let t=e.detail;N.getState().closeSettings(),ct(),st(AZ(t)).catch(e=>me(e instanceof Error?e.message:String(e)))};return window.addEventListener(EZ,e),()=>window.removeEventListener(EZ,e)},[ct,st]);let ft=(0,B.useCallback)(e=>{BQ(),ee({state:`ready`}),ze(),tt(),e&&(e.needs_input?_e(e.prompt):st(e.prompt).catch(e=>me(e instanceof Error?e.message:String(e))))},[tt,st,ze]),pt=(0,B.useCallback)(()=>{ee({state:`ready`}),tt()},[tt]);(0,B.useEffect)(()=>{let e=()=>{N.getState().closeSettings(),ee({state:`addingLocal`})};return window.addEventListener(`gaia:set-up-local`,e),()=>window.removeEventListener(`gaia:set-up-local`,e)},[]);let[mt,gt]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&(e.shiftKey&&e.key.toLowerCase()===`o`?(e.preventDefault(),ct()):!e.shiftKey&&e.key.toLowerCase()===`k`?(e.preventDefault(),window.dispatchEvent(new CustomEvent(`gaia:focus-search`))):!e.shiftKey&&e.key.toLowerCase()===`b`?(e.preventDefault(),N.getState().toggleSidebarCollapsed()):!e.shiftKey&&e.key===`,`?(e.preventDefault(),y()):e.key===`/`&&(e.preventDefault(),gt(e=>!e)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ct,y]),(0,B.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 768px)`);if(!e)return;let t=()=>f(!e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[f]),(0,B.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(prefers-color-scheme: light)`);return e.addEventListener(`change`,x),()=>e.removeEventListener(`change`,x)},[x]),(0,B.useEffect)(()=>{at().then(e=>Ee(e.active===!0)).catch(e=>F.system.debug(`Mobile access unavailable`,e))},[]);let _t=(0,B.useCallback)(async()=>{if(we(!0),Oe(null),Te)Ae(null);else try{let e=await M(),t=e.reason===`ngrok_not_installed`;if(Ae(t?e.installCommands??[]:null),t)return;e.error?Oe(e.error):Ee(!0)}catch(e){Ae(null),Oe(e instanceof Error?e.message:`Could not start mobile access`)}},[Te]),vt=(0,B.useCallback)(async()=>{try{await ve(),Ee(!1),we(!1)}catch(e){Oe(e instanceof Error?e.message:`Could not stop mobile access`)}},[]);RB(e=>{e?_t():vt()}),(0,B.useEffect)(()=>{IB(Te)},[Te]);let yt=Ou(`(max-width: 768px)`),bt=SQ(O.state===`checking`,T,E.current);if(!bt&&O.state!==`needed`&&(E.current=!0),bt)return L(`div`,{className:`app`,children:z(`main`,{className:`startup`,role:`status`,"aria-label":`Starting GAIA`,children:[L(`div`,{className:`loading-spinner`,"aria-hidden":`true`}),L(`p`,{className:`startup-text`,children:`Starting GAIA…`})]})});if(O.state===`upgrading`)return L(`div`,{className:`app`,children:z(`main`,{className:`startup`,role:`status`,"aria-live":`polite`,"aria-label":e(`setup.upgrading.notice`),children:[L(`div`,{className:`loading-spinner`,"aria-hidden":`true`}),L(`p`,{className:`startup-text`,children:e(`setup.upgrading.notice`)})]})});if(O.state===`needed`||O.state===`addingLocal`||te){let e=te?()=>ne(!1):O.state===`addingLocal`?pt:void 0;return z(`div`,{className:`app`,children:[L(UY,{onReady:e=>{ne(!1),ft(e)},onClose:e}),L(wK,{}),L(VZ,{})]})}let xt=!c&&!l?hH():void 0,St=c?L(B.Suspense,{fallback:L(RQ,{}),children:L(CQ,{})}):t?L(aG,{sessionId:t},t):L(yK,{onSend:ot,initialText:ge,focusRequest:ye,agentMissing:de,agentRefused:j},`${xe}:${ge}`);return z(`div`,{className:`app`,children:[!u&&L(`button`,{className:`sidebar-toggle`,onClick:()=>f(!0),"aria-label":e(`sidebar.open`),children:L(so,{size:18})}),L(`div`,{className:`sidebar-overlay ${u?`visible`:``}`,onClick:()=>f(!1),"aria-hidden":`true`}),L(fZ,{area:`sidebar`,variant:`compact`,children:L(Nd,{onNewChat:ct,onMobileAccess:yt?void 0:()=>void _t(),tunnelActive:Te})}),z(`div`,{className:`main-content`,children:[(O.state===`ready`||O.state===`checking`||O.state===`serverDown`&&Pe)&&L(zZ,{onRetry:tt,backendSlow:Je,backendError:Xe}),O.state===`serverDown`&&!Pe&&z(`div`,{className:`app-notice is-warning`,role:`status`,children:[L(`span`,{children:e(O.modelListUnread?`setup.modelListUnread.notice`:`setup.serverDown.notice`)}),L(`button`,{type:`button`,className:`link-btn`,onClick:()=>void Ne(!0),children:e(`setup.unknown.retry`)}),!O.modelListUnread&&L(`button`,{type:`button`,className:`link-btn`,onClick:()=>ne(!0),children:e(`setup.serverDown.setup`)})]}),O.state===`unknown`&&(O.upgradeFailed?z(P.Fragment,{children:[z(`div`,{className:`app-notice is-warning`,role:`status`,children:[L(`span`,{children:e(`setup.upgrading.failed`,{error:O.error})}),L(`button`,{type:`button`,className:`link-btn`,onClick:()=>void Ne(),children:e(`setup.upgrading.retry`)})]}),L(hY,{className:`app-go-back`})]}):z(`div`,{className:`app-notice is-warning`,role:`status`,children:[L(`span`,{children:e(`setup.unknown.failed`,{error:O.error})}),L(`button`,{type:`button`,className:`link-btn`,onClick:()=>void Ne(),children:e(`setup.unknown.retry`)})]})),(!u||d)&&L(Sl,{placement:`main`}),de&&L(XZ,{onInstalled:Re,noBuild:le}),S?.ok&&L(`div`,{className:`toast app-restore-toast`,role:`status`,children:e(`model.restore.done`)}),S&&!S.ok&&z(`div`,{className:`app-notice is-warning`,role:`status`,children:[L(`span`,{children:S.message}),L(`button`,{type:`button`,className:`link-btn`,onClick:()=>{C(),y(`model`)},children:e(`model.restore.pick`)}),L(`button`,{type:`button`,className:`app-notice-close`,onClick:C,"aria-label":e(`banner.dismiss`),children:L(nc,{size:14})})]}),L(fZ,{resetKey:c?`memory`:t??`new-${ye}`,area:`main`,children:St})]}),xt&&L($H,{api:xt}),l&&L(B.Suspense,{fallback:null,children:L(wQ,{})}),o&&L(B.Suspense,{fallback:null,children:L(TQ,{})}),s&&L(B.Suspense,{fallback:null,children:L(EQ,{onStartChat:st})}),w&&L(`div`,{className:`notification-center-popover`,children:L(KZ,{onClose:()=>D(!1),onOpenChat:ut})}),Ce&&L(B.Suspense,{fallback:null,children:L(DQ,{isOpen:Ce,onClose:()=>we(!1),onStop:()=>void vt(),error:De,setupCommands:ke,onRetry:()=>void _t()})}),b&&L(TZ,{onUseSkill:dt}),L(wK,{}),L(LK,{}),mt&&L(BK,{onClose:()=>gt(!1)}),L(VZ,{}),pe&&z(`div`,{className:`toast toast-dismissible`,role:`alert`,children:[L(`span`,{children:pe}),L(`button`,{type:`button`,className:`toast-dismiss`,onClick:()=>me(null),"aria-label":e(`banner.dismiss`),children:L(nc,{size:14,"aria-hidden":`true`})})]})]})}var HQ=`agent-refresh`,UQ={"pre-checks":`engine.stage.preChecks`,"ensure-uv":`engine.stage.ensureUv`,"create-venv":`engine.stage.createVenv`,"install-package":`engine.stage.installPackage`,verify:`engine.stage.verify`,[HQ]:`engine.stage.agentRefresh`,start:`engine.stage.start`},WQ={disk:`engine.hint.disk`,network:`engine.hint.network`,tls:`engine.hint.tls`,locked:`engine.hint.locked`,daemon:`engine.hint.daemon`};function GQ(e,t){if(!e)return t(`engine.stage.neutral`);let n=UQ[e];return n?t(n):(console.warn(`[EngineInstallScreen] install stage "${e}" has no label`),t(`engine.stage.neutral`))}function KQ(e,t){return e.reason?t(WQ[e.reason]):t(e.stage===HQ?`engine.hint.agent`:`engine.hint.other`)}function qQ(e){return e.reason===`locked`&&e.lockedBy?.length?e.lockedBy:null}function JQ(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 YQ({status:e}){let t=R(),n=GQ(e.stage,t);return z(`div`,{className:`engine-progress`,role:`status`,children:[z(`div`,{className:`engine-progress-head`,children:[L(`span`,{children:n}),e.percent!==null&&z(`bdi`,{dir:`ltr`,children:[e.percent,`%`]})]}),L(`progress`,{className:`engine-bar`,"aria-label":n,max:100,value:e.percent??void 0})]})}function XQ({error:e,busy:t,notice:n,onRetry:r,onCloseLockers:i,onContinue:a,onRevert:o,onOpenLog:s}){let c=R(),l=qQ(e),u=l!==null&&l.every(e=>e.isGaia),d=(l?.length??0)>1;return z(`div`,{className:`engine-failure`,children:[z(`div`,{role:`alert`,children:[l?z(P.Fragment,{children:[l.map(e=>L(`p`,{className:`engine-hint`,children:JQ(e,c)},e.pid)),!u&&L(`p`,{className:`engine-hint`,children:c(d?`engine.locked.closeThenMany`:`engine.locked.closeThen`)})]}):L(`p`,{className:`engine-hint`,children:KQ(e,c)}),L(`p`,{className:`engine-error`,children:L(`bdi`,{dir:`ltr`,children:e.message})})]}),u&&L(`button`,{type:`button`,className:`btn-primary engine-retry`,disabled:t,onClick:i,autoFocus:!0,children:c(d?`engine.locked.closeMany`:`engine.locked.close`)}),L(`button`,{type:`button`,className:`${u?`btn-secondary`:`btn-primary`} engine-retry`,disabled:t,onClick:r,autoFocus:!u,children:c(`engine.tryAgain`)}),e.stage===HQ&&L(`button`,{type:`button`,className:`btn-secondary engine-retry`,disabled:t,onClick:a,children:c(`engine.continueWithout`)}),e.previousVersion&&L(`button`,{type:`button`,className:`btn-secondary engine-retry`,disabled:t,onClick:o,children:c(`update.chip.goBack`,{version:e.previousVersion})}),n&&L(`p`,{className:`engine-error`,role:`alert`,children:L(`bdi`,{dir:`ltr`,children:n})}),z(`details`,{className:`engine-details`,children:[L(`summary`,{children:c(`engine.details`)}),L(`pre`,{className:`engine-log`,dir:`ltr`,children:e.logTail.join(`
|
|
222
|
-
`)}),L(`button`,{type:`button`,className:`btn-secondary`,onClick:s,children:c(`engine.openLog`)})]})]})}function ZQ(){let e=R(),[t,n]=(0,B.useState)({phase:`running`,stage:null,percent:null,message:``,error:null}),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(null),s=(0,B.useCallback)(e=>{console.error(`[EngineInstallScreen] the desktop app did not answer`,e),o(e instanceof Error?e.message:String(e))},[]);(0,B.useEffect)(()=>{let e=window.gaiaInstall,t=e.onProgress(n);return e.status().then(n).catch(s),t},[s]);let c=(0,B.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.retry().catch(s).finally(()=>i(!1))},[s]),l=(0,B.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.closeLockingPrograms().catch(s).finally(()=>i(!1))},[s]),u=(0,B.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.continueWithoutAgentUpdate().catch(s).finally(()=>i(!1))},[s]),d=(0,B.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.revert().then(e=>{e||i(!1)}).catch(e=>{s(e),i(!1)})},[s]),f=(0,B.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===HQ?`engine.failed.agentTitle`:`engine.failed.title`:`engine.title`);return L(`div`,{className:`app`,children:L(`main`,{className:`engine`,children:z(`div`,{className:`engine-inner`,children:[L(`h1`,{className:`engine-title`,children:h}),m?L(XQ,{error:p,busy:r,notice:a,onRetry:c,onCloseLockers:l,onContinue:u,onRevert:d,onOpenLog:f}):z(P.Fragment,{children:[L(`p`,{className:`engine-lede`,children:e(`engine.lede`)}),L(YQ,{status:t}),a&&L(`p`,{className:`engine-error`,role:`alert`,children:L(`bdi`,{dir:`ltr`,children:a})})]})]})})})}function QQ(){return!!window.gaiaInstall&&new URLSearchParams(window.location.search).get(`engine`)===`install`}async function $Q(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}}Tl(),ot();var e$=localStorage.getItem(`gaia-chat-theme`);Qe(Ee(e$===`light`||e$===`dark`?e$:`system`));var t$=N.getState();nt(t$.palette,t$.customColors,t$.theme),Se(t$.locale),r(),Mt(),ac.createRoot(document.getElementById(`root`)).render(L(B.StrictMode,{children:L(fZ,{area:`app`,variant:`window`,children:QQ()?L(ZQ,{}):L(VQ,{})})})),window.addEventListener(`load`,()=>{$Q({isProduction:!0,protocol:window.location.protocol,serviceWorker:`serviceWorker`in navigator?navigator.serviceWorker:void 0})});export{bU as $,Mo as $t,DG as A,xr as An,hu as At,zG as B,Js as Bt,$G as C,ai as Cn,lk as Ct,TG as D,Yr as Dn,dd as Dt,EG as E,$r as En,bv as Et,UG as F,Sc as Ft,RG as G,Es as Gt,FG as H,Ws as Ht,xG as I,hc as It,XG as J,is as Jt,JG as K,us as Kt,OG as L,ic as Lt,CG as M,Uc as Mt,SG as N,Bc as Nt,jG as O,Lr as On,V as Ot,kG as P,zc as Pt,DU as Q,Io as Qt,MG as R,nc as Rt,PG as S,si as Sn,ck as St,rK as T,ti as Tn,Nv as Tt,LG as U,Hs as Ut,BG as V,Ks as Vt,IG as W,Os as Wt,WG as X,Ko as Xt,AG as Y,Qo as Yt,BW as Z,Ho as Zt,eK as _,yi as _n,kk as _t,yZ as a,ka as an,SV as at,VG as b,di as bn,dk as bt,sX as c,la as cn,ZL as ct,WY as d,Ui as dn,qL as dt,vo as en,vU as et,Gq as f,zi as fn,VL as ft,uK as g,Ti as gn,aN as gt,TK as h,ki as hn,BL as ht,jZ as i,qa as in,jV as it,ZG as j,mu as jt,NG as k,Dr as kn,Cu as kt,uX as l,sa as ln,$L as lt,IK as m,ji as mn,HL as mt,FZ as n,Za as nn,xU as nt,fX as o,_a as on,MB as ot,VK as p,Ni as pn,zL as pt,tK as q,cs as qt,kZ as r,Ya as rn,yU as rt,dX as s,da as sn,aR as st,eQ as t,fo as tn,_U as tt,lX as u,qi as un,GL as ut,nK as v,_i as vn,xk as vt,wG as w,ri as wn,Tv as wt,HG as x,li as xn,gk as xt,qG as y,hi as yn,_k as yt,QG as z,ec as zt};
|